Release v2.10.3
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m13s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 31s

This commit is contained in:
2026-08-29 01:56:45 +01:00
parent 30814f3f46
commit 3f4f57020a
60 changed files with 1075 additions and 523 deletions
+19 -2
View File
@@ -4,6 +4,7 @@ const crypto = require('node:crypto');
const {
collectLiveConnections,
findAvailableClientName,
isClientNameAvailable,
normalizeClientName,
normalizeDeviceId,
@@ -22,7 +23,7 @@ test('collectLiveConnections returns an array safely', () => {
assert.deepEqual(collectLiveConnections([{ clientName: 'A' }]), [{ clientName: 'A' }]);
});
test('isClientNameAvailable rejects matching db rows and live connections', async () => {
test('isClientNameAvailable ignores stored names for offline devices', async () => {
const pool = {
async query(sql, params) {
assert.match(sql, /FROM d_onboarding_devices/);
@@ -31,12 +32,28 @@ test('isClientNameAvailable rejects matching db rows and live connections', asyn
}
};
assert.equal(await isClientNameAvailable(pool, ' Screen A ', 'device-01', []), false);
assert.equal(await isClientNameAvailable(pool, ' Screen A ', 'device-01', []), true);
assert.equal(await isClientNameAvailable(pool, 'Screen A', 'device-01', [{ clientName: 'screen a', deviceId: 'device-99' }]), false);
assert.equal(await isClientNameAvailable(null, 'Screen A', 'device-01', [{ clientName: 'screen a', clientId: 'device-99' }]), false);
assert.equal(await isClientNameAvailable(null, 'Screen A', 'device-01', [{ clientName: 'screen a', clientId: 'device-01' }]), true);
assert.equal(await isClientNameAvailable(null, ' ', 'device-01', []), false);
});
test('findAvailableClientName adds the first free numeric suffix', async () => {
const occupiedNames = new Set(['Lobby', 'Lobby (1)']);
const pool = {
async query(_sql, params) {
const name = params[0];
return [[occupiedNames.has(name) ? { device_id: 'active-device' } : undefined].filter(Boolean)];
}
};
assert.equal(
await findAvailableClientName(pool, 'Lobby', 'new-device', [{ deviceId: 'active-device' }]),
'Lobby (2)'
);
});
test('withClientNameReservation acquires and releases locks around the handler', async () => {
const calls = [];
const lockName = `ps_client_name_${crypto.createHash('sha1').update('screen a').digest('hex')}`;