First commit, imported from the working folder: Android TV app, loopback guide server, design sources and per-release verification notes. Includes the 0.16 tuning screen, built and tested but not yet confirmed on the box. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
21 lines
1.3 KiB
TypeScript
21 lines
1.3 KiB
TypeScript
import { createServer } from 'node:http';
|
|
import { guide } from './schedule.ts';
|
|
|
|
// Development-only service: loopback binding, no media, accounts or Emby credentials.
|
|
const server = createServer((req, res) => {
|
|
res.setHeader('Content-Type', 'application/json; charset=utf-8');
|
|
res.setHeader('Cache-Control', 'no-store');
|
|
res.setHeader('X-Content-Type-Options', 'nosniff');
|
|
if (req.method !== 'GET') { res.writeHead(405, { Allow: 'GET' }); res.end('{"error":"GET required"}'); return; }
|
|
const url = new URL(req.url ?? '/', 'http://127.0.0.1');
|
|
if (url.pathname === '/health') { res.end('{"status":"ok","mode":"fictional-demo"}'); return; }
|
|
if (url.pathname !== '/guide') { res.writeHead(404); res.end('{"error":"Not found"}'); return; }
|
|
try {
|
|
const now = url.searchParams.has('at') ? Number(url.searchParams.get('at')) : Date.now();
|
|
const count = url.searchParams.has('count') ? Number(url.searchParams.get('count')) : 6;
|
|
res.end(JSON.stringify({ generatedAt: Date.now(), channels: guide(now, count) }));
|
|
} catch { res.writeHead(400); res.end('{"error":"Use a valid epoch timestamp and count from 1 to 48"}'); }
|
|
});
|
|
server.listen(4317, '127.0.0.1', () => console.log('Orbit demo guide: http://127.0.0.1:4317/guide'));
|
|
for (const signal of ['SIGINT', 'SIGTERM'] as const) process.on(signal, () => server.close());
|