From ba6167eb5d78242d0889b83b75e5ce38910b0d01 Mon Sep 17 00:00:00 2001 From: Thomas Berger Date: Wed, 20 Mar 2019 21:01:11 +0100 Subject: [PATCH 01/99] optimize Dockerfile - use stretch-slim instead of stretch - use multistage builds --- Dockerfile | 53 ++++++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/Dockerfile b/Dockerfile index c23916fc7..110c4106f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,26 @@ -# 6-stretch is the ONLY node 6 release supported by arm32v7, arm64v8 and x86-64 docker hub labels -FROM node:6-stretch +# We use multi stage builds +FROM node:6-stretch-slim AS build + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq git jq python +RUN npm install -g bower + +# install tini in this stage to avoid the need of jq and python +# in the final image +ADD docker-install-tini.sh /usr/local/bin/docker-install-tini.sh +RUN /usr/local/bin/docker-install-tini.sh + +COPY . /cryptpad +WORKDIR /cryptpad + +RUN npm install --production \ + && npm install -g bower \ + && bower install --allow-root + +FROM node:6-stretch-slim # You want USE_SSL=true if not putting cryptpad behind a proxy ENV USE_SSL=false -ENV STORAGE=\'./storage/file\' +ENV STORAGE="'./storage/file'" ENV LOG_TO_STDOUT=true # Persistent storage needs @@ -16,36 +33,14 @@ VOLUME /cryptpad/block VOLUME /cryptpad/blob VOLUME /cryptpad/blobstage -# Required packages -# jq is a build only dependency, removed in cleanup stage -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - git jq python +# Copy cryptpad and tini from the build container +COPY --from=build /sbin/tini /sbin/tini +COPY --from=build /cryptpad /cryptpad -# Install tini for faux init -# sleep 1 is to ensure overlay2 can catch up with the copy prior to running chmod -COPY ./docker-install-tini.sh / -RUN chmod a+x /docker-install-tini.sh \ - && sleep 1 \ - && /docker-install-tini.sh \ - && rm /docker-install-tini.sh - -# Cleanup apt -RUN apt-get remove -y --purge jq python \ - && apt-get auto-remove -y \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -# Install cryptpad -COPY . /cryptpad WORKDIR /cryptpad -RUN npm install --production \ - && npm install -g bower \ - && bower install --allow-root # Unsafe / Safe ports EXPOSE 3000 3001 # Run cryptpad on startup -CMD ["/sbin/tini", "--", "/cryptpad/container-start.sh"] - +CMD ["/sbin/tini", "--", "/cryptpad/container-start.sh"] \ No newline at end of file From 7cd4df3e7f7ef54f02a95fcac537e5bde1a858d2 Mon Sep 17 00:00:00 2001 From: Florian Knodt Date: Thu, 9 May 2019 13:54:11 +0200 Subject: [PATCH 02/99] cryptpad-docker: Missing \ --- docs/cryptpad-docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cryptpad-docker.md b/docs/cryptpad-docker.md index 2647da319..12018902e 100644 --- a/docs/cryptpad-docker.md +++ b/docs/cryptpad-docker.md @@ -21,7 +21,7 @@ Run from the cryptpad source directory, keeping instance state in `/var/cryptpad docker build -t xwiki/cryptpad . docker run --restart=always -d --name cryptpad -p 3000:3000 -p 3001:3001 \ -v /var/cryptpad/files:/cryptpad/datastore \ --v /var/cryptpad/customize:/cryptpad/customize +-v /var/cryptpad/customize:/cryptpad/customize \ -v /var/cryptpad/blob:/cryptpad/blob \ -v /var/cryptpad/blobstage:/cryptpad/blobstage \ -v /var/cryptpad/pins:/cryptpad/pins \ From 04cddf58cf7b977e7d38706a54366e2b408e6705 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Tue, 14 May 2019 16:37:10 +0200 Subject: [PATCH 03/99] tweak the bower dependencies work around a missing bower2nix features. see https://github.com/rvl/bower2nix/issues/19 --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 1021dbf62..b362c0a5f 100644 --- a/bower.json +++ b/bower.json @@ -45,7 +45,7 @@ "localforage": "^1.5.2", "html2canvas": "^0.4.1", "croppie": "^2.5.0", - "sortablejs": "#^1.6.0", + "sortablejs": "^1.6.0", "saferphore": "^0.0.1", "jszip": "Stuk/jszip#^3.1.5", "requirejs-plugins": "^1.0.3" From 35dd3abbb5ef6e3f9d5fb0b31b693c430d159b4a Mon Sep 17 00:00:00 2001 From: zimbatm Date: Tue, 14 May 2019 21:43:19 +0200 Subject: [PATCH 04/99] make the config path configurable --- lib/load-config.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/load-config.js b/lib/load-config.js index 7b9f73251..80f4706dc 100644 --- a/lib/load-config.js +++ b/lib/load-config.js @@ -1,11 +1,14 @@ +/* jslint node: true */ +"use strict"; var config; +var configPath = process.env.CRYPTPAD_CONFIG || "../config/config"; try { - config = require("../config/config"); + config = require(configPath); if (config.adminEmail === 'i.did.not.read.my.config@cryptpad.fr') { console.log("You can configure the administrator email (adminEmail) in your config/config.js file"); } } catch (e) { - console.log("You can customize the configuration by copying config/config.example.js to config/config.js"); + console.log("Config not found, loading the example config. You can customize the configuration by copying config/config.example.js to " + configPath); config = require("../config/config.example"); } module.exports = config; From d317053db47ed37b1c2c964269aa8be1e6a653f0 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 28 May 2019 14:14:09 +0200 Subject: [PATCH 05/99] Increase tab/worker timeout value --- www/common/outer/async-store.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/common/outer/async-store.js b/www/common/outer/async-store.js index 39aac9b54..ad9982030 100644 --- a/www/common/outer/async-store.js +++ b/www/common/outer/async-store.js @@ -1816,8 +1816,8 @@ define([ // Ping clients regularly to make sure one tab was not closed without sending a removeClient() // command. This allow us to avoid phantom viewers in pads. - var PING_INTERVAL = 30000; - var MAX_PING = 5000; + var PING_INTERVAL = 120000; + var MAX_PING = 30000; var MAX_FAILED_PING = 2; setInterval(function () { From 8b200817ee46f538271be3652fd2c7c7a0d8bb2e Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 28 May 2019 14:28:51 +0200 Subject: [PATCH 06/99] Fix translation issue with weblate pushing empty strings --- customize.dist/messages.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/customize.dist/messages.js b/customize.dist/messages.js index 68b6083d6..f389d3cbc 100755 --- a/customize.dist/messages.js +++ b/customize.dist/messages.js @@ -69,10 +69,25 @@ define(req, function(Util, AppConfig, Default, Language) { }); } - Util.extend(messages, Default); + var extend = function (a, b) { + for (var k in b) { + if (Util.isObject(b[k])) { + a[k] = Util.isObject(a[k]) ? a[k] : {}; + extend(a[k], b[k]); + continue; + } + if (Array.isArray(b[k])) { + a[k] = b[k].slice(); + continue; + } + a[k] = b[k] || a[k]; + } + }; + + extend(messages, Default); if (Language && language !== defaultLanguage) { // Add the translated keys to the returned object - Util.extend(messages, Language); + extend(messages, Language); } messages._languages = map; From 9aceb339ef453299989316c9ca3e2109dee8c435 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 28 May 2019 14:38:13 +0200 Subject: [PATCH 07/99] Update UI for pending friend request --- www/common/toolbar3.js | 6 ++++-- www/common/translations/messages.json | 5 ----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 6eb8d0596..185eb6608 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -304,8 +304,10 @@ MessengerUI, Messages) { } else if (Common.isLoggedIn() && data.curvePublic && !friends[data.curvePublic] && !priv.readOnly) { if (pendingFriends[data.curvePublic] && pendingFriends[data.curvePublic] > friendTo) { - $('', {'class': 'cp-toolbar-userlist-friend'}).text(Messages.userlist_pending) - .appendTo($rightCol); + $('