From 3982037498d83b7e94945db34ab0c7bb81d2fc3d Mon Sep 17 00:00:00 2001 From: fenn-cs Date: Tue, 18 Jun 2024 00:26:22 +0100 Subject: [PATCH] fix(DavClient): Provide proper feedback for dav requests Before this commit there is no error handling whatsover for this requests and the user won't get any visual feedback whatsover irrespective of what goes down at the server level. Signed-off-by: fenn-cs --- package-lock.json | 307 +++++++++++++++++++------- package.json | 19 +- src/client.js | 20 +- src/components/SharingSidebarView.vue | 18 +- 4 files changed, 276 insertions(+), 88 deletions(-) diff --git a/package-lock.json b/package-lock.json index ab63c3258..aa6121c0a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@mdi/svg": "^7.4.47", "@nextcloud/auth": "^2.2.1", "@nextcloud/axios": "^2.4.0", + "@nextcloud/dialogs": "^5.3.4", "@nextcloud/event-bus": "^3.1.0", "@nextcloud/files": "^3.1.1", "@nextcloud/initial-state": "^2.1.0", @@ -3392,6 +3393,11 @@ "unist-util-is": "^3.0.0" } }, + "node_modules/@mdi/js": { + "version": "7.4.47", + "resolved": "https://registry.npmjs.org/@mdi/js/-/js-7.4.47.tgz", + "integrity": "sha512-KPnNOtm5i2pMabqZxpUz7iQf+mfrYZyKCZ8QNz85czgEt7cuHcGorWfdzUMWYA0SD+a6Hn4FmJ+YhzzzjkTZrQ==" + }, "node_modules/@mdi/svg": { "version": "7.4.47", "resolved": "https://registry.npmjs.org/@mdi/svg/-/svg-7.4.47.tgz", @@ -3410,26 +3416,13 @@ } }, "node_modules/@nextcloud/axios": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@nextcloud/axios/-/axios-2.4.0.tgz", - "integrity": "sha512-ARGzT9p45L0sjRIV3JZWGPtMbwgxd4eEMcMJNn58NA7UQIsMkTwHb5pXQjL+5elXY9zp/JMz7n/7SHTp0bkuXQ==", - "dependencies": { - "@nextcloud/auth": "^2.1.0", - "@nextcloud/router": "^2.1.2", - "axios": "^1.4.0" - }, - "engines": { - "node": "^20.0.0", - "npm": "^9.0.0" - } - }, - "node_modules/@nextcloud/axios/node_modules/@nextcloud/router": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@nextcloud/router/-/router-2.2.1.tgz", - "integrity": "sha512-ZRc/WI0RaksEJMz08H/6LimIdP+1A1xTHThCYEghs7VgAKNp5917vT2OKSpG0cMRbIwk0ongFVt5FB5qjy/iFg==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@nextcloud/axios/-/axios-2.5.0.tgz", + "integrity": "sha512-82LQ5PZA0ZVUnS8QiGoAGOR5kE7EKD84qEEgeZJ+Y7p5iljwi3AT6niQuP7YuHjt3MKM+6jQiyghZk5SquiszQ==", "dependencies": { - "@nextcloud/typings": "^1.7.0", - "core-js": "^3.6.4" + "@nextcloud/auth": "^2.3.0", + "@nextcloud/router": "^3.0.1", + "axios": "^1.6.8" }, "engines": { "node": "^20.0.0", @@ -3563,6 +3556,138 @@ "cypress": "^13.2.0" } }, + "node_modules/@nextcloud/dialogs": { + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-5.3.4.tgz", + "integrity": "sha512-0oWLycHX/T68Ab7xMOlghg3nHZOOldbTwoOmNOSIbAg69Tmpcu90JlRtFa9LKiDf1pWQPqCoh9QeYj10SCEm0w==", + "dependencies": { + "@mdi/js": "^7.4.47", + "@nextcloud/auth": "^2.3.0", + "@nextcloud/axios": "^2.5.0", + "@nextcloud/event-bus": "^3.3.1", + "@nextcloud/files": "^3.5.1", + "@nextcloud/initial-state": "^2.2.0", + "@nextcloud/l10n": "^3.1.0", + "@nextcloud/router": "^3.0.1", + "@nextcloud/sharing": "^0.2.2", + "@nextcloud/typings": "^1.8.0", + "@types/toastify-js": "^1.12.3", + "@vueuse/core": "^10.11.0", + "cancelable-promise": "^4.3.1", + "toastify-js": "^1.12.0", + "vue-frag": "^1.4.3", + "webdav": "^5.6.0" + }, + "engines": { + "node": "^20.0.0", + "npm": "^10.0.0" + }, + "peerDependencies": { + "@nextcloud/vue": "^8.9.1", + "vue": "^2.7.16" + } + }, + "node_modules/@nextcloud/dialogs/node_modules/@nextcloud/l10n": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nextcloud/l10n/-/l10n-3.1.0.tgz", + "integrity": "sha512-unciqr8QSJ29vFBw9S1bquyoj1PTWHszNL8tcUNuxUAYpq0hX+8o7rpB5gimELA4sj4m9+VCJwgLtBZd1Yj0lg==", + "dependencies": { + "@nextcloud/router": "^3.0.1", + "@nextcloud/typings": "^1.8.0", + "@types/dompurify": "^3.0.5", + "@types/escape-html": "^1.0.4", + "dompurify": "^3.1.2", + "escape-html": "^1.0.3", + "node-gettext": "^3.0.0" + }, + "engines": { + "node": "^20.0.0", + "npm": "^10.0.0" + } + }, + "node_modules/@nextcloud/dialogs/node_modules/@vueuse/core": { + "version": "10.11.0", + "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-10.11.0.tgz", + "integrity": "sha512-x3sD4Mkm7PJ+pcq3HX8PLPBadXCAlSDR/waK87dz0gQE+qJnaaFhc/dZVfJz+IUYzTMVGum2QlR7ImiJQN4s6g==", + "dependencies": { + "@types/web-bluetooth": "^0.0.20", + "@vueuse/metadata": "10.11.0", + "@vueuse/shared": "10.11.0", + "vue-demi": ">=0.14.8" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@nextcloud/dialogs/node_modules/@vueuse/core/node_modules/vue-demi": { + "version": "0.14.8", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.8.tgz", + "integrity": "sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==", + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, + "node_modules/@nextcloud/dialogs/node_modules/@vueuse/metadata": { + "version": "10.11.0", + "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-10.11.0.tgz", + "integrity": "sha512-kQX7l6l8dVWNqlqyN3ePW3KmjCQO3ZMgXuBMddIu83CmucrsBfXlH+JoviYyRBws/yLTQO8g3Pbw+bdIoVm4oQ==", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@nextcloud/dialogs/node_modules/@vueuse/shared": { + "version": "10.11.0", + "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-10.11.0.tgz", + "integrity": "sha512-fyNoIXEq3PfX1L3NkNhtVQUSRtqYwJtJg+Bp9rIzculIZWHTkKSysujrOk2J+NrRulLTQH9+3gGSfYLWSEWU1A==", + "dependencies": { + "vue-demi": ">=0.14.8" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@nextcloud/dialogs/node_modules/@vueuse/shared/node_modules/vue-demi": { + "version": "0.14.8", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.8.tgz", + "integrity": "sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==", + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/@nextcloud/eslint-config": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/@nextcloud/eslint-config/-/eslint-config-8.3.0.tgz", @@ -3608,11 +3733,11 @@ } }, "node_modules/@nextcloud/event-bus": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/@nextcloud/event-bus/-/event-bus-3.3.0.tgz", - "integrity": "sha512-M7e0sC7RuLr3k7cyJOGeXvKpUZf25Qyhr9+Vr27Q6rBZ6J94xZhDdOyJGehXc34sQJX1TTbJRSDF02vsLx8Gqg==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@nextcloud/event-bus/-/event-bus-3.3.1.tgz", + "integrity": "sha512-VBYJspOVk5aZopgZwCUoMKFqcTLCNel2TLvtu0HMPV2gR5ZLPiPAKbkyKkYTh+Sd5QB1gR6l3STTv1gyal0soQ==", "dependencies": { - "@types/node": "^20.12.11", + "@types/node": "^20.12.12", "semver": "^7.6.2" }, "engines": { @@ -3632,30 +3757,51 @@ } }, "node_modules/@nextcloud/files": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@nextcloud/files/-/files-3.1.1.tgz", - "integrity": "sha512-PwGxh/AcKeDehYSf/L+OpYNzZ2eK5xA1l/lVjufwa7I+u2onCo6qjYSqvc9Dh4Myzixjmt5YiA+Um/gx/Kq4NA==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/@nextcloud/files/-/files-3.5.1.tgz", + "integrity": "sha512-GkVWUgkBSVt27Carmp/DbnDiqHq03w3VQWt8xszacp/IQSB9G+8/KCvi8zxldac2q7lQ8NpHlB/Bqy8o+OOc0A==", "dependencies": { - "@nextcloud/auth": "^2.2.1", - "@nextcloud/l10n": "^2.2.0", - "@nextcloud/logger": "^2.7.0", + "@nextcloud/auth": "^2.3.0", + "@nextcloud/l10n": "^3.1.0", + "@nextcloud/logger": "^3.0.2", "@nextcloud/paths": "^2.1.0", - "@nextcloud/router": "^3.0.0", - "is-svg": "^5.0.0", - "webdav": "^5.4.0" + "@nextcloud/router": "^3.0.1", + "@nextcloud/sharing": "^0.2.1", + "cancelable-promise": "^4.3.1", + "is-svg": "^5.0.1", + "typescript-event-target": "^1.1.1", + "webdav": "^5.6.0" }, "engines": { "node": "^20.0.0", - "npm": "^9.0.0" + "npm": "^10.0.0" + } + }, + "node_modules/@nextcloud/files/node_modules/@nextcloud/l10n": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nextcloud/l10n/-/l10n-3.1.0.tgz", + "integrity": "sha512-unciqr8QSJ29vFBw9S1bquyoj1PTWHszNL8tcUNuxUAYpq0hX+8o7rpB5gimELA4sj4m9+VCJwgLtBZd1Yj0lg==", + "dependencies": { + "@nextcloud/router": "^3.0.1", + "@nextcloud/typings": "^1.8.0", + "@types/dompurify": "^3.0.5", + "@types/escape-html": "^1.0.4", + "dompurify": "^3.1.2", + "escape-html": "^1.0.3", + "node-gettext": "^3.0.0" + }, + "engines": { + "node": "^20.0.0", + "npm": "^10.0.0" } }, "node_modules/@nextcloud/initial-state": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@nextcloud/initial-state/-/initial-state-2.1.0.tgz", - "integrity": "sha512-b92X/GvUPGQJpUQwauyG3D3dHsWowViVLnTtFPSMUc0rXtvYR5CvhkqJRfPC7O7W4VC7+V3q+FWeA+mQWMxN2Q==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@nextcloud/initial-state/-/initial-state-2.2.0.tgz", + "integrity": "sha512-cDW98L5KGGgpS8pzd+05304/p80cyu8U2xSDQGa+kGPTpUFmCbv2qnO5WrwwGTauyjYijCal2bmw82VddSH+Pg==", "engines": { "node": "^20.0.0", - "npm": "^9.0.0" + "npm": "^10.0.0" } }, "node_modules/@nextcloud/l10n": { @@ -3688,16 +3834,15 @@ } }, "node_modules/@nextcloud/logger": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/@nextcloud/logger/-/logger-2.7.0.tgz", - "integrity": "sha512-DSJg9H1jT2zfr7uoP4tL5hKncyY+LOuxJzLauj0M/f6gnpoXU5WG1Zw8EFPOrRWjkC0ZE+NCqrMnITgdRRpXJQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@nextcloud/logger/-/logger-3.0.2.tgz", + "integrity": "sha512-wByt0R0/6QC44RBpaJr1MWghjjOxk/pRbACHo/ZWWKht1qYbJRHB4GtEi+35KEIHY07ZpqxiDk6dIRuN7sXYWQ==", "dependencies": { - "@nextcloud/auth": "^2.0.0", - "core-js": "^3.6.4" + "@nextcloud/auth": "^2.3.0" }, "engines": { "node": "^20.0.0", - "npm": "^9.0.0" + "npm": "^10.0.0" } }, "node_modules/@nextcloud/paths": { @@ -3720,6 +3865,18 @@ "npm": "^10.0.0" } }, + "node_modules/@nextcloud/sharing": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@nextcloud/sharing/-/sharing-0.2.2.tgz", + "integrity": "sha512-ui0ZoVazroA+cF4+homhFSFAddd/P4uRYMfG3rw3QR8o6igrVFe0f0l21kYtUwXU0oC0K4v3k8j93zCTfz6v3g==", + "dependencies": { + "@nextcloud/initial-state": "^2.2.0" + }, + "engines": { + "node": "^20.0.0", + "npm": "^10.0.0" + } + }, "node_modules/@nextcloud/stylelint-config": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@nextcloud/stylelint-config/-/stylelint-config-2.4.0.tgz", @@ -3838,18 +3995,6 @@ "npm": "^10.0.0" } }, - "node_modules/@nextcloud/vue/node_modules/@nextcloud/logger": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@nextcloud/logger/-/logger-3.0.2.tgz", - "integrity": "sha512-wByt0R0/6QC44RBpaJr1MWghjjOxk/pRbACHo/ZWWKht1qYbJRHB4GtEi+35KEIHY07ZpqxiDk6dIRuN7sXYWQ==", - "dependencies": { - "@nextcloud/auth": "^2.3.0" - }, - "engines": { - "node": "^20.0.0", - "npm": "^10.0.0" - } - }, "node_modules/@nextcloud/webpack-vue-config": { "version": "5.5.1", "resolved": "https://registry.npmjs.org/@nextcloud/webpack-vue-config/-/webpack-vue-config-5.5.1.tgz", @@ -4536,6 +4681,11 @@ "integrity": "sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ==", "dev": true }, + "node_modules/@types/toastify-js": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/@types/toastify-js/-/toastify-js-1.12.3.tgz", + "integrity": "sha512-9RjLlbAHMSaae/KZNHGv19VG4gcLIm3YjvacCXBtfMfYn26h76YP5oxXI8k26q4iKXCB9LNfv18lsoS0JnFPTg==" + }, "node_modules/@types/tough-cookie": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", @@ -6053,11 +6203,11 @@ "peer": true }, "node_modules/axios": { - "version": "1.6.5", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", - "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", "dependencies": { - "follow-redirects": "^1.15.4", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -7071,6 +7221,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cancelable-promise": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/cancelable-promise/-/cancelable-promise-4.3.1.tgz", + "integrity": "sha512-A/8PwLk/T7IJDfUdQ68NR24QHa8rIlnN/stiJEBo6dmVUkD4K14LswG0w3VwdeK/o7qOwRUR1k2MhK5Rpy2m7A==" + }, "node_modules/caniuse-lite": { "version": "1.0.30001576", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz", @@ -8332,7 +8487,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", - "optional": true, "engines": { "node": ">= 12" } @@ -9154,7 +9308,6 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true, "engines": { "node": ">=0.12" }, @@ -10795,7 +10948,6 @@ "url": "https://paypal.me/jimmywarting" } ], - "optional": true, "dependencies": { "node-domexception": "^1.0.0", "web-streams-polyfill": "^3.0.3" @@ -11098,7 +11250,6 @@ "version": "4.0.10", "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "optional": true, "dependencies": { "fetch-blob": "^3.1.2" }, @@ -12767,9 +12918,9 @@ } }, "node_modules/is-svg": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-5.0.0.tgz", - "integrity": "sha512-sRl7J0oX9yUNamSdc8cwgzh9KBLnQXNzGmW0RVHwg/jEYjGNYHC6UvnYD8+hAeut9WwxRvhG9biK7g/wDGxcMw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-5.0.1.tgz", + "integrity": "sha512-mLYxDsfisQWdS4+gSblAwhATDoNMS/tx8G7BKA+aBIf7F0m1iUwMvuKAo6mW4WMleQAEE50I1Zqef9yMMfHk3w==", "dependencies": { "fast-xml-parser": "^4.1.3" }, @@ -16612,7 +16763,6 @@ "url": "https://paypal.me/jimmywarting" } ], - "optional": true, "engines": { "node": ">=10.5.0" } @@ -16621,7 +16771,6 @@ "version": "3.3.2", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", - "optional": true, "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", @@ -20716,6 +20865,11 @@ "node": ">=8.0" } }, + "node_modules/toastify-js": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/toastify-js/-/toastify-js-1.12.0.tgz", + "integrity": "sha512-HeMHCO9yLPvP9k0apGSdPUWrUbLnxUKNFzgUoZp1PHCLploIX/4DSQ7V8H25ef+h4iO9n0he7ImfcndnN6nDrQ==" + }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -21225,6 +21379,11 @@ "node": ">=14.17" } }, + "node_modules/typescript-event-target": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/typescript-event-target/-/typescript-event-target-1.1.1.tgz", + "integrity": "sha512-dFSOFBKV6uwaloBCCUhxlD3Pr/P1a/tJdcmPrTXCHlEFD3faj0mztjcGn6VBAhQ0/Bdy8K3VWrrqwbt/ffsYsg==" + }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -22024,32 +22183,32 @@ "version": "3.3.3", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", - "optional": true, "engines": { "node": ">= 8" } }, "node_modules/webdav": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/webdav/-/webdav-5.5.0.tgz", - "integrity": "sha512-SHSDe6n8lBuwwyX+uePB1N1Yn35ebd3locl/LbADMWpcEoowyFdIbnH3fv17T4Jf2tOa1Vwjr/Lld3t0dOio1w==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/webdav/-/webdav-5.6.0.tgz", + "integrity": "sha512-1zpC9T+nZAEz3hHrEdis3gybiwoR5LillHmFiylhYWAsGU0bGlWlRZtK5NJ3bTr2wCoKABrRGGqLk24+UxF4Gg==", "dependencies": { "@buttercup/fetch": "^0.2.1", "base-64": "^1.0.0", "byte-length": "^1.0.2", + "entities": "^4.5.0", "fast-xml-parser": "^4.2.4", - "he": "^1.2.0", "hot-patcher": "^2.0.0", "layerr": "^2.0.1", "md5": "^2.3.0", "minimatch": "^7.4.6", "nested-property": "^4.0.0", + "node-fetch": "^3.3.2", "path-posix": "^1.0.0", "url-join": "^5.0.0", "url-parse": "^1.5.10" }, "engines": { - "node": ">=14" + "node": ">=16" } }, "node_modules/webdav/node_modules/minimatch": { diff --git a/package.json b/package.json index 70769de72..09a94b725 100644 --- a/package.json +++ b/package.json @@ -22,42 +22,43 @@ "@babel/preset-react": "^7.24.1", "@nextcloud/babel-config": "^1.0.0", "@nextcloud/browserslist-config": "^3.0.0", + "@nextcloud/cypress": "^1.0.0-beta.6", "@nextcloud/eslint-config": "^8.3.0", "@nextcloud/stylelint-config": "^2.4.0", "@nextcloud/webpack-vue-config": "^5.5.1", "@types/bootstrap": "^5.2.10", + "@types/dockerode": "^3.3.26", + "@types/jest": "^29.5.12", "@types/jquery": "^3.5.29", "@types/react": "^17.0.43", "@types/react-dom": "^17.0.0", "@types/webpack": "^5.28.5", "@types/webpack-env": "^1.18.4", - "clean-webpack-plugin": "^4.0.0", - "eslint-plugin-react": "^7.34.1", - "react-hot-loader": "4.13.1", - "ts-loader": "^9.5.1", - "typescript": "^5.4.2", - "@nextcloud/cypress": "^1.0.0-beta.6", - "@types/dockerode": "^3.3.26", - "@types/jest": "^29.5.12", "@vue/test-utils": "^1.3.6", "@vue/tsconfig": "^0.5.1", "@vue/vue2-jest": "^29.2.6", "babel-loader-exclude-node-modules-except": "^1.2.1", + "clean-webpack-plugin": "^4.0.0", "cypress-visual-regression": "^3.0.0", "cypress-wait-until": "^3.0.1", "dockerode": "^4.0.2", "eslint-plugin-cypress": "^2.12.1", + "eslint-plugin-react": "^7.34.1", "jest": "^29.4.1", "jest-environment-jsdom": "^29.4.1", + "module-replace-webpack-plugin": "0.0.12", + "react-hot-loader": "4.13.1", + "ts-loader": "^9.5.1", "ts-node": "^10.9.2", "tslib": "^2.6.2", - "module-replace-webpack-plugin": "0.0.12", + "typescript": "^5.4.2", "wait-on": "^7.0.1" }, "dependencies": { "@mdi/svg": "^7.4.47", "@nextcloud/auth": "^2.2.1", "@nextcloud/axios": "^2.4.0", + "@nextcloud/dialogs": "^5.3.4", "@nextcloud/event-bus": "^3.1.0", "@nextcloud/files": "^3.1.1", "@nextcloud/initial-state": "^2.1.0", diff --git a/src/client.js b/src/client.js index 561201107..dcd9576c2 100644 --- a/src/client.js +++ b/src/client.js @@ -256,8 +256,26 @@ class AclDavService { } const props = {} props[ACL_PROPERTIES.PROPERTY_ACL_LIST] = aclList + return client._client.propPatch(client._client.baseUrl + model.path.replaceAll('#', '%23') + '/' + encodeURIComponent(model.name), props) - } + .then(response => { + if (response.status === 207) { + return response + } else if (response.status === 403) { + // Handle permission denied scenario + console.error('Permission denied:', response.status, response.statusText) + throw new Error(t('groupfolders', 'Permission denied. User does not have sufficient permissions.')) + } else { + // Handle unexpected status codes + console.error('Unexpected status:', response.status, response.statusText) + throw new Error(t('groupfolders', 'Unexpected status from server')) + } + }).catch(error => { + // Handle network errors or exceptions + console.error('Error in propPatch:', error) + throw error + }) + } } diff --git a/src/components/SharingSidebarView.vue b/src/components/SharingSidebarView.vue index 27a4ac9b1..bdaff4ac7 100644 --- a/src/components/SharingSidebarView.vue +++ b/src/components/SharingSidebarView.vue @@ -176,6 +176,7 @@ import Vue from 'vue' import axios from '@nextcloud/axios' import { generateUrl } from '@nextcloud/router' import AclStateButton, { STATES } from './AclStateButton.vue' +import { showError } from '@nextcloud/dialogs' import Rule from './../model/Rule.js' import BinaryTools from './../BinaryTools.js' import client from './../client.js' @@ -355,11 +356,12 @@ export default { }) }, - changePermission(item, permission, $event) { + async changePermission(item, permission, $event) { const index = this.list.indexOf(item) const inherit = $event === STATES.INHERIT_ALLOW || $event === STATES.INHERIT_DENY || $event === STATES.INHERIT_DEFAULT const allow = $event === STATES.SELF_ALLOW const bit = BinaryTools.firstHigh(permission) + const itemRestorePoint = item.clone() item = item.clone() if (inherit) { item.mask = BinaryTools.clear(item.mask, bit) @@ -374,9 +376,17 @@ export default { } item.inherited = false Vue.set(this.list, index, item) - client.propPatch(this.model, this.list.filter(rule => !rule.inherited)).then(() => { - // TODO block UI during save - }) + this.loading = true + try { + await client.propPatch(this.model, this.list.filter(rule => !rule.inherited)) + console.debug('Permissions updated successfully') + } catch (error) { + console.error('Failed to save changes:', error) + Vue.set(this.list, index, itemRestorePoint) + showError(error) + } finally { + this.loading = false + } }, }, }