From 82c4708636a1e12935cc9f59f42bd2bceea7e3bf Mon Sep 17 00:00:00 2001 From: pompurin404 Date: Thu, 24 Oct 2024 10:48:43 +0800 Subject: [PATCH] Revert "use webdav legacy" This reverts commit cd0a9dd9115998b1fc73536d9b76c6ecd3d2fcf3. --- changelog.md | 1 - package.json | 2 +- pnpm-lock.yaml | 120 +++++++++++++++++++++++++------------ src/main/resolve/backup.ts | 5 +- 4 files changed, 86 insertions(+), 42 deletions(-) diff --git a/changelog.md b/changelog.md index fc680bd..6e17686 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,5 @@ ### Bug Fixes -- 修复 Win7 无法使用 WebDAV 的问题 - 修复对话框字体模糊的问题 - 修复 macOS 窄边栏宽度错误的问题 diff --git a/package.json b/package.json index e641073..1b2c833 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "dayjs": "^1.11.13", "express": "^5.0.1", "iconv-lite": "^0.6.3", - "webdav": "legacy", + "webdav": "^5.7.1", "ws": "^8.18.0", "yaml": "^2.6.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c1099eb..15ec4ab 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,8 +36,8 @@ importers: specifier: ^0.6.3 version: 0.6.3 webdav: - specifier: legacy - version: 4.11.4 + specifier: ^5.7.1 + version: 5.7.1 ws: specifier: ^8.18.0 version: 8.18.0 @@ -309,6 +309,9 @@ packages: resolution: {integrity: sha512-OwS2CM5KocvQ/k7dFJa8i5bNGJP0hXWfVCfDkqRFP1IreH1JDC7wG6eCYCi0+McbfT8OR/kNqsI0UU0xP9H6PQ==} engines: {node: '>=6.9.0'} + '@buttercup/fetch@0.2.1': + resolution: {integrity: sha512-sCgECOx8wiqY8NN1xN22BqqKzXYIG2AicNLlakOAI4f0WgyLVUbAigMf8CZhBtJxdudTcB1gD5lciqi44jwJvg==} + '@develar/schema-utils@2.6.5': resolution: {integrity: sha512-0cp4PsWQ/9avqTVMCtZ+GirikIA36ikvjtHweU4/j8yLtgObI0+JUPhYFScgwlteveGB1rt3Cm8UhN04XayDig==} engines: {node: '>= 8.9.0'} @@ -2380,9 +2383,6 @@ packages: resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} engines: {node: '>= 0.4'} - axios@0.27.2: - resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} - axios@1.7.7: resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} @@ -2736,6 +2736,10 @@ packages: resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==} engines: {node: '>=12'} + data-uri-to-buffer@4.0.1: + resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==} + engines: {node: '>= 12'} + data-view-buffer@1.0.1: resolution: {integrity: sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==} engines: {node: '>= 0.4'} @@ -2958,6 +2962,10 @@ packages: end-of-stream@1.4.4: resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} + entities@5.0.0: + resolution: {integrity: sha512-BeJFvFRJddxobhvEdm5GqHzRV/X+ACeuw0/BuuxsCh1EUZcAIz8+kYmBp/LrQuloy6K1f3a0M7+IhmZ7QnkISA==} + engines: {node: '>=0.12'} + env-paths@2.2.1: resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} engines: {node: '>=6'} @@ -3143,6 +3151,10 @@ packages: fd-slicer@1.1.0: resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==} + fetch-blob@3.2.0: + resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==} + engines: {node: ^12.20 || >= 14.13} + file-entry-cache@6.0.1: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} @@ -3193,6 +3205,10 @@ packages: resolution: {integrity: sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==} engines: {node: '>= 6'} + formdata-polyfill@4.0.10: + resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==} + engines: {node: '>=12.20.0'} + forwarded@0.2.0: resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} engines: {node: '>= 0.6'} @@ -3388,16 +3404,12 @@ packages: hast-util-whitespace@3.0.0: resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} - he@1.2.0: - resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} - hasBin: true - hosted-git-info@4.1.0: resolution: {integrity: sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==} engines: {node: '>=10'} - hot-patcher@1.0.0: - resolution: {integrity: sha512-3H8VH0PreeNsKMZw16nTHbUp4YoHCnPlawpsPXGJUR4qENDynl79b6Xk9CIFvLcH1qungBsCuzKcWyzoPPalTw==} + hot-patcher@2.0.1: + resolution: {integrity: sha512-ECg1JFG0YzehicQaogenlcs2qg6WsXQsxtnbr1i696u5tLUjtJdQAh0u2g0Q5YV45f263Ta1GnUJsc8WIfJf4Q==} html-url-attributes@3.0.1: resolution: {integrity: sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==} @@ -3721,8 +3733,8 @@ packages: keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} - layerr@0.1.2: - resolution: {integrity: sha512-ob5kTd9H3S4GOG2nVXyQhOu9O8nBgP555XxWPkJI0tR0JeRilfyTp8WtPdIJHLXBmHMSdEq5+KMxiYABeScsIQ==} + layerr@3.0.0: + resolution: {integrity: sha512-tv754Ki2dXpPVApOrjTyRo4/QegVb9eVFq4mjqp4+NM5NaX7syQvN5BBNfV/ZpAHCEHV24XdUVrBAoka4jt3pA==} lazy-val@1.0.5: resolution: {integrity: sha512-0/BnGCCfyUMkBpeDgWihanIAF9JmZhHBgUhEqzvf+adhNGLoP6TaiI5oF8oyb3I45P+PcnrqihSf01M0l0G5+Q==} @@ -4125,6 +4137,14 @@ packages: node-api-version@0.2.0: resolution: {integrity: sha512-fthTTsi8CxaBXMaBAD7ST2uylwvsnYxh2PfaScwpMhos6KlSFajXQPcM4ogNE1q2s3Lbz9GCGqeIHC+C6OZnKg==} + node-domexception@1.0.0: + resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==} + engines: {node: '>=10.5.0'} + + node-fetch@3.3.2: + resolution: {integrity: sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + node-gyp@9.4.1: resolution: {integrity: sha512-OQkWKbjQKbGkMf/xqI1jjy3oCTgMKJac58G2+bjZb3fza6gW2YrCSdMQYaoTb70crvE//Gngr4f0AgVHmqHvBQ==} engines: {node: ^12.13 || ^14.13 || >=16} @@ -5062,8 +5082,9 @@ packages: uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - url-join@4.0.1: - resolution: {integrity: sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==} + url-join@5.0.0: + resolution: {integrity: sha512-n2huDr9h9yzd6exQVnH/jU5mr+Pfx08LRXXZhkLLetAMESRj+anQsTAh940iMrIetKAmry9coFuZQ2jY8/p3WA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} url-parse@1.5.10: resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} @@ -5198,9 +5219,13 @@ packages: wcwidth@1.0.1: resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} - webdav@4.11.4: - resolution: {integrity: sha512-abrHtgE9N/7U7sO7veJO3HeE5cHZ35YOOIU1//SKbVlVlfwq5XvW4omNC1++gRnMwf89qjZI8hWy7jCz2D5haQ==} - engines: {node: '>=10'} + web-streams-polyfill@3.3.3: + resolution: {integrity: sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==} + engines: {node: '>= 8'} + + webdav@5.7.1: + resolution: {integrity: sha512-JVPn3nLxXJfHSRvennHsOrDYjFLkilZ1Qlw8Ff6hpqp6AvkgF7a//aOh5wA4rMp+sLZ1Km0V+iv0LyO1FIwtXg==} + engines: {node: '>=16'} which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} @@ -5440,6 +5465,10 @@ snapshots: '@babel/helper-string-parser': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 + '@buttercup/fetch@0.2.1': + optionalDependencies: + node-fetch: 3.3.2 + '@develar/schema-utils@2.6.5': dependencies: ajv: 6.12.6 @@ -8392,13 +8421,6 @@ snapshots: dependencies: possible-typed-array-names: 1.0.0 - axios@0.27.2: - dependencies: - follow-redirects: 1.15.9 - form-data: 4.0.1 - transitivePeerDependencies: - - debug - axios@1.7.7: dependencies: follow-redirects: 1.15.9 @@ -8776,6 +8798,8 @@ snapshots: d3-timer@3.0.1: {} + data-uri-to-buffer@4.0.1: {} + data-view-buffer@1.0.1: dependencies: call-bind: 1.0.7 @@ -9019,6 +9043,8 @@ snapshots: dependencies: once: 1.4.0 + entities@5.0.0: {} + env-paths@2.2.1: {} err-code@2.0.3: {} @@ -9372,6 +9398,11 @@ snapshots: dependencies: pend: 1.2.0 + fetch-blob@3.2.0: + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 3.3.3 + file-entry-cache@6.0.1: dependencies: flat-cache: 3.2.0 @@ -9428,6 +9459,10 @@ snapshots: combined-stream: 1.0.8 mime-types: 2.1.35 + formdata-polyfill@4.0.10: + dependencies: + fetch-blob: 3.2.0 + forwarded@0.2.0: {} fraction.js@4.3.7: {} @@ -9663,13 +9698,11 @@ snapshots: dependencies: '@types/hast': 3.0.4 - he@1.2.0: {} - hosted-git-info@4.1.0: dependencies: lru-cache: 6.0.0 - hot-patcher@1.0.0: {} + hot-patcher@2.0.1: {} html-url-attributes@3.0.1: {} @@ -9975,7 +10008,7 @@ snapshots: dependencies: json-buffer: 3.0.1 - layerr@0.1.2: {} + layerr@3.0.0: {} lazy-val@1.0.5: {} @@ -10485,6 +10518,14 @@ snapshots: dependencies: semver: 7.6.3 + node-domexception@1.0.0: {} + + node-fetch@3.3.2: + dependencies: + data-uri-to-buffer: 4.0.1 + fetch-blob: 3.2.0 + formdata-polyfill: 4.0.10 + node-gyp@9.4.1: dependencies: env-paths: 2.2.1 @@ -11586,7 +11627,7 @@ snapshots: dependencies: punycode: 2.3.1 - url-join@4.0.1: {} + url-join@5.0.0: {} url-parse@1.5.10: dependencies: @@ -11701,23 +11742,24 @@ snapshots: dependencies: defaults: 1.0.4 - webdav@4.11.4: + web-streams-polyfill@3.3.3: {} + + webdav@5.7.1: dependencies: - axios: 0.27.2 + '@buttercup/fetch': 0.2.1 base-64: 1.0.0 byte-length: 1.0.2 + entities: 5.0.0 fast-xml-parser: 4.5.0 - he: 1.2.0 - hot-patcher: 1.0.0 - layerr: 0.1.2 + hot-patcher: 2.0.1 + layerr: 3.0.0 md5: 2.3.0 - minimatch: 5.1.6 + minimatch: 9.0.5 nested-property: 4.0.0 + node-fetch: 3.3.2 path-posix: 1.0.0 - url-join: 4.0.1 + url-join: 5.0.0 url-parse: 1.5.10 - transitivePeerDependencies: - - debug which-boxed-primitive@1.0.2: dependencies: diff --git a/src/main/resolve/backup.ts b/src/main/resolve/backup.ts index a150f88..c0a7973 100644 --- a/src/main/resolve/backup.ts +++ b/src/main/resolve/backup.ts @@ -1,5 +1,4 @@ import { getAppConfig } from '../config' -import { createClient } from 'webdav' import dayjs from 'dayjs' import AdmZip from 'adm-zip' import { @@ -15,6 +14,7 @@ import { } from '../utils/dirs' export async function webdavBackup(): Promise { + const { createClient } = await import('webdav/dist/node/index.js') const { webdavUrl = '', webdavUsername = '', @@ -48,6 +48,7 @@ export async function webdavBackup(): Promise { } export async function webdavRestore(filename: string): Promise { + const { createClient } = await import('webdav/dist/node/index.js') const { webdavUrl = '', webdavUsername = '', @@ -65,6 +66,7 @@ export async function webdavRestore(filename: string): Promise { } export async function listWebdavBackups(): Promise { + const { createClient } = await import('webdav/dist/node/index.js') const { webdavUrl = '', webdavUsername = '', @@ -85,6 +87,7 @@ export async function listWebdavBackups(): Promise { } export async function webdavDelete(filename: string): Promise { + const { createClient } = await import('webdav/dist/node/index.js') const { webdavUrl = '', webdavUsername = '',