mirror of https://github.com/xwiki-labs/cryptpad
Merge branch 'staging' into appconfig_ui
This commit is contained in:
commit
d010c60550
|
@ -7,6 +7,7 @@ www/components/
|
|||
www/bower_components/
|
||||
www/common/onlyoffice/dist
|
||||
www/common/onlyoffice/x2t
|
||||
onlyoffice-dist/
|
||||
|
||||
www/scratch
|
||||
www/accounts
|
||||
|
|
|
@ -49,13 +49,10 @@ module.exports = {
|
|||
|
||||
// TODO remove these exceptions from the eslint defaults
|
||||
'no-irregular-whitespace': ['off'],
|
||||
'no-unused-vars': ['warn'],
|
||||
'no-self-assign': ['off'],
|
||||
'no-empty': ['off'],
|
||||
'no-useless-escape': ['off'],
|
||||
'no-redeclare': ['off'],
|
||||
'no-extra-boolean-cast': ['off'],
|
||||
'no-global-assign': ['off'],
|
||||
'no-prototype-builtins': ['off'],
|
||||
}
|
||||
};
|
||||
|
|
|
@ -22,14 +22,15 @@ RUN npm install --production \
|
|||
# Create actual CryptPad image
|
||||
FROM node:lts-slim
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt update && apt install -y git rdfind && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create user and group for CryptPad so it does not run as root
|
||||
RUN groupadd cryptpad -g 4001
|
||||
RUN useradd cryptpad -u 4001 -g 4001 -d /cryptpad
|
||||
|
||||
# Install wget for healthcheck
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y wget && \
|
||||
# Install curl for healthcheck
|
||||
# Install git, rdfind and unzip for install-onlyoffice.sh
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
||||
curl ca-certificates git rdfind unzip && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
@ -56,7 +57,7 @@ VOLUME /cryptpad/datastore
|
|||
ENTRYPOINT ["/bin/bash", "/cryptpad/docker-entrypoint.sh"]
|
||||
|
||||
# Healthcheck
|
||||
HEALTHCHECK --interval=1m CMD wget --no-verbose --tries=1 http://localhost:3000/ -q -O /dev/null || exit 1
|
||||
HEALTHCHECK --interval=1m CMD curl -f http://localhost:3000/ || exit 1
|
||||
|
||||
# Ports
|
||||
EXPOSE 3000 3001 3003
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals module */
|
||||
|
||||
/* DISCLAIMER:
|
||||
|
||||
There are two recommended methods of running a CryptPad instance:
|
||||
|
@ -89,9 +87,10 @@ module.exports = {
|
|||
*/
|
||||
//httpPort: 3000,
|
||||
|
||||
/* httpSafePort allows you to specify an alternative port from which
|
||||
* the node process should serve sandboxed assets. The default value is
|
||||
* that of your httpPort + 1. You probably don't need to change this.
|
||||
/* httpSafePort purpose is to emulate another origin for the sandbox when
|
||||
* you don't have two domains at hand (i.e. when httpSafeOrigin not defined).
|
||||
* It is meant to be used only in case where you are working on a local
|
||||
* development instance. The default value is your httpPort + 1.
|
||||
*
|
||||
*/
|
||||
//httpSafePort: 3001,
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
}
|
||||
.cp-reminder, .cp-avatar {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background-color: @cp_dropdown-bg-hover;
|
||||
}
|
||||
}
|
||||
.cp-avatar {
|
||||
.avatar_main(30px);
|
||||
|
@ -61,9 +58,6 @@
|
|||
}
|
||||
&.cp-clickable {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background-color: @cp_dropdown-bg-hover;
|
||||
}
|
||||
}
|
||||
}
|
||||
.cp-notification-dismiss {
|
||||
|
@ -73,9 +67,6 @@
|
|||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background-color: @cp_dropdown-bg-hover;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,6 +77,12 @@
|
|||
&:hover {
|
||||
background-color: contrast(@cp_toolbar-bg, darken(@cp_toolbar-bg, 5%), lighten(@cp_toolbar-bg, 5%));
|
||||
}
|
||||
&:focus {
|
||||
outline: @cryptpad_color_brand solid 2px;
|
||||
}
|
||||
}
|
||||
button:nth-of-type(1) {
|
||||
margin-left: 0.3rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,13 @@
|
|||
# in production and require professional support please contact sales@cryptpad.fr
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
http2 on;
|
||||
|
||||
# Let's Encrypt webroot
|
||||
include letsencrypt-webroot;
|
||||
|
||||
# Include mime.types to be able to support .mjs files (see "types" below)
|
||||
include mime.types;
|
||||
|
||||
|
@ -82,6 +84,9 @@ server {
|
|||
# replace with the IP address of your resolver
|
||||
resolver 8.8.8.8 8.8.4.4 1.1.1.1 1.0.0.1 9.9.9.9 149.112.112.112 208.67.222.222 208.67.220.220;
|
||||
|
||||
# OnlyOffice fonts may be loaded from both domains
|
||||
if ($uri ~ ^\/common\/onlyoffice\/.*\/fonts\/.*$) { set $allowed_origins "*"; }
|
||||
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header Access-Control-Allow-Origin "${allowed_origins}";
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
# in production and require professional support please contact sales@cryptpad.fr
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
http2 on;
|
||||
|
||||
# Let's Encrypt webroot
|
||||
include letsencrypt-webroot;
|
||||
|
|
|
@ -33,7 +33,8 @@ main () {
|
|||
install_version v4 6ebc6938
|
||||
install_version v5 88a356f0
|
||||
install_version v6 abd8a309
|
||||
install_version v7 9d8b914a
|
||||
install_version v7 ba82142f
|
||||
install_x2t v7.3+1 ab0c05b0e4c81071acea83f0c6a8e75f5870c360ec4abc4af09105dd9b52264af9711ec0b7020e87095193ac9b6e20305e446f2321a541f743626a598e5318c1
|
||||
|
||||
rm -rf "$BUILDS_DIR"
|
||||
if command -v rdfind &>/dev/null; then
|
||||
|
@ -83,10 +84,13 @@ ask_for_license () {
|
|||
|
||||
ensure_command_available curl
|
||||
|
||||
(echo -e "Please review the license of OnlyOffice:\n\n" ; curl https://raw.githubusercontent.com/ONLYOFFICE/web-apps/master/LICENSE.txt 2>/dev/null) | less
|
||||
(
|
||||
echo -e "Please review the license of OnlyOffice:\n\n"
|
||||
curl https://raw.githubusercontent.com/ONLYOFFICE/web-apps/master/LICENSE.txt 2>/dev/null
|
||||
) | less
|
||||
|
||||
read -rp "Do you accept the license? (Y/N): " confirm \
|
||||
&& [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
|
||||
read -rp "Do you accept the license? (Y/N): " confirm &&
|
||||
[[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
|
||||
|
||||
set_prop "agree_license" yes
|
||||
}
|
||||
|
@ -143,12 +147,46 @@ install_version () {
|
|||
echo "$DIR was up to date"
|
||||
fi
|
||||
|
||||
|
||||
if [ ${CLEAR+x} ]; then
|
||||
rm -f "$FULL_DIR"/.git
|
||||
fi
|
||||
}
|
||||
|
||||
install_x2t() {
|
||||
ensure_command_available curl
|
||||
ensure_command_available sha512sum
|
||||
ensure_command_available unzip
|
||||
|
||||
local VERSION=$1
|
||||
local HASH=$2
|
||||
local LAST_DIR
|
||||
LAST_DIR=$(pwd)
|
||||
local X2T_DIR=$OO_DIR/x2t
|
||||
|
||||
if [ ! -e "$X2T_DIR"/.version ] || [ "$(cat "$X2T_DIR"/.version)" != "$VERSION" ]; then
|
||||
rm -rf "$X2T_DIR"
|
||||
mkdir -p "$X2T_DIR"
|
||||
|
||||
cd "$X2T_DIR"
|
||||
|
||||
curl "https://github.com/cryptpad/onlyoffice-x2t-wasm/releases/download/$VERSION/x2t.zip" --location --output x2t.zip
|
||||
# curl "https://github.com/cryptpad/onlyoffice-x2t-wasm/releases/download/v7.3%2B1/x2t.zip" --location --output x2t.zip
|
||||
echo "$HASH x2t.zip" >x2t.zip.sha512
|
||||
if ! sha512sum --check x2t.zip.sha512; then
|
||||
echo "x2t.zip does not match expected checksum"
|
||||
exit 1
|
||||
fi
|
||||
unzip x2t.zip
|
||||
rm x2t.zip*
|
||||
|
||||
echo "$VERSION" >"$X2T_DIR"/.version
|
||||
|
||||
echo "x2t updated"
|
||||
else
|
||||
echo "x2t was up to date"
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_command_available() {
|
||||
if ! command -v "$1" &>/dev/null; then
|
||||
echo "$1 needs to be installed to run this script"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals Buffer */
|
||||
const B32 = require("thirty-two");
|
||||
const OTP = require("notp");
|
||||
const nThen = require("nthen");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals process */
|
||||
const nThen = require("nthen");
|
||||
const getFolderSize = require("get-folder-size");
|
||||
const Util = require("../common-util");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals Buffer*/
|
||||
const Block = module.exports;
|
||||
const Nacl = require("tweetnacl/nacl-fast");
|
||||
const nThen = require("nthen");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals process */
|
||||
const Core = module.exports;
|
||||
const Util = require("../common-util");
|
||||
const escapeKeyCharacters = Util.escapeKeyCharacters;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals Buffer*/
|
||||
const Quota = module.exports;
|
||||
|
||||
//const Util = require("../common-util");
|
||||
|
|
|
@ -169,6 +169,7 @@ var isInteger = function (n) {
|
|||
var args_isString = function (args) {
|
||||
return !(!Array.isArray(args) || !isString(args[0]));
|
||||
};
|
||||
|
||||
var args_isInteger = function (args) {
|
||||
return !(!Array.isArray(args) || !isInteger(args[0]));
|
||||
};
|
||||
|
@ -211,10 +212,6 @@ commands.SET_ARCHIVE_RETENTION_TIME = makeIntegerSetter('archiveRetentionTime');
|
|||
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_ACCOUNT_RETENTION_TIME', [365]]], console.log)
|
||||
commands.SET_ACCOUNT_RETENTION_TIME = makeIntegerSetter('accountRetentionTime');
|
||||
|
||||
var args_isString = function (args) {
|
||||
return Array.isArray(args) && typeof(args[0]) === "string";
|
||||
};
|
||||
|
||||
// CryptPad_AsyncStore.rpc.send('ADMIN', [ 'ADMIN_DECREE', ['SET_ADMIN_EMAIL', ['admin@website.tld']]], console.log)
|
||||
commands.SET_ADMIN_EMAIL = makeGenericSetter('adminEmail', args_isString);
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals process */
|
||||
|
||||
const { existsSync, readdirSync } = require('node:fs');
|
||||
|
||||
const Crypto = require('crypto');
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* global Buffer */
|
||||
var HK = module.exports;
|
||||
|
||||
const nThen = require('nthen');
|
||||
|
|
|
@ -161,6 +161,13 @@ var setHeaders = function (req, res) {
|
|||
}
|
||||
|
||||
var h = getHeaders(Env, type);
|
||||
|
||||
// Allow main domain to load resources from the sandbox URL
|
||||
if (!Env.enableEmbedding && req.get('origin') === Env.httpUnsafeOrigin &&
|
||||
/^\/common\/onlyoffice\/dist\/.*\/fonts\/.*/.test(req.url)) {
|
||||
h['Access-Control-Allow-Origin'] = Env.httpUnsafeOrigin;
|
||||
}
|
||||
|
||||
applyHeaderMap(res, h);
|
||||
};
|
||||
|
||||
|
@ -736,7 +743,8 @@ var server = Http.createServer(app);
|
|||
nThen(function (w) {
|
||||
server.listen(Env.httpPort, Env.httpAddress, w());
|
||||
if (Env.httpSafePort) {
|
||||
server.listen(Env.httpSafePort, Env.httpAddress, w());
|
||||
let safeServer = Http.createServer(app);
|
||||
safeServer.listen(Env.httpSafePort, Env.httpAddress, w());
|
||||
}
|
||||
server.on('upgrade', function (req, socket, head) {
|
||||
// TODO warn admins that websockets should only be proxied in this way in a dev environment
|
||||
|
|
|
@ -39,8 +39,6 @@ var handlers = {};
|
|||
handlers[level] = function (ctx, content) { console.error(content); };
|
||||
});
|
||||
|
||||
var noop = function () {};
|
||||
|
||||
var createLogType = function (ctx, type) {
|
||||
if (logLevels.indexOf(type) < logLevels.indexOf(ctx.logLevel)) {
|
||||
return noop;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals Buffer */
|
||||
var Fs = require("fs");
|
||||
var Fse = require("fs-extra");
|
||||
var Path = require("path");
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*@flow*/
|
||||
/* globals Buffer */
|
||||
var Fs = require("fs");
|
||||
var Fse = require("fs-extra");
|
||||
var Path = require("path");
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* global Buffer */
|
||||
|
||||
const ToPull = require('stream-to-pull-stream');
|
||||
const Pull = require('pull-stream');
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals process, Buffer */
|
||||
|
||||
const HK = require("../hk-util");
|
||||
const Store = require("../storage/file");
|
||||
const BlobStore = require("../storage/blob");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* global process */
|
||||
const Util = require("../common-util");
|
||||
const nThen = require('nthen');
|
||||
const OS = require("os");
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "cryptpad",
|
||||
"version": "5.7.0",
|
||||
"version": "2024.3.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "cryptpad",
|
||||
"version": "5.7.0",
|
||||
"version": "2024.3.0",
|
||||
"license": "AGPL-3.0+",
|
||||
"dependencies": {
|
||||
"@mcrowe/minibloom": "^0.2.0",
|
||||
|
@ -27,7 +27,7 @@
|
|||
"croppie": "^2.5.0",
|
||||
"dragula": "3.7.2",
|
||||
"drawio": "github:cryptpad/drawio-npm#npm-21.8.2+5",
|
||||
"express": "~4.19.2",
|
||||
"express": "~4.18.2",
|
||||
"file-saver": "1.3.1",
|
||||
"fs-extra": "^7.0.0",
|
||||
"get-folder-size": "^2.0.1",
|
||||
|
@ -1598,9 +1598,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
|
||||
"integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
|
||||
"integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
|
@ -2232,16 +2232,16 @@
|
|||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "4.19.2",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
|
||||
"integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==",
|
||||
"version": "4.18.3",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-4.18.3.tgz",
|
||||
"integrity": "sha512-6VyCijWQ+9O7WuVMTRBTl+cjNNIzD5cY5mQ1WM8r/LEkI2u8EYpOotESNwzNlyCn3g+dmjKYI6BmNneSr/FSRw==",
|
||||
"dependencies": {
|
||||
"accepts": "~1.3.8",
|
||||
"array-flatten": "1.1.1",
|
||||
"body-parser": "1.20.2",
|
||||
"content-disposition": "0.5.4",
|
||||
"content-type": "~1.0.4",
|
||||
"cookie": "0.6.0",
|
||||
"cookie": "0.5.0",
|
||||
"cookie-signature": "1.0.6",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
|
|
15
package.json
15
package.json
|
@ -13,19 +13,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@mcrowe/minibloom": "^0.2.0",
|
||||
"chainpad-crypto": "^0.2.5",
|
||||
"chainpad-server": "^5.1.0",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"body-parser": "^1.20.2",
|
||||
"express": "~4.19.2",
|
||||
"fs-extra": "^7.0.0",
|
||||
"get-folder-size": "^2.0.1",
|
||||
"netflux-websocket": "^1.0.0",
|
||||
"http-proxy-middleware": "^2.0.6",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"notp": "^2.0.3",
|
||||
"nthen": "0.1.8",
|
||||
"openid-client": "^5.4.2",
|
||||
"@node-saml/node-saml": "^4.0.5",
|
||||
"alertify.js": "1.0.11",
|
||||
"body-parser": "^1.20.2",
|
||||
|
@ -43,7 +30,7 @@
|
|||
"croppie": "^2.5.0",
|
||||
"dragula": "3.7.2",
|
||||
"drawio": "github:cryptpad/drawio-npm#npm-21.8.2+5",
|
||||
"express": "~4.18.2",
|
||||
"express": "~4.19.2",
|
||||
"file-saver": "1.3.1",
|
||||
"fs-extra": "^7.0.0",
|
||||
"get-folder-size": "^2.0.1",
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* global process */
|
||||
var WebDriver = require("selenium-webdriver");
|
||||
var nThen = require('nthen');
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals process */
|
||||
|
||||
var Fs = require("fs");
|
||||
var Fse = require("fs-extra");
|
||||
var Path = require("path");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals Buffer */
|
||||
var Https = require('https');
|
||||
var Config = require("../lib/load-config");
|
||||
var Package = require("../package.json");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals process */
|
||||
const jwt = require("jsonwebtoken");
|
||||
const Sessions = require("../lib/storage/sessions.js");
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals process */
|
||||
var Client = require("../../lib/client");
|
||||
var Nacl = require("tweetnacl/nacl-fast");
|
||||
var nThen = require("nthen");
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals process */
|
||||
|
||||
var Client = require("../../lib/client/");
|
||||
var Crypto = require("../../www/components/chainpad-crypto");
|
||||
var Mailbox = Crypto.Mailbox;
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* globals process */
|
||||
|
||||
var Client = require("../../lib/client/");
|
||||
var Crypto = require("../../www/components/chainpad-crypto");
|
||||
var Mailbox = Crypto.Mailbox;
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*
|
||||
globals process
|
||||
*/
|
||||
var Express = require('express');
|
||||
var Http = require('http');
|
||||
var Fs = require('fs');
|
||||
|
|
|
@ -1197,11 +1197,12 @@ define([
|
|||
});
|
||||
};
|
||||
|
||||
// `app`: true (force open wiht the app), false (force open in preview),
|
||||
// `app`: true (force open with the app), false (force open in preview),
|
||||
// falsy (open in preview if default is not using the app)
|
||||
var defaultInApp = ['application/pdf'];
|
||||
var openFile = function (el, isRo, app) {
|
||||
var data = manager.getFileData(el);
|
||||
// In anonymous drives, `el` already contains file data
|
||||
var data = el.channel ? el : manager.getFileData(el);
|
||||
|
||||
if (data.static) {
|
||||
if (data.href) {
|
||||
|
|
|
@ -179,15 +179,11 @@ define([
|
|||
});
|
||||
};
|
||||
|
||||
var getUserIndex = function () {
|
||||
var i = 1;
|
||||
var ids = content.ids || {};
|
||||
Object.keys(ids).forEach(function (k) {
|
||||
if (ids[k] && ids[k].index && ids[k].index >= i) {
|
||||
i = ids[k].index + 1;
|
||||
}
|
||||
});
|
||||
return i;
|
||||
const getNewUserIndex = function () {
|
||||
const ids = content.ids || {};
|
||||
const indexes = Object.values(ids).map((user) => user.index);
|
||||
const maxIndex = Math.max(...indexes);
|
||||
return maxIndex === -Infinity ? 1 : maxIndex+1;
|
||||
};
|
||||
|
||||
var setMyId = function () {
|
||||
|
@ -198,7 +194,7 @@ define([
|
|||
myOOId = Util.createRandomInteger();
|
||||
// f: function used in .some(f) but defined outside of the while
|
||||
var f = function (id) {
|
||||
return ids[id] === myOOId;
|
||||
return ids[id].ooid === myOOId;
|
||||
};
|
||||
while (Object.keys(ids).some(f)) {
|
||||
myOOId = Util.createRandomInteger();
|
||||
|
@ -207,7 +203,7 @@ define([
|
|||
var myId = getId();
|
||||
ids[myId] = {
|
||||
ooid: myOOId,
|
||||
index: getUserIndex(),
|
||||
index: getNewUserIndex(),
|
||||
netflux: metadataMgr.getNetfluxId()
|
||||
};
|
||||
oldIds = JSON.parse(JSON.stringify(ids));
|
||||
|
@ -912,6 +908,15 @@ define([
|
|||
});
|
||||
};
|
||||
|
||||
const findUserByOOId = function(ooId) {
|
||||
return Object.values(content.ids)
|
||||
.find((user) => user.ooid === ooId);
|
||||
};
|
||||
|
||||
const getMyOOIndex = function() {
|
||||
return findUserByOOId(myOOId).index;
|
||||
};
|
||||
|
||||
var getParticipants = function () {
|
||||
var users = metadataMgr.getMetadata().users;
|
||||
var i = 1;
|
||||
|
@ -943,19 +948,19 @@ define([
|
|||
isCloseCoAuthoring:false,
|
||||
view: false
|
||||
});
|
||||
i++;
|
||||
if (!myUniqueOOId) { myUniqueOOId = String(myOOId) + i; }
|
||||
const myOOIndex = getMyOOIndex();
|
||||
if (!myUniqueOOId) { myUniqueOOId = String(myOOId) + myOOIndex; }
|
||||
p.push({
|
||||
id: myUniqueOOId,
|
||||
id: String(myOOId),
|
||||
idOriginal: String(myOOId),
|
||||
username: metadataMgr.getUserData().name || Messages.anonymous,
|
||||
indexUser: i,
|
||||
indexUser: myOOIndex,
|
||||
connectionId: metadataMgr.getNetfluxId() || Hash.createChannelId(),
|
||||
isCloseCoAuthoring:false,
|
||||
view: false
|
||||
});
|
||||
return {
|
||||
index: i,
|
||||
index: myOOIndex,
|
||||
list: p.filter(Boolean)
|
||||
};
|
||||
};
|
||||
|
@ -1592,13 +1597,15 @@ define([
|
|||
|
||||
var x2tConvertData = function (data, fileName, format, cb) {
|
||||
var sframeChan = common.getSframeChannel();
|
||||
var e = getEditor();
|
||||
var fonts = e && e.FontLoader.fontInfos;
|
||||
var files = e && e.FontLoader.fontFiles.map(function (f) {
|
||||
var editor = getEditor();
|
||||
var fonts = editor && editor.FontLoader.fontInfos;
|
||||
var files = editor && editor.FontLoader.fontFiles.map(function (f) {
|
||||
return { 'Id': f.Id, };
|
||||
});
|
||||
var type = common.getMetadataMgr().getPrivateData().ooType;
|
||||
var images = (e && window.frames[0].AscCommon.g_oDocumentUrls.urls) || {};
|
||||
const images = editor
|
||||
? structuredClone(window.frames[0].AscCommon.g_oDocumentUrls.getUrls())
|
||||
: {};
|
||||
|
||||
// Fix race condition which could drop images sometimes
|
||||
// ==> make sure each image has a 'media/image_name.ext' entry as well
|
||||
|
@ -1609,7 +1616,7 @@ define([
|
|||
});
|
||||
|
||||
// Add theme images
|
||||
var theme = e && window.frames[0].AscCommon.g_image_loader.map_image_index;
|
||||
var theme = editor && window.frames[0].AscCommon.g_image_loader.map_image_index;
|
||||
if (theme) {
|
||||
Object.keys(theme).forEach(function (url) {
|
||||
if (!/^(\/|blob:|data:)/.test(url)) {
|
||||
|
@ -1623,7 +1630,7 @@ define([
|
|||
type: type,
|
||||
fileName: fileName,
|
||||
outputFormat: format,
|
||||
images: (e && window.frames[0].AscCommon.g_oDocumentUrls.urls) || {},
|
||||
images: (editor && window.frames[0].AscCommon.g_oDocumentUrls.urls) || {},
|
||||
fonts: fonts,
|
||||
fonts_files: files,
|
||||
mediasSources: getMediasSources(),
|
||||
|
@ -2051,6 +2058,15 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
|
|||
if (blobUrl) {
|
||||
delete downloadImages[name];
|
||||
debug("CryptPad Image already loaded " + blobUrl);
|
||||
|
||||
// Fix: https://github.com/cryptpad/cryptpad/issues/1500
|
||||
// Maybe OO was reloaded, but the CryptPad cache is still intact?
|
||||
// -> Add the image to OnlyOffice again.
|
||||
const documentUrls = window.frames[0].AscCommon.g_oDocumentUrls;
|
||||
if (!(data.name in documentUrls.getUrls())) {
|
||||
documentUrls.addImageUrl(data.name, blobUrl);
|
||||
}
|
||||
|
||||
return void callback(blobUrl);
|
||||
}
|
||||
|
||||
|
@ -2668,7 +2684,6 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
|
|||
};
|
||||
var onCheckpoint = function (cp) {
|
||||
// We want to load a checkpoint:
|
||||
console.log('XXX onCheckpoint', JSON.stringify(cp));
|
||||
loadCp(cp);
|
||||
};
|
||||
var setHistoryMode = function (bool) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -6,8 +6,8 @@
|
|||
|
||||
importScripts('/components/requirejs/require.js');
|
||||
|
||||
window = self;
|
||||
localStorage = {
|
||||
window = self; // eslint-disable-line no-global-assign
|
||||
localStorage = { // eslint-disable-line no-global-assign
|
||||
setItem: function (k, v) { localStorage[k] = v; },
|
||||
getItem: function (k) { return localStorage[k]; }
|
||||
};
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
importScripts('/components/requirejs/require.js');
|
||||
|
||||
window = self;
|
||||
localStorage = {
|
||||
window = self; // eslint-disable-line no-global-assign
|
||||
localStorage = { // eslint-disable-line no-global-assign
|
||||
setItem: function (k, v) { localStorage[k] = v; },
|
||||
getItem: function (k) { return localStorage[k]; }
|
||||
};
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
importScripts('/components/requirejs/require.js');
|
||||
|
||||
window = self;
|
||||
localStorage = {
|
||||
window = self; // eslint-disable-line no-global-assign
|
||||
localStorage = { // eslint-disable-line no-global-assign
|
||||
setItem: function (k, v) { localStorage[k] = v; },
|
||||
getItem: function (k) { return localStorage[k]; }
|
||||
};
|
||||
|
|
|
@ -65,7 +65,7 @@ define([
|
|||
};
|
||||
var getX2T = function (cb) {
|
||||
// Perform the x2t conversion
|
||||
require(['/common/onlyoffice/x2t/x2t.js'], function() { // FIXME why does this fail without an access-control-allow-origin header?
|
||||
require(['/common/onlyoffice/dist/x2t/x2t.js'], function() { // FIXME why does this fail without an access-control-allow-origin header?
|
||||
var x2t = window.Module;
|
||||
if (x2tInitialized) {
|
||||
debug("x2t runtime already initialized");
|
||||
|
|
|
@ -176,6 +176,10 @@ define([
|
|||
else { editor.execCommand("insertTab"); }
|
||||
}
|
||||
},
|
||||
//remove focus from editor
|
||||
"Esc": function () {
|
||||
editor.display.input.blur();
|
||||
},
|
||||
"Shift-Tab": function () {
|
||||
editor.execCommand("indentLess");
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue