From 03e10b95f9cb154f15de0c8bba69ac1e32cb09f5 Mon Sep 17 00:00:00 2001 From: ElijahPepe Date: Sun, 1 May 2022 09:18:56 -0700 Subject: [PATCH 1/8] Add WebDAV support to backups --- lib/modules/backupAndRestore.js | 28 ++++ .../backupAndRestore/providers/WebDAV.js | 37 +++++ .../backupAndRestore/providers/index.js | 1 + locales/locales/en.json | 21 +++ package.json | 4 +- yarn.lock | 139 +++++++++++++++++- 6 files changed, 227 insertions(+), 3 deletions(-) create mode 100644 lib/modules/backupAndRestore/providers/WebDAV.js diff --git a/lib/modules/backupAndRestore.js b/lib/modules/backupAndRestore.js index 49ca196351..adca073251 100644 --- a/lib/modules/backupAndRestore.js +++ b/lib/modules/backupAndRestore.js @@ -103,6 +103,30 @@ module.options = { title: 'backupAndRestoreGoogleAccountTitle', advanced: true, }, + webDAV: { + type: 'table', + addRowText: 'backupAndRestoreAddWebDAVAccount', + fields: [{ + key: 'username', + name: 'backupAndRestoreUsername', + type: 'text', + }, { + key: 'password', + name: 'backupAndRestorePassword', + type: 'password', + }, { + key: 'url', + name: 'backupAndRestoreUrl', + type: 'text', + }, { + key: 'digest', + name: 'backupAndRestoreDigest', + type: 'boolean', + }], + value: ([]: Array<[string, string, string, boolean]>), + description: 'backupAndRestoreWebDAVTitle', + title: 'backupAndRestoreWebDAVTitle', + }, }; module.afterLoad = async () => { @@ -112,6 +136,10 @@ module.afterLoad = async () => { function getProvider(providerClass) { return new providerClass().init({ // eslint-disable-line new-cap googleLoginHint: module.options.googleAccount.value, + webDAVUsername: module.options.webDAV.value[0][0], + webDAVPassword: module.options.webDAV.value[0][1], + webDAVUrl: module.options.webDAV.value[0][2], + webDAVDigest: module.options.webDAV.value[0][3], }); } diff --git a/lib/modules/backupAndRestore/providers/WebDAV.js b/lib/modules/backupAndRestore/providers/WebDAV.js new file mode 100644 index 0000000000..e64bda840e --- /dev/null +++ b/lib/modules/backupAndRestore/providers/WebDAV.js @@ -0,0 +1,37 @@ +/* @flow */ + +import { AuthType, createClient } from 'webdav/web'; +import { Provider } from './Provider'; + +const FILE = '/res-storage.json'; + +export class WebDAV extends Provider { + static key = 'webdav'; + static text = 'WebDAV'; + static supportsAutomaticBackups = true; + + client: string; + + // eslint-disable-next-line require-await + async init({ webDAVUrl, webDAVDigest, webDAVUsername, webDAVPassword }: *): Promise { // eslint-disable-line no-empty-pattern + this.client = createClient(webDAVUrl, { + authType: webDAVDigest ? AuthType.digest : AuthType.password, + username: webDAVUsername, + password: webDAVPassword, + }); + + return this; + } + + async read() { + try { + return await this.client.getFileContents(FILE); + } catch (e) { + throw new Error('Could not find backup.'); + } + } + + async write(data: string) { + await this.client.putFileContents(FILE, data); + } +} diff --git a/lib/modules/backupAndRestore/providers/index.js b/lib/modules/backupAndRestore/providers/index.js index 77915fb4a5..5516a9fb90 100644 --- a/lib/modules/backupAndRestore/providers/index.js +++ b/lib/modules/backupAndRestore/providers/index.js @@ -4,3 +4,4 @@ export { File } from './File'; export { GoogleDrive } from './GoogleDrive'; export { OneDrive } from './OneDrive'; export { Dropbox } from './Dropbox'; +export { WebDAV } from './WebDAV'; diff --git a/locales/locales/en.json b/locales/locales/en.json index ee83b04370..ab9917a9ca 100644 --- a/locales/locales/en.json +++ b/locales/locales/en.json @@ -1860,6 +1860,27 @@ "backupAndRestoreGoogleAccountDesc": { "message": "If, and only if, you have multiple Google accounts logged in at once, enter the email of the account you want to use.\n\nIn most cases you will not need to use this option." }, + "backupAndRestoreAddWebDAVAccount": { + "message": "+add account" + }, + "backupAndRestoreWebDAVTitle": { + "message": "WebDAV" + }, + "backupAndRestoreWebDAVDesc": { + "message": "Configure a WebDAV account for use in RES backups" + }, + "backupAndRestoreUsername": { + "message": "username" + }, + "backupAndRestorePassword": { + "message": "password" + }, + "backupAndRestoreUrl": { + "message": "url" + }, + "backupAndRestoreDigest": { + "message": "uses digest" + }, "backupAndRestoreBackupTitle": { "message": "Backup" }, diff --git a/package.json b/package.json index 15a9e253e4..42da5f26b4 100644 --- a/package.json +++ b/package.json @@ -62,8 +62,10 @@ "lodash-es": "4.17.21", "snudown-js": "3.2.2", "sortablejs": "1.14.0", + "stream": "^0.0.2", "suncalc": "1.8.0", - "tinycolor2": "1.4.2" + "tinycolor2": "1.4.2", + "webdav": "^4.9.0" }, "devDependencies": { "@babel/core": "7.17.0", diff --git a/yarn.lock b/yarn.lock index 09741fad66..c994b4dae1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1091,6 +1091,13 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== +axios@^0.26.1: + version "0.26.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" + integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== + dependencies: + follow-redirects "^1.14.8" + babel-core@^7.0.0-bridge.0: version "7.0.0-bridge.0" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" @@ -1156,6 +1163,11 @@ balanced-match@^2.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-2.0.0.tgz#dc70f920d78db8b858535795867bf48f820633d9" integrity sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA== +base-64@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/base-64/-/base-64-1.0.0.tgz#09d0f2084e32a3fd08c2475b973788eee6ae8f4a" + integrity sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg== + base64-js@^1.0.2, base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" @@ -1254,6 +1266,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + braces@^2.3.1, braces@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" @@ -1547,6 +1566,11 @@ chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: ansi-styles "^4.1.0" supports-color "^7.1.0" +charenc@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" + integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc= + "chokidar@>=3.0.0 <4.0.0", chokidar@^3.4.1, chokidar@^3.4.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" @@ -1977,6 +2001,11 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" +crypt@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" + integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs= + crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" @@ -2338,6 +2367,11 @@ elliptic@^6.5.3: minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" +emitter-component@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/emitter-component/-/emitter-component-1.1.1.tgz#065e2dbed6959bf470679edabeaf7981d1003ab6" + integrity sha1-Bl4tvtaVm/RwZ57avq95gdEAOrY= + emittery@^0.8.0: version "0.8.1" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.8.1.tgz#bb23cc86d03b30aa75a7f734819dee2e1ba70860" @@ -2899,6 +2933,13 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= +fast-xml-parser@^3.19.0: + version "3.21.1" + resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-3.21.1.tgz#152a1d51d445380f7046b304672dd55d15c9e736" + integrity sha512-FTFVjYoBOZTJekiUsawGsSYV9QL0A+zDYCRj7y34IO6Jg+2IMYEtQa+bbictpdpV8dHxXywqU7C0gRDEOFtBFg== + dependencies: + strnum "^1.0.4" + fastest-levenshtein@^1.0.12, fastest-levenshtein@^1.0.7: version "1.0.12" resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz#9990f7d3a88cc5a9ffd1f1745745251700d497e2" @@ -3081,6 +3122,11 @@ flush-write-stream@^1.0.0: inherits "^2.0.3" readable-stream "^2.3.6" +follow-redirects@^1.14.8: + version "1.14.9" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.9.tgz#dd4ea157de7bfaf9ea9b3fbd85aa16951f78d8d7" + integrity sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w== + for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" @@ -3520,7 +3566,7 @@ hasha@^5.0.0: is-stream "^2.0.0" type-fest "^0.8.0" -he@1.2.0, he@1.2.x: +he@1.2.0, he@1.2.x, he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -3546,6 +3592,11 @@ hosted-git-info@^4.0.1: dependencies: lru-cache "^6.0.0" +hot-patcher@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/hot-patcher/-/hot-patcher-0.5.0.tgz#9d401424585aaf3a91646b816ceff40eb6a916b9" + integrity sha512-2Uu2W0s8+dnqXzdlg0MRsRzPoDCs1wVjOGSyMRRaMzLDX4bgHw6xDYKccsWafXPPxQpkQfEjgW6+17pwcg60bw== + html-entities@^1.2.1: version "1.4.0" resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.4.0.tgz#cfbd1b01d2afaf9adca1b10ae7dffab98c71d2dc" @@ -3862,7 +3913,7 @@ is-boolean-object@^1.1.0: call-bind "^1.0.2" has-tostringtag "^1.0.0" -is-buffer@^1.1.5: +is-buffer@^1.1.5, is-buffer@~1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== @@ -4464,6 +4515,11 @@ latest-version@^5.1.0: dependencies: package-json "^6.3.0" +layerr@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/layerr/-/layerr-0.1.2.tgz#16c8e7fb042d3595ab15492bdad088f31d7afd15" + integrity sha512-ob5kTd9H3S4GOG2nVXyQhOu9O8nBgP555XxWPkJI0tR0JeRilfyTp8WtPdIJHLXBmHMSdEq5+KMxiYABeScsIQ== + levn@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" @@ -4854,6 +4910,15 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" +md5@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f" + integrity sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g== + dependencies: + charenc "0.0.2" + crypt "0.0.2" + is-buffer "~1.1.6" + mem@^8.0.0: version "8.1.1" resolved "https://registry.yarnpkg.com/mem/-/mem-8.1.1.tgz#cf118b357c65ab7b7e0817bdf00c8062297c0122" @@ -5010,6 +5075,13 @@ minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" +minimatch@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" + integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== + dependencies: + brace-expansion "^2.0.1" + minimist-options@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -5170,6 +5242,11 @@ neo-async@^2.5.0, neo-async@^2.6.1, neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +nested-property@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/nested-property/-/nested-property-4.0.0.tgz#a67b5a31991e701e03cdbaa6453bc5b1011bb88d" + integrity sha512-yFehXNWRs4cM0+dz7QxCd06hTbWbSkV0ISsqBfkntU6TOY4Qm3Q88fRRLOddkGh2Qq6dZvnKVAahfhjcUvLnyA== + netmask@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.0.2.tgz#8b01a07644065d536383835823bc52004ebac5e7" @@ -5753,6 +5830,11 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-posix@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/path-posix/-/path-posix-1.0.0.tgz#06b26113f56beab042545a23bfa88003ccac260f" + integrity sha1-BrJhE/Vr6rBCVFojv6iAA8ysJg8= + path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -6085,6 +6167,11 @@ querystring@0.2.0: resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= +querystringify@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" + integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -6344,6 +6431,11 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== +requires-port@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" + integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -6901,6 +6993,13 @@ stream-shift@^1.0.0: resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== +stream@^0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/stream/-/stream-0.0.2.tgz#7f5363f057f6592c5595f00bc80a27f5cec1f0ef" + integrity sha1-f1Nj8Ff2WSxVlfALyAon9c7B8O8= + dependencies: + emitter-component "^1.1.1" + string-natural-compare@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" @@ -7020,6 +7119,11 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +strnum@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/strnum/-/strnum-1.0.5.tgz#5c4e829fe15ad4ff0d20c3db5ac97b73c9b072db" + integrity sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA== + style-search@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/style-search/-/style-search-0.1.0.tgz#7958c793e47e32e07d2b5cafe5c0bf8e12e77902" @@ -7577,6 +7681,11 @@ urix@^0.1.0: resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= +url-join@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" + integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA== + url-loader@4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-4.1.1.tgz#28505e905cae158cf07c92ca622d7f237e70a4e2" @@ -7593,6 +7702,14 @@ url-parse-lax@^3.0.0: dependencies: prepend-http "^2.0.0" +url-parse@^1.5.10: + version "1.5.10" + resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== + dependencies: + querystringify "^2.1.1" + requires-port "^1.0.0" + url@^0.11.0: version "0.11.0" resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" @@ -7687,6 +7804,24 @@ wcwidth@^1.0.1: dependencies: defaults "^1.0.3" +webdav@^4.9.0: + version "4.9.0" + resolved "https://registry.yarnpkg.com/webdav/-/webdav-4.9.0.tgz#cc12a55102feba8f87be6c6f2cd9bbb093abf22e" + integrity sha512-pMuRtZcjBk3i6q1iY5wBHdablKftoBfhrQEWWEejSh2LXgd0J6VE5V0c1tUlMrFHaVDx8iCoB9kupNzy8SMC4A== + dependencies: + axios "^0.26.1" + base-64 "^1.0.0" + fast-xml-parser "^3.19.0" + he "^1.2.0" + hot-patcher "^0.5.0" + layerr "^0.1.2" + md5 "^2.3.0" + minimatch "^5.0.1" + nested-property "^4.0.0" + path-posix "^1.0.0" + url-join "^4.0.1" + url-parse "^1.5.10" + webpack-cli@4.9.2: version "4.9.2" resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.9.2.tgz#77c1adaea020c3f9e2db8aad8ea78d235c83659d" From 62ceb5cf949252357e1fad255d45ff5a1f555084 Mon Sep 17 00:00:00 2001 From: ElijahPepe Date: Sun, 1 May 2022 09:31:02 -0700 Subject: [PATCH 2/8] Fix Flow --- lib/modules/backupAndRestore.js | 1 + lib/modules/backupAndRestore/providers/WebDAV.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/modules/backupAndRestore.js b/lib/modules/backupAndRestore.js index adca073251..b33272c24a 100644 --- a/lib/modules/backupAndRestore.js +++ b/lib/modules/backupAndRestore.js @@ -122,6 +122,7 @@ module.options = { key: 'digest', name: 'backupAndRestoreDigest', type: 'boolean', + value: false, }], value: ([]: Array<[string, string, string, boolean]>), description: 'backupAndRestoreWebDAVTitle', diff --git a/lib/modules/backupAndRestore/providers/WebDAV.js b/lib/modules/backupAndRestore/providers/WebDAV.js index e64bda840e..b4fe6127c8 100644 --- a/lib/modules/backupAndRestore/providers/WebDAV.js +++ b/lib/modules/backupAndRestore/providers/WebDAV.js @@ -10,7 +10,7 @@ export class WebDAV extends Provider { static text = 'WebDAV'; static supportsAutomaticBackups = true; - client: string; + client: any; // eslint-disable-next-line require-await async init({ webDAVUrl, webDAVDigest, webDAVUsername, webDAVPassword }: *): Promise { // eslint-disable-line no-empty-pattern From 7cbb6defc63bfb76074cd5dd4da736507b812fb8 Mon Sep 17 00:00:00 2001 From: Elijah Date: Sun, 1 May 2022 09:40:33 -0700 Subject: [PATCH 3/8] Title => Desc --- lib/modules/backupAndRestore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/backupAndRestore.js b/lib/modules/backupAndRestore.js index b33272c24a..2e5f2023cb 100644 --- a/lib/modules/backupAndRestore.js +++ b/lib/modules/backupAndRestore.js @@ -125,7 +125,7 @@ module.options = { value: false, }], value: ([]: Array<[string, string, string, boolean]>), - description: 'backupAndRestoreWebDAVTitle', + description: 'backupAndRestoreWebDAVDesc', title: 'backupAndRestoreWebDAVTitle', }, }; From 19e9435e4e4dfc6146459d3ed4fbab1fbbe0c7a8 Mon Sep 17 00:00:00 2001 From: Elijah Date: Mon, 2 May 2022 17:12:43 -0700 Subject: [PATCH 4/8] Add warning to backupAndRestore.webdav --- lib/modules/backupAndRestore.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/modules/backupAndRestore.js b/lib/modules/backupAndRestore.js index 2e5f2023cb..b39b553cc6 100644 --- a/lib/modules/backupAndRestore.js +++ b/lib/modules/backupAndRestore.js @@ -127,6 +127,9 @@ module.options = { value: ([]: Array<[string, string, string, boolean]>), description: 'backupAndRestoreWebDAVDesc', title: 'backupAndRestoreWebDAVTitle', + onChange() { + window.alert('RES stores WebDAV credentials in plaintext.'); + }, }, }; From 5afbcfc9e2135b37f6795242ad1bf4332854276f Mon Sep 17 00:00:00 2001 From: Elijah Date: Mon, 2 May 2022 17:17:08 -0700 Subject: [PATCH 5/8] Tabs over spaces --- lib/modules/backupAndRestore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/modules/backupAndRestore.js b/lib/modules/backupAndRestore.js index b39b553cc6..f7231b3bf3 100644 --- a/lib/modules/backupAndRestore.js +++ b/lib/modules/backupAndRestore.js @@ -128,7 +128,7 @@ module.options = { description: 'backupAndRestoreWebDAVDesc', title: 'backupAndRestoreWebDAVTitle', onChange() { - window.alert('RES stores WebDAV credentials in plaintext.'); + window.alert('RES stores WebDAV credentials in plaintext.'); }, }, }; From 04a3549fc26aa251bda2399ba5a86f640dbdca94 Mon Sep 17 00:00:00 2001 From: Elijah Date: Thu, 5 May 2022 08:24:02 -0700 Subject: [PATCH 6/8] Use showNotification --- lib/modules/backupAndRestore.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/modules/backupAndRestore.js b/lib/modules/backupAndRestore.js index f7231b3bf3..ff3b4e5347 100644 --- a/lib/modules/backupAndRestore.js +++ b/lib/modules/backupAndRestore.js @@ -128,7 +128,12 @@ module.options = { description: 'backupAndRestoreWebDAVDesc', title: 'backupAndRestoreWebDAVTitle', onChange() { - window.alert('RES stores WebDAV credentials in plaintext.'); + Notifications.showNotification({ + message: i18n('backupAndRestoreWarnNotification', text), + notificationID: 'backupAndRestoreWarn', + moduleID: module.moduleID, + closeDelay: 1000, + }); }, }, }; From ce40486ee0e263bde24e4f91605841a3b59aa915 Mon Sep 17 00:00:00 2001 From: Elijah Date: Thu, 5 May 2022 08:31:28 -0700 Subject: [PATCH 7/8] Add i18n --- locales/locales/en.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/locales/locales/en.json b/locales/locales/en.json index ab9917a9ca..e338d9b738 100644 --- a/locales/locales/en.json +++ b/locales/locales/en.json @@ -1905,6 +1905,12 @@ "backupAndRestoreSavedNotification": { "message": "Backup saved to $1." }, + "backupAndRestoreWarnNotification": { + "message": "RES stores WebDAV credentials in plain text." + }, + "backupAndRestoreWarn": { + "message": "Warning" + }, "backupAndRestoreFoundBackup": { "message": "Found new automatic backup from $1." }, From c0637e5531a135bf1e9f95159d4e57b8b557a9c1 Mon Sep 17 00:00:00 2001 From: Elijah Date: Thu, 5 May 2022 08:54:38 -0700 Subject: [PATCH 8/8] Fix showNotification --- lib/modules/backupAndRestore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modules/backupAndRestore.js b/lib/modules/backupAndRestore.js index ff3b4e5347..18b215d37b 100644 --- a/lib/modules/backupAndRestore.js +++ b/lib/modules/backupAndRestore.js @@ -129,8 +129,8 @@ module.options = { title: 'backupAndRestoreWebDAVTitle', onChange() { Notifications.showNotification({ - message: i18n('backupAndRestoreWarnNotification', text), - notificationID: 'backupAndRestoreWarn', + message: i18n('backupAndRestoreWarnNotification'), + notificationID: i18n('backupAndRestoreWarn'), moduleID: module.moduleID, closeDelay: 1000, });