33 */
44import { config } from '../../package.json' ;
55import { CONFIG } from '../main' ;
6- import { md5 } from '../utils/MD5' ;
76import { exportIndex , Post } from '../utils/post' ;
87
98export class RemoteFile {
@@ -13,15 +12,15 @@ export class RemoteFile{
1312
1413 static async __get ( f : string ) {
1514 this . __check_enabled ( ) ;
16- const url = `${ config . davbase } ${ config . base } ${ f } ` ;
15+ const url = `${ CONFIG . davroot } ${ config . base } ${ f } ` ;
1716 const res = await fetch ( url ) ;
1817 if ( ! res . ok ) throw new Error ( `Failed to fetch ${ url } : ${ res . statusText } ` ) ;
1918 return res ;
2019 }
2120
2221 static async __put ( f : string , data : XMLHttpRequestBodyInit ) {
2322 this . __check_enabled ( ) ;
24- const url = `${ config . davbase } ${ config . base } ${ f } ` ;
23+ const url = `${ CONFIG . davroot } ${ config . base } ${ f } ` ;
2524 const res = await fetch ( url , {
2625 method : 'PUT' ,
2726 body : data ,
@@ -35,7 +34,7 @@ export class RemoteFile{
3534
3635 static __put_with_progress ( f : string , data : XMLHttpRequestBodyInit , progress : ( loaded : number , total : number ) => void ) {
3736 this . __check_enabled ( ) ;
38- const url = `${ config . davbase } ${ config . base } ${ f } ` ;
37+ const url = `${ CONFIG . davroot } ${ config . base } ${ f } ` ;
3938 const xhr = new XMLHttpRequest ( ) ;
4039 xhr . open ( 'PUT' , url ) ;
4140 xhr . setRequestHeader ( 'Content-Type' , 'application/octet-stream' ) ;
@@ -52,7 +51,7 @@ export class RemoteFile{
5251
5352 static async __mkdir ( p : string ) {
5453 this . __check_enabled ( ) ;
55- const url = `${ config . davbase } ${ config . base } ${ p } /` ;
54+ const url = `${ CONFIG . davroot } ${ config . base } ${ p } /` ;
5655 const res = await fetch ( url , {
5756 method : 'MKCOL'
5857 } ) ;
0 commit comments