This PR breaks the large web and player bootstrap files into smaller modules with clearer ownership.

Web changes:

Split shared helpers, bootstrap logic, route groups, and upload-sync behavior out of web.js.
Kept web.js focused on wiring and server startup.
Fixed screen playlist reassignment so changing a screen’s playlist now triggers a refresh.
Fixed single-slide playlist refresh behavior so updates do not get stuck behind the current slide.
Player changes:

Split websocket/runtime handling into runtime.js.
Split playlist assembly and revision hashing into playlist.js.
Split onboarding and player HTTP routes into dedicated modules.
Split render utilities and template loading into render-helpers.js.
Kept player.js mostly as startup/orchestration.
Validation:

Rebuilt both services with Docker Compose.
Smoke-checked web and player routes after the refactor.
Verified get_errors was clean on the touched modules.
This commit is contained in:
2026-07-20 23:58:27 +01:00
parent 480ccdbe9c
commit 2ea8d389fa
321 changed files with 12687 additions and 7080 deletions
+36
View File
@@ -39,6 +39,42 @@ Handlebars.registerHelper('userInitial', function (name, username) {
return value.charAt(0).toUpperCase();
});
Handlebars.registerHelper('saveActionButtons', function (options) {
const hash = options && options.hash ? options.hash : {};
const formId = String(hash.formId || '').trim();
const saveLabel = String(hash.saveLabel || 'Save');
const saveButtonClass = String(hash.saveButtonClass || 'btn btn-success');
const saveActionName = String(hash.saveActionName || 'save_action');
const saveActionValue = String(hash.saveActionValue || 'save');
const closeLabel = String(hash.saveAndCloseLabel || 'Save and Close');
const closeValue = String(hash.saveAndCloseValue || 'close');
const newLabel = String(hash.saveAndNewLabel || 'Save and New');
const newValue = String(hash.saveAndNewValue || 'new');
const showSaveAndClose = hash.showSaveAndClose === undefined ? true : String(hash.showSaveAndClose).toLowerCase() !== 'false';
const showSaveAndNew = hash.showSaveAndNew === undefined ? true : String(hash.showSaveAndNew).toLowerCase() !== 'false';
const ariaLabel = String(hash.ariaLabel || 'Save actions');
if (!formId) {
return '';
}
const escape = Handlebars.escapeExpression;
const formAttr = ` form="${escape(formId)}"`;
return new Handlebars.SafeString([
'<div class="btn-group save-action-group" role="group">',
`<button type="submit" class="${escape(saveButtonClass)}"${formAttr} name="${escape(saveActionName)}" value="${escape(saveActionValue)}">${escape(saveLabel)}</button>`,
`<button type="button" class="btn btn-success dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">`,
'<span class="visually-hidden">Toggle save options</span>',
'</button>',
'<div class="dropdown-menu dropdown-menu-end">',
showSaveAndClose ? `<button type="submit" class="dropdown-item"${formAttr} name="${escape(saveActionName)}" value="${escape(closeValue)}">${escape(closeLabel)}</button>` : '',
showSaveAndNew ? `<button type="submit" class="dropdown-item"${formAttr} name="${escape(saveActionName)}" value="${escape(newValue)}">${escape(newLabel)}</button>` : '',
'</div>',
'</div>',
].join(''));
});
function loadTemplate(relativePath) {
const filePath = path.join(VIEWS_ROOT, relativePath);
const stat = fs.statSync(filePath);