Activate | Viaplay

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

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'); activate viaplay

// API: Check if a code has been activated (polling by TV) app.post('/api/check-code', (req, res) => const code = req.body; const entry = codes.get(code); if (entry && entry.status === 'activated') res.json( activated: true, deviceId: entry.deviceId ); codes.delete(code); // one-time use else res.json( activated: false ); // Auto-expire after 10 minutes setTimeout(() =&gt; if

);

catch (err) messageDiv.innerHTML = '❌ Network error. Try again.'; messageDiv.className = 'error'; !-- public/activate.html --&gt

res.json( code ); );

// API: Activate code (user submits from browser) app.post('/api/activate', (req, res) => );

Go to Top