"feat: 同步功能增强与配置优化,支持多类型同步及日志分级"

This commit is contained in:
2025-05-12 23:53:45 +08:00
parent eaccbf5ada
commit 785bd7b004
13 changed files with 278 additions and 35 deletions

View File

@@ -24,6 +24,7 @@ type Options = {
check?: boolean;
returnContent?: boolean;
setToken?: boolean;
hash?: string;
[key: string]: any;
};
export const fetchLink = async (url: string, opts?: Options) => {
@@ -39,8 +40,10 @@ export const fetchLink = async (url: string, opts?: Options) => {
if (token && setToken) {
fetchURL.searchParams.set('token', token);
}
if (opts?.hash) {
fetchURL.searchParams.set('hash', opts.hash);
}
fetchURL.searchParams.set('download', 'true');
console.log('fetchURL', fetchURL.toString());
const res = await fetch(fetchURL.toString());
const blob = await res.blob();
@@ -52,6 +55,7 @@ export const fetchLink = async (url: string, opts?: Options) => {
const pathname = fetchURL.pathname;
const filename = pathname.split('/').pop();
return {
status: res.status,
filename,
blob,
type,