catch (err) console.error('Poll error', err);
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'; activate viaplay
fetchNewCode(); </script> </body> </html> <!-- public/activate.html --> <!DOCTYPE html> <html> <head> <title>Viaplay – Activate Device</title> <style> body font-family: system-ui, -apple-system, sans-serif; background: #f0f2f5; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; .card background: white; padding: 2rem; border-radius: 32px; box-shadow: 0 20px 35px rgba(0,0,0,0.1); width: 350px; text-align: center; h1 color: #00a6a6; input width: 100%; padding: 15px; font-size: 1.5rem; text-align: center; letter-spacing: 5px; font-family: monospace; border: 2px solid #ddd; border-radius: 60px; margin: 20px 0; button background: #00a6a6; color: white; border: none; padding: 12px 24px; font-size: 1.2rem; border-radius: 40px; width: 100%; cursor: pointer; font-weight: bold; button:hover background: #008080; .error color: red; margin-top: 15px; .success color: green; margin-top: 15px; .note margin-top: 20px; font-size: 0.8rem; color: #555; </style> </head> <body> <div class="card"> <h1>🎬 Viaplay Activation</h1> <p>Enter the code shown on your TV</p> <input type="text" id="codeInput" maxlength="6" placeholder="000000" autofocus> <button id="activateBtn">Activate Device</button> <div id="message"></div> <div class="note">Code expires in 10 minutes</div> </div> <script> const activateBtn = document.getElementById('activateBtn'); const codeInput = document.getElementById('codeInput'); const messageDiv = document.getElementById('message'); catch (err) console