mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import escapeHTML from 'escape-html'
2import {type Request} from 'express'
3
4export function linkWarningContents(
5 req: Request,
6 opts: {
7 type: 'warn' | 'block'
8 link: string
9 },
10): string {
11 const continueButton =
12 opts.type === 'warn'
13 ? `<a class="button secondary" href="${escapeHTML(opts.link)}">${req.__('Continue Anyway')}</a>`
14 : ''
15
16 return `
17 <div class="warning-icon">⚠️</div>
18 <h1>
19 ${
20 opts.type === 'warn'
21 ? req.__('Potentially Dangerous Link')
22 : req.__('Blocked Link')
23 }
24 </h1>
25 <p class="warning-text">
26 ${
27 opts.type === 'warn'
28 ? req.__(
29 'This link may be malicious. You should proceed at your own risk.',
30 )
31 : req.__(
32 'This link has been identified as malicious and has blocked for your safety.',
33 )
34 }
35 </p>
36 <div class="blocked-site">
37 <p class="site-url">${escapeHTML(opts.link)}</p>
38 </div>
39 <div class="button-group">
40 ${continueButton}
41 <a class="button primary" href="https://bsky.app">${req.__('Return to Bluesky')}</a>
42 </div>
43 `
44}