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

This commit is contained in:
lzstealth committed 2026-10-17 16:01:00 +01:00
1 parent 64aeb1b47e
commit 05c9341b08
25 files changed
+595 -31

No files matched your search

+70
View File
@@ -206,4 +206,74 @@ test('weather icon usage recognizes one set reference', function () {
};
assert.equal(isUsed('set'), true);
assert.equal(isUsed('other'), false);
});
test('weather icon set create, update, toggle, and delete are audited', async function () {
const originals = {
readWeatherIconSets: library.readWeatherIconSets,
saveWeatherIconSet: library.saveWeatherIconSet,
collectWeatherIconRemovalOperations: library.collectWeatherIconRemovalOperations,
setWeatherIconSetEnabled: library.setWeatherIconSetEnabled,
deleteWeatherIconSet: library.deleteWeatherIconSet
};
const handlers = {};
const events = [];
let sets = [];
const app = {
get(route, ...callbacks) { handlers['GET ' + route] = callbacks; },
post(route, ...callbacks) { handlers['POST ' + route] = callbacks; }
};
const iconSet = { id: 'clear-set', name: 'Clear skies', icons: { clear: '/media/assets/weather-icons/clear-set/clear.png' }, nightIcons: {} };
library.readWeatherIconSets = function () { return sets.slice(); };
library.saveWeatherIconSet = async function (_root, name, _files, id) {
const saved = Object.assign({}, iconSet, { id: id || iconSet.id, name: name });
sets = id ? sets.map(function (set) { return set.id === id ? saved : set; }) : sets.concat(saved);
return saved;
};
library.collectWeatherIconRemovalOperations = function () { return []; };
library.setWeatherIconSetEnabled = function (_root, id, enabled) {
const updated = Object.assign({}, sets.find(function (set) { return set.id === id; }), { enabled: enabled });
sets = sets.map(function (set) { return set.id === id ? updated : set; });
return updated;
};
library.deleteWeatherIconSet = function (_root, id) {
const removed = sets.find(function (set) { return set.id === id; });
sets = sets.filter(function (set) { return set.id !== id; });
return removed;
};
try {
require('../src/web/routes/settings/weather-icons') (app, {
mediaDir: 'unused',
pool: { async query() { return [[]]; } },
requirePermission() { return function (_req, _res, next) { next(); }; },
recordRequestAuditEvent(_pool, _req, event) { events.push(event); }
});
const response = { redirect() { return this; }, status() { return this; }, send() { return this; } };
const next = function (error) { if (error) throw error; };
const currentUser = { id: 21 };
const createRequest = { currentUser: currentUser, body: { name: 'Clear skies' }, files: {}, params: {} };
await handlers['POST /settings/weather-icons'].at(-1)(createRequest, response, next);
await handlers['POST /settings/weather-icons/:id'].at(-1)(
{ currentUser: currentUser, body: { name: 'Updated skies' }, files: {}, params: { id: iconSet.id } }, response, next
);
await handlers['POST /settings/weather-icons/:id/toggle'].at(-1)(
{ currentUser: currentUser, body: { enabled: '0' }, params: { id: iconSet.id } }, response, next
);
await handlers['POST /settings/weather-icons/:id/delete'].at(-1)(
{ currentUser: currentUser, params: { id: iconSet.id } }, response, next
);
assert.deepEqual(events.map(function (event) { return event.eventType; }), [
'weather-icon-set.created', 'weather-icon-set.updated', 'weather-icon-set.disabled', 'weather-icon-set.deleted'
]);
assert.ok(events.every(function (event) { return event.category === 'media-assets' && event.actorUserId === 21; }));
} finally {
library.readWeatherIconSets = originals.readWeatherIconSets;
library.saveWeatherIconSet = originals.saveWeatherIconSet;
library.collectWeatherIconRemovalOperations = originals.collectWeatherIconRemovalOperations;
library.setWeatherIconSetEnabled = originals.setWeatherIconSetEnabled;
library.deleteWeatherIconSet = originals.deleteWeatherIconSet;
}
});