diff --git a/Dockerfile b/Dockerfile index a786563fccaf88d0fd482e5af58f3241007e5ad5..11bc0466d5cfea69786d7b9bc9ca70d104c51498 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,24 @@ -FROM nextcloud:20.0.12-fpm +FROM nextcloud:21.0.7-fpm AS nextcloud ARG BASE_DIR="/usr/src/nextcloud" ARG TMP_PATCH_DIR="/tmp/build_patches" -ARG THEME_VERSION="20.1.2" -ARG THEME_HELPER_VERSION="1.0.1" -ARG NEWS_VERSION="16.0.1" -ARG QUOTA_WARN_VERSION="1.9.1" -ARG NOTES_VERSION="4.1.1" -ARG CONTACTS_VERSION="4.0.1" -ARG CALENDAR_VERSION="2.3.3" -ARG USER_BACKEND_RAW_SQL_VERSION="1.1.0" +# temporarily setting theme version to "nc21" to test +ARG THEME_VERSION="21.0.0" +ARG THEME_HELPER_VERSION="1.0.2" +ARG NEWS_VERSION="16.2.1" +ARG QUOTA_WARN_VERSION="1.11.0" +ARG NOTES_VERSION="4.2.0" +ARG CONTACTS_VERSION="4.0.6" +ARG CALENDAR_VERSION="2.3.4" +ARG USER_BACKEND_RAW_SQL_VERSION="1.1.1" ARG EMAIL_RECOVERY_JOB_ID="199763" ARG RAINLOOP_VERSION="7.1.2" ARG RAINLOOP_COMMIT_SHA="aa5c57a7" -ARG EDA_TAG="nc-20" -ARG ECLOUD_LAUNCHER_JOB_ID="204816" -ARG GOOGLE_INTEGRATION_VERSION="1.0.5-1-nightly" +ARG EDA_TAG="nc-21" +ARG ECLOUD_LAUNCHER_JOB_ID="222001" +ARG GOOGLE_INTEGRATION_VERSION="1.0.6" -RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images COPY patches/ ${TMP_PATCH_DIR}/ -COPY custom_entrypoint.sh / -RUN chmod +x /custom_entrypoint.sh -RUN sed -i 's/20,0,12,1/20,0,12,14/' ${BASE_DIR}/version.php +RUN sed -i 's/21,0,7,0/21,0,7,8/' ${BASE_DIR}/version.php # Install unzip for unzipping artifacts RUN apt-get update && apt-get install unzip @@ -32,7 +30,7 @@ RUN curl -fsSL -o news.tar.gz \ rm news.tar.gz; RUN curl -fsSL -o quota_warning.tar.gz \ - "https://github.com/nextcloud/quota_warning/releases/download/v${QUOTA_WARN_VERSION}/quota_warning-${QUOTA_WARN_VERSION}.tar.gz" && \ + "https://github.com/nextcloud-releases/quota_warning/releases/download/v${QUOTA_WARN_VERSION}/quota_warning-${QUOTA_WARN_VERSION}.tar.gz" && \ tar -xf quota_warning.tar.gz -C ${BASE_DIR}/custom_apps/ && \ rm quota_warning.tar.gz; @@ -98,9 +96,6 @@ RUN apt-get -y remove unzip # force eCloud theme not to be disabled even when there is an upgrade process launched RUN sed -i "s/\$systemConfig->setValue('theme', '');/\$systemConfig->setValue('theme', 'eCloud');/g" ${BASE_DIR}/lib/base.php -# fix min version of google data migration app -RUN sed -i "s/min-version=\"22\"/min-version=\"20\"/" ${BASE_DIR}/custom_apps/integration_google/appinfo/info.xml - # Patches RUN patch -u ${BASE_DIR}/core/Controller/LoginController.php -i ${TMP_PATCH_DIR}/002-login-without-domain.patch RUN patch -u ${BASE_DIR}/core/templates/layout.user.php -i ${TMP_PATCH_DIR}/003-contact-search-removal.patch @@ -120,8 +115,10 @@ RUN rm -rf ${TMP_PATCH_DIR} # autocomplete leak tweak apps frontend with sed, disable group suggestion RUN cd ${BASE_DIR}/custom_apps/contacts && sed -i 's/"GROUP","INDIVIDUAL"/"INDIVIDUAL"/g' js/contacts-main.js +RUN cd ${BASE_DIR}/custom_apps/contacts && sed -i 's/emit("new-contact")/emit("newContact")/g' js/contacts-main.js RUN cd ${BASE_DIR}/custom_apps/calendar && sed -i 's/"GROUP","INDIVIDUAL"/"INDIVIDUAL"/g' js/calendar.js -RUN cd ${BASE_DIR}/custom_apps/calendar && sed -i 's/anyof/allof/g' js/calendar.js +RUN cd ${BASE_DIR}/custom_apps/calendar && sed -i 's/{name:\[a,"displayname"\]},//' js/calendar.js +RUN cd ${BASE_DIR}/custom_apps/calendar && sed -i 's/defaultValue:"PUBLIC"/defaultValue:"CONFIDENTIAL"/' js/calendar.js # Set default widgets to calendar, tasks and notes RUN sed -i 's/recommendations,spreed,mail,calendar/calendar,tasks,notes/' ${BASE_DIR}/apps/dashboard/lib/Controller/DashboardController.php @@ -129,6 +126,11 @@ RUN sed -i 's/recommendations,spreed,mail,calendar/calendar,tasks,notes/' ${BASE # Remove colored background from email template logo RUN sed -i 's/$this->header, \[$this->themingDefaults->getColorPrimary()/$this->header, \["none"/' ${BASE_DIR}/lib/private/Mail/EMailTemplate.php +# fix min version of google data migration app +RUN sed -i "s/min-version=\"22\"/min-version=\"21\"/" ${BASE_DIR}/custom_apps/integration_google/appinfo/info.xml +RUN sed -i 's/ in Nextcloud/ /' ${BASE_DIR}/custom_apps/integration_google/js/integration_google-personalSettings.js +RUN sed -i 's/Nextcloud administrator/administrator/' ${BASE_DIR}/custom_apps/integration_google/js/integration_google-personalSettings.js + # Custom theme RUN curl -fsSL -o eCloud-theme.tar.gz \ "https://gitlab.e.foundation/e/infra/nextcloud-theme/-/archive/${THEME_VERSION}/nextcloud-theme-${THEME_VERSION}.tar.gz" && \ @@ -140,5 +142,112 @@ RUN curl -fsSL -o eCloud-theme.tar.gz \ # Replace "Get your own free account" NC link with /e/ Account link in public pages RUN sed -i 's/https:\/\/nextcloud.com\/signup\//https:\/\/e\.foundation\/\/e-email-invite\//' ${BASE_DIR}/core/templates/layout.public.php +# Use php 8 image +FROM php:8.0.12-fpm-bullseye +RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images + +# Copy all the required files from the nextcloud stage +COPY --from=nextcloud /usr/src/nextcloud /usr/src/nextcloud +COPY --from=nextcloud /usr/local/etc/php/conf.d/ /usr/local/etc/php/conf.d/ +COPY --from=nextcloud /*.sh / +COPY --from=nextcloud /upgrade.exclude / +COPY --from=nextcloud /var/spool/cron/crontabs /var/spool/cron/crontabs +COPY --from=nextcloud /entrypoint.sh / + +# Copy entrypoints and add correct permissions +COPY custom_entrypoint.sh / +RUN chmod +x /custom_entrypoint.sh +RUN chmod +x /entrypoint.sh + +# Install required dependencies of nextcloud +RUN set -ex; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + rsync \ + bzip2 \ + busybox-static \ + libldap-common \ + ; \ + rm -rf /var/lib/apt/lists/*; + +# install the PHP extensions we need +# see https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html +ENV PHP_MEMORY_LIMIT 512M +ENV PHP_UPLOAD_LIMIT 512M +RUN set -ex; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libcurl4-openssl-dev \ + libevent-dev \ + libfreetype6-dev \ + libicu-dev \ + libjpeg-dev \ + libldap2-dev \ + libmcrypt-dev \ + libmemcached-dev \ + libpng-dev \ + libpq-dev \ + libxml2-dev \ + libmagickwand-dev \ + libzip-dev \ + libwebp-dev \ + libgmp-dev \ + ; \ + \ + debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \ + docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \ + docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \ + docker-php-ext-install -j "$(nproc)" \ + bcmath \ + exif \ + gd \ + intl \ + ldap \ + opcache \ + pcntl \ + pdo_mysql \ + pdo_pgsql \ + zip \ + gmp \ + ; \ + \ +# pecl will claim success even if one install fails, so we need to perform each install separately + pecl install APCu-5.1.21; \ + pecl install memcached-3.1.5; \ + pecl install redis-5.3.4; \ + pecl install imagick-3.5.1; \ + \ + docker-php-ext-enable \ + apcu \ + memcached \ + redis \ + imagick \ + ; \ + rm -r /tmp/pear; \ + \ +# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ + | awk '/=>/ { print $3 }' \ + | sort -u \ + | xargs -r dpkg-query -S \ + | cut -d: -f1 \ + | sort -u \ + | xargs -rt apt-mark manual; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; + +# Install imagemagick +RUN apt-get -y install imagemagick;\ + rm -rf /var/lib/apt/lists/*; + +VOLUME /var/www/html +ENV NEXTCLOUD_VERSION 21.0.7 + ENTRYPOINT ["/custom_entrypoint.sh"] -CMD ["php-fpm"] +CMD ["php-fpm"] \ No newline at end of file diff --git a/custom_entrypoint.sh b/custom_entrypoint.sh index 36dfb301e73e299cfb0b877fd29cc00c7ffdc4a0..65ebb0f0fd40129a7b2035a20f6ea419bcd12198 100644 --- a/custom_entrypoint.sh +++ b/custom_entrypoint.sh @@ -29,6 +29,7 @@ if version_greater "$image_version" "$installed_version"; then rsync $rsync_options --include "/ecloud_drop_account/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ rsync $rsync_options --include "/ecloud-theme-helper/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ rsync $rsync_options --include "/ecloud-launcher/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + rsync $rsync_options --include "/integration_google/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ rsync $rsync_options --include "/eCloud/" --exclude '/*' $SRC_DIR/themes/ $DST_DIR/themes/ else diff --git a/patches/005-autocomplete-user-leak-core.patch b/patches/005-autocomplete-user-leak-core.patch index ea8b0f9f76bb73e9b1266c06fad1cb19e0d93a02..51c01eddda9466279df92bf2e3cce60e2d1c87ca 100644 --- a/patches/005-autocomplete-user-leak-core.patch +++ b/patches/005-autocomplete-user-leak-core.patch @@ -26,7 +26,7 @@ diff --git lib/private/Collaboration/Collaborators/UserPlugin.php lib/private/Co diff --git lib/private/Collaboration/Collaborators/MailPlugin.php lib/private/Collaboration/Collaborators/MailPlugin-new.php --- lib/private/Collaboration/Collaborators/MailPlugin.php 2021-06-22 14:53:24.451402977 +0530 +++ lib/private/Collaboration/Collaborators/MailPlugin-new.php 2021-06-22 14:56:31.201379020 +0530 -@@ -36,6 +36,7 @@ +@@ -37,6 +37,7 @@ use OCP\IConfig; use OCP\IGroupManager; use OCP\IUser; @@ -34,22 +34,24 @@ diff --git lib/private/Collaboration/Collaborators/MailPlugin.php lib/private/Co use OCP\IUserSession; use OCP\Share\IShare; -@@ -56,12 +57,13 @@ - /** @var IUserSession */ - private $userSession; - -- public function __construct(IManager $contactsManager, ICloudIdManager $cloudIdManager, IConfig $config, IGroupManager $groupManager, IUserSession $userSession) { -+ public function __construct(IManager $contactsManager, ICloudIdManager $cloudIdManager, IConfig $config, IGroupManager $groupManager, IUserSession $userSession, IUserManager $userManager) { +@@ -71,13 +72,15 @@ + IConfig $config, + IGroupManager $groupManager, + KnownUserService $knownUserService, +- IUserSession $userSession) { ++ IUserSession $userSession, ++ IUserManager $userManager) { $this->contactsManager = $contactsManager; $this->cloudIdManager = $cloudIdManager; $this->config = $config; $this->groupManager = $groupManager; - $this->userSession = $userSession; -+ $this->userManager = $userManager; + $this->knownUserService = $knownUserService; + $this->userSession = $userSession; ++ $this->userManager = $userManager; $this->shareeEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; $this->shareWithGroupOnly = $this->config->getAppValue('core', 'shareapi_only_share_with_group_members', 'no') === 'yes'; -@@ -185,43 +187,78 @@ +@@ -209,27 +212,62 @@ if ($exactEmailMatch) { $searchResult->markExactIdMatch($emailType); } @@ -103,53 +105,32 @@ diff --git lib/private/Collaboration/Collaborators/MailPlugin.php lib/private/Co - ], - ]; + $isUserinInstance = $this->userManager->get($emailAddress); -+ if ($isUserinInstance === null) { -+ // /e/ user is not in ecloud -+ $result['wide'][] = [ -+ 'label' => $displayName, -+ 'uuid' => $contact['UID'], -+ 'name' => $contact['FN'], -+ 'type' => $emailAddressType ?? '', -+ 'value' => [ -+ 'shareType' => IShare::TYPE_EMAIL, -+ 'shareWith' => $emailAddress, -+ ], -+ ]; -+ } else { -+ // /e/ user IS an ecloud user, convert to user share type -+ if (!$isUserinInstance->isEnabled()) { -+ // Ignore disabled users -+ continue; -+ } -+ $result['wide'][] = [ -+ 'label' => $displayName, -+ 'value' => [ -+ 'shareType' => IShare::TYPE_USER, -+ 'shareWith' => $emailAddress, -+ ], -+ ]; -+ } ++ if ($isUserinInstance === null) { ++ // /e/ user is not in ecloud ++ $result['wide'][] = [ ++ 'label' => $displayName, ++ 'uuid' => $contact['UID'], ++ 'name' => $contact['FN'], ++ 'type' => $emailAddressType ?? '', ++ 'value' => [ ++ 'shareType' => IShare::TYPE_EMAIL, ++ 'shareWith' => $emailAddress, ++ ], ++ ]; ++ } else { ++ // /e/ user IS an ecloud user, convert to user share type ++ if (!$isUserinInstance->isEnabled()) { ++ // Ignore disabled users ++ continue; ++ } ++ $result['wide'][] = [ ++ 'label' => $displayName, ++ 'value' => [ ++ 'shareType' => IShare::TYPE_USER, ++ 'shareWith' => $emailAddress, ++ ], ++ ]; ++ } } } } - } - - $reachedEnd = true; -- if (!$this->shareeEnumeration) { -- $result['wide'] = []; -- $userResults['wide'] = []; -- } else { -+// if (!$this->shareeEnumeration) { -+// $result['wide'] = []; -+// $userResults['wide'] = []; -+// } else { - $reachedEnd = (count($result['wide']) < $offset + $limit) && - (count($userResults['wide']) < $offset + $limit); - - $result['wide'] = array_slice($result['wide'], $offset, $limit); - $userResults['wide'] = array_slice($userResults['wide'], $offset, $limit); -- } -+// } - - - if (!$searchResult->hasExactIdMatch($emailType) && filter_var($search, FILTER_VALIDATE_EMAIL)) { diff --git a/patches/006-recovery-email-changes.patch b/patches/006-recovery-email-changes.patch index be661bc7efe97d771987d90ef6f42e78338c2218..adc5377e577ae173f41f6c47e8ccf87ba76163ea 100644 --- a/patches/006-recovery-email-changes.patch +++ b/patches/006-recovery-email-changes.patch @@ -54,12 +54,13 @@ diff --git ./core/Controller/LostController.php ./core/Controller/LostController diff --git ./apps/settings/templates/settings/personal/personal.info.php ./apps/settings/templates/settings/personal/personal.info.new.php --- ./apps/settings/templates/settings/personal/personal.info.php 2021-04-22 07:49:34.926418855 +0530 +++ ./apps/settings/templates/settings/personal/personal.info.new.php 2021-04-22 07:50:00.026660710 +0530 -@@ -160,7 +160,7 @@ +@@ -157,7 +157,7 @@ print_unescaped('class="hidden"'); } ?> placeholder="t('Your email address')); ?>" - autocomplete="on" autocapitalize="none" autocorrect="off" /> + autocomplete="on" autocapitalize="none" autocorrect="off" readonly /> - + + diff --git a/patches/008-icons-cacher-theme-svgs.patch b/patches/008-icons-cacher-theme-svgs.patch index 3a1aac74c20b96e89900b7f456f526eaa5da56ce..11a7d2d6995c9989f7a32a089aaa2fb02de61c66 100644 --- a/patches/008-icons-cacher-theme-svgs.patch +++ b/patches/008-icons-cacher-theme-svgs.patch @@ -6,40 +6,42 @@ 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 = ''; +--- ./lib/private/Template/IconsCacher.php 2021-11-16 11:42:40.162071882 +0530 ++++ ./lib/private/Template/IconsCacher-new.php 2021-11-16 11:59:07.575908578 +0530 +@@ -162,21 +162,29 @@ $color = ''; $base = $this->getRoutePrefix() . '/svg/'; -- $cleanUrl = \substr($url, \strlen($base)); -+ $cleanUrl = \substr($url, \strlen($base)); -+ $theme = \OC::$server->getConfig()->getSystemValue("theme"); + $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; + 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'; -+ } ++ $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'; +- $appPath = \OC_App::getAppPath($app); +- if ($appPath !== false) { +- $location = $appPath . '/img/' . $cleanUrl . '.svg'; +- } - if ($app === 'settings') { - $location = \OC::$SERVERROOT . '/settings/img/' . $cleanUrl . '.svg'; -- } -+ $location = \OC::$SERVERROOT . '/themes/' . $theme . '/apps/' . $app . '/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'; -+ } ++ $appPath = \OC_App::getAppPath($app); ++ if ($appPath !== false) { ++ $location = $appPath . '/img/' . $cleanUrl . '.svg'; ++ } ++ if ($app === 'settings') { ++ $location = \OC::$SERVERROOT . '/settings/img/' . $cleanUrl . '.svg'; + } + } } } - return [ diff --git a/patches/010-disable-app-store-upgrade.patch b/patches/010-disable-app-store-upgrade.patch index 0810c6e2e186ac4acc2886e28a67dabbad0ce3c1..569905c90f84a0e8536745c41f2d5f89b94d0fec 100644 --- a/patches/010-disable-app-store-upgrade.patch +++ b/patches/010-disable-app-store-upgrade.patch @@ -4,18 +4,19 @@ Subject: [PATCH] Disables app store checking during "occ upgrade" This patch disables checking the app store for app updates during "occ upgrade" ---- ./lib/private/Updater.php 2021-08-11 19:46:04.607195791 +0530 -+++ ./lib/private/Updater-new.php 2021-08-11 19:46:15.173946740 +0530 -@@ -261,9 +261,9 @@ - \OC::$server->getAppFetcher()->setVersion($currentVersion); +--- ./lib/private/Updater.php 2021-11-16 12:12:35.631823438 +0530 ++++ ./lib/private/Updater-new.php 2021-11-16 12:14:28.445155684 +0530 +@@ -268,11 +268,11 @@ + $appManager = \OC::$server->getAppManager(); // upgrade appstore apps -- $this->upgradeAppStoreApps(\OC::$server->getAppManager()->getInstalledApps()); -- $autoDisabledApps = \OC::$server->getAppManager()->getAutoDisabledApps(); -- $this->upgradeAppStoreApps($autoDisabledApps, true); -+ //$this->upgradeAppStoreApps(\OC::$server->getAppManager()->getInstalledApps()); -+ //$autoDisabledApps = \OC::$server->getAppManager()->getAutoDisabledApps(); -+ //$this->upgradeAppStoreApps($autoDisabledApps, true); +- $this->upgradeAppStoreApps($appManager->getInstalledApps()); ++ /*$this->upgradeAppStoreApps($appManager->getInstalledApps()); + $autoDisabledApps = $appManager->getAutoDisabledApps(); + if (!empty($autoDisabledApps)) { + $this->upgradeAppStoreApps(array_keys($autoDisabledApps), $autoDisabledApps); +- } ++ }*/ // install new shipped apps on upgrade $errors = Installer::installShippedApps(true);