• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / blurts-server / #13417

pending completion
#13417

push

circleci

flozia
chore: Add meta strings for breach scan page

282 of 1780 branches covered (15.84%)

Branch coverage included in aggregate %.

959 of 4679 relevant lines covered (20.5%)

1.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/views/mainLayout.js
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4

5
import AppConstants from '../appConstants.js'
6
import { getMessage, getLocale } from '../utils/fluent.js'
7

8
/**
9
 * @type {ViewPartial<MainViewPartialData<any>>}
10
 */
11
const mainLayout = data => {
×
12
  const siteTitle = data.meta?.title ?? getMessage('brand-fx-monitor')
×
13
  const metaTitle = data.meta?.socialTitle ?? getMessage('brand-fx-monitor')
×
14
  const metaDescription = data.meta?.socialDescription ?? getMessage('meta-desc-2')
×
15

16
  return `
×
17
    <!doctype html>
18
    <html lang=${getLocale()}>
19
      <head>
20
        <title>${siteTitle}</title>
21
        <style>html {display: none;}</style>
22

23
        <meta charset='utf-8'>
24
        <meta name='viewport' content='width=320, initial-scale=1'>
25
        <meta name='description' content='${metaDescription}'>
26
        <meta name='twitter:card' content='summary_large_image'>
27
        <meta name='twitter:title' content='${metaTitle}'>
28
        <meta name='twitter:description' content='${metaDescription}'>
29
        <meta name='twitter:image' content='${AppConstants.SERVER_URL}/images/og-image.webp'>
30
        <meta property='og:title' content='${metaTitle}'>
31
        <meta property='og:description' content='${metaDescription}'>
32
        <meta property='og:site_name' content='${getMessage('brand-fx-monitor')}'>
33
        <meta property='og:type' content='website'>
34
        <meta property='og:url' content='${AppConstants.SERVER_URL}'>
35
        <meta property='og:image' content='${AppConstants.SERVER_URL}/images/og-image.webp'>
36

37
        <link rel='preload' href='/fonts/Metropolis-Bold.woff2' as='font' type='font/woff2' crossorigin>
38
        <link rel='preload' href='/fonts/Inter-Regular-latin.woff2' as='font' type='font/woff2' crossorigin>
39
        <link rel='stylesheet' href='/css/index.css' type='text/css'>
40
        <link rel='stylesheet' href='/css/partials/${data.partial.name}.css' type='text/css'>
41
        <link rel='icon' href='/images/favicon-16.webp' sizes='16x16'>
42
        <link rel='icon' href='/images/favicon-32.webp' sizes='32x32'>
43
        <link rel='icon' href='/images/favicon-48.webp' sizes='48x48'>
44
        <link rel='icon' href='/images/favicon-96.webp' sizes='96x96'>
45
        <link rel='icon' href='/images/favicon-144.webp' sizes='144x144'>
46
        <link rel='icon' href='/images/favicon-256.webp' sizes='256x256'>
47
        <link rel='apple-touch-icon' href='/images/apple-touch-icon.webp' sizes='180x180'>
48

49
        <script src='/js/index.js' type='module'></script>
50
        ${data.skipPartialModule ? '' : `<script src='/js/partials/${data.partial.name}.js' type='module'></script>`}
×
51
      </head>
52
      <body>
53
        <header>
54
          <a href='/user/breaches'>
55
            <img class='monitor-logo' srcset='/images/monitor-logo-transparent.webp 213w, /images/monitor-logo-transparent@2x.webp 425w' width='213' height='33' alt='${getMessage('brand-fx-monitor')}'>
56
          </a>
57
          <div class='nav-wrapper'>
58
            <button class='nav-toggle'>
59
              <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 8' width='20'>
60
                <path d='M1 1h8M1 4h8M1 7h8' stroke='#000' stroke-width='1' stroke-linecap='round'/>
61
              </svg>
62
            </button>
63
            ${userMenu(data)}
64
          </div>
65
        </header>
66

67
        <nav class='site-nav'>
68
          <div class='pages-nav'>
69
            <a href='/user/breaches' class='nav-item ${data.partial.name === 'breaches' ? 'current' : ''}'>
×
70
              <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
71
                <path fill-rule="evenodd" clip-rule="evenodd" d="M10.5942 20.049C9.87439 21.3816 10.8394 22.9996 12.3539 22.9996H19.657C21.1692 22.9996 22.1344 21.3862 21.4193 20.0538L17.7796 13.2724C17.0264 11.8689 15.0148 11.8662 14.2577 13.2676L10.5942 20.049Z" fill="white" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
72
                <path fill-rule="evenodd" clip-rule="evenodd" d="M16 21C16.5523 21 17 20.5523 17 20C17 19.4477 16.5523 19 16 19C15.4477 19 15 19.4477 15 20C15 20.5523 15.4477 21 16 21Z" fill="currentcolor"/>
73
                <path d="M16 17V16" stroke="currentcolor" stroke-width="2" stroke-linecap="round"/>
74
                <path d="M7 22H5C3.89543 22 3 21.1046 3 20V11C3 9.89543 3.89543 9 5 9H19C20.1046 9 21 9.89543 21 11V13" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
75
                <path d="M7 9V7C7 4.23858 9.23858 2 12 2C14.7614 2 17 4.23858 17 7V9" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
76
              </svg>
77
              ${getMessage('site-nav-breaches-link')}
78
            </a>
79
          </div>
80
          <div class='meta-nav'>
81
            <a href='/user/settings' class='nav-item ${data.partial.name === 'settings' ? 'current' : ''}'>
×
82
              ${getMessage('site-nav-settings-link')}
83
            </a>
84
            <a target="_blank" href='https://support.mozilla.org/kb/firefox-monitor' class='nav-item'>
85
              ${getMessage('site-nav-help-link')}
86
            </a>
87
          </div>
88
          <div class='callouts'>
89
            <p>${getMessage('site-nav-ad-callout')}</p>
90
            <a href='https://relay.firefox.com/?utm_medium=mozilla-websites&utm_source=monitor&utm_campaign=&utm_content=nav-bar-global' target='_blank'><img src='/images/logo-relay.svg' width='416' height='92' alt='${getMessage('brand-relay')}'></a>
91
            <a href='https://www.mozilla.org/products/vpn?utm_medium=mozilla-websites&utm_source=monitor&utm_campaign=&utm_content=nav-bar-global' target='_blank'><img src='/images/logo-vpn.svg' width='232' height='48' alt='${getMessage('brand-mozilla-vpn')}'></a>
92
          </div>
93
        </nav>
94

95
        <main data-partial='${data.partial.name}'>
96
          ${data.partial(data)}
97
        </main>
98
        <footer class='site-footer'>
99
          <a href='https://www.mozilla.org' target='_blank'>
100
            <img src='/images/moz-logo-1color-white-rgb-01.svg' width='100' height='29' loading='lazy' alt='${getMessage('mozilla')}'>
101
          </a>
102
          <menu>
103
            <li><a href='/breaches'>${getMessage('footer-nav-all-breaches')}</a></li>
104
            <li><a href='https://support.mozilla.org/kb/firefox-monitor-faq' target='_blank'>FAQ</a></li>
105
            <li><a href='https://www.mozilla.org/privacy/firefox-monitor' target='_blank'>${getMessage('terms-and-privacy')}</a></li>
106
            <li><a href='https://github.com/mozilla/blurts-server' target='_blank'>${getMessage('github')}</a></li>
107
          </menu>
108
        </footer>
109
      </body>
110
    </html>
111
  `
112
}
113

