Apply site.cfg_json theme defaults to ae_loc (theme_name, theme_mode); allow URL param to override
This commit is contained in:
@@ -393,6 +393,19 @@ export async function load({ fetch, params, parent, route, url }) {
|
||||
ae_loc_init['site_google_tracking_id'] = json_data.google_tracking_id || '';
|
||||
ae_loc_init['site_access_code_kv'] = json_data.access_code_kv_json || {};
|
||||
ae_loc_init['site_cfg_json'] = json_data.cfg_json || {};
|
||||
// If the site-level cfg_json provides a theme, apply it as a default
|
||||
// so the site admin can select a preferred theme via site.cfg_json.
|
||||
// This will later be overridable by a URL `?theme=` param or user/local setting.
|
||||
try {
|
||||
const scfg = ae_loc_init['site_cfg_json'] as any;
|
||||
if (scfg && typeof scfg === 'object') {
|
||||
if (scfg.theme_name) ae_loc_init['theme_name'] = scfg.theme_name;
|
||||
if (scfg.theme_mode && (scfg.theme_mode === 'light' || scfg.theme_mode === 'dark'))
|
||||
ae_loc_init['theme_mode'] = scfg.theme_mode;
|
||||
}
|
||||
} catch (e) {
|
||||
// Defensive: if parsing fails, don't block boot.
|
||||
}
|
||||
ae_loc_init['site_access_key'] = json_data.access_key || '';
|
||||
ae_loc_init['site_domain_access_key'] =
|
||||
json_data.site_domain_access_key || '';
|
||||
|
||||
Reference in New Issue
Block a user