From c7991b553c10fec2b0d6ea396fa4fa56d36e9578 Mon Sep 17 00:00:00 2001 From: codewithvk Date: Tue, 4 Feb 2025 13:38:33 +0530 Subject: [PATCH] refactor: some code cleanups Signed-off-by: codewithvk --- lib/Controller/SettingsController.php | 2 -- src/components/AdminSettings.vue | 24 +++++++++--------------- src/components/PersonalSettings.vue | 18 +++++++----------- src/helpers/url.js | 2 +- tests/psalm-baseline.xml | 5 ----- 5 files changed, 17 insertions(+), 34 deletions(-) diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 0db8d555dc..bd3a22346d 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -414,8 +414,6 @@ public function getFontFileOverview(string $name): DataDisplayResponse { /** * @NoAdminRequired - * @PublicPage - * @NoCSRFRequired * * @param string $type - Type is 'admin' or 'user' * @return DataResponse diff --git a/src/components/AdminSettings.vue b/src/components/AdminSettings.vue index 09d916dbce..25eb441b9f 100644 --- a/src/components/AdminSettings.vue +++ b/src/components/AdminSettings.vue @@ -217,14 +217,13 @@ -
- -
+

{{ t('richdocuments', 'Advanced settings') }}

@@ -432,10 +431,7 @@ import SettingsExternalApps from './SettingsExternalApps.vue' import SettingsInputFile from './SettingsInputFile.vue' import SettingsFontList from './SettingsFontList.vue' import GlobalTemplates from './AdminSettings/GlobalTemplates.vue' -import { - getCurrentUser, - getGuestNickname, -} from '@nextcloud/auth' +import { getCurrentUser } from '@nextcloud/auth' import { isPublicShare, getSharingToken } from '@nextcloud/sharing/public' @@ -531,7 +527,7 @@ export default { }, accessToken: '', accessTokenTTL: '', - userId: '', + userId: getCurrentUser()?.uid, tokenGenerated: false, wopiSettingBaseUrl: '', } @@ -644,8 +640,6 @@ export default { this.accessToken = data.token this.accessTokenTTL = data.token_ttl console.debug('Admin settings WOPI token generated:', this.accessToken, this.accessTokenTTL) - } else if (data.federatedUrl) { - console.error('Federated URL returned, not expected for admin settings.') } else { console.error('Failed to generate token for admin settings') } diff --git a/src/components/PersonalSettings.vue b/src/components/PersonalSettings.vue index df5be2649b..8a7a9f6e6d 100644 --- a/src/components/PersonalSettings.vue +++ b/src/components/PersonalSettings.vue @@ -35,14 +35,12 @@

-
- -
+
@@ -168,7 +166,7 @@ export default { tokenGenerated: false, accessToken: '', accessTokenTTL: '', - userId: '', + userId: getCurrentUser()?.uid, wopiSettingBaseUrl: '', public_wopi_url: this.initial.publicWopiUrl || '', } @@ -199,8 +197,6 @@ export default { this.accessToken = data.token this.accessTokenTTL = data.token_ttl console.debug('Admin settings WOPI token generated:', this.accessToken, this.accessTokenTTL) - } else if (data.federatedUrl) { - console.error('Federated URL returned, not expected for admin settings.') } else { console.error('Failed to generate token for admin settings') } diff --git a/src/helpers/url.js b/src/helpers/url.js index c9bcae104c..40b77cfaa8 100644 --- a/src/helpers/url.js +++ b/src/helpers/url.js @@ -82,7 +82,7 @@ const getDocumentUrlForFile = (fileDir, fileId) => { } export const getConfigFileUrl = () => { - return getCallbackBaseUrl() + '/index.php/apps/richdocuments/wopi/settings' + return getCallbackBaseUrl() + generateUrl('apps/richdocuments/wopi/settings') } const getNextcloudUrl = () => { diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index b91cb8f1ba..81a432d72c 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -125,9 +125,4 @@ 0]]> - - - 0]]> - -