114
/**
115
 * @type {ViewPartial<MainViewPartialData>}
116
 */
117
const userMenu = data => `
×
118
<div class='user-menu-wrapper' tabindex='-1'>
119
  <button
120
    aria-expanded='false'
121
    aria-haspopup='true'
122
    class='user-menu-button'
123
    title='${getMessage('menu-button-title')}'
124
  >
125
    <img src='${data.fxaProfile?.avatar}' alt='${getMessage('menu-button-alt')}' />
126
  </button>
127
  <menu
128
    aria-label='${getMessage('menu-list-accessible-label')}'
129
    class='user-menu-container user-menu-popover'
130
    role='navigation'
131
    hidden
132
  >
133
    <li tabindex='1'>
134
      <a href='${AppConstants.FXA_SETTINGS_URL}' target='_blank' class='user-menu-header'>
135
        <b class='user-menu-email'>${data.fxaProfile?.email}</b>
136
        <div class='user-menu-subtitle'>
137
          ${getMessage('menu-item-fxa')}
138
          <img src='/images/icon-open-in.svg' />
139
        </div>
140
      </a>
141
    </li>
142
    <hr>
143
    <li>
144
      <a href='/user/settings' class='user-menu-link'>
145
        <img src='/images/icon-settings.svg' />
146
        ${getMessage('menu-item-settings')}
147
      </a>
148
    </li>
149
    <li>
150
      <a href='https://support.mozilla.org/kb/firefox-monitor' target='_blank' class='user-menu-link'>
151
        <img src='/images/icon-help.svg' />
152
        ${getMessage('menu-item-help')}
153
      </a>
154
    </li>
155
    <li>
156
      <a href='/user/logout' class='user-menu-link'>
157
        <img src='/images/icon-signout.svg' />
158
        ${getMessage('menu-item-logout')}
159
      </a>
160
    </li>
161
  </menu>
162
</div>
163
`
164

165
export { mainLayout }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc