refactor: Split config files

This commit is contained in:
Gabe
2025-09-01 18:56:48 +08:00
parent c4fba1c905
commit 2bfb27f346
17 changed files with 821 additions and 863 deletions

View File

@@ -1,5 +1,4 @@
import { getMsauth, setMsauth } from "./storage";
import { URL_MICROSOFT_AUTH } from "../config";
import { fetchData } from "./fetch";
import { kissLog } from "./log";
@@ -35,7 +34,7 @@ const _msAuth = () => {
}
// 缓存没有或失效,查询接口
token = await fetchData(URL_MICROSOFT_AUTH);
token = await fetchData("https://edge.microsoft.com/translate/auth");
exp = parseMSToken(token);
await setMsauth({ token, exp });
return [token, exp];

View File

@@ -3,10 +3,9 @@ import { kissLog } from "./log";
/**
* 任务池
* @param {*} fn
* @param {*} preFn
* @param {*} _interval
* @param {*} _limit
* @param {*} _retryInteral
* @returns
*/
const taskPool = (_interval = 100, _limit = 100, _retryInteral = 1000) => {
@@ -80,6 +79,9 @@ let fetchPool;
/**
* 获取请求池实例
* @param {*} interval
* @param {*} limit
* @returns
*/
export const getFetchPool = (interval, limit) => {
if (!fetchPool) {