about summary refs log tree commit diff
path: root/bskylink/src/html/linkWarningContents.ts
diff options
context:
space:
mode:
authorhailey <hailey@blueskyweb.xyz>2025-09-02 13:36:20 -0700
committerGitHub <noreply@github.com>2025-09-02 13:36:20 -0700
commitacdc509630d5182f9f3d224b259e2a46000b1f27 (patch)
tree92d6b474bad9692e5b054ed8b693bca1cba816ac /bskylink/src/html/linkWarningContents.ts
parentb2258fb6cbdb5de79a7c7d848347f3f157059aa5 (diff)
downloadvoidsky-acdc509630d5182f9f3d224b259e2a46000b1f27.tar.zst
safelink (#8917)
Co-authored-by: hailey <me@haileyok.com>
Co-authored-by: Stanislas Signoud <signez@stanisoft.net>
Co-authored-by: will berry <wsb@wills-MBP.attlocal.net>
Co-authored-by: BlueSkiesAndGreenPastures <will@blueskyweb.xyz>
Co-authored-by: Chenyu Huang <itschenyu@gmail.com>
Diffstat (limited to 'bskylink/src/html/linkWarningContents.ts')
-rw-r--r--bskylink/src/html/linkWarningContents.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/bskylink/src/html/linkWarningContents.ts b/bskylink/src/html/linkWarningContents.ts
new file mode 100644
index 000000000..31449c3c8
--- /dev/null
+++ b/bskylink/src/html/linkWarningContents.ts
@@ -0,0 +1,44 @@
+import escapeHTML from 'escape-html'
+import {type Request} from 'express'
+
+export function linkWarningContents(
+  req: Request,
+  opts: {
+    type: 'warn' | 'block'
+    link: string
+  },
+): string {
+  const continueButton =
+    opts.type === 'warn'
+      ? `<a class="button secondary" href="${escapeHTML(opts.link)}">${req.__('Continue Anyway')}</a>`
+      : ''
+
+  return `
+    <div class="warning-icon">⚠️</div>
+    <h1>
+      ${
+        opts.type === 'warn'
+          ? req.__('Potentially Dangerous Link')
+          : req.__('Blocked Link')
+      }
+    </h1>
+    <p class="warning-text">
+      ${
+        opts.type === 'warn'
+          ? req.__(
+              'This link may be malicious. You should proceed at your own risk.',
+            )
+          : req.__(
+              'This link has been identified as malicious and has blocked for your safety.',
+            )
+      }
+    </p>
+    <div class="blocked-site">
+      <p class="site-url">${escapeHTML(opts.link)}</p>
+    </div>
+    <div class="button-group">
+      ${continueButton}
+      <a class="button primary" href="https://bsky.app">${req.__('Return to Bluesky')}</a>
+    </div>
+  `
+}