Initial commit: restore project after Git corruption

This commit is contained in:
2025-10-21 18:29:15 +08:00
commit 0bb423fcca
112 changed files with 19665 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
export const getConfig = () => {
// 从localStorage获取配置如果不存在则使用默认值
const getFromLocalStorage = (key: string, defaultValue: string) => {
try {
return localStorage.getItem(key) || defaultValue;
} catch (error) {
console.warn(`Failed to read ${key} from localStorage:`, error);
return defaultValue;
}
};
return {
VOLCENGINE_AUC_APPID: getFromLocalStorage('VOLCENGINE_AUC_APPID', ''),
VOLCENGINE_AUC_TOKEN: getFromLocalStorage('VOLCENGINE_AUC_TOKEN', ''),
};
};
export const setConfig = (config: { VOLCENGINE_AUC_APPID?: string; VOLCENGINE_AUC_TOKEN?: string }) => {
// 将配置保存到localStorage
try {
if (config.VOLCENGINE_AUC_APPID !== undefined) {
localStorage.setItem('VOLCENGINE_AUC_APPID', config.VOLCENGINE_AUC_APPID);
}
if (config.VOLCENGINE_AUC_TOKEN !== undefined) {
localStorage.setItem('VOLCENGINE_AUC_TOKEN', config.VOLCENGINE_AUC_TOKEN);
}
} catch (error) {
console.warn('Failed to save config to localStorage:', error);
}
};