domma-cms 1.51.3 → 1.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/admin/css/admin-assistant.css +1 -0
- package/admin/index.html +1 -0
- package/admin/js/app.js +2 -2
- package/admin/js/lib/admin-assistant.js +9 -0
- package/admin/js/lib/site-settings-arrange.js +3 -3
- package/admin/js/lib/theme-settings-arrange.js +1 -1
- package/admin/js/templates/settings.html +11 -0
- package/admin/js/templates/theme.html +18 -0
- package/admin/js/views/settings.js +1 -1
- package/admin/js/views/theme.js +5 -5
- package/docs/admin-assistant.md +53 -0
- package/docs/screenshots/admin-assistant-panel.png +0 -0
- package/docs/screenshots/admin-assistant-settings.png +0 -0
- package/docs/screenshots/theme-switcher-public.png +0 -0
- package/docs/screenshots/theme-switcher-settings.png +0 -0
- package/docs/theming.md +35 -1
- package/package.json +1 -1
- package/public/css/theme-switcher.css +1 -1
- package/public/js/site.js +1 -1
- package/public/js/theme-switcher.js +1 -1
- package/server/routes/api/admin-assistant.js +43 -0
- package/server/routes/api/settings.js +7 -1
- package/server/server.js +2 -0
- package/server/services/adminAssistant.js +73 -0
- package/server/services/plugins.js +3 -1
- package/server/services/renderer.js +9 -1
- package/server/services/themeSettings.js +19 -4
- package/server/templates/page.html +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Authenticated help and drafts, separate from visitor chat and with no write tools. */
|
|
2
|
+
import {authenticate as defaultAuthenticate} from '../../middleware/auth.js';
|
|
3
|
+
import {getConfig} from '../../config.js';
|
|
4
|
+
import {siteAssistant} from '../../services/assistant.js';
|
|
5
|
+
import {adminAssistantConfig, adminAssistantContext, requestAdminAnswer} from '../../services/adminAssistant.js';
|
|
6
|
+
|
|
7
|
+
export async function adminAssistantRoutes(fastify, {authenticate = defaultAuthenticate, contextFor = adminAssistantContext, settings = adminAssistantConfig, answer = requestAdminAnswer} = {}) {
|
|
8
|
+
const guard = {preHandler: [authenticate]};
|
|
9
|
+
fastify.get('/admin-assistant/config', guard, async request => {
|
|
10
|
+
const cfg = settings();
|
|
11
|
+
if (!cfg.enabled) return {enabled: false};
|
|
12
|
+
const help = contextFor(request.user, request.query?.route || '/');
|
|
13
|
+
if (help.error) return {enabled: false};
|
|
14
|
+
return {enabled: true, available: cfg.available, name: help.name || cfg.name,
|
|
15
|
+
character: cfg.charactersEnabled === false ? '' : help.character || cfg.character, animated: cfg.animated};
|
|
16
|
+
});
|
|
17
|
+
fastify.post('/admin-assistant/ask', {...guard, bodyLimit: 20 * 1024, config: {rateLimit: {max: 12, timeWindow: '1 minute'}}}, async (request, reply) => {
|
|
18
|
+
const cfg = settings();
|
|
19
|
+
if (!cfg.enabled) return reply.code(403).send({error: 'The admin assistant is switched off.'});
|
|
20
|
+
const body = request.body || {};
|
|
21
|
+
if (typeof body.question !== 'string' || !body.question.trim() || body.question.length > 1000) return reply.code(400).send({error: 'Ask a question of up to 1000 characters.'});
|
|
22
|
+
if (body.history !== undefined && (!Array.isArray(body.history) || body.history.length > 10 || body.history.some(m => !['visitor', 'bot'].includes(m?.from) || typeof m.text !== 'string' || m.text.length > 1000))) {
|
|
23
|
+
return reply.code(400).send({error: 'Invalid conversation history.'});
|
|
24
|
+
}
|
|
25
|
+
const help = contextFor(request.user, body.route || '/');
|
|
26
|
+
if (help.error) return reply.code(help.status).send({error: help.error});
|
|
27
|
+
const site = getConfig('site') || {};
|
|
28
|
+
const shared = siteAssistant();
|
|
29
|
+
try {
|
|
30
|
+
const result = await answer({audience: 'admin', botName: help.name || cfg.name,
|
|
31
|
+
site: {name: String(site.title || '').slice(0, 200)}, context: [shared.context, cfg.context].filter(Boolean).join('\n\n'),
|
|
32
|
+
rules: [shared.rules, cfg.rules].filter(Boolean).join('\n'), knowledge: (help.context.match(/[\s\S]{1,4000}/g) || []).map((a, i) => ({q: `Admin tool guidance ${i + 1}`, a})),
|
|
33
|
+
history: body.history || [], question: body.question.trim()});
|
|
34
|
+
if (result.status !== 200) return reply.code([403, 429, 503].includes(result.status) ? result.status : 503)
|
|
35
|
+
.send({error: result.status === 429 ? 'The site AI allowance is currently unavailable. Please try again later.' : 'AI answers are not available for this site right now.'});
|
|
36
|
+
if (result.body?.audience !== 'admin') return reply.code(503).send({error: 'The Manager needs the admin assistant update before it can answer here.'});
|
|
37
|
+
return {answer: typeof result.body.answer === 'string' && result.body.answer.trim()
|
|
38
|
+
? result.body.answer.slice(0, 6000) : 'I do not have enough information to answer that. Try asking about the current tool or provide the facts for a draft.'};
|
|
39
|
+
} catch {
|
|
40
|
+
return reply.code(503).send({error: 'The assistant could not answer just now. Please try again.'});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -24,6 +24,7 @@ import {cssClassProblems} from '../../../public/js/css-classes.mjs';
|
|
|
24
24
|
import {motionFooterMirror, normaliseMotionSettings} from '../../services/motionSettings.js';
|
|
25
25
|
import {invalidateMeasurementId, measurementIdOf, normaliseMeasurementId} from '../../services/googleAnalytics.js';
|
|
26
26
|
import {assistantProblem, normaliseAssistant} from '../../services/assistant.js';
|
|
27
|
+
import {adminAssistantProblem, normaliseAdminAssistant} from '../../services/adminAssistant.js';
|
|
27
28
|
import {normaliseCharacterSettings} from '../../../public/js/characters.mjs';
|
|
28
29
|
|
|
29
30
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -150,7 +151,7 @@ export async function settingsRoutes(fastify) {
|
|
|
150
151
|
// The "Reduce motion" control (Site Settings > Reduce motion) - services/motionSettings.js.
|
|
151
152
|
'motion',
|
|
152
153
|
// What every AI answer knows about the site and the rules it keeps (services/assistant.js).
|
|
153
|
-
'assistant', 'characters'
|
|
154
|
+
'assistant', 'characters', 'adminAssistant'
|
|
154
155
|
]);
|
|
155
156
|
const unknownKeys = Object.keys(data).filter(k => !ALLOWED_KEYS.has(k));
|
|
156
157
|
if (unknownKeys.length > 0) {
|
|
@@ -193,6 +194,10 @@ export async function settingsRoutes(fastify) {
|
|
|
193
194
|
if ('characters' in data && (!data.characters || typeof data.characters !== 'object' || Array.isArray(data.characters))) {
|
|
194
195
|
return reply.status(400).send({error: 'Builders and Bots: send an object.'});
|
|
195
196
|
}
|
|
197
|
+
if ('adminAssistant' in data) {
|
|
198
|
+
const problem = adminAssistantProblem(data.adminAssistant);
|
|
199
|
+
if (problem) return reply.status(400).send({error: `Admin assistant: ${problem}`});
|
|
200
|
+
}
|
|
196
201
|
if ('assistant' in data) {
|
|
197
202
|
const a = data.assistant;
|
|
198
203
|
if (!a || typeof a !== 'object' || Array.isArray(a)) return reply.status(400).send({error: 'AI assistant: send {context, rules}.'});
|
|
@@ -223,6 +228,7 @@ export async function settingsRoutes(fastify) {
|
|
|
223
228
|
// The Reduce motion control: stored whitelisted, with the footer keys it used to live
|
|
224
229
|
// under kept in step for older readers. A client that still writes only those footer
|
|
225
230
|
// keys (fleet tooling) moves the block with them, so its change is not overruled.
|
|
231
|
+
if ('adminAssistant' in data) merged.adminAssistant = normaliseAdminAssistant(merged.adminAssistant);
|
|
226
232
|
if ('characters' in data) merged.characters = normaliseCharacterSettings(merged.characters);
|
|
227
233
|
if ('motion' in data) {
|
|
228
234
|
if (data.motion !== null && (typeof data.motion !== 'object' || Array.isArray(data.motion))) {
|
package/server/server.js
CHANGED
|
@@ -556,6 +556,7 @@ const { formsRoutes } = await import('./routes/api/forms.js');
|
|
|
556
556
|
const { viewsRoutes } = await import('./routes/api/views.js');
|
|
557
557
|
const { actionsRoutes } = await import('./routes/api/actions.js');
|
|
558
558
|
const {blocksRoutes} = await import('./routes/api/blocks.js');
|
|
559
|
+
const {adminAssistantRoutes} = await import('./routes/api/admin-assistant.js');
|
|
559
560
|
const {listTagsRoutes} = await import('./routes/api/list-tags.js');
|
|
560
561
|
const {componentsRoutes} = await import('./routes/api/components.js');
|
|
561
562
|
const {versionsRoutes} = await import('./routes/api/versions.js');
|
|
@@ -595,6 +596,7 @@ await app.register(formsRoutes, { prefix: '/api' });
|
|
|
595
596
|
await app.register(viewsRoutes, { prefix: '/api' });
|
|
596
597
|
await app.register(actionsRoutes, { prefix: '/api' });
|
|
597
598
|
await app.register(blocksRoutes, {prefix: '/api'});
|
|
599
|
+
await app.register(adminAssistantRoutes, {prefix: '/api'});
|
|
598
600
|
await app.register(listTagsRoutes, {prefix: '/api'});
|
|
599
601
|
await app.register(componentsRoutes, {prefix: '/api'});
|
|
600
602
|
await app.register(versionsRoutes, {prefix: '/api'});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Core admin assistant: opt-in settings, permission-filtered help and AI transport. */
|
|
2
|
+
import {getConfig} from '../config.js';
|
|
3
|
+
import {adminAccessFor} from './adminAccess.js';
|
|
4
|
+
import {covers} from './pluginScope.js';
|
|
5
|
+
import {characterId, normaliseCharacterSettings} from '../../public/js/characters.mjs';
|
|
6
|
+
|
|
7
|
+
const providers = new Map();
|
|
8
|
+
const text = (v, max) => typeof v === 'string' ? v.trim().slice(0, max) : '';
|
|
9
|
+
export function normaliseAdminAssistant(value = {}) {
|
|
10
|
+
return {enabled: value?.enabled === true, name: text(value?.name, 40) || 'Della',
|
|
11
|
+
character: characterId(value?.character), context: text(value?.context, 4000), rules: text(value?.rules, 2000)};
|
|
12
|
+
}
|
|
13
|
+
export function adminAssistantProblem(value) {
|
|
14
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return 'Send an admin assistant object.';
|
|
15
|
+
if (value.enabled !== undefined && typeof value.enabled !== 'boolean') return 'enabled must be true or false.';
|
|
16
|
+
for (const [key, max] of [['name', 40], ['context', 4000], ['rules', 2000]]) {
|
|
17
|
+
if (value[key] !== undefined && (typeof value[key] !== 'string' || value[key].length > max)) return `${key} must be text of at most ${max} characters.`;
|
|
18
|
+
}
|
|
19
|
+
if (value.character !== undefined && value.character !== '' && !characterId(value.character)) return 'Choose a known character or no character.';
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Plugins supply static help, never records. The loader binds registration to its owner. */
|
|
24
|
+
export function registerAdminAssistant(owner, def, allowedRoutes) {
|
|
25
|
+
if (!def || !Array.isArray(def.routes) || !def.routes.length || !def.permission || !text(def.context, 8000)) {
|
|
26
|
+
throw new Error('Admin assistant help needs routes, a permission and context.');
|
|
27
|
+
}
|
|
28
|
+
if (!def.routes.every(r => typeof r === 'string' && /^\/[a-z0-9/_-]*$/i.test(r))) throw new Error('Invalid assistant route.');
|
|
29
|
+
if (allowedRoutes && !def.routes.every(route => allowedRoutes.some(prefix => covers(prefix, route)))) throw new Error('Assistant routes must belong to the registering plugin.');
|
|
30
|
+
providers.set(owner, {routes: [...def.routes], permission: String(def.permission), context: text(def.context, 8000), name: text(def.name, 40), character: characterId(def.character)});
|
|
31
|
+
return () => providers.delete(owner);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const CORE_HELP = [
|
|
35
|
+
{routes: ['/pages', '/page'], permission: 'pages.read', context: 'Pages are edited under Content > Pages. Open a page, edit its title and Markdown content, and use Preview to review it. Use the editor Save command to save it. Its status determines whether it is published. This assistant can draft text but cannot save or publish it.'},
|
|
36
|
+
{routes: ['/theme'], permission: 'theme.read', context: 'Content > Theme controls the public and admin themes, typography, scheduled day/night themes, the public theme switcher and scoped element overrides. Make changes in the Theme tool and use Save. Site and admin themes are independent.'},
|
|
37
|
+
{routes: ['/settings'], permission: 'settings.read', context: 'Site Settings controls the site identity, branding, footer, email settings and assistant configuration. Changes are saved using the Save command. Only people with the settings update permission can change these options.'}
|
|
38
|
+
];
|
|
39
|
+
const GENERAL = 'You are inside Domma CMS admin. The navigation shows tools this account can use. You provide explanations and draft plain text for the person to copy into an editor. You cannot inspect records or carry out actions. For an undocumented operation, say you do not know. Never suggest bypassing permissions.';
|
|
40
|
+
|
|
41
|
+
export function adminAssistantContext(user, route = '/', access = adminAccessFor(user)) {
|
|
42
|
+
const path = typeof route === 'string' ? route.split('?')[0].slice(0, 200) : '/';
|
|
43
|
+
if (!/^\/[a-z0-9/_-]*$/i.test(path)) return {error: 'Invalid admin screen.', status: 400};
|
|
44
|
+
const scope = access.adminScope;
|
|
45
|
+
const always = ['/my-profile', '/my-preferences'];
|
|
46
|
+
if (scope && ![...(scope.allow || []), ...always].some(prefix => covers(prefix, path))) return {error: 'That screen is outside your admin access.', status: 403};
|
|
47
|
+
const matching = [...CORE_HELP, ...providers.values()].filter(p => p.routes.some(prefix => covers(prefix, path)));
|
|
48
|
+
const holds = permission => access.permissions.includes(permission) || access.permissions.includes(permission.replace(/\.read$/, ''));
|
|
49
|
+
const allowed = matching.filter(p => holds(p.permission));
|
|
50
|
+
if (matching.length && !allowed.length) return {error: 'You do not have permission for that tool.', status: 403};
|
|
51
|
+
const persona = allowed.find(p => p.name);
|
|
52
|
+
return {context: [GENERAL, ...allowed.map(p => p.context)].join('\n\n'),
|
|
53
|
+
...(persona ? {name: persona.name, character: persona.character} : {})};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function adminAssistantConfig() {
|
|
57
|
+
const site = getConfig('site') || {};
|
|
58
|
+
const settings = normaliseAdminAssistant(site.adminAssistant);
|
|
59
|
+
const characters = normaliseCharacterSettings(site.characters);
|
|
60
|
+
return {...settings, character: characters.enabled ? settings.character : '', charactersEnabled: characters.enabled, animated: characters.animated,
|
|
61
|
+
available: Boolean(globalThis[Symbol.for('domma.launcher-chat')] || process.env.MANAGER_URL && process.env.FLEET_TOKEN)};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function requestAdminAnswer(input, {env = process.env, fetchFn = fetch} = {}) {
|
|
65
|
+
const local = globalThis[Symbol.for('domma.launcher-chat')];
|
|
66
|
+
if (local) return local.answer(input);
|
|
67
|
+
if (!env.MANAGER_URL || !env.FLEET_TOKEN) return {status: 503, body: {error: 'AI answers are not configured on this site.'}};
|
|
68
|
+
const response = await fetchFn(`${env.MANAGER_URL.replace(/\/+$/, '')}/api/fleet/launcher-chat`, {
|
|
69
|
+
method: 'POST', headers: {authorization: `Bearer ${env.FLEET_TOKEN}`, 'content-type': 'application/json'},
|
|
70
|
+
body: JSON.stringify(input), signal: AbortSignal.timeout(30_000)
|
|
71
|
+
});
|
|
72
|
+
return {status: response.status, body: await response.json()};
|
|
73
|
+
}
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
} from './hooks.js';
|
|
37
37
|
import {registerPluginResource, unregisterPluginResourcesByPlugin} from './permissionRegistry.js';
|
|
38
38
|
import {registerThemeProvider} from './themeSettings.js';
|
|
39
|
+
import {registerAdminAssistant} from './adminAssistant.js';
|
|
39
40
|
import {classifyEntitlement, mayLoad} from './pluginEntitlement.js';
|
|
40
41
|
import {notifierFor} from './notify.js';
|
|
41
42
|
import {disableInstantCalls, enableInstantCalls, grantInstantCallsOnce} from './instantCalls.js';
|
|
@@ -45,7 +46,7 @@ import {disableDashboardPro, enableDashboardPro, registerWidget, unregisterWidge
|
|
|
45
46
|
import {createCollection, getCollection, updateCollection} from './collections.js';
|
|
46
47
|
import * as defaultRolesService from './roles.js';
|
|
47
48
|
import {getAdminScope, normaliseAdminScope} from './roles.js';
|
|
48
|
-
import {pluginAuthGuards} from './pluginScope.js';
|
|
49
|
+
import {pluginAuthGuards, pluginAdminPaths} from './pluginScope.js';
|
|
49
50
|
import {getEffectiveRoles} from './userRoles.js';
|
|
50
51
|
import {isDcmStaff} from './staffAccess.js';
|
|
51
52
|
import * as defaultUsersService from './users.js';
|
|
@@ -554,6 +555,7 @@ export async function registerPlugins(fastify) {
|
|
|
554
555
|
// Custom themes the plugin offers (the Theme Roller) - bound to the
|
|
555
556
|
// plugin, so one plugin cannot replace another's. See themeSettings.js.
|
|
556
557
|
registerThemes: (provider) => registerThemeProvider(manifest.name, provider),
|
|
558
|
+
registerAdminAssistant: (definition) => registerAdminAssistant(manifest.name, definition, pluginAdminPaths(manifest)),
|
|
557
559
|
// Calendar sources and related items (0.79) - stamped with the plugin's name.
|
|
558
560
|
registerCalendarSource: (source) => registerCalendarSource({...source, owner: manifest.name}),
|
|
559
561
|
getCalendarSources,
|
|
@@ -85,7 +85,7 @@ function buildSearchAssets() {
|
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
const THEME_SWITCHER_ASSET_V = '
|
|
88
|
+
const THEME_SWITCHER_ASSET_V = '20261110-ts-system';
|
|
89
89
|
const ANALYTICS_ASSET_V = '20260922-analytics';
|
|
90
90
|
const CONSENT_ASSET_V = '20261022-consent-reopen';
|
|
91
91
|
const GOOGLE_ANALYTICS_ASSET_V = '20261022-ga4';
|
|
@@ -293,8 +293,16 @@ function buildThemeSwitcherAssets(themeCfg, page = {}) {
|
|
|
293
293
|
};
|
|
294
294
|
});
|
|
295
295
|
|
|
296
|
+
const system = sw.followSystem === true && wanted.includes(sw.lightTheme) && wanted.includes(sw.darkTheme)
|
|
297
|
+
? {lightTheme: sw.lightTheme, darkTheme: sw.darkTheme} : null;
|
|
298
|
+
if (system && themes.length === 2) {
|
|
299
|
+
themes.sort((a, b) => (a.id === system.lightTheme ? -1 : 1));
|
|
300
|
+
themes.forEach(t => { t.label = t.id === system.lightTheme ? 'Light' : 'Dark'; });
|
|
301
|
+
}
|
|
296
302
|
const payload = {
|
|
297
303
|
floating,
|
|
304
|
+
system,
|
|
305
|
+
defaultTheme: themeCfg.theme,
|
|
298
306
|
position: sw.position || 'right-center',
|
|
299
307
|
offsetX: sw.offsetX ?? 32,
|
|
300
308
|
offsetY: sw.offsetY ?? 32,
|
|
@@ -104,7 +104,10 @@ export function defaultThemeConfig() {
|
|
|
104
104
|
position: 'right-center',
|
|
105
105
|
offsetX: 32,
|
|
106
106
|
offsetY: 32,
|
|
107
|
-
themes: []
|
|
107
|
+
themes: [],
|
|
108
|
+
followSystem: false,
|
|
109
|
+
lightTheme: 'charcoal-light',
|
|
110
|
+
darkTheme: 'charcoal-dark'
|
|
108
111
|
},
|
|
109
112
|
overrides: []
|
|
110
113
|
};
|
|
@@ -465,7 +468,7 @@ export function loadThemeConfigSync() {
|
|
|
465
468
|
*/
|
|
466
469
|
export async function saveThemeConfig(input) {
|
|
467
470
|
const stored = await loadThemeConfig();
|
|
468
|
-
const errors = validateThemeConfig(input, {remembered: rememberedIds(stored)});
|
|
471
|
+
const errors = validateThemeConfig(input, {remembered: rememberedIds(stored), currentSwitcher: stored.switcher});
|
|
469
472
|
if (errors.length) {
|
|
470
473
|
const err = new Error(errors.join('; '));
|
|
471
474
|
err.validation = errors;
|
|
@@ -631,7 +634,7 @@ function isSafeTokenValue(value) {
|
|
|
631
634
|
* @param {object} input
|
|
632
635
|
* @returns {string[]}
|
|
633
636
|
*/
|
|
634
|
-
export function validateThemeConfig(input, {remembered = []} = {}) {
|
|
637
|
+
export function validateThemeConfig(input, {remembered = [], currentSwitcher = {}} = {}) {
|
|
635
638
|
const errors = [];
|
|
636
639
|
if (!input || typeof input !== 'object') return ['Theme config must be an object'];
|
|
637
640
|
|
|
@@ -669,7 +672,7 @@ export function validateThemeConfig(input, {remembered = []} = {}) {
|
|
|
669
672
|
}
|
|
670
673
|
}
|
|
671
674
|
if (input.switcher) {
|
|
672
|
-
const sw = input.switcher;
|
|
675
|
+
const sw = {...defaultThemeConfig().switcher, ...currentSwitcher, ...input.switcher};
|
|
673
676
|
const POSITIONS = ['right-center', 'left-center', 'bottom-right', 'bottom-left',
|
|
674
677
|
'top-left', 'top-right'];
|
|
675
678
|
if (sw.position !== undefined && !POSITIONS.includes(sw.position)) {
|
|
@@ -681,6 +684,18 @@ export function validateThemeConfig(input, {remembered = []} = {}) {
|
|
|
681
684
|
errors.push(`switcher.${key} must be between 0 and 400`);
|
|
682
685
|
}
|
|
683
686
|
}
|
|
687
|
+
if (typeof sw.followSystem !== 'boolean') errors.push('switcher.followSystem must be true or false');
|
|
688
|
+
for (const [key, suffix] of [['lightTheme', '-light'], ['darkTheme', '-dark']]) {
|
|
689
|
+
checkTheme(sw[key], `switcher.${key}`, builtins);
|
|
690
|
+
if (sw.followSystem) {
|
|
691
|
+
if (typeof sw[key] !== 'string' || !sw[key].endsWith(suffix)) {
|
|
692
|
+
errors.push(`switcher.${key} must be a ${suffix.slice(1)} theme`);
|
|
693
|
+
}
|
|
694
|
+
if (Array.isArray(sw.themes) && sw.themes.length && !sw.themes.includes(sw[key])) {
|
|
695
|
+
errors.push(`switcher.${key} must be included in switcher.themes`);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
684
699
|
if (sw.themes !== undefined) {
|
|
685
700
|
if (!Array.isArray(sw.themes)) {
|
|
686
701
|
errors.push('switcher.themes must be an array');
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
<script src="/public/js/form-logic-engine.js?v=20261031-forms-reduce-motion" defer></script>
|
|
189
189
|
|
|
190
190
|
<!-- Site initialisation -->
|
|
191
|
-
<script src="/public/js/site.js?v=
|
|
191
|
+
<script src="/public/js/site.js?v=20261110-theme-preference" type="module"></script>
|
|
192
192
|
<script src="/public/js/collection-context.js?v=20261010-utf8-payloads" type="module"></script>
|
|
193
193
|
{{ctxMenusModule}}
|
|
194
194
|
<!-- [image zoom] pictures' full-size view - only on a page that has one -->
|