Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 746871ad authored by Arnau Vàzquez's avatar Arnau Vàzquez
Browse files

Merge branch 'notes_patch' into 'master'

Notes patch

See merge request !4
parents e59334bf 66046f98
Loading
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
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" && \
+9 −4
Original line number Diff line number Diff line
@@ -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"
+45 −0
Original line number Diff line number Diff line
--- ../../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<id>\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<id>\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 {