update: add local-proxy library

This commit is contained in:
2025-06-20 12:07:09 +08:00
parent 3c0cb64478
commit 574317a42d
14 changed files with 361 additions and 133 deletions

View File

@@ -192,19 +192,17 @@ const uploadFiles = async (files: string[], directory: string, opts: UploadFileO
}
const token = await storage.getItem('token');
const checkUrl = new URL('/api/s1/resources/upload/check', getBaseURL());
const res = await query
.adapter({ url: checkUrl.toString(), method: 'POST', body: data, headers: { Authorization: 'Bearer ' + token, contentType: 'application/json' } })
.then((res) => {
try {
if (typeof res === 'string') {
return JSON.parse(res);
} else {
return res;
}
} catch (error) {
return typeof res === 'string' ? {} : res;
const res = await query.adapter({ url: checkUrl.toString(), method: 'POST', body: data, headers: { Authorization: 'Bearer ' + token } }).then((res) => {
try {
if (typeof res === 'string') {
return JSON.parse(res);
} else {
return res;
}
});
} catch (error) {
return typeof res === 'string' ? {} : res;
}
});
const checkData: { path: string; isUpload: boolean }[] = res.data;
if (res.code !== 200) {
console.error('check failed', res);