Results share link: read-only /r page with a revocable key, the admin ticks which closed questions it shows (sharing locks reopen like publish), refreshes every 15 s

This commit is contained in:
2026-11-19 01:11:05 +01:00
parent 41b4ac1a78
commit 98d8199ffd
7 changed files with 146 additions and 4 deletions
+27
View File
@@ -0,0 +1,27 @@
import { $, h, api, pollId, hashKey, resultsView } from "./common.js";
const pid = pollId();
// the key stays in the address bar so the link can be passed on as is
const key = hashKey();
async function load() {
let data;
try { data = await api("GET", `/api/r/${pid}`, undefined, key); }
catch {
$("#denied").hidden = false;
$("#list").replaceChildren();
return;
}
$("#denied").hidden = true;
$("#title").textContent = data.title;
document.title = `Résultats · ${data.title}`;
const qs = data.questions.sort((a, b) => a.id - b.id);
$("#list").replaceChildren(...(qs.length
? qs.map((q) => h("article", { class: "q" }, h("div", { class: "q-text" }, q.text), resultsView(q)))
: [h("p", { class: "muted" }, "Aucun résultat pour l'instant.")]));
}
load();
// questions get added as the meeting goes on
setInterval(() => { if (!document.hidden) load(); }, 15000);
document.addEventListener("visibilitychange", () => { if (!document.hidden) load(); });