This commit is contained in:
2025-12-24 10:55:40 +08:00
parent eec9d6045c
commit 752bb23571
25 changed files with 2348 additions and 816 deletions

View File

@@ -63,8 +63,9 @@ async function refreshLgres(template, lgres) {
lgres = await doRefreshLgres(template);
}
const ver = Number(consts.resver);
if (isNaN(lgres.ver) || isNaN(ver) || ver > lgres.ver) {
console.log(`found new language res version: ${lgres.ver} => ${ver}`);
const currentVer = Number(lgres.ver);
if (isNaN(currentVer) || isNaN(ver) || ver > currentVer) {
console.log(`found new language res version: ${lgres.ver} => ${consts.resver}`);
lgres = await doRefreshLgres(template);
}
Object.defineProperty(lgres, 'r', {

View File

@@ -37,13 +37,25 @@ export function post(url, data, options = {}) {
options.customHeaders['Content-Type'] = 'application/json';
}
}
return fetch(combineUrl(url), {
const opts = {
method: options.method || 'POST',
headers: options.customHeaders,
body: data,
signal: options.signal,
cache: 'no-cache'
});
};
if (options.diagnostic) {
const started = new Date().getTime();
return new Promise((resolve, reject) => {
fetch(combineUrl(url), opts).then(response => {
resolve({
time: new Date().getTime() - started,
response
});
}).catch(reject);
});
}
return fetch(combineUrl(url), opts);
}
export function upload(url, data, options = {}) {