|
|
|
@ -23,15 +23,18 @@ export function initFavicon() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function getXpackSetting() {
|
|
|
|
|
const searchXSettingGlob = import.meta.glob('xpack/api/modules/setting.ts');
|
|
|
|
|
const module = await searchXSettingGlob?.['../xpack/api/modules/setting.ts']?.();
|
|
|
|
|
const res = await module?.searchXSetting();
|
|
|
|
|
let searchXSetting;
|
|
|
|
|
const xpackModules = import.meta.glob('../xpack/api/modules/setting.ts', { eager: true });
|
|
|
|
|
if (xpackModules['../xpack/api/modules/setting.ts']) {
|
|
|
|
|
searchXSetting = xpackModules['../xpack/api/modules/setting.ts']['searchXSetting'] || {};
|
|
|
|
|
const res = await searchXSetting();
|
|
|
|
|
if (!res) {
|
|
|
|
|
resetXSetting();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const loadDataFromDB = async () => {
|
|
|
|
|
const res = await getSettingInfo();
|
|
|
|
@ -81,9 +84,11 @@ export async function getXpackSettingForTheme() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const searchXSettingGlob = import.meta.glob('xpack/api/modules/setting.ts');
|
|
|
|
|
const module = await searchXSettingGlob?.['../xpack/api/modules/setting.ts']?.();
|
|
|
|
|
const res2 = await module?.searchXSetting();
|
|
|
|
|
let searchXSetting;
|
|
|
|
|
const xpackModules = import.meta.glob('../xpack/api/modules/setting.ts', { eager: true });
|
|
|
|
|
if (xpackModules['../xpack/api/modules/setting.ts']) {
|
|
|
|
|
searchXSetting = xpackModules['../xpack/api/modules/setting.ts']['searchXSetting'] || {};
|
|
|
|
|
const res2 = await searchXSetting();
|
|
|
|
|
if (res2) {
|
|
|
|
|
globalStore.themeConfig.title = res2.data?.title;
|
|
|
|
|
globalStore.themeConfig.logo = res2.data?.logo;
|
|
|
|
@ -93,12 +98,16 @@ export async function getXpackSettingForTheme() {
|
|
|
|
|
} else {
|
|
|
|
|
resetXSetting();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
switchTheme();
|
|
|
|
|
initFavicon();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function updateXpackSettingByKey(key: string, value: string) {
|
|
|
|
|
const searchXSettingGlob = import.meta.glob('xpack/api/modules/setting.ts');
|
|
|
|
|
const module = await searchXSettingGlob?.['../xpack/api/modules/setting.ts']?.();
|
|
|
|
|
return module?.updateXSettingByKey(key, value);
|
|
|
|
|
let updateXSettingByKey;
|
|
|
|
|
const xpackModules = import.meta.glob('../xpack/api/modules/setting.ts', { eager: true });
|
|
|
|
|
if (xpackModules['../xpack/api/modules/setting.ts']) {
|
|
|
|
|
updateXSettingByKey = xpackModules['../xpack/api/modules/setting.ts']['updateXSettingByKey'] || {};
|
|
|
|
|
return updateXSettingByKey(key, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|