[relay] Join page: GET /join hands an invite link opened in a browser to the app
ci / check (pull_request) Has been cancelled
ci / check (pull_request) Has been cancelled
A static page for https://<relay>/join#<invite id>.<secret>, the link messengers make tappable. The fragment never reaches the relay. One button opens amicitia://invite?relay=<origin>#…; its only script and style are named by SHA-256 in a Content-Security-Policy of default-src 'none'; no-store, no-referrer, no cookie, framing refused. PROTOCOL.md §8 lists the route.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>An invite to a private chat</title>
|
||||
<style>
|
||||
:root { color-scheme: dark light; }
|
||||
body { margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center;
|
||||
background: #0d0a0c; color: #f2ece8; font: 17px/1.5 system-ui, sans-serif; }
|
||||
main { max-width: 420px; padding: 32px 24px; text-align: center; }
|
||||
h1 { font-weight: 600; font-size: 26px; line-height: 1.2; margin: 0 0 12px; }
|
||||
p { margin: 0 0 20px; color: #cfc4bf; }
|
||||
.button { display: block; padding: 14px 20px; margin: 8px 0 24px; border-radius: 12px;
|
||||
background: #b3223a; color: #fff; text-decoration: none; font-weight: 600; font-size: 18px; }
|
||||
.small { font-size: 14px; color: #a99d98; }
|
||||
[hidden] { display: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>You're invited to a private chat</h1>
|
||||
<p>Someone who knows you invited you to chat in Amicitia, end to end encrypted.</p>
|
||||
<a id="open" class="button" href="#">Open Amicitia</a>
|
||||
<p id="missing" class="small">Don't have Amicitia yet? Ask the person who invited you how to get it, then tap their message again.</p>
|
||||
<p id="bad" class="small" hidden>This invite link is incomplete. Ask for a new one.</p>
|
||||
</main>
|
||||
<script>
|
||||
(function () {
|
||||
// The invite is in the fragment, which the browser never sends to this server.
|
||||
var invite = location.hash.slice(1);
|
||||
var open = document.getElementById("open");
|
||||
if (!/^[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}$/.test(invite)) {
|
||||
open.hidden = true;
|
||||
document.getElementById("missing").hidden = true;
|
||||
document.getElementById("bad").hidden = false;
|
||||
return;
|
||||
}
|
||||
open.href = "amicitia://invite?relay=" + location.origin + "#" + invite;
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user