diff --git a/Dockerfile b/Dockerfile index 32cbfdd4ba6c0cb787da20bf927636f0b2b89136..5afc59f21c0fc10ddc43fe1b31fe509371f16022 100644 --- a/Dockerfile +++ b/Dockerfile @@ -83,6 +83,9 @@ RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete-user-leak-co RUN cd ${BASE_DIR}/custom_apps && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete-user-leak-custom-app.patch RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/006-recovery-email-changes.patch RUN patch -u ${BASE_DIR}/apps/settings/lib/Settings/Personal/ServerDevNotice.php -i ${TMP_PATCH_DIR}/007-remove-dev-notice.patch +RUN patch -u ${BASE_DIR}/lib/private/Template/IconsCacher.php -i ${TMP_PATCH_DIR}/008-icons-cacher-theme-svgs.patch +RUN patch -u ${BASE_DIR}/core/Controller/SvgController.php -i ${TMP_PATCH_DIR}/008-svg-controller-theme-svgs.patch +RUN patch -u ${BASE_DIR}/lib/private/TemplateLayout.php -i ${TMP_PATCH_DIR}/009-remove-external-sites-from-navigation.patch RUN rm -rf ${TMP_PATCH_DIR} # autocomplete leak tweak apps frontend with sed, disable group suggestion diff --git a/patches/008-icons-cacher-theme-svgs.patch b/patches/008-icons-cacher-theme-svgs.patch new file mode 100644 index 0000000000000000000000000000000000000000..3a1aac74c20b96e89900b7f456f526eaa5da56ce --- /dev/null +++ b/patches/008-icons-cacher-theme-svgs.patch @@ -0,0 +1,45 @@ +From: Akhil +Date: Tue, 22 Jul 2021 18:15:00 +0530 +Subject: [PATCH] Caches SVGs added via theme + +This patch modifies Icons Cacher to check theme for icons and if they exist, +cache them instead of the icons in core or apps directories + +diff --git ./lib/private/Template/IconsCacher.php ./lib/private/Template/IconsCacher-new.php +--- ./lib/private/Template/IconsCacher.php 2021-07-22 18:05:40.133856200 +0530 ++++ ./lib/private/Template/IconsCacher-new.php 2021-07-27 20:43:14.122338212 +0530 +@@ -161,20 +161,27 @@ + $location = ''; + $color = ''; + $base = $this->getRoutePrefix() . '/svg/'; +- $cleanUrl = \substr($url, \strlen($base)); ++ $cleanUrl = \substr($url, \strlen($base)); ++ $theme = \OC::$server->getConfig()->getSystemValue("theme"); + if (\strpos($url, $base . 'core') === 0) { + $cleanUrl = \substr($cleanUrl, \strlen('core')); + if (\preg_match('/\/([a-zA-Z0-9-_\~\/\.\=\:\;\+\,]+)\?color=([0-9a-fA-F]{3,6})/', $cleanUrl, $matches)) { +- list(,$cleanUrl,$color) = $matches; +- $location = \OC::$SERVERROOT . '/core/img/' . $cleanUrl . '.svg'; ++ list(,$cleanUrl,$color) = $matches; ++ $location = \OC::$SERVERROOT . '/themes/'. $theme . '/core/img/' . $cleanUrl . '.svg'; ++ if(!file_exists($location)){ ++ $location = \OC::$SERVERROOT . '/core/img/' . $cleanUrl . '.svg'; ++ } + } + } elseif (\strpos($url, $base) === 0) { + if (\preg_match('/([A-z0-9\_\-]+)\/([a-zA-Z0-9-_\~\/\.\=\:\;\+\,]+)\?color=([0-9a-fA-F]{3,6})/', $cleanUrl, $matches)) { + list(,$app,$cleanUrl, $color) = $matches; +- $location = \OC_App::getAppPath($app) . '/img/' . $cleanUrl . '.svg'; +- if ($app === 'settings') { +- $location = \OC::$SERVERROOT . '/settings/img/' . $cleanUrl . '.svg'; +- } ++ $location = \OC::$SERVERROOT . '/themes/' . $theme . '/apps/' . $app . '/img/' . $cleanUrl . '.svg'; ++ if(!file_exists($location)) { ++ $location = \OC_App::getAppPath($app) . '/img/' . $cleanUrl . '.svg'; ++ if ($app === 'settings') { ++ $location = \OC::$SERVERROOT . '/settings/img/' . $cleanUrl . '.svg'; ++ } ++ } + } + } + return [ diff --git a/patches/008-svg-controller-theme-svgs.patch b/patches/008-svg-controller-theme-svgs.patch new file mode 100644 index 0000000000000000000000000000000000000000..4e86543e4319cc477b9a6e5e640879d2bd85b1c2 --- /dev/null +++ b/patches/008-svg-controller-theme-svgs.patch @@ -0,0 +1,38 @@ +From: Akhil +Date: Tue, 22 Jul 2021 18:15:00 +0530 +Subject: [PATCH] Serves SVGs added via theme through SVG Controller + +This patch modifies SVG Controllers to check theme for icons and if they exist, return them before checking +app or core directories in their respective methods + +diff --git ./lib/private/Template/IconsCacher.php ./lib/private/Template/IconsCacher-new.php +--- ./core/Controller/SvgController.php 2021-07-22 18:00:30.575284496 +0530 ++++ ./core/Controller/SvgController-new.php 2021-07-22 18:07:55.927091362 +0530 +@@ -81,7 +81,13 @@ + * @return DataDisplayResponse|NotFoundResponse + */ + public function getSvgFromCore(string $folder, string $fileName, string $color = 'ffffff') { +- $path = $this->serverRoot . "/core/img/$folder/$fileName.svg"; ++ $theme = \OC::$server->getConfig()->getSystemValue("theme"); ++ $path = $this->serverRoot . '/themes/' . $theme .'/core/img/' . $folder . '/' . $fileName . '.svg'; ++ if(file_exists($path)) { ++ return $this->getSvg($path, $color, $fileName); ++ } ++ ++ $path = $this->serverRoot . "/core/img/$folder/$fileName.svg"; + return $this->getSvg($path, $color, $fileName); + } + +@@ -103,7 +109,11 @@ + } catch (AppPathNotFoundException $e) { + return new NotFoundResponse(); + } +- ++ $theme = \OC::$server->getConfig()->getSystemValue("theme"); ++ $path = $this->serverRoot . '/themes/' . $theme .'/apps/' . $app . '/img/'. $fileName . '.svg'; ++ if(file_exists($path)) { ++ return $this->getSvg($path, $color, $fileName); ++ } + $path = $appPath . "/img/$fileName.svg"; + return $this->getSvg($path, $color, $fileName); + } diff --git a/patches/009-remove-external-sites-from-navigation.patch b/patches/009-remove-external-sites-from-navigation.patch new file mode 100644 index 0000000000000000000000000000000000000000..6b359727ca8a2d294af3f97e7fd67973577ce855 --- /dev/null +++ b/patches/009-remove-external-sites-from-navigation.patch @@ -0,0 +1,24 @@ +From: Akhil +Date: Tue, 28 Jul 2021 21:25:00 +0530 +Subject: [PATCH] Removes external results from navigation + +This patch removes external link results from navigation. External link results are those coming from the +"external sites" app + +diff --git ./lib/private/TemplateLayout.php ./lib/private/TemplateLayout-new.php +--- ./lib/private/TemplateLayout.php 2021-07-29 00:10:10.515495166 +0530 ++++ ./lib/private/TemplateLayout-new.php 2021-07-29 00:10:27.873160383 +0530 +@@ -105,7 +105,12 @@ + $this->assign('application', ''); + $this->assign('appid', $appId); + +- $navigation = $this->navigationManager->getAll(); ++ $navigation = $this->navigationManager->getAll(); ++ $navigation = array_filter($navigation, function($entry) { ++ if (strpos($entry["id"], "external_index") !== 0) { ++ return true; ++ } ++ }); + $this->assign('navigation', $navigation); + $settingsNavigation = $this->navigationManager->getAll('settings'); + $this->assign('settingsnavigation', $settingsNavigation);