Add a Settings action to manually rerun Live TV stream analysis: it triggers an admin-guarded projection rebuild endpoint that groups streams into logical channels (covering channels present before the projection existed) and reruns language/Laya detection, with progress presented via liveAnalysisPresentation. Harden the Laya batch path that failed with 'Local AI language matching failed' by surfacing the underlying cause and falling back to standard matching cleanly. Guard admin-only rebuild through a new authz helper and cover routes, service and presentation with tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
866 B
JavaScript
22 lines
866 B
JavaScript
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const { isAdmin } = require('../server/authz');
|
|
|
|
const routeSource = fs.readFileSync(path.join(__dirname, '..', 'server', 'routes', 'live.js'), 'utf8');
|
|
|
|
test('projection status route requires authentication', () => {
|
|
assert.match(routeSource, /router\.get\('\/projection\/status', requireAuth,/);
|
|
});
|
|
|
|
test('projection rebuild route requires authentication and admin authorization', () => {
|
|
assert.match(routeSource, /router\.post\('\/projection\/rebuild', requireAuth, requireAdmin,/);
|
|
});
|
|
|
|
test('projection authorization distinguishes viewer and admin roles', () => {
|
|
assert.equal(isAdmin({ role: 'viewer' }), false);
|
|
assert.equal(isAdmin({ role: 'admin' }), true);
|
|
assert.equal(isAdmin(null), false);
|
|
});
|