restyling
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
const stage = document.getElementById('stage');
|
||||
const notice = document.getElementById('notice');
|
||||
|
||||
const isPreview = new URLSearchParams(window.location.search).get('preview') === '1';
|
||||
|
||||
// Stable session id per browser (used to enforce max concurrent viewers per display token)
|
||||
const SID_KEY = `display_sid_${token}`;
|
||||
function getSid() {
|
||||
@@ -31,14 +33,15 @@
|
||||
return sid;
|
||||
}
|
||||
|
||||
const sid = getSid();
|
||||
const sid = isPreview ? null : getSid();
|
||||
|
||||
let playlist = null;
|
||||
let idx = 0;
|
||||
let timer = null;
|
||||
|
||||
async function fetchPlaylist() {
|
||||
const res = await fetch(`/api/display/${token}/playlist?sid=${encodeURIComponent(sid)}`, { cache: 'no-store' });
|
||||
const qs = sid ? `?sid=${encodeURIComponent(sid)}` : '';
|
||||
const res = await fetch(`/api/display/${token}/playlist${qs}`, { cache: 'no-store' });
|
||||
if (res.status === 429) {
|
||||
const data = await res.json().catch(() => null);
|
||||
throw Object.assign(new Error(data?.message || 'Display limit reached'), { code: 'LIMIT', data });
|
||||
|
||||
Reference in New Issue
Block a user