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:
@@ -1,12 +1,24 @@
|
||||
const { renderView } = require('../../view');
|
||||
|
||||
module.exports = function renderAccountPage(currentUser, message) {
|
||||
function normalizeReturnUrl(value) {
|
||||
const url = String(value || '').trim();
|
||||
if (!url || url === '/admin/account' || url.indexOf('/admin/account?') === 0) {
|
||||
return '/admin';
|
||||
}
|
||||
if (!/^\/admin(?:\/|\?|$)/.test(url)) {
|
||||
return '/admin';
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
module.exports = function renderAccountPage(currentUser, message, returnUrl) {
|
||||
return renderView('account/password', {
|
||||
title: 'My account',
|
||||
active: 'account',
|
||||
currentUser: currentUser || null,
|
||||
message: message || '',
|
||||
username: currentUser ? currentUser.username : '',
|
||||
name: currentUser ? String(currentUser.name || '') : ''
|
||||
name: currentUser ? String(currentUser.name || '') : '',
|
||||
returnUrl: normalizeReturnUrl(returnUrl)
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user