diff --git a/Dockerfile b/Dockerfile index e261a593dfccda8be1bc11ff90fdf5d774dc8747..23313e1161418fc52a2bb50187eba67cafc01b24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,18 @@ FROM nextcloud:19.0.8-fpm ARG BASE_DIR="/usr/src/nextcloud" +ARG TMP_PATCH_DIR="/tmp/build_patches" ARG THEME_VERSION="19.0.8.2" ARG NEWS_VERSION="14.2.2" ARG QUOTA_WARN_VERSION="1.8.0" ARG CARNET_VERSION="0.23.7" +ARG NOTES_VERSION="3.6.4" RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images -COPY patches/ /tmp/build_patches/ +COPY patches/ ${TMP_PATCH_DIR}/ COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh RUN sed -i 's/19,0,8,1/19,0,8,6/' ${BASE_DIR}/version.php -# Patches -#RUN patch -u ${BASE_DIR}/core/signature.json -i /tmp/build_patches/001-sha512-signature.patch -RUN patch -u ${BASE_DIR}/core/Controller/LoginController.php -i /tmp/build_patches/002-login-without-domain.patch -RUN patch -u ${BASE_DIR}/core/templates/layout.user.php -i /tmp/build_patches/003-contact-search-removal.patch -RUN patch -u ${BASE_DIR}/core/Controller/ContactsMenuController.php -i /tmp/build_patches/004-contact-search-controller-removal.patch -RUN cd ${BASE_DIR} && patch -p0 < /tmp/build_patches/005-autocomplete-user-leak.patch -RUN rm -rf /tmp/build_patches/ - # Custom apps RUN curl -fsSL -o news.tar.gz \ "https://github.com/nextcloud/news/releases/download/${NEWS_VERSION}/news.tar.gz" && \ @@ -35,6 +29,20 @@ RUN curl -fsSL -o carnet_app.tar.gz \ tar -xf carnet_app.tar.gz -C ${BASE_DIR}/custom_apps/ && \ rm carnet_app.tar.gz; +RUN curl -fsSL -o notes.tar.gz \ + "https://github.com/nextcloud/notes/releases/download/v${NOTES_VERSION}/notes.tar.gz" && \ + tar -xf notes.tar.gz -C ${BASE_DIR}/custom_apps/ && \ + rm notes.tar.gz; + +# Patches +#RUN patch -u ${BASE_DIR}/core/signature.json -i ${TMP_PATCH_DIR}/001-sha512-signature.patch +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 +RUN patch -u ${BASE_DIR}/core/Controller/ContactsMenuController.php -i ${TMP_PATCH_DIR}/004-contact-search-controller-removal.patch +RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete-user-leak.patch +RUN patch -u ${BASE_DIR}/custom_apps/notes/lib/Service/NoteUtil.php -i ${TMP_PATCH_DIR}/006-notes-url-fix.patch +RUN rm -rf ${TMP_PATCH_DIR} + # Custom theme RUN curl -fsSL -o eelo-theme.tar.gz \ "https://gitlab.e.foundation/e/infra/nextcloud-theme/-/archive/${THEME_VERSION}/nextcloud-theme-${THEME_VERSION}.tar.gz" && \ diff --git a/custom_entrypoint.sh b/custom_entrypoint.sh index 14925e9c078afb643d6c283c7ede5e0677e4fb5a..1732ca15d933e954b92f011ab57f057d19a4ea0b 100644 --- a/custom_entrypoint.sh +++ b/custom_entrypoint.sh @@ -3,10 +3,15 @@ echo "Custom eCloud entrypoint" rsync_options="-rlDog --chown www-data:www-data --delete" -rsync $rsync_options --include "/news/" --exclude '/*' /usr/src/nextcloud/custom_apps/ /var/www/html/custom_apps/ -rsync $rsync_options --include "/quota_warning/" --exclude '/*' /usr/src/nextcloud/custom_apps/ /var/www/html/custom_apps/ -rsync $rsync_options --include "/carnet/" --exclude '/*' /usr/src/nextcloud/custom_apps/ /var/www/html/custom_apps/ -rsync $rsync_options --include "/eelo/" --exclude '/*' /usr/src/nextcloud/themes/ /var/www/html/themes/ +SRC_DIR="/usr/src/nextcloud" +DST_DIR="/var/www/html" + +rsync $rsync_options --include "/news/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ +rsync $rsync_options --include "/notes/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ +rsync $rsync_options --include "/quota_warning/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ +rsync $rsync_options --include "/carnet/" --exclude '/*' $SRC_DIR/custom_apps/ $DST_DIR/custom_apps/ + +rsync $rsync_options --include "/eelo/" --exclude '/*' $SRC_DIR/themes/ $DST_DIR/themes/ /entrypoint.sh "$@" echo "bye bye NC" diff --git a/patches/006-notes-url-fix.patch b/patches/006-notes-url-fix.patch new file mode 100644 index 0000000000000000000000000000000000000000..5749edefed33c19480ca7ae251eedb9501832014 --- /dev/null +++ b/patches/006-notes-url-fix.patch @@ -0,0 +1,45 @@ +--- ../../notes-3.6.4/lib/Service/NoteUtilOriginal.php 2020-12-21 13:45:50.215222624 +0530 ++++ ../../notes-3.6.4/lib/Service/NoteUtil.php 2020-12-21 13:47:24.277418659 +0530 +@@ -86,23 +86,25 @@ + + // if file does not exist, that name has not been taken. Similar we don't + // need to handle file collisions if it is the filename did not change +- if (!$folder->nodeExists($filename) || $folder->get($filename)->getId() === $id) { +- return $filename; +- } else { +- // increments name (2) to name (3) +- $match = preg_match('/\((?P\d+)\)$/u', $title, $matches); +- if ($match) { +- $newId = ((int) $matches['id']) + 1; +- $newTitle = preg_replace( +- '/(.*)\s\((\d+)\)$/u', +- '$1 (' . $newId . ')', +- $title +- ); +- } else { +- $newTitle = $title . ' (2)'; +- } +- return $this->generateFileName($folder, $newTitle, $suffix, $id); +- } ++ while($folder->nodeExists($filename) ) { ++ $file = $folder->get($filename); ++ if($file && $file->getId() === $id) { ++ return $filename; ++ } ++ $match = preg_match('/\((?P\d+)\)$/u', $title, $matches); ++ if ($match) { ++ $newId = ((int) $matches['id']) + 1; ++ $title = preg_replace( ++ '/(.*)\s\((\d+)\)$/u', ++ '$1 (' . $newId . ')', ++ $title ++ ); ++ } else { ++ $title = $title . ' (2)'; ++ } ++ $filename = $title . $suffix; ++ } ++ return $filename; + } + + public function getSafeTitle(string $content) : string {