application stuff

This commit is contained in:
chrisbell committed 2026-11-20 19:40:23 -06:00
1 parent aa7ef06858
commit e3e291b8cf
4 files changed
+97 -5

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
---
title: Application status
description: "Check the status of your Alabama Progress join application."
noindex: true
scripts: [join-status.js]
---
<h2>Application status</h2>
<p class="lead" data-status-msg role="status">Checking…</p>
<div data-invite hidden>
<p><a class="btn btn-primary" href="#" rel="noopener">Join the Discord server</a></p>
</div>
<p><em>Keep this page's address private. It's how you check on your application.</em></p>
<p>Questions? Write to <a href="mailto:AlabamaProgressOrg@gmail.com">AlabamaProgressOrg@gmail.com</a>.</p>
+2 -5
View File
@@ -25,14 +25,11 @@ description: How Alabama Progress handles your information, including what the j
</ul> </ul>
<h3>How Information Is Used and Retained</h3> <h3>How Information Is Used and Retained</h3>
<p>Information submitted through the join form is transmitted solely to the administrators of the Alabama Progress <p>Your full application is posted to a private moderator channel in our Discord server. Once a moderator accepts or declines it, the bot removes your answers and keeps only your Discord username and the decision. To let you check your status, the bot also keeps a random pickup code (stored only as a one-way hash), your application's status and, if accepted, a single-use invite link for up to 14 days. None of this contains your answers.</p>
Discord server for the purpose of reviewing and approving your membership request. Submitted form data is not stored
in a database or retained after your application is reviewed.</p>
<h3>Third-Party Sharing</h3> <h3>Third-Party Sharing</h3>
<p>Alabama Progress does not sell, rent, trade, or share any submitted information with third parties, data brokers, or <p>Alabama Progress does not sell, rent, trade, or share any submitted information with third parties, data brokers, or
outside organizations.</p> outside organizations.</p>
<h3>Contact</h3> <h3>Contact</h3>
<p>If you have any questions about this privacy policy or how join requests are handled, contact <a <p>If you have any questions about this privacy policy or how join requests are handled, contact <a href="mailto:AlabamaProgressOrg@gmail.com">AlabamaProgressOrg@gmail.com</a>.</p>
href="mailto:AlabamaProgressOrg@gmail.com">AlabamaProgressOrg@gmail.com</a>.</p>
+47
View File
@@ -0,0 +1,47 @@
const message = document.querySelector('[data-status-msg]');
const box = document.querySelector('[data-invite]');
const link = box.querySelector('a');
const code = decodeURIComponent(location.hash.slice(1));
const INVITE = /^https:\/\/discord\.(gg|com\/invite)\/[A-Za-z0-9-]+$/;
const POLL_MS = 15000;
const TEXT = {
pending: 'Your application has been received and is waiting for a moderator. This page updates on its own, so you can keep it open, or bookmark it and come back later.',
accepted: 'Good news: your application was approved! Use the invite below to join the server. It works once and expires 7 days after approval.',
declined: 'Your application was not approved at this time.',
unknown: 'We couldn’t find this application. It may be more than 14 days old, or the link may be incomplete.',
};
function show(state) {
message.textContent = TEXT[state];
}
async function check() {
try {
const res = await fetch('/api/join/status', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ code }),
});
if (res.status === 404) return show('unknown');
if (res.ok) {
const body = await res.json();
if (body.status === 'accepted' && INVITE.test(body.invite || '')) {
link.href = body.invite;
box.hidden = false;
return show('accepted');
}
if (body.status === 'declined') return show('declined');
show('pending');
}
} catch {
// Network hiccup: keep the last message and try again.
}
setTimeout(check, POLL_MS);
}
if (code) {
check();
} else {
show('unknown');
}
+33
View File
@@ -0,0 +1,33 @@
const form = document.querySelector('form[data-join]');
if (form) {
const status = form.querySelector('[data-status]');
const button = form.querySelector('button[type="submit"]');
form.addEventListener('submit', async (event) => {
event.preventDefault();
status.textContent = 'Sending…';
button.disabled = true;
try {
const res = await fetch('/api/join', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(Object.fromEntries(new FormData(form))),
});
const body = await res.json().catch(() => ({}));
if (res.ok && body.code) {
location.href = `/join-status/#${encodeURIComponent(body.code)}`;
return;
}
status.textContent = body.error ||
(res.status === 429
? 'Too many attempts. Please wait a few minutes and try again.'
: 'Something went wrong. Please try again, or email us instead.');
} catch {
status.textContent = 'Could not reach the server. Check your connection and try again.';
}
button.disabled = false;
});
}