karin-plugin-qgroup-file2openlist 0.0.28 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,12 +6,12 @@ import "../chunk-PBBZ5KAD.js";
6
6
  import "../chunk-QB3GSENE.js";
7
7
  import {
8
8
  handleGroupFileUploadedAutoBackup
9
- } from "../chunk-ZXZMBJN3.js";
10
- import "../chunk-AAKFRFSO.js";
9
+ } from "../chunk-E5CTTWEE.js";
10
+ import "../chunk-ZDQD4SBL.js";
11
11
  import {
12
12
  backupOpenListToOpenListCore,
13
13
  formatErrorMessage
14
- } from "../chunk-HSFFULJR.js";
14
+ } from "../chunk-GMMSG2EE.js";
15
15
  import {
16
16
  config
17
17
  } from "../chunk-DA4U55JC.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  exportGroupFilesToDisk,
3
3
  syncGroupFilesToOpenListCore
4
- } from "../chunk-ZXZMBJN3.js";
5
- import "../chunk-AAKFRFSO.js";
4
+ } from "../chunk-E5CTTWEE.js";
5
+ import "../chunk-ZDQD4SBL.js";
6
6
  import {
7
7
  formatErrorMessage,
8
8
  normalizePosixPath
9
- } from "../chunk-HSFFULJR.js";
9
+ } from "../chunk-GMMSG2EE.js";
10
10
  import {
11
11
  config
12
12
  } from "../chunk-DA4U55JC.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  handleGroupSyncConfigCommand
3
- } from "../chunk-H2TAMQ7I.js";
4
- import "../chunk-ZXZMBJN3.js";
5
- import "../chunk-AAKFRFSO.js";
6
- import "../chunk-HSFFULJR.js";
3
+ } from "../chunk-OPAVLUGF.js";
4
+ import "../chunk-E5CTTWEE.js";
5
+ import "../chunk-ZDQD4SBL.js";
6
+ import "../chunk-GMMSG2EE.js";
7
7
  import "../chunk-DA4U55JC.js";
8
8
  import "../chunk-IZS467MR.js";
9
9
 
@@ -5,7 +5,7 @@ import {
5
5
  resolveOpltMapping,
6
6
  withOpltUser,
7
7
  writeOpltData
8
- } from "../chunk-GAVQ23XT.js";
8
+ } from "../chunk-JUZ2BWIL.js";
9
9
  import {
10
10
  buildActionCard,
11
11
  replyImages
@@ -20,7 +20,7 @@ import {
20
20
  normalizePosixPath,
21
21
  readJsonSafe,
22
22
  writeJsonSafe
23
- } from "../chunk-HSFFULJR.js";
23
+ } from "../chunk-GMMSG2EE.js";
24
24
  import {
25
25
  config
26
26
  } from "../chunk-DA4U55JC.js";
@@ -4,14 +4,14 @@ import {
4
4
  import "../chunk-QB3GSENE.js";
5
5
  import {
6
6
  readGroupSyncState
7
- } from "../chunk-AAKFRFSO.js";
7
+ } from "../chunk-ZDQD4SBL.js";
8
8
  import {
9
9
  backupOpenListToOpenListCore,
10
10
  formatErrorMessage,
11
11
  normalizePosixPath,
12
12
  readJsonSafe,
13
13
  writeJsonSafe
14
- } from "../chunk-HSFFULJR.js";
14
+ } from "../chunk-GMMSG2EE.js";
15
15
  import "../chunk-DA4U55JC.js";
16
16
  import {
17
17
  dir
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  runNightlyOpltBackup
3
- } from "../chunk-GAVQ23XT.js";
3
+ } from "../chunk-JUZ2BWIL.js";
4
4
  import {
5
5
  runNightlyGroupBackup
6
- } from "../chunk-H2TAMQ7I.js";
7
- import "../chunk-ZXZMBJN3.js";
8
- import "../chunk-AAKFRFSO.js";
9
- import "../chunk-HSFFULJR.js";
6
+ } from "../chunk-OPAVLUGF.js";
7
+ import "../chunk-E5CTTWEE.js";
8
+ import "../chunk-ZDQD4SBL.js";
9
+ import "../chunk-GMMSG2EE.js";
10
10
  import {
11
11
  config
12
12
  } from "../chunk-DA4U55JC.js";
