refactor: Optimize data and cache request logic

This commit is contained in:
Gabe
2025-08-31 23:37:29 +08:00
parent 4a5e6c2a23
commit c4fba1c905
10 changed files with 443 additions and 425 deletions

View File

@@ -703,9 +703,9 @@ export const I18N = {
zh_TW: `OpenAI 提示詞`,
},
if_clear_cache: {
zh: `是否清除缓存`,
en: `Whether clear cache`,
zh_TW: `是否清除快取`,
zh: `是否清除缓存默认缓存7天`,
en: `Whether clear cache (Default cache is 7 days)`,
zh_TW: `是否清除快取預設快取7天`,
},
clear_cache_never: {
zh: `不清除缓存`,

View File

@@ -58,6 +58,7 @@ export const CACHE_NAME = `${APP_NAME}_cache`;
export const MSG_FETCH = "fetch";
export const MSG_GET_HTTPCACHE = "get_httpcache";
export const MSG_PUT_HTTPCACHE = "put_httpcache";
export const MSG_OPEN_OPTIONS = "open_options";
export const MSG_SAVE_RULE = "save_rule";
export const MSG_TRANS_TOGGLE = "trans_toggle";
@@ -551,6 +552,7 @@ export const DEFAULT_SUBRULES_LIST = [
];
export const DEFAULT_HTTP_TIMEOUT = 5000; // 调用超时时间
export const DEFAULT_CACHE_TIMEOUT = 3600 * 24 * 7; // 缓存超时时间(7天)
// 翻译接口
const defaultCustomApi = {