From fd0cd20bbaad3780228fba066903dc3687ccc85e Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 22 Jul 2024 23:06:52 +0530 Subject: [PATCH 1/7] Onlyoffice active appicon issue --- Dockerfile | 1 + patches/037-onlyoffice-active-appicon.patch | 26 +++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 patches/037-onlyoffice-active-appicon.patch diff --git a/Dockerfile b/Dockerfile index 5112e63..603b4c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -230,6 +230,7 @@ RUN patch -u ${BASE_DIR}/apps/dav/lib/HookManager.php -i ${TMP_PATCH_DIR}/028-de RUN patch -u ${BASE_DIR}/apps/provisioning_api/lib/Controller/UsersController.php -i ${TMP_PATCH_DIR}/029-restrict-user-to-change-primary-email.patch RUN patch -u ${BASE_DIR}/lib/private/Security/VerificationToken/VerificationToken.php -i ${TMP_PATCH_DIR}/033-verification-token-private.patch RUN patch -u ${BASE_DIR}/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php -i ${TMP_PATCH_DIR}/034-oidc-bearer-token-auth.patch +RUN patch -u ${BASE_DIR}/custom_apps/onlyoffice/lib/Controller/EditorController.php -i ${TMP_PATCH_DIR}/037-onlyoffice-active-appicon.patch RUN rm -rf ${TMP_PATCH_DIR} diff --git a/patches/037-onlyoffice-active-appicon.patch b/patches/037-onlyoffice-active-appicon.patch new file mode 100644 index 0000000..2ffbc26 --- /dev/null +++ b/patches/037-onlyoffice-active-appicon.patch @@ -0,0 +1,26 @@ +--- ./lib/Controller/EditorController.php 2024-07-22 22:58:03 ++++ ./lib/Controller/EditorController-new.php 2024-07-22 23:01:12 +@@ -1282,10 +1282,21 @@ + $csp->addAllowedFrameDomain("'self'"); + } + $response->setContentSecurityPolicy($csp); +- ++ $app = $this->appName.'_'.$this->getExt($fileId); ++ \OC::$server->getNavigationManager()->setActiveEntry($app); + return $response; + } +- ++ private function getExt($fileId){ ++ $user = $this->userSession->getUser(); ++ $userId = null; ++ if (!empty($user)) { ++ $userId = $user->getUID(); ++ } ++ list ($file, $error, $share) = $this->getFile($userId, $fileId); ++ $fileName = $file->getName(); ++ $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); ++ return $ext; ++ } + /** + * Print public editor section + * -- GitLab From 4d87c6f84a8997caa1164d56c07ff5462c8ca839 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Mon, 22 Jul 2024 23:07:26 +0530 Subject: [PATCH 2/7] Onlyoffice active appicon issue --- patches/037-onlyoffice-active-appicon.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/037-onlyoffice-active-appicon.patch b/patches/037-onlyoffice-active-appicon.patch index 2ffbc26..2e944fb 100644 --- a/patches/037-onlyoffice-active-appicon.patch +++ b/patches/037-onlyoffice-active-appicon.patch @@ -6,7 +6,7 @@ $response->setContentSecurityPolicy($csp); - + $app = $this->appName.'_'.$this->getExt($fileId); -+ \OC::$server->getNavigationManager()->setActiveEntry($app); ++ \OC::$server->getNavigationManager()->setActiveEntry($app); return $response; } - -- GitLab From 258331962b7ef01de4367d154cc945013ede4eda Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 23 Jul 2024 15:21:36 +0530 Subject: [PATCH 3/7] onlyoffice patch step removed --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 603b4c6..5112e63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -230,7 +230,6 @@ RUN patch -u ${BASE_DIR}/apps/dav/lib/HookManager.php -i ${TMP_PATCH_DIR}/028-de RUN patch -u ${BASE_DIR}/apps/provisioning_api/lib/Controller/UsersController.php -i ${TMP_PATCH_DIR}/029-restrict-user-to-change-primary-email.patch RUN patch -u ${BASE_DIR}/lib/private/Security/VerificationToken/VerificationToken.php -i ${TMP_PATCH_DIR}/033-verification-token-private.patch RUN patch -u ${BASE_DIR}/lib/private/AppFramework/Middleware/Security/CORSMiddleware.php -i ${TMP_PATCH_DIR}/034-oidc-bearer-token-auth.patch -RUN patch -u ${BASE_DIR}/custom_apps/onlyoffice/lib/Controller/EditorController.php -i ${TMP_PATCH_DIR}/037-onlyoffice-active-appicon.patch RUN rm -rf ${TMP_PATCH_DIR} -- GitLab From 81c1d31662cc9175a879368381e8c954bd66d239 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 23 Jul 2024 15:31:26 +0530 Subject: [PATCH 4/7] onlyoffice patch step removed --- patches/037-onlyoffice-active-appicon.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/037-onlyoffice-active-appicon.patch b/patches/037-onlyoffice-active-appicon.patch index 2e944fb..656eb20 100644 --- a/patches/037-onlyoffice-active-appicon.patch +++ b/patches/037-onlyoffice-active-appicon.patch @@ -1,5 +1,5 @@ ---- ./lib/Controller/EditorController.php 2024-07-22 22:58:03 -+++ ./lib/Controller/EditorController-new.php 2024-07-22 23:01:12 +--- ./custom_apps/onlyoffice/lib/Controller/EditorController.php 2024-07-22 22:58:03 ++++ ./custom_apps/onlyoffice/lib/Controller/EditorController-new.php 2024-07-22 23:01:12 @@ -1282,10 +1282,21 @@ $csp->addAllowedFrameDomain("'self'"); } -- GitLab From 69b682ad663dfd6126fce821be482028fb06952e Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 23 Jul 2024 15:33:58 +0530 Subject: [PATCH 5/7] desc added --- patches/037-onlyoffice-active-appicon.patch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/patches/037-onlyoffice-active-appicon.patch b/patches/037-onlyoffice-active-appicon.patch index 656eb20..66ea656 100644 --- a/patches/037-onlyoffice-active-appicon.patch +++ b/patches/037-onlyoffice-active-appicon.patch @@ -1,3 +1,7 @@ +From: Ronak +Date: Tue, 23 Jul 2024 11:24:27 +0100 +Subject: [PATCH] Adding patch to apply active app-icon +This patch resolves issue of active app-icon for onlyoffice apps --- ./custom_apps/onlyoffice/lib/Controller/EditorController.php 2024-07-22 22:58:03 +++ ./custom_apps/onlyoffice/lib/Controller/EditorController-new.php 2024-07-22 23:01:12 @@ -1282,10 +1282,21 @@ -- GitLab From b4341d7a7bff2d54aee11c169c3cd90ecccd8095 Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 23 Jul 2024 15:35:15 +0530 Subject: [PATCH 6/7] desc added --- patches/037-onlyoffice-active-appicon.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/patches/037-onlyoffice-active-appicon.patch b/patches/037-onlyoffice-active-appicon.patch index 66ea656..608dc11 100644 --- a/patches/037-onlyoffice-active-appicon.patch +++ b/patches/037-onlyoffice-active-appicon.patch @@ -1,7 +1,7 @@ -From: Ronak -Date: Tue, 23 Jul 2024 11:24:27 +0100 -Subject: [PATCH] Adding patch to apply active app-icon -This patch resolves issue of active app-icon for onlyoffice apps +From: Ronak +Date: Tue, 23 Jul 2024 11:24:27 +0100 +Subject: [PATCH] Apply Active App-Icon for OnlyOffice Apps +This patch resolves the issue of the active app-icon for OnlyOffice apps. --- ./custom_apps/onlyoffice/lib/Controller/EditorController.php 2024-07-22 22:58:03 +++ ./custom_apps/onlyoffice/lib/Controller/EditorController-new.php 2024-07-22 23:01:12 @@ -1282,10 +1282,21 @@ -- GitLab From a5e95dee1ac663dc56dc3e1acddab2d57a2d6d6b Mon Sep 17 00:00:00 2001 From: Ronak Patel Date: Tue, 23 Jul 2024 15:42:52 +0530 Subject: [PATCH 7/7] added patch --- patches/037-onlyoffice-active-appicon.patch | 25 ++++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/patches/037-onlyoffice-active-appicon.patch b/patches/037-onlyoffice-active-appicon.patch index 608dc11..87fc60b 100644 --- a/patches/037-onlyoffice-active-appicon.patch +++ b/patches/037-onlyoffice-active-appicon.patch @@ -1,29 +1,32 @@ From: Ronak Date: Tue, 23 Jul 2024 11:24:27 +0100 Subject: [PATCH] Apply Active App-Icon for OnlyOffice Apps + This patch resolves the issue of the active app-icon for OnlyOffice apps. --- ./custom_apps/onlyoffice/lib/Controller/EditorController.php 2024-07-22 22:58:03 -+++ ./custom_apps/onlyoffice/lib/Controller/EditorController-new.php 2024-07-22 23:01:12 -@@ -1282,10 +1282,21 @@ ++++ ./custom_apps/onlyoffice/lib/Controller/EditorController-new.php 2024-07-23 15:40:54 +@@ -1282,10 +1282,23 @@ $csp->addAllowedFrameDomain("'self'"); } $response->setContentSecurityPolicy($csp); - + $app = $this->appName.'_'.$this->getExt($fileId); -+ \OC::$server->getNavigationManager()->setActiveEntry($app); ++ \OC::$server->getNavigationManager()->setActiveEntry($app); return $response; } - -+ private function getExt($fileId){ ++ private function getExt($fileId) ++ { + $user = $this->userSession->getUser(); + $userId = null; -+ if (!empty($user)) { -+ $userId = $user->getUID(); -+ } -+ list ($file, $error, $share) = $this->getFile($userId, $fileId); -+ $fileName = $file->getName(); -+ $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); -+ return $ext; ++ if (empty($user)) { ++ return ''; ++ } ++ $userId = $user->getUID(); ++ list($file, $error, $share) = $this->getFile($userId, $fileId); ++ $fileName = $file->getName(); ++ $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); ++ return $ext; + } /** * Print public editor section -- GitLab