@@ -2,7 +2,7 @@ import {
2
2
  readGroupSyncState,
3
3
  withGroupSyncLock,
4
4
  writeGroupSyncState
5
- } from "./chunk-AAKFRFSO.js";
5
+ } from "./chunk-ZDQD4SBL.js";
6
6
  import {
7
7
  buildOpenListAuthHeader,
8
8
  buildOpenListDavBaseUrl,
@@ -16,7 +16,7 @@ import {
16
16
  runWithConcurrency,
17
17
  safePathSegment,
18
18
  webdavHeadExists
19
- } from "./chunk-HSFFULJR.js";
19
+ } from "./chunk-GMMSG2EE.js";
20
20
  import {
21
21
  config,
22
22
  time
@@ -795,7 +795,48 @@ var webdavHeadExists = async (params) => {
795
795
  redirect: "follow",
796
796
  signal: controller.signal
797
797
  });
798
- return res.ok;
798
+ if (res.ok) return true;
799
+ if (res.status === 404) return false;
800
+ if (res.status === 405 || res.status === 501) {
801
+ try {
802
+ await res.body?.cancel();
803
+ } catch {
804
+ }
805
+ const body = `<?xml version="1.0" encoding="utf-8" ?>
806
+ <d:propfind xmlns:d="DAV:">
807
+ <d:prop>
808
+ <d:resourcetype />
809
+ </d:prop>
810
+ </d:propfind>`;
811
+ const fallback = await fetch(url, {
812
+ method: "PROPFIND",
813
+ headers: {
814
+ Authorization: auth,
815
+ Depth: "0",
816
+ "Content-Type": "application/xml; charset=utf-8"
817
+ },
818
+ body,
819
+ redirect: "follow",
820
+ signal: controller.signal
821
+ });
822
+ if (fallback.ok) {
823
+ try {
824
+ await fallback.body?.cancel();
825
+ } catch {
826
+ }
827
+ return true;
828
+ }
829
+ try {
830
+ await fallback.body?.cancel();
831
+ } catch {
832
+ }
833
+ return false;
834
+ }
835
+ try {
836
+ await res.body?.cancel();
837
+ } catch {
838
+ }
839
+ return false;
799
840
  } catch {
800
841
  return false;
801
842
  } finally {
@@ -4,7 +4,7 @@ import {
4
4
  normalizePosixPath,
5
5
  readJsonSafe,
6
6
  writeJsonSafe
7
- } from "./chunk-HSFFULJR.js";
7
+ } from "./chunk-GMMSG2EE.js";
8
8
  import {
9
9
  config
10
10
  } from "./chunk-DA4U55JC.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  syncGroupFilesToOpenListCore
3
- } from "./chunk-ZXZMBJN3.js";
3
+ } from "./chunk-E5CTTWEE.js";
4
4
  import {
5
5
  normalizePosixPath,
6
6
  readJsonSafe,
7
7
  writeJsonSafe
8
- } from "./chunk-HSFFULJR.js";
8
+ } from "./chunk-GMMSG2EE.js";
9
9
  import {
10
10
  config
11
11
  } from "./chunk-DA4U55JC.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readJsonSafe,
3
3
  writeJsonSafe
4
- } from "./chunk-HSFFULJR.js";
4
+ } from "./chunk-GMMSG2EE.js";
5
5
  import {
6
6
  dir
7
7
  } from "./chunk-IZS467MR.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karin-plugin-qgroup-file2openlist",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "author": "429",
5
5
  "type": "module",
6
6
  "description": "karin plugin for QGroupFile backup",