Code box survives a board reload: the board hands back the member's started mission, a second Start reuses the live token, and submit accepts the code of any live token of theirs for that mission (ticket IAP-1027, phones that open the site in the board's own window)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-24 08:51:00 -06:00
parent d915884409
commit 21b2f5e91b
5 changed files with 481 additions and 466 deletions
+3 -2
View File
@@ -257,11 +257,12 @@
}
}
let explorer = 'https://polygonscan.com';
async function load() { board = await api('/api/my/board'); render(); }
// the server remembers a started mission, so its code box survives a reload (phones often open the site in this same window)
async function load() { board = await api('/api/my/board'); if (board && board.open && (!open || open.token !== board.open.token || open.missionId !== board.open.missionId)) open = board.open; render(); }
async function start(id) {
const r = await api('/api/my/start', { missionId: id });
if (r.error) { toast(esc(r.error), 'bad'); if (r.spent || r.dailyDone) await load(); return; }
open = { missionId: id, token: r.token, url: r.url, dwell: r.dwell, started: Date.now(), expires: r.expires };
open = { missionId: id, token: r.token, url: r.url, dwell: r.dwell, started: r.started || Date.now(), expires: r.expires };
window.open(r.url, '_blank', 'noopener');
render();
}