"feat: 同步功能增强与配置优化,支持多类型同步及日志分级"
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user