| 13 | |
| 14 | return { |
| 15 | async check() { |
| 16 | try { |
| 17 | const res = await fetch(this.path(folder, proxyUrl, "MKCOL"), { |
| 18 | method: "GET", |
| 19 | headers: this.headers(), |
| 20 | }); |
| 21 | const success = [201, 200, 404, 405, 301, 302, 307, 308].includes( |
| 22 | res.status, |
| 23 | ); |
| 24 | console.log( |
| 25 | `[WebDav] check ${success ? "success" : "failed"}, ${res.status} ${ |
| 26 | res.statusText |
| 27 | }`, |
| 28 | ); |
| 29 | return success; |
| 30 | } catch (e) { |
| 31 | console.error("[WebDav] failed to check", e); |
| 32 | } |
| 33 | |
| 34 | return false; |
| 35 | }, |
| 36 | |
| 37 | async get(key: string) { |
| 38 | const res = await fetch(this.path(fileName, proxyUrl), { |