Activate Viaplay File

// Auto-expire after 10 minutes setTimeout(() => if (codes.get(code)?.status === 'pending') codes.delete(code);

, 10 * 60 * 1000);

catch (err) console.error('Poll error', err); activate viaplay

);

function startPolling(code) pollInterval = setInterval(async () => try const res = await fetch('/api/check-code', method: 'POST', headers: 'Content-Type': 'application/json' , body: JSON.stringify( code ) ); const data = await res.json(); if (data.activated) clearInterval(pollInterval); document.getElementById('statusMessage').innerHTML = '✅ ACTIVATED! Enjoy Viaplay.'; document.getElementById('statusMessage').className = 'status activated'; document.getElementById('activationCode').style.opacity = '0.5'; // Auto-expire after 10 minutes setTimeout(() => if

document.getElementById('refreshBtn').addEventListener('click', () => if (pollInterval) clearInterval(pollInterval); fetchNewCode(); ); 10 * 60 * 1000)

// Generate a new 6-digit activation code function generateCode() return Math.floor(100000 + Math.random() * 900000).toString();