diff --git a/frontend/js/views/device-detail.js b/frontend/js/views/device-detail.js index fa2a917..8ee9b96 100644 --- a/frontend/js/views/device-detail.js +++ b/frontend/js/views/device-detail.js @@ -89,9 +89,8 @@ function renderDeviceClock(device) { // covers panels paired before that existed, which registered as "Chrome 120" with a BrightSign UA. function isBrightSignDevice(device) { if (!device) return false; - const platform = String(device.platform || '').toLowerCase(); - if (platform.includes('brightsign')) return true; - return String(device.user_agent || '').toLowerCase().includes('brightsign'); + // platform only: `devices` has no user_agent column, so a fallback on it could never fire. + return String(device.platform || '').toLowerCase().includes('brightsign'); } export function render(container, deviceId) { diff --git a/server/lib/sync-backend.js b/server/lib/sync-backend.js index e77336b..e4858fd 100644 --- a/server/lib/sync-backend.js +++ b/server/lib/sync-backend.js @@ -24,16 +24,22 @@ const BACKENDS = ['auto', 'screentinker', 'brightsign']; /* - * A device is a BrightSign if it said so. The player sends ?platform=brightsign (autorun.brs - * puts it there), which lands in devices.platform. The UA fallback covers players paired before - * the port existed — those registered a platform of "Chrome 120" with a BrightSign UA. + * A device is a BrightSign if it said so: the player sends ?platform=brightsign (autorun.brs puts + * it there), which lands in devices.platform. + * + * There is deliberately NO user-agent fallback. An earlier version had one, to catch panels paired + * before this port existed — which registered as "Chrome 120" with a BrightSign user agent. It + * could never fire: `devices` has no user_agent column, so the field is always undefined on a row + * read from the database. It read as defensive and was dead code. + * + * Those pre-port panels are identified the moment they re-register on a build that carries the + * host, which every one of them gets on its next update. Recognising them earlier would mean + * persisting the user agent, and a column added solely to identify a population that disappears on + * its own is not worth carrying. */ function isBrightSignDevice(device) { if (!device) return false; - const platform = String(device.platform || '').toLowerCase(); - if (platform.includes('brightsign')) return true; - const ua = String(device.user_agent || '').toLowerCase(); - return ua.includes('brightsign'); + return String(device.platform || '').toLowerCase().includes('brightsign'); } /* diff --git a/server/test/sync-backend.test.js b/server/test/sync-backend.test.js index 8e12216..d171596 100644 --- a/server/test/sync-backend.test.js +++ b/server/test/sync-backend.test.js @@ -66,11 +66,15 @@ test('unknown or missing settings read as auto rather than throwing', () => { assert.equal(resolveSyncBackend('auto', null).backend, 'screentinker'); }); -test('a player paired before the port is still recognised by its user agent', () => { - // Both of giyokun's devices registered platform "Chrome 120" with a BrightSign UA. +test('a pre-port panel is NOT recognised until it re-registers — no phantom user-agent match', () => { + // Panels paired before this port registered as "Chrome 120" with a BrightSign user agent, and an + // earlier version tried to catch them that way. It could never work: `devices` has no user_agent + // column, so the field is always undefined on a row read from the database — the check passed + // only in tests that fabricated it, which is exactly how dead code survives. const legacy = { id: 'old', platform: 'Chrome 120', user_agent: 'BrightSign/9.1.92.2 (HD1026) Chrome/120' }; - assert.equal(isBrightSignDevice(legacy), true); - assert.equal(resolveSyncBackend('auto', [legacy, bs(2)]).backend, 'brightsign'); + assert.equal(isBrightSignDevice(legacy), false, 'a fabricated user_agent must not create a match'); + assert.equal(resolveSyncBackend('auto', [legacy, bs(2)]).backend, 'screentinker', + 'so a group containing one reads as mixed until that panel re-registers as brightsign'); }); test('a non-BrightSign device is never mistaken for one', () => {