Release 2.22.0: normalize playlist schedules and unify player sync
This commit is contained in:
1 parent
7748129307
commit
b71958cb38
39 files changed
+1174
-314
No files matched your search
@@ -248,3 +248,54 @@ test('client command route uses the bridge device route without a public player
|
||||
payload: { screenSlug: 'lobby', command: 'pause', connectionId: 'connection-1' }
|
||||
}]);
|
||||
});
|
||||
|
||||
test('client command route sends registered local players directly without querying bridge connections', async () => {
|
||||
const { app, handlers } = createAppHarness();
|
||||
const calls = [];
|
||||
registerScreenCommandRoutes(app, {
|
||||
pool: {
|
||||
async query(sql) {
|
||||
if (String(sql).includes('SELECT id, name, slug FROM d_screens WHERE slug = ?')) {
|
||||
return [[{ id: 3, name: 'Test', slug: 'test' }]];
|
||||
}
|
||||
return [[]];
|
||||
}
|
||||
},
|
||||
common: {
|
||||
async fetchPlayerRegistrations() {
|
||||
return [{ identifier: 'player-local', public_base_url: 'http://localhost:8081', internal_base_url: 'http://player:8081' }];
|
||||
}
|
||||
},
|
||||
forwardPlayerCommand() { throw new Error('default player route should not be used'); },
|
||||
forwardPlayerCommandToBaseUrl(baseUrl, slug, payload, connectionId) {
|
||||
calls.push({ baseUrl, slug, payload, connectionId });
|
||||
return { ok: true, sent: 1 };
|
||||
},
|
||||
forwardPlayerCommandToDevice() { throw new Error('bridge device route should not be used'); },
|
||||
getScreenConnections() { throw new Error('bridge connection lookup should not be used'); },
|
||||
isClientNameAvailable() { return true; },
|
||||
withClientNameReservation() {},
|
||||
broadcastDashboardState() {},
|
||||
requirePermission() { return function (_req, _res, next) { next(); }; }
|
||||
});
|
||||
|
||||
const response = {
|
||||
statusCode: 200,
|
||||
body: null,
|
||||
status(code) { this.statusCode = code; return this; },
|
||||
json(payload) { this.body = payload; return this; }
|
||||
};
|
||||
await handlers['/clients/:slug/commands'][1]({
|
||||
params: { slug: 'test' },
|
||||
body: { command: 'pause', connectionId: 'client-local', playerBaseUrl: 'http://localhost:8081' },
|
||||
query: {}
|
||||
}, response, () => {});
|
||||
|
||||
assert.equal(response.statusCode, 200);
|
||||
assert.deepEqual(calls, [{
|
||||
baseUrl: 'http://player:8081',
|
||||
slug: 'test',
|
||||
payload: { command: 'pause', connectionId: 'client-local', playerBaseUrl: 'http://localhost:8081' },
|
||||
connectionId: 'client-local'
|
||||
}]);
|
||||
});
|
||||
Reference in new issue
Block a user