Merge branch 'sidebar' of https://github.com/cryptpad/cryptpad into sidebar
This commit is contained in:
commit
aa56739dd7
99 changed files with 1557 additions and 741 deletions
|
@ -14,8 +14,9 @@ www/scratch
|
|||
www/accounts
|
||||
www/lib
|
||||
www/accounts
|
||||
www/worker
|
||||
www/todo
|
||||
|
||||
www/common/toolbar.js
|
||||
www/common/hyperscript.js
|
||||
|
||||
www/pad/wysiwygarea-plugin.js
|
57
.eslintrc.js
Normal file
57
.eslintrc.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
module.exports = {
|
||||
'env': {
|
||||
'browser': true,
|
||||
'es2021': true,
|
||||
'node': true
|
||||
},
|
||||
'plugins': ['compat'],
|
||||
'extends': ['eslint:recommended', 'plugin:compat/recommended'],
|
||||
"globals": {
|
||||
"define": "readonly",
|
||||
},
|
||||
'overrides': [
|
||||
{
|
||||
'env': {
|
||||
'node': true
|
||||
},
|
||||
'files': [
|
||||
'.eslintrc.{js,cjs}'
|
||||
],
|
||||
'parserOptions': {
|
||||
'sourceType': 'script'
|
||||
}
|
||||
}
|
||||
],
|
||||
'parserOptions': {
|
||||
'ecmaVersion': 'latest'
|
||||
},
|
||||
'rules': {
|
||||
'indent': [
|
||||
'off', // TODO enable this check
|
||||
4
|
||||
],
|
||||
'linebreak-style': [
|
||||
'error',
|
||||
'unix'
|
||||
],
|
||||
'quotes': [
|
||||
'off', // TODO enable this check
|
||||
'single'
|
||||
],
|
||||
'semi': [
|
||||
'error',
|
||||
'always'
|
||||
],
|
||||
|
||||
// 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'],
|
||||
}
|
||||
};
|
26
.jshintrc
26
.jshintrc
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"laxcomma": true,
|
||||
"laxbreak": true,
|
||||
"sub": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"iterator": true,
|
||||
"latedef": true,
|
||||
"nocomma": true,
|
||||
"shadow": false,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"futurehostile":true,
|
||||
"browser": true,
|
||||
"esversion": 6,
|
||||
"predef": [
|
||||
"console",
|
||||
"define",
|
||||
"require",
|
||||
"module",
|
||||
"__dirname"
|
||||
],
|
||||
"globals": {
|
||||
"self": true
|
||||
}
|
||||
}
|
|
@ -139,6 +139,21 @@ module.exports = {
|
|||
*/
|
||||
//enforceMFA: false,
|
||||
|
||||
/* =====================
|
||||
* Privacy
|
||||
* ===================== */
|
||||
|
||||
/* Depending on where your instance is hosted, you may be required to log IP
|
||||
* addresses of the users who make a change to a document. This setting allows you
|
||||
* to do so. You can configure the logging system below in this config file.
|
||||
* Setting this value to true will include a log for each websocket connection
|
||||
* including this connection's unique ID, the user public key and the IP.
|
||||
* NOTE: this option requires a log level of "info" or below.
|
||||
*
|
||||
* defaults to false
|
||||
*/
|
||||
//logIP: false,
|
||||
|
||||
/* =====================
|
||||
* Admin
|
||||
* ===================== */
|
||||
|
|
|
@ -64,7 +64,6 @@ define([
|
|||
return bar;
|
||||
};
|
||||
|
||||
var hasErrored = false;
|
||||
var isOffline = false;
|
||||
var updateLoadingProgress = function (data) {
|
||||
if (!built || !data) { return; }
|
||||
|
@ -102,7 +101,6 @@ define([
|
|||
var el3 = document.querySelector('.cp-loading-progress-container');
|
||||
if (el3) { el3.innerHTML = makeBar(data); }
|
||||
} catch (e) {
|
||||
//if (!hasErrored) { console.error(e); }
|
||||
}
|
||||
};
|
||||
window.CryptPad_updateLoadingProgress = updateLoadingProgress;
|
||||
|
@ -115,7 +113,6 @@ define([
|
|||
return;
|
||||
}
|
||||
|
||||
hasErrored = true;
|
||||
var err2;
|
||||
if (err === 'Script error.') {
|
||||
err2 = Messages.error_unhelpfulScriptError;
|
||||
|
|
|
@ -127,22 +127,22 @@
|
|||
margin-bottom: 0;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
th{
|
||||
th {
|
||||
max-width: 60vw;
|
||||
border: 1px solid #777;
|
||||
padding: 7px;
|
||||
}
|
||||
td{
|
||||
td {
|
||||
padding: 2px;
|
||||
}
|
||||
.cp-checkmark{
|
||||
.cp-checkmark {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
.cp-broadcast-container{
|
||||
.cp-broadcast-container {
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
}
|
||||
.cp-broadcast-lang{
|
||||
.cp-broadcast-lang {
|
||||
order: 4;
|
||||
margin: 30px;
|
||||
margin-bottom: 0;
|
||||
|
@ -150,10 +150,6 @@
|
|||
flex-flow: column;
|
||||
align-items: baseline;
|
||||
}
|
||||
.button.btn.primary.cp-report{
|
||||
margin-left: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
table {
|
||||
.cp-strong {
|
||||
font-weight: bold;
|
||||
|
|
|
@ -7,7 +7,7 @@ version: '3.8'
|
|||
|
||||
services:
|
||||
cryptpad:
|
||||
image: "cryptpad/cryptpad:version-5.5.0"
|
||||
image: "cryptpad/cryptpad:version-5.7.0"
|
||||
hostname: cryptpad
|
||||
|
||||
environment:
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6 */
|
||||
const WebSocketServer = require('ws').Server;
|
||||
const NetfluxSrv = require('chainpad-server');
|
||||
const Decrees = require("./decrees");
|
||||
|
@ -67,6 +66,7 @@ nThen(function (w) {
|
|||
.on('channelMessage', historyKeeper.channelMessage)
|
||||
.on('channelOpen', historyKeeper.channelOpen)
|
||||
.on('sessionClose', historyKeeper.sessionClose)
|
||||
.on('sessionOpen', historyKeeper.sessionOpen)
|
||||
.on('error', function (error, label, info) {
|
||||
if (!error) { return; }
|
||||
var code = error && (error.code || error.message);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6, node: true */
|
||||
const nThen = require('nthen');
|
||||
const Pins = require('./pins');
|
||||
const Util = require("./common-util");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
var Netflux = require("netflux-websocket");
|
||||
var WebSocket = require("ws"); // jshint ignore:line
|
||||
var WebSocket = require("ws");
|
||||
var nThen = require("nthen");
|
||||
|
||||
var Util = require("../../www/common/common-util");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
/* globals process */
|
||||
const nThen = require("nthen");
|
||||
const getFolderSize = require("get-folder-size");
|
||||
|
@ -17,9 +16,7 @@ const Users = require("./users");
|
|||
const BlockStore = require("../storage/block");
|
||||
const MFA = require("../storage/mfa");
|
||||
const ArchiveAccount = require('../archive-account');
|
||||
/* jshint ignore:start */
|
||||
const { Worker } = require('node:worker_threads');
|
||||
/* jshint ignore:end */
|
||||
|
||||
var Fs = require("fs");
|
||||
|
||||
|
@ -85,7 +82,7 @@ var getActiveSessions = function (Env, Server, cb) {
|
|||
};
|
||||
|
||||
var shutdown = function (Env, Server, cb) {
|
||||
if (true) {
|
||||
if (true) { // eslint-disable-line no-constant-condition
|
||||
return void cb('E_NOT_IMPLEMENTED');
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
/* globals Buffer*/
|
||||
const Block = module.exports;
|
||||
const Nacl = require("tweetnacl/nacl-fast");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Channel = module.exports;
|
||||
|
||||
const Util = require("../common-util");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
/* globals process */
|
||||
const Core = module.exports;
|
||||
const Util = require("../common-util");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Invitation = module.exports;
|
||||
|
||||
const Invite = require('../storage/invite');
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Data = module.exports;
|
||||
|
||||
const Meta = require("../metadata");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Core = require("./core");
|
||||
|
||||
const Pinning = module.exports;
|
||||
|
@ -266,13 +265,6 @@ Pinning.resetUserPins = function (Env, safeKey, channelList, _cb) {
|
|||
pins[channel] = true;
|
||||
});
|
||||
|
||||
var oldChannels;
|
||||
if (session.channels && typeof(session.channels) === 'object') {
|
||||
oldChannels = Object.keys(session.channels);
|
||||
} else {
|
||||
oldChannels = [];
|
||||
}
|
||||
|
||||
// update in-memory cache IFF the reset was allowed.
|
||||
session.channels = pins;
|
||||
cb();
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
/* globals Buffer*/
|
||||
const Quota = module.exports;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Upload = module.exports;
|
||||
const Util = require("../common-util");
|
||||
const Pinning = require("./pin-rpc");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Users = module.exports;
|
||||
|
||||
const User = require('../storage/user');
|
||||
|
|
|
@ -374,7 +374,7 @@ commands.SET_BEARER_SECRET = function (Env, args) {
|
|||
};
|
||||
|
||||
// [<command>, <args>, <author>, <time>]
|
||||
var handleCommand = Decrees.handleCommand = function (Env, line, cb) {
|
||||
var handleCommand = Decrees.handleCommand = function (Env, line) {
|
||||
var command = line[0];
|
||||
var args = line[1];
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6 */
|
||||
/* globals process */
|
||||
|
||||
const Crypto = require('crypto');
|
||||
|
@ -111,6 +110,7 @@ module.exports.create = function (config) {
|
|||
httpPort: isValidPort(config.httpPort)? config.httpPort: 3000,
|
||||
httpAddress: typeof(config.httpAddress) === 'string'? config.httpAddress: 'localhost',
|
||||
websocketPath: config.externalWebsocketURL,
|
||||
logIP: config.logIP,
|
||||
|
||||
OFFLINE_MODE: false,
|
||||
FRESH_KEY: '',
|
||||
|
|
|
@ -45,7 +45,6 @@ var PROGRESS_FACTOR = 1000;
|
|||
var evictArchived = function (Env, cb) {
|
||||
var Log;
|
||||
var store;
|
||||
var pinStore;
|
||||
var blobs;
|
||||
var retentionTime = +new Date() - (Env.archiveRetentionTime * 24 * 3600 * 1000);
|
||||
|
||||
|
@ -74,7 +73,6 @@ var evictArchived = function (Env, cb) {
|
|||
|
||||
var loadStorage = function () {
|
||||
store = Env.store;
|
||||
pinStore = Env.pinStore;
|
||||
Log = Env.Log;
|
||||
blobs = Env.blobStore;
|
||||
};
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6 */
|
||||
|
||||
const nThen = require('nthen');
|
||||
const RPC = require("./rpc");
|
||||
const HK = require("./hk-util.js");
|
||||
|
@ -107,6 +105,12 @@ module.exports.create = function (Env, cb) {
|
|||
},
|
||||
sessionClose: function (userId, reason) {
|
||||
HK.closeNetfluxSession(Env, userId);
|
||||
if (Env.logIP && !['SOCKET_CLOSED', 'INACTIVITY'].includes(reason)) {
|
||||
return void Log.info('USER_DISCONNECTED_ERROR', {
|
||||
userId: userId,
|
||||
reason: reason
|
||||
});
|
||||
}
|
||||
if (['BAD_MESSAGE', 'SEND_MESSAGE_FAIL_2'].indexOf(reason) !== -1) {
|
||||
if (reason && reason.code === 'ECONNRESET') { return; }
|
||||
return void Log.error('SESSION_CLOSE_WITH_ERROR', {
|
||||
|
@ -115,12 +119,19 @@ module.exports.create = function (Env, cb) {
|
|||
});
|
||||
}
|
||||
|
||||
if (['SOCKET_CLOSED', 'SOCKET_ERROR'].indexOf(reason)) { return; }
|
||||
if (['SOCKET_CLOSED', 'SOCKET_ERROR'].includes(reason)) { return; }
|
||||
Log.verbose('SESSION_CLOSE_ROUTINE', {
|
||||
userId: userId,
|
||||
reason: reason,
|
||||
});
|
||||
},
|
||||
sessionOpen: function (userId, ip) {
|
||||
if (!Env.logIP) { return; }
|
||||
Log.info('USER_CONNECTION', {
|
||||
userId: userId,
|
||||
ip: ip,
|
||||
});
|
||||
},
|
||||
directMessage: function (Server, seq, userId, json) {
|
||||
// netflux-server allows you to register an id with a handler
|
||||
// this handler is invoked every time someone sends a message to that id
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6 */
|
||||
/* global Buffer */
|
||||
var HK = module.exports;
|
||||
|
||||
|
|
|
@ -198,6 +198,9 @@ const wsProxy = createProxyMiddleware({
|
|||
target: proxyTarget.href,
|
||||
ws: true,
|
||||
logLevel: 'error',
|
||||
onProxyReqWs: function (proxyReq, req) {
|
||||
proxyReq.setHeader('X-Real-Ip', req.socket.remoteAddress);
|
||||
},
|
||||
logProvider: (p) => {
|
||||
p.error = (data) => {
|
||||
if (/ECONNRESET/.test(data)) { return; }
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
var Store = require("./storage/file");
|
||||
var Util = require("./common-util");
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
|
||||
var Pins = module.exports;
|
||||
|
||||
const Fs = require("fs");
|
||||
|
@ -90,7 +88,6 @@ var createLineHandler = Pins.createLineHandler = function (ref, errorHandler) {
|
|||
});
|
||||
}
|
||||
ref.surplus = ref.index;
|
||||
//jshint -W086
|
||||
// fallthrough
|
||||
}
|
||||
case 'PIN': {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Util = require("./common-util");
|
||||
|
||||
const Core = require("./commands/core");
|
||||
|
@ -145,11 +144,12 @@ var rpc = function (Env, Server, userId, data, respond) {
|
|||
|
||||
var signature = msg.shift();
|
||||
var publicKey = msg.shift();
|
||||
var safeKey = Util.escapeKeyCharacters(publicKey);
|
||||
var hadSession = Boolean(Env.Sessions[safeKey]);
|
||||
|
||||
// make sure a user object is initialized in the cookie jar
|
||||
var session;
|
||||
if (publicKey) {
|
||||
session = Core.getSession(Env.Sessions, publicKey);
|
||||
Core.getSession(Env.Sessions, publicKey);
|
||||
} else {
|
||||
Env.Log.debug("NO_PUBLIC_KEY_PROVIDED", publicKey);
|
||||
}
|
||||
|
@ -182,6 +182,9 @@ var rpc = function (Env, Server, userId, data, respond) {
|
|||
if (err) {
|
||||
return void respond("INVALID_SIGNATURE_OR_PUBLIC_KEY");
|
||||
}
|
||||
if (command === 'COOKIE' && !hadSession && Env.logIP) {
|
||||
Env.Log.info('NEW_RPC_SESSION', {userId: userId, publicKey: publicKey});
|
||||
}
|
||||
HK.authenticateNetfluxSession(Env, userId, publicKey);
|
||||
return void handleAuthenticatedMessage(Env, publicKey, msg, respond, Server);
|
||||
});
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Stats = module.exports;
|
||||
|
||||
var truthyStringOrNothing = function (s) {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Block = module.exports;
|
||||
const Util = require("../common-util");
|
||||
const Path = require("path");
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*@flow*/
|
||||
/* jshint esversion: 6 */
|
||||
/* globals Buffer */
|
||||
var Fs = require("fs");
|
||||
var Fse = require("fs-extra");
|
||||
|
@ -268,7 +267,7 @@ var getMetadataAtPath = function (Env, path, _cb) {
|
|||
// if you can't parse, that's bad
|
||||
return void cb("INVALID_METADATA");
|
||||
}
|
||||
readMore();
|
||||
readMore(); // eslint-disable-line no-unreachable
|
||||
}, function (err) {
|
||||
cb(err);
|
||||
});
|
||||
|
|
|
@ -225,7 +225,8 @@ var run = Tasks.run = function (env, path, cb) {
|
|||
var CURRENT = +new Date();
|
||||
|
||||
var Log = env.log;
|
||||
var task, time, command, args;
|
||||
var task, time, command;
|
||||
//var args;
|
||||
|
||||
nThen(function (w) {
|
||||
read(env, path, w(function (err, _task) {
|
||||
|
@ -243,7 +244,7 @@ var run = Tasks.run = function (env, path, cb) {
|
|||
}
|
||||
|
||||
command = task[1];
|
||||
args = task.slice(2);
|
||||
//args = task.slice(2);
|
||||
}));
|
||||
}).nThen(function (w) {
|
||||
switch (command) {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6 */
|
||||
/* global Buffer */
|
||||
|
||||
const ToPull = require('stream-to-pull-stream');
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6 */
|
||||
/* globals process, Buffer */
|
||||
|
||||
const HK = require("../hk-util");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6 */
|
||||
/* global process */
|
||||
const Util = require("../common-util");
|
||||
const nThen = require('nthen');
|
||||
|
|
1357
package-lock.json
generated
1357
package-lock.json
generated
File diff suppressed because it is too large
Load diff
80
package.json
80
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cryptpad",
|
||||
"description": "realtime collaborative visual editor with zero knowlege server",
|
||||
"description": "realtime collaborative visual editor with zero knowledge server",
|
||||
"version": "5.7.0",
|
||||
"license": "AGPL-3.0+",
|
||||
"repository": {
|
||||
|
@ -13,62 +13,62 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@mcrowe/minibloom": "^0.2.0",
|
||||
"chainpad-crypto": "^0.2.5",
|
||||
"chainpad-server": "^5.1.0",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"@node-saml/node-saml": "^4.0.5",
|
||||
"alertify.js": "1.0.11",
|
||||
"body-parser": "^1.20.2",
|
||||
"bootstrap": "^4.0.0",
|
||||
"bootstrap-tokenfield": "^0.12.0",
|
||||
"chainpad": "^5.2.6",
|
||||
"chainpad-crypto": "^0.2.5",
|
||||
"chainpad-listmap": "^1.0.0",
|
||||
"chainpad-netflux": "^1.0.0",
|
||||
"chainpad-server": "^5.2.0",
|
||||
"ckeditor": "npm:ckeditor4@~4.22.1",
|
||||
"codemirror": "^5.19.0",
|
||||
"components-font-awesome": "^4.6.3",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"croppie": "^2.5.0",
|
||||
"dragula": "3.7.2",
|
||||
"drawio": "github:cryptpad/drawio-npm#npm-21.8.2+4",
|
||||
"express": "~4.18.2",
|
||||
"file-saver": "1.3.1",
|
||||
"fs-extra": "^7.0.0",
|
||||
"get-folder-size": "^2.0.1",
|
||||
"netflux-websocket": "^1.0.0",
|
||||
"html2canvas": "^1.4.0",
|
||||
"http-proxy-middleware": "^2.0.6",
|
||||
"hyper-json": "~1.4.0",
|
||||
"jquery": "3.6.0",
|
||||
"json.sortify": "~2.1.0",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"jszip": "3.10.1",
|
||||
"localforage": "^1.5.2",
|
||||
"marked": "^4.3.0",
|
||||
"mathjax": "3.0.5",
|
||||
"netflux-websocket": "^1.0.0",
|
||||
"notp": "^2.0.3",
|
||||
"nthen": "0.1.8",
|
||||
"open-sans-fontface": "^1.4.0",
|
||||
"openid-client": "^5.4.2",
|
||||
"@node-saml/node-saml": "^4.0.5",
|
||||
"pako": "^2.1.0",
|
||||
"prompt-confirm": "^2.0.4",
|
||||
"pull-stream": "^3.6.1",
|
||||
"require-css": "0.1.10",
|
||||
"requirejs": "2.3.5",
|
||||
"requirejs-plugins": "^1.0.2",
|
||||
"saferphore": "0.0.1",
|
||||
"scrypt-async": "1.2.0",
|
||||
"sortablejs": "^1.6.0",
|
||||
"sortify": "^1.0.4",
|
||||
"stream-to-pull-stream": "^1.7.2",
|
||||
"thirty-two": "^1.0.2",
|
||||
"tweetnacl": "~0.12.2",
|
||||
"ulimit": "0.0.2",
|
||||
"ws": "^3.3.1",
|
||||
|
||||
"alertify.js": "1.0.11",
|
||||
"bootstrap": "^4.0.0",
|
||||
"bootstrap-tokenfield": "^0.12.0",
|
||||
"chainpad": "^5.2.6",
|
||||
"chainpad-listmap": "^1.0.0",
|
||||
"chainpad-netflux": "^1.0.0",
|
||||
"ckeditor": "npm:ckeditor4@~4.22.1",
|
||||
"codemirror": "^5.19.0",
|
||||
"components-font-awesome": "^4.6.3",
|
||||
"croppie": "^2.5.0",
|
||||
"file-saver": "1.3.1",
|
||||
"hyper-json": "~1.4.0",
|
||||
"jquery": "3.6.0",
|
||||
"json.sortify": "~2.1.0",
|
||||
"jszip": "3.10.1",
|
||||
"dragula": "3.7.2",
|
||||
"html2canvas": "^1.4.0",
|
||||
"localforage": "^1.5.2",
|
||||
"marked": "^4.3.0",
|
||||
"mathjax": "3.0.5",
|
||||
"open-sans-fontface": "^1.4.0",
|
||||
"require-css": "0.1.10",
|
||||
"requirejs": "2.3.5",
|
||||
"requirejs-plugins": "^1.0.2",
|
||||
"scrypt-async": "1.2.0",
|
||||
"sortablejs": "^1.6.0",
|
||||
"drawio": "github:cryptpad/drawio-npm#npm-21.8.2+4",
|
||||
"pako": "^2.1.0",
|
||||
"x2js": "^3.4.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jshint": "^2.13.4",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-compat": "^4.2.0",
|
||||
"lesshint": "6.3.7"
|
||||
},
|
||||
"overrides": {
|
||||
|
@ -86,9 +86,8 @@
|
|||
"offline": "FRESH=1 OFFLINE=1 node server.js",
|
||||
"offlinedev": "DEV=1 OFFLINE=1 node server.js",
|
||||
"package": "PACKAGE=1 node server.js",
|
||||
"lint": "jshint --config .jshintrc --exclude-path .jshintignore . && ./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/",
|
||||
"lint:js": "jshint --config .jshintrc --exclude-path .jshintignore .",
|
||||
"lint:server": "jshint --config .jshintrc lib",
|
||||
"lint": "eslint . && ./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/",
|
||||
"lint:js": "eslint .",
|
||||
"lint:less": "./node_modules/lesshint/bin/lesshint -c ./.lesshintrc ./customize.dist/src/less2/",
|
||||
"lint:translations": "node ./scripts/translations/lint-translations.js",
|
||||
"unused-translations": "node ./scripts/translations/unused-translations.js",
|
||||
|
@ -98,5 +97,6 @@
|
|||
"build": "node scripts/build.js",
|
||||
"clear": "node scripts/clear.js",
|
||||
"installtoken": "node scripts/install.js"
|
||||
}
|
||||
},
|
||||
"browserslist": ["> 0.5%, last 2 versions, Firefox ESR, not dead, not op_mini all"]
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6, node: true */
|
||||
const Fs = require('fs');
|
||||
const nThen = require('nthen');
|
||||
const Nacl = require('tweetnacl/nacl-fast');
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6, node: true */
|
||||
const nThen = require("nthen");
|
||||
const Pins = require("../lib/pins");
|
||||
const Assert = require("assert");
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6, node: true */
|
||||
|
||||
const Nacl = require('tweetnacl/nacl-fast');
|
||||
|
||||
const keyPair = Nacl.box.keyPair();
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 6, node: true */
|
||||
const Fs = require('fs');
|
||||
const Path = require("path");
|
||||
const Semaphore = require('saferphore');
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// jshint esversion: 6, browser: false, node: true
|
||||
// This file is for automated testing, it should probably not be invoked for any other purpose.
|
||||
// It will:
|
||||
// 1. npm install
|
||||
|
|
|
@ -149,11 +149,10 @@ var createUser = function (config, cb) {
|
|||
//wc.leave();
|
||||
}));
|
||||
}).nThen(function () {
|
||||
user.cleanup = function (cb) {
|
||||
user.cleanup = function (/* cb */) {
|
||||
//console.log("Destroying user");
|
||||
// TODO remove your mailbox
|
||||
user.destroy.fire();
|
||||
cb = cb;
|
||||
};
|
||||
|
||||
cb(void 0, user);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Pins = require("../../lib/pins");
|
||||
|
||||
var stats = {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/*jshint esversion: 6 */
|
||||
const Plan = require("../../lib/plan");
|
||||
|
||||
var rand_delay = function (f) {
|
||||
|
|
|
@ -249,11 +249,10 @@ var createUser = function (config, cb) {
|
|||
}));
|
||||
}).nThen(function () {
|
||||
|
||||
user.cleanup = function (cb) {
|
||||
user.cleanup = function (/* cb */) {
|
||||
//console.log("Destroying user");
|
||||
// TODO remove your mailbox
|
||||
user.destroy.fire();
|
||||
cb = cb;
|
||||
};
|
||||
|
||||
cb(void 0, user);
|
||||
|
@ -897,13 +896,14 @@ nThen(function (w) {
|
|||
text: "CAMEMBERT",
|
||||
}
|
||||
}), bob.curveKeys.curvePublic);
|
||||
alice.anonRpc.send('WRITE_PRIVATE_MESSAGE', [bob.mailboxChannel, message], w(function (err, response) {
|
||||
alice.anonRpc.send('WRITE_PRIVATE_MESSAGE', [bob.mailboxChannel, message], w(function (err/*, response*/) {
|
||||
if (err) {
|
||||
return void console.error(err);
|
||||
}
|
||||
|
||||
// TODO validate that the write was actually successful by checking its size
|
||||
response = response;
|
||||
//response = response;
|
||||
|
||||
// shutdown doesn't work, so we need to do this instead
|
||||
}));
|
||||
}).nThen(function () {
|
||||
|
|
|
@ -157,8 +157,7 @@ nThen(function (w) {
|
|||
});
|
||||
};
|
||||
|
||||
var broadcast = (command, data, cb) => {
|
||||
cb = cb; // TODO nThen/concurrency
|
||||
var broadcast = (command, data/*, cb*/) => {
|
||||
for (const worker of Object.values(Cluster.workers)) {
|
||||
sendCommand(worker, command, data /*, cb */);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint esversion: 7 */
|
||||
define([], function () {
|
||||
// Based on https://gist.github.com/bellbind/871b145110c458e83077a718aef9fa0e
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ define(['/api/config'], function (ApiConfig) {
|
|||
// Inform the user that we won't navigate and that the 'bounce tab' will be closed.
|
||||
// our linter warns when it sees 'javascript:' because it doesn't distinguish between
|
||||
// detecting this pattern and using it, so we ignore this line
|
||||
if (['javascript:', 'vbscript:', 'data:', 'blob:'].includes(target.protocol)) { // jshint ignore:line
|
||||
if (['javascript:', 'vbscript:', 'data:', 'blob:'].includes(target.protocol)) {
|
||||
window.alert(Messages._getKey('bounce_danger', [target.href]));
|
||||
return void reject();
|
||||
}
|
||||
|
|
|
@ -1287,6 +1287,7 @@ define([
|
|||
|
||||
// check if they provide legal data
|
||||
assert(function (cb, msg) {
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
if (true) { return void cb(true); } // FIXME stubbed while we determine whether this is necessary
|
||||
if (ApiConfig.restrictRegistration) { return void cb(true); }
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ define([
|
|||
existing = Object.keys(res.tags).sort();
|
||||
}));
|
||||
}).nThen(function (waitFor) {
|
||||
var _err;
|
||||
hrefs.forEach(function (href) {
|
||||
common.getPadAttribute('tags', waitFor(function (err, res) {
|
||||
if (err) {
|
||||
|
@ -69,7 +68,6 @@ define([
|
|||
UI.alert(Messages.tags_noentry);
|
||||
}
|
||||
waitFor.abort();
|
||||
_err = err;
|
||||
return void console.error(err);
|
||||
}
|
||||
allTags[href] = res || [];
|
||||
|
@ -362,7 +360,7 @@ define([
|
|||
buttons: contactsButtons,
|
||||
});
|
||||
|
||||
var linkName, linkPassword, linkMessage, linkError, linkSpinText;
|
||||
var linkName, linkPassword, linkMessage, linkError;
|
||||
var linkForm, linkSpin, linkResult, linkUses, linkRole;
|
||||
var linkWarning;
|
||||
// Invite from link
|
||||
|
@ -429,7 +427,7 @@ define([
|
|||
style: 'display: none;'
|
||||
}, [
|
||||
h('i.fa.fa-spinner.fa-spin'),
|
||||
linkSpinText = h('span', Messages.team_inviteLinkLoading)
|
||||
h('span', Messages.team_inviteLinkLoading)
|
||||
]),
|
||||
linkResult = h('div', {
|
||||
style: 'display: none;'
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
var Util = {};
|
||||
|
||||
// polyfill for atob in case you're using this from node...
|
||||
window.atob = window.atob || function (str) { return Buffer.from(str, 'base64').toString('binary'); }; // jshint ignore:line
|
||||
window.btoa = window.btoa || function (str) { return Buffer.from(str, 'binary').toString('base64'); }; // jshint ignore:line
|
||||
window.atob = window.atob || function (str) { return Buffer.from(str, 'base64').toString('binary'); };
|
||||
window.btoa = window.btoa || function (str) { return Buffer.from(str, 'binary').toString('base64'); };
|
||||
|
||||
Util.slice = function (A, start, end) {
|
||||
return Array.prototype.slice.call(A, start, end);
|
||||
|
|
|
@ -1566,7 +1566,6 @@ define([
|
|||
var oldChannel;
|
||||
var warning;
|
||||
|
||||
var FileCrypto;
|
||||
var MediaTag;
|
||||
var Upload;
|
||||
Nthen(function (waitFor) {
|
||||
|
@ -1577,12 +1576,10 @@ define([
|
|||
}
|
||||
}).nThen(function (waitFor) {
|
||||
require([
|
||||
'/file/file-crypto.js',
|
||||
'/common/media-tag.js',
|
||||
'/common/outer/upload.js',
|
||||
'/components/tweetnacl/nacl-fast.min.js'
|
||||
], waitFor(function (_FileCrypto, _MT, _Upload) {
|
||||
FileCrypto = _FileCrypto;
|
||||
], waitFor(function (_MT, _Upload) {
|
||||
MediaTag = _MT;
|
||||
Upload = _Upload;
|
||||
}));
|
||||
|
@ -1952,7 +1949,7 @@ define([
|
|||
var oldBytes = data.oldBytes; // From Scrypt
|
||||
var newBytes = data.newBytes; // From Scrypt
|
||||
var secret = Hash.getSecrets('drive', hash);
|
||||
var newHash, newHref, newSecret;
|
||||
var newHash, newSecret;
|
||||
var oldIsOwned = false;
|
||||
|
||||
var blockHash = LocalStore.getBlockHash();
|
||||
|
@ -2031,7 +2028,6 @@ define([
|
|||
// Get the current content, store it in the new user file
|
||||
// and make sure the new user drive is owned
|
||||
newHash = Hash.createRandomHash('drive');
|
||||
newHref = '/drive/#' + newHash;
|
||||
newSecret = Hash.getSecrets('drive', newHash);
|
||||
|
||||
var optsPut = {
|
||||
|
@ -2717,6 +2713,7 @@ define([
|
|||
window.addEventListener('unload', function () {
|
||||
postMsg('CLOSE');
|
||||
});
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
} else if (false && !noWorker && !noSharedWorker && 'serviceWorker' in navigator) {
|
||||
var initializing = true;
|
||||
var stopWaiting = waitFor2(); // Call this function when we're ready
|
||||
|
|
|
@ -1907,7 +1907,7 @@ define([
|
|||
};
|
||||
|
||||
// create the folder structure before to upload files from folder
|
||||
var uploadFolder = function (fileList) {
|
||||
var uploadFolder = function (fileList, name) {
|
||||
var currentFolder = currentPath;
|
||||
// create an array of all the files relative path
|
||||
var files = Array.prototype.map.call(fileList, function (file) {
|
||||
|
@ -1917,7 +1917,7 @@ define([
|
|||
};
|
||||
});
|
||||
// if folder name already exist in drive, rename it
|
||||
var uploadedFolderName = files[0].path[0];
|
||||
var uploadedFolderName = files.length ? files[0].path[0] : (name || '');
|
||||
var availableName = manager.user.userObject.getAvailableName(manager.find(currentFolder), uploadedFolderName);
|
||||
|
||||
// ask for folder name and files options, then upload all the files!
|
||||
|
@ -1926,6 +1926,10 @@ define([
|
|||
|
||||
// verfify folder name is possible, and update files path
|
||||
availableName = manager.user.userObject.getAvailableName(manager.find(currentFolder), folderUploadOptions.folderName);
|
||||
if (!files.length) {
|
||||
return manager.addFolder(currentFolder, availableName, refresh);
|
||||
}
|
||||
|
||||
if (uploadedFolderName !== availableName) {
|
||||
files.forEach(function (file) {
|
||||
file.path[0] = availableName;
|
||||
|
@ -2001,19 +2005,21 @@ define([
|
|||
fileDrop = Array.prototype.slice.call(fileDrop).map(function (file) {
|
||||
if (file.kind !== "file") { return; }
|
||||
var f = file.getAsFile();
|
||||
if (!f.type && f.size % 4096 === 0) {
|
||||
// It's a folder!
|
||||
if (file.webkitGetAsEntry) { // IE and Opera don't support it
|
||||
f = file.webkitGetAsEntry();
|
||||
var files = [];
|
||||
nThen(function (w) {
|
||||
traverseFileTree(f, "", w, files);
|
||||
}).nThen(function () {
|
||||
uploadFolder(files);
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
// Folder drop not supported by the browser
|
||||
if (file.webkitGetAsEntry) {
|
||||
let entry = file.webkitGetAsEntry();
|
||||
if (entry.isFile) { return f; }
|
||||
// It's a folder
|
||||
var files = [];
|
||||
nThen(function (w) {
|
||||
traverseFileTree(entry, "", w, files);
|
||||
}).nThen(function () {
|
||||
uploadFolder(files, f.name);
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
// Old browsers: unreliable hack to detect folders
|
||||
if (!file.type && file.size%4096 === 0) {
|
||||
return; // Folder upload not supported
|
||||
}
|
||||
}
|
||||
return f;
|
||||
|
@ -2025,7 +2031,7 @@ define([
|
|||
}
|
||||
}
|
||||
|
||||
var oldPaths = JSON.parse(data).path;
|
||||
var oldPaths = data && JSON.parse(data).path;
|
||||
if (!oldPaths) { return; }
|
||||
// A moved element should be removed from its previous location
|
||||
var movedPaths = [];
|
||||
|
|
|
@ -757,7 +757,7 @@ define([
|
|||
var priv = common.getMetadataMgr().getPrivateData();
|
||||
var user = common.getMetadataMgr().getUserData();
|
||||
var edPublic = priv.edPublic;
|
||||
var strangers = 0;
|
||||
//var strangers = 0;
|
||||
var _owners = {};
|
||||
list.forEach(function (ed) {
|
||||
// If a friend is an owner, add their name to the list
|
||||
|
@ -808,7 +808,7 @@ define([
|
|||
// in the pad itself (as is the case of the uid in rich text comments)
|
||||
// TODO or just implement "Acquaintances"
|
||||
};
|
||||
strangers++;
|
||||
//strangers++;
|
||||
});
|
||||
if (!Object.keys(_owners).length) { return; }
|
||||
/*
|
||||
|
|
|
@ -278,6 +278,7 @@ define([
|
|||
if (code.length !== 6 || /\D/.test(code)) {
|
||||
return void UI.warn(Messages.settings_otp_invalid);
|
||||
}
|
||||
if (lock) { return; }
|
||||
confirmOTP.disabled = true;
|
||||
lock = true;
|
||||
|
||||
|
|
|
@ -214,8 +214,7 @@ define([
|
|||
|
||||
sidebar.addItem = (key, get, options) => {
|
||||
const safeKey = keyToCamlCase(key);
|
||||
get((content, config) => {
|
||||
config = config || {};
|
||||
get((content) => {
|
||||
options = options || {};
|
||||
const title = options.noTitle ? undefined : h('label.cp-item-label', {
|
||||
id: `cp-${app}-${key}`
|
||||
|
|
|
@ -349,9 +349,7 @@ var factory = function () {
|
|||
increment: function (N) {
|
||||
var l = N.length;
|
||||
while (l-- > 1) {
|
||||
/* .jshint probably suspects this is unsafe because we lack types
|
||||
but as long as this is only used on nonces, it should be safe */
|
||||
if (N[l] !== 255) { return void N[l]++; } // jshint ignore:line
|
||||
if (N[l] !== 255) { return void N[l]++; }
|
||||
|
||||
// you don't need to worry about this running out.
|
||||
// you'd need a REAAAALLY big file
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* eslint compat/compat: "off" */
|
||||
|
||||
define(['/api/config'], function (ApiConfig) {
|
||||
var Module = {};
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ define([
|
|||
// This structure is used for caching media data and blob urls for each media cryptpad url
|
||||
var mediasData = {};
|
||||
|
||||
var startOO = function () {};
|
||||
let startOO = function () {};
|
||||
|
||||
var supportsXLSX = function () {
|
||||
return privateData.supportsWasm;
|
||||
|
@ -681,51 +681,51 @@ define([
|
|||
}
|
||||
return new Blob([newText], {type: 'text/plain'});
|
||||
};
|
||||
var loadLastDocument = function (lastCp, onCpError, cb) {
|
||||
if (!lastCp || !lastCp.file) {
|
||||
return void onCpError('EEMPTY');
|
||||
}
|
||||
ooChannel.cpIndex = lastCp.index || 0;
|
||||
ooChannel.lastHash = lastCp.hash;
|
||||
var parsed = Hash.parsePadUrl(lastCp.file);
|
||||
var secret = Hash.getSecrets('file', parsed.hash);
|
||||
if (!secret || !secret.channel) { return; }
|
||||
var hexFileName = secret.channel;
|
||||
var fileHost = privateData.fileHost || privateData.origin;
|
||||
var src = fileHost + Hash.getBlobPathFromHex(hexFileName);
|
||||
var key = secret.keys && secret.keys.cryptKey;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', src, true);
|
||||
if (window.sendCredentials) { xhr.withCredentials = true; }
|
||||
xhr.responseType = 'arraybuffer';
|
||||
xhr.onload = function () {
|
||||
if (/^4/.test('' + this.status)) {
|
||||
onCpError(this.status);
|
||||
return void console.error('XHR error', this.status);
|
||||
|
||||
const loadLastDocument = function (lastCp) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!lastCp || !lastCp.file) {
|
||||
return void reject('EEMPTY');
|
||||
}
|
||||
var arrayBuffer = xhr.response;
|
||||
if (arrayBuffer) {
|
||||
var u8 = new Uint8Array(arrayBuffer);
|
||||
FileCrypto.decrypt(u8, key, function (err, decrypted) {
|
||||
if (err) {
|
||||
if (err === "DECRYPTION_ERROR") {
|
||||
console.warn(err);
|
||||
return void onCpError(err);
|
||||
ooChannel.cpIndex = lastCp.index || 0;
|
||||
ooChannel.lastHash = lastCp.hash;
|
||||
var parsed = Hash.parsePadUrl(lastCp.file);
|
||||
var secret = Hash.getSecrets('file', parsed.hash);
|
||||
if (!secret || !secret.channel) { return; }
|
||||
var hexFileName = secret.channel;
|
||||
var fileHost = privateData.fileHost || privateData.origin;
|
||||
var src = fileHost + Hash.getBlobPathFromHex(hexFileName);
|
||||
var key = secret.keys && secret.keys.cryptKey;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', src, true);
|
||||
if (window.sendCredentials) { xhr.withCredentials = true; }
|
||||
xhr.responseType = 'arraybuffer';
|
||||
xhr.onload = function () {
|
||||
if (/^4/.test('' + this.status)) {
|
||||
reject(this.status);
|
||||
return void console.error('XHR error', this.status);
|
||||
}
|
||||
var arrayBuffer = xhr.response;
|
||||
if (arrayBuffer) {
|
||||
var u8 = new Uint8Array(arrayBuffer);
|
||||
FileCrypto.decrypt(u8, key, function (err, decrypted) {
|
||||
if (err) {
|
||||
if (err === "DECRYPTION_ERROR") {
|
||||
console.warn(err);
|
||||
return void reject(err);
|
||||
}
|
||||
return void console.error(err);
|
||||
}
|
||||
return void console.error(err);
|
||||
}
|
||||
var blob = new Blob([decrypted.content], {type: 'plain/text'});
|
||||
if (cb) {
|
||||
return cb(blob, getFileType());
|
||||
}
|
||||
startOO(blob, getFileType());
|
||||
});
|
||||
}
|
||||
};
|
||||
xhr.onerror = function (err) {
|
||||
onCpError(err);
|
||||
};
|
||||
xhr.send(null);
|
||||
var blob = new Blob([decrypted.content], {type: 'plain/text'});
|
||||
resolve({blob, fileType: getFileType()});
|
||||
});
|
||||
}
|
||||
};
|
||||
xhr.onerror = function (err) {
|
||||
reject(err);
|
||||
};
|
||||
xhr.send(null);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -825,26 +825,28 @@ define([
|
|||
|
||||
if (!exists) { return void UI.removeLoadingScreen(); }
|
||||
|
||||
loadLastDocument(cp, function () {
|
||||
if (cp.hash && vHashEl) {
|
||||
// We requested a checkpoint but we can't find it...
|
||||
loadLastDocument(cp)
|
||||
.then(({blob, fileType}) => {
|
||||
ooChannel.queue = messages;
|
||||
resetData(blob, fileType);
|
||||
UI.removeLoadingScreen();
|
||||
vHashEl.innerText = Messages.oo_deletedVersion;
|
||||
$(vHashEl).removeClass('alert-warning').addClass('alert-danger');
|
||||
return;
|
||||
}
|
||||
var file = getFileType();
|
||||
var type = common.getMetadataMgr().getPrivateData().ooType;
|
||||
if (APP.downloadType) { type = APP.downloadType; }
|
||||
var blob = loadInitDocument(type, true);
|
||||
ooChannel.queue = messages;
|
||||
resetData(blob, file);
|
||||
UI.removeLoadingScreen();
|
||||
}, function (blob, file) {
|
||||
ooChannel.queue = messages;
|
||||
resetData(blob, file);
|
||||
UI.removeLoadingScreen();
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
if (cp.hash && vHashEl) {
|
||||
// We requested a checkpoint but we can't find it...
|
||||
UI.removeLoadingScreen();
|
||||
vHashEl.innerText = Messages.oo_deletedVersion;
|
||||
$(vHashEl).removeClass('alert-warning').addClass('alert-danger');
|
||||
return;
|
||||
}
|
||||
var file = getFileType();
|
||||
var type = common.getMetadataMgr().getPrivateData().ooType;
|
||||
if (APP.downloadType) { type = APP.downloadType; }
|
||||
var blob = loadInitDocument(type, true);
|
||||
ooChannel.queue = messages;
|
||||
resetData(blob, file);
|
||||
UI.removeLoadingScreen();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -1675,7 +1677,8 @@ define([
|
|||
chat: false,
|
||||
logo: {
|
||||
url: "/bounce/#" + encodeURIComponent('https://www.onlyoffice.com')
|
||||
}
|
||||
},
|
||||
comments: !lock && !readOnly
|
||||
},
|
||||
"user": {
|
||||
"id": String(myOOId), //"c0c3bf82-20d7-4663-bf6d-7fa39c598b1d",
|
||||
|
@ -1998,14 +2001,13 @@ define([
|
|||
APP.themeRemote = true;
|
||||
*/
|
||||
};
|
||||
APP.changeTheme = function (id) {
|
||||
APP.changeTheme = function (/*id*/) {
|
||||
/*
|
||||
// disabled:
|
||||
Uncaught TypeError: Cannot read property 'calculatedType' of null
|
||||
at CPresentation.changeTheme (sdk-all.js?ver=4.11.0-1633612942653-1633619288217:15927)
|
||||
*/
|
||||
|
||||
id = id;
|
||||
/*
|
||||
APP.themeChanged = {
|
||||
id: id
|
||||
|
@ -2359,25 +2361,15 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
|
|||
// If the last checkpoint is empty, load the "initial" doc instead
|
||||
if (!lastCp || !lastCp.file) { return void loadDocument(true, useNewDefault); }
|
||||
// Load latest checkpoint
|
||||
return void loadLastDocument(lastCp, function () {
|
||||
// Checkpoint error: load the previous one
|
||||
i = i || 0;
|
||||
loadDocument(noCp, useNewDefault, ++i);
|
||||
});
|
||||
}
|
||||
var newText;
|
||||
switch (type) {
|
||||
case 'sheet' :
|
||||
newText = EmptyCell(useNewDefault);
|
||||
break;
|
||||
case 'doc':
|
||||
newText = EmptyDoc();
|
||||
break;
|
||||
case 'presentation':
|
||||
newText = EmptySlide();
|
||||
break;
|
||||
default:
|
||||
newText = '';
|
||||
loadLastDocument(lastCp)
|
||||
.then(({blob, fileType}) => {
|
||||
startOO(blob, fileType);
|
||||
})
|
||||
.catch(() => {
|
||||
// Checkpoint error: load the previous one
|
||||
i = i || 0;
|
||||
loadDocument(noCp, useNewDefault, ++i);
|
||||
});
|
||||
}
|
||||
var blob = loadInitDocument(type, useNewDefault);
|
||||
startOO(blob, file);
|
||||
|
@ -2427,7 +2419,6 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
|
|||
}
|
||||
};
|
||||
|
||||
var wasEditing = false;
|
||||
var setStrictEditing = function () {
|
||||
if (APP.isFast) { return; }
|
||||
var editor = getEditor();
|
||||
|
@ -2437,12 +2428,10 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
|
|||
} else {
|
||||
evOnSync.fire();
|
||||
}
|
||||
wasEditing = Boolean(editing);
|
||||
};
|
||||
APP.onFastChange = function (isFast) {
|
||||
APP.isFast = isFast;
|
||||
if (isFast) {
|
||||
wasEditing = false;
|
||||
if (APP.hasChangedInterval) {
|
||||
window.clearInterval(APP.hasChangedInterval);
|
||||
}
|
||||
|
@ -2464,20 +2453,21 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
|
|||
pinImages();
|
||||
};
|
||||
|
||||
var loadCp = function (cp, keepQueue) {
|
||||
const loadCp = async function (cp, keepQueue) {
|
||||
if (!isLockedModal.modal) {
|
||||
isLockedModal.modal = UI.openCustomModal(isLockedModal.content);
|
||||
}
|
||||
loadLastDocument(cp, function () {
|
||||
try {
|
||||
const {blob, fileType} = await loadLastDocument(cp);
|
||||
if (!keepQueue) { ooChannel.queue = []; }
|
||||
resetData(blob, fileType);
|
||||
} catch (e) {
|
||||
var file = getFileType();
|
||||
var type = common.getMetadataMgr().getPrivateData().ooType;
|
||||
var blob = loadInitDocument(type, true);
|
||||
if (!keepQueue) { ooChannel.queue = []; }
|
||||
resetData(blob, file);
|
||||
}, function (blob, file) {
|
||||
if (!keepQueue) { ooChannel.queue = []; }
|
||||
resetData(blob, file);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var loadTemplate = function (href, pw, parsed) {
|
||||
|
@ -2678,6 +2668,7 @@ 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) {
|
||||
|
@ -3213,13 +3204,15 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
|
|||
isLockedModal.modal = UI.openCustomModal(isLockedModal.content);
|
||||
}
|
||||
var lastCp = getLastCp();
|
||||
loadLastDocument(lastCp, function (err) {
|
||||
console.error(err);
|
||||
// On error, do nothing
|
||||
// FIXME lock the document or ask for a page reload?
|
||||
}, function (blob, type) {
|
||||
resetData(blob, type);
|
||||
});
|
||||
loadLastDocument(lastCp)
|
||||
.then(({blob, fileType}) => {
|
||||
resetData(blob, fileType);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
// On error, do nothing
|
||||
// FIXME lock the document or ask for a page reload?
|
||||
});
|
||||
};
|
||||
|
||||
config.onRemote = function () {
|
||||
|
|
|
@ -104,8 +104,7 @@ define([
|
|||
};
|
||||
};
|
||||
|
||||
Block.proveAncestor = function (O /* oldBlockKeys */, N /* newBlockKeys */) {
|
||||
N = N;
|
||||
Block.proveAncestor = function (O /* oldBlockKeys, N, newBlockKeys */) {
|
||||
var u8_pub = Util.find(O, ['sign', 'publicKey']);
|
||||
var u8_secret = Util.find(O, ['sign', 'secretKey']);
|
||||
try {
|
||||
|
|
|
@ -545,12 +545,10 @@ define([
|
|||
// Make sure we are a member of this team
|
||||
var myTeams = Util.find(ctx, ['store', 'proxy', 'teams']) || {};
|
||||
var teamId;
|
||||
var team;
|
||||
Object.keys(myTeams).some(function (k) {
|
||||
var _team = myTeams[k];
|
||||
if (_team.channel === content.teamData.channel) {
|
||||
teamId = k;
|
||||
team = _team;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -74,8 +74,7 @@ define([
|
|||
});
|
||||
};
|
||||
|
||||
var setName = function (ctx, value, cb) {
|
||||
cb = cb || function () {};
|
||||
var setName = function (ctx, value) {
|
||||
ctx.listmap.proxy.name = value;
|
||||
Realtime.whenRealtimeSyncs(ctx.listmap.realtime, function () {
|
||||
if (!ctx.listmap) { return; }
|
||||
|
|
|
@ -582,7 +582,6 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto, Feedback)
|
|||
delete ref.internal.checkpointTimeout;
|
||||
};
|
||||
|
||||
var webChannel;
|
||||
roster.stop = function () {
|
||||
if (ref.internal.cpNetflux && typeof(ref.internal.cpNetflux.stop) === "function") {
|
||||
ref.internal.cpNetflux.stop();
|
||||
|
@ -604,9 +603,8 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto, Feedback)
|
|||
}
|
||||
config.onCacheReady(roster);
|
||||
};
|
||||
var onReady = function (info) {
|
||||
var onReady = function () {
|
||||
//console.log("READY");
|
||||
webChannel = info;
|
||||
ready = true;
|
||||
cb(void 0, roster);
|
||||
};
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint ignore:start */
|
||||
/* global importScripts, tabs */
|
||||
|
||||
importScripts('/components/requirejs/require.js');
|
||||
|
||||
window = self;
|
||||
|
@ -168,12 +169,12 @@ self.addEventListener('message', function (e) {
|
|||
self.tabs[cId].msgEv.fire(e);
|
||||
}
|
||||
});
|
||||
self.addEventListener('install', function (e) {
|
||||
self.addEventListener('install', function () {
|
||||
debug('V1 installing…');
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener('activate', function (e) {
|
||||
self.addEventListener('activate', function () {
|
||||
debug('V1 now ready to handle fetches!');
|
||||
});
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint ignore:start */
|
||||
/* global importScripts */
|
||||
|
||||
importScripts('/components/requirejs/require.js');
|
||||
|
||||
window = self;
|
||||
|
@ -161,10 +162,10 @@ var init = function (client, cb) {
|
|||
});
|
||||
};
|
||||
|
||||
onconnect = function(e) {
|
||||
addEventListener('connect', function(e) {
|
||||
debug('New SharedWorker client');
|
||||
var port = e.ports[0];
|
||||
var cId = Number(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER))
|
||||
var cId = Number(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER));
|
||||
var client = self.tabs[cId] = {
|
||||
id: cId,
|
||||
port: port
|
||||
|
@ -186,5 +187,5 @@ onconnect = function(e) {
|
|||
client.msgEv.fire(e);
|
||||
}
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint ignore:start */
|
||||
/* global importScripts */
|
||||
|
||||
importScripts('/components/requirejs/require.js');
|
||||
|
||||
window = self;
|
||||
|
|
|
@ -121,7 +121,7 @@ define([
|
|||
|
||||
// Sanitize file names
|
||||
var illegalRe = /[\/\?<>\\:\*\|"]/g;
|
||||
var controlRe = /[\x00-\x1f\x80-\x9f]/g;
|
||||
var controlRe = /[\x00-\x1f\x80-\x9f]/g; // eslint-disable-line no-control-regex
|
||||
var reservedRe = /^\.+$/;
|
||||
var safeRe = /[&'%!"{}[\]]/g;
|
||||
var sanitize = function (input) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// IF YOU EDIT THIS FILE, bump the version (replace 1.3 in the following command with the next version.)
|
||||
// grep -nr '/common/sframe-boot.js?ver=' | sed 's/:.*$//' | grep -v 'sframe-boot.js' | while read x; do \
|
||||
// sed -i -e 's@/common/sframe-boot.js?ver=[^"]*@/common/sframe-boot.js?ver=1.3@' $x; done
|
||||
;(function () {
|
||||
(function () {
|
||||
|
||||
var _alert = function (cb) {
|
||||
return void require([
|
||||
|
@ -45,7 +45,7 @@ if (typeof(Promise) !== 'function') {
|
|||
var caughtEval;
|
||||
console.log("Testing if CSP correctly blocks an 'eval' call");
|
||||
try {
|
||||
eval('true'); // jshint ignore:line
|
||||
eval('true');
|
||||
} catch (err) { caughtEval = true; }
|
||||
|
||||
if (!/^\/(sheet|doc|presentation|unsafeiframe)/.test(window.location.pathname) && !caughtEval) {
|
||||
|
|
|
@ -13,9 +13,6 @@ define([
|
|||
var badStateTimeout = typeof(AppConfig.badStateTimeout) === 'number' ?
|
||||
AppConfig.badStateTimeout : 30000;
|
||||
|
||||
var verbose = function (x) { console.log(x); };
|
||||
verbose = function () {}; // comment out to enable verbose logging
|
||||
|
||||
module.exports.start = function (config) {
|
||||
var onConnectionChange = config.onConnectionChange || function () { };
|
||||
var onRemote = config.onRemote || function () { };
|
||||
|
|
|
@ -225,14 +225,12 @@ define([
|
|||
var $textarea = exp.$textarea = textarea ? $(textarea) : $('#editor1');
|
||||
if (!$textarea.length) { $textarea = exp.$textarea = $pad.contents().find('#editor1'); }
|
||||
|
||||
var Title;
|
||||
var onLocal = function () {};
|
||||
var $drawer;
|
||||
exp.init = function (local, title, toolbar) {
|
||||
if (typeof local === "function") {
|
||||
onLocal = local;
|
||||
}
|
||||
Title = title;
|
||||
$drawer = toolbar.$theme || $();
|
||||
};
|
||||
|
||||
|
|
|
@ -467,9 +467,6 @@ define([
|
|||
type = "text/markdown";
|
||||
}
|
||||
|
||||
// Can't upload folder here
|
||||
if (!file.type && file.size%4096 === 0) { return; }
|
||||
|
||||
var thumb;
|
||||
var preview;
|
||||
var alt;
|
||||
|
|
|
@ -114,7 +114,6 @@ define([
|
|||
var SecureIframe;
|
||||
var UnsafeIframe;
|
||||
var OOIframe;
|
||||
var Messaging;
|
||||
var Notifier;
|
||||
var Utils = {
|
||||
nThen: nThen
|
||||
|
@ -142,7 +141,6 @@ define([
|
|||
'/secureiframe/main.js',
|
||||
'/unsafeiframe/main.js',
|
||||
'/common/onlyoffice/ooiframe.js',
|
||||
'/common/common-messaging.js',
|
||||
'/common/common-notifier.js',
|
||||
'/common/common-hash.js',
|
||||
'/common/common-util.js',
|
||||
|
@ -158,7 +156,7 @@ define([
|
|||
'/common/userObject.js',
|
||||
'optional!/api/instance'
|
||||
], waitFor(function (_CpNfOuter, _Cryptpad, _Crypto, _Cryptget, _SFrameChannel,
|
||||
_SecureIframe, _UnsafeIframe, _OOIframe, _Messaging, _Notifier, _Hash, _Util, _Realtime, _Notify,
|
||||
_SecureIframe, _UnsafeIframe, _OOIframe, _Notifier, _Hash, _Util, _Realtime, _Notify,
|
||||
_Constants, _Feedback, _LocalStore, _Block, _Cache, _AppConfig, /* _Test,*/ _UserObject,
|
||||
_Instance) {
|
||||
CpNfOuter = _CpNfOuter;
|
||||
|
@ -169,7 +167,6 @@ define([
|
|||
SecureIframe = _SecureIframe;
|
||||
UnsafeIframe = _UnsafeIframe;
|
||||
OOIframe = _OOIframe;
|
||||
Messaging = _Messaging;
|
||||
Notifier = _Notifier;
|
||||
Utils.Hash = _Hash;
|
||||
Utils.Util = _Util;
|
||||
|
@ -2047,6 +2044,7 @@ define([
|
|||
|
||||
sframeChan.on('Q_ASK_NOTIFICATION', function (data, cb) {
|
||||
if (!Utils.Notify.isSupported()) { return void cb(false); }
|
||||
// eslint-disable-next-line compat/compat
|
||||
Notification.requestPermission(function (s) {
|
||||
cb(s === "granted");
|
||||
});
|
||||
|
|
|
@ -68,7 +68,6 @@ define([], function () {
|
|||
}
|
||||
};
|
||||
|
||||
// jshint -W103
|
||||
var errProto = (new Error()).__proto__;
|
||||
var doLog = function (o) {
|
||||
var s;
|
||||
|
|
|
@ -34,8 +34,6 @@ MessengerUI, Messages, Pages) {
|
|||
var BOTTOM_LEFT_CLS = Bar.constants.bottomL = 'cp-toolbar-bottom-left';
|
||||
var BOTTOM_MID_CLS = Bar.constants.bottomM = 'cp-toolbar-bottom-mid';
|
||||
var BOTTOM_RIGHT_CLS = Bar.constants.bottomR = 'cp-toolbar-bottom-right';
|
||||
var LEFTSIDE_CLS = Bar.constants.leftside = 'cp-toolbar-leftside';
|
||||
var RIGHTSIDE_CLS = Bar.constants.rightside = 'cp-toolbar-rightside';
|
||||
var FILE_CLS = Bar.constants.file = 'cp-toolbar-file';
|
||||
var DRAWER_CLS = Bar.constants.drawer = 'cp-toolbar-drawer-content';
|
||||
var HISTORY_CLS = Bar.constants.history = 'cp-toolbar-history';
|
||||
|
@ -137,7 +135,7 @@ MessengerUI, Messages, Pages) {
|
|||
$('<span>', {'class': USERADMIN_CLS + ' cp-dropdown-container'}).hide().appendTo($userContainer);
|
||||
|
||||
$toolbar.append($topContainer);
|
||||
var $bottom = $(h('div.'+BOTTOM_CLS, [
|
||||
$(h('div.'+BOTTOM_CLS, [
|
||||
h('div.'+BOTTOM_LEFT_CLS),
|
||||
h('div.'+BOTTOM_MID_CLS),
|
||||
h('div.'+BOTTOM_RIGHT_CLS)
|
||||
|
@ -506,7 +504,7 @@ MessengerUI, Messages, Pages) {
|
|||
return $container;
|
||||
};
|
||||
|
||||
createCollapse = function (toolbar) {
|
||||
var createCollapse = function (toolbar) {
|
||||
var up = h('i.fa.fa-chevron-up', {title: Messages.toolbar_collapse});
|
||||
var down = h('i.fa.fa-chevron-down', {title: Messages.toolbar_expand});
|
||||
var notif = h('span.cp-collapsed-notif');
|
||||
|
@ -979,7 +977,6 @@ MessengerUI, Messages, Pages) {
|
|||
if (overLimit) {
|
||||
$limit.show().click(function () {
|
||||
if (ApiConfig.allowSubscriptions && Config.upgradeURL) {
|
||||
var key = 'pinLimitReachedAlert'; // Msg.pinLimitReachedAlert
|
||||
var msg = Pages.setHTML(h('span'), Messages.pinLimitReachedAlert);
|
||||
$(msg).find('a').attr({
|
||||
target: '_blank',
|
||||
|
@ -998,7 +995,7 @@ MessengerUI, Messages, Pages) {
|
|||
return $limit;
|
||||
};
|
||||
|
||||
var createNewPad = function (toolbar, config) {
|
||||
var createNewPad = function (toolbar) {
|
||||
var $button = Common.createButton('newpad', true);
|
||||
toolbar.$drawer.append($button);
|
||||
return $button;
|
||||
|
@ -1008,7 +1005,6 @@ MessengerUI, Messages, Pages) {
|
|||
if (!config.metadataMgr) {
|
||||
throw new Error("You must provide a `metadataMgr` to display the user menu");
|
||||
}
|
||||
var metadataMgr = config.metadataMgr;
|
||||
var $userAdmin = toolbar.$userAdmin.find('.'+USERADMIN_CLS).show();
|
||||
var userMenuCfg = {
|
||||
$initBlock: $userAdmin,
|
||||
|
@ -1028,7 +1024,7 @@ MessengerUI, Messages, Pages) {
|
|||
return $userAdmin;
|
||||
};
|
||||
|
||||
var createMaintenance = function (toolbar, config) {
|
||||
var createMaintenance = function (toolbar) {
|
||||
var $notif = toolbar.$top.find('.'+MAINTENANCE_CLS);
|
||||
var button = h('button.cp-maintenance-wrench.fa.fa-wrench');
|
||||
$notif.append(button);
|
||||
|
|
|
@ -51,7 +51,7 @@ define([
|
|||
const loadCryptPadImages = (doc) => {
|
||||
return Array.from(doc .querySelectorAll('mxCell'))
|
||||
.map((element) => [element, parseDrawioStyle(element.getAttribute('style'))])
|
||||
.filter(([element, style]) => style && style.image && style.image.startsWith('cryptpad://'))
|
||||
.filter(([, style]) => style && style.image && style.image.startsWith('cryptpad://'))
|
||||
.map(([element, style]) => {
|
||||
return loadImage(style.image)
|
||||
.then((dataUrl) => {
|
||||
|
|
|
@ -141,7 +141,6 @@ define([
|
|||
var common;
|
||||
var proxy = {};
|
||||
var folders = {};
|
||||
var readOnly;
|
||||
|
||||
var startOnline = false;
|
||||
var onReco;
|
||||
|
@ -168,7 +167,7 @@ define([
|
|||
}
|
||||
metadataMgr.onChange(function () {
|
||||
if (typeof(metadataMgr.getPrivateData().readOnly) === 'boolean') {
|
||||
readOnly = APP.readOnly = metadataMgr.getPrivateData().readOnly;
|
||||
APP.readOnly = metadataMgr.getPrivateData().readOnly;
|
||||
privReady();
|
||||
}
|
||||
});
|
||||
|
@ -200,7 +199,7 @@ define([
|
|||
|
||||
APP.disableSF = !privateData.enableSF && AppConfig.disableSharedFolders;
|
||||
if (APP.newSharedFolder && !APP.loggedIn) {
|
||||
readOnly = APP.readOnly = true;
|
||||
APP.readOnly = true;
|
||||
var data = folders[APP.newSharedFolder];
|
||||
if (data) {
|
||||
sframeChan.query('Q_SET_PAD_TITLE_IN_DRIVE', {
|
||||
|
|
|
@ -42,7 +42,7 @@ define([
|
|||
while (l-- > 1) {
|
||||
/* our linter suspects this is unsafe because we lack types
|
||||
but as long as this is only used on nonces, it should be safe */
|
||||
if (N[l] !== 255) { return void N[l]++; } // jshint ignore:line
|
||||
if (N[l] !== 255) { return void N[l]++; }
|
||||
if (l === 0) { throw new Error('E_NONCE_TOO_LARGE'); }
|
||||
N[l] = 0;
|
||||
}
|
||||
|
|
|
@ -1243,14 +1243,14 @@ define([
|
|||
h('i.fa.fa-plus'),
|
||||
h('span', Messages.form_conditional_addAnd)
|
||||
]);
|
||||
var $b = $(btn).click(function () {
|
||||
getConditions($container, true, rules, undefined, $b);
|
||||
$(btn).click(function () {
|
||||
getConditions($container, true, rules, undefined);
|
||||
});
|
||||
$container.append(btn);
|
||||
return $b;
|
||||
return;
|
||||
};
|
||||
var values = getConditionsValues();
|
||||
getConditions = function ($container, isNew, rules, condition, $btn) {
|
||||
getConditions = function ($container, isNew, rules, condition) {
|
||||
condition = condition || {};
|
||||
condition.uid = condition.uid || Util.uid();
|
||||
|
||||
|
@ -1272,7 +1272,7 @@ define([
|
|||
if (!Array.isArray(rules)) { // new set of rules (OR)
|
||||
rules = [condition];
|
||||
w.push(rules);
|
||||
$btn = getAddAndButton($container, rules);
|
||||
getAddAndButton($container, rules);
|
||||
} else {
|
||||
rules.push(condition);
|
||||
}
|
||||
|
@ -1473,9 +1473,9 @@ define([
|
|||
w.forEach(function (rules) {
|
||||
var rulesC = h('div.cp-form-condition-rule');
|
||||
var $rulesC = $(rulesC);
|
||||
var $b = getAddAndButton($rulesC, rules);
|
||||
getAddAndButton($rulesC, rules);
|
||||
rules.forEach(function (obj) {
|
||||
getConditions($rulesC, false, rules, obj, $b);
|
||||
getConditions($rulesC, false, rules, obj);
|
||||
});
|
||||
$addC.before($rulesC);
|
||||
});
|
||||
|
@ -1585,11 +1585,11 @@ define([
|
|||
if (!$v.length) { return; }
|
||||
var dropV = $v[0] && $v[0].dropdown;
|
||||
if (!dropV) { return; }
|
||||
var res, type;
|
||||
var res;
|
||||
values.some(function (obj) {
|
||||
if (String(obj.uid) === String(val)) {
|
||||
res = obj.values;
|
||||
type = obj.type;
|
||||
//var type = obj.type;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -41,8 +41,6 @@ define([
|
|||
// checkboxes
|
||||
var $register = $('button#register');
|
||||
|
||||
var registering = false;
|
||||
|
||||
var I_REALLY_WANT_TO_USE_MY_EMAIL_FOR_MY_USERNAME = false;
|
||||
var br = function () { return h('br'); };
|
||||
|
||||
|
@ -103,9 +101,7 @@ define([
|
|||
var warning = Messages._getKey('register_passwordTooShort', [
|
||||
Cred.MINIMUM_PASSWORD_LENGTH
|
||||
]);
|
||||
return void UI.alert(warning, function () {
|
||||
registering = false;
|
||||
});
|
||||
return void UI.alert(warning);
|
||||
}
|
||||
|
||||
if (passwd !== confirmPassword) { // do their passwords match?
|
||||
|
@ -156,7 +152,6 @@ define([
|
|||
return true;
|
||||
}
|
||||
});
|
||||
registering = true;
|
||||
}, {
|
||||
ok: Messages.register_writtenPassword,
|
||||
cancel: Messages.register_cancel,
|
||||
|
|
|
@ -73,7 +73,7 @@ define([
|
|||
};
|
||||
var chan = makeChan();
|
||||
|
||||
var isNew = false;
|
||||
//var isNew = false;
|
||||
var checkSession = function (oldKey, cb) {
|
||||
var channel = Hash.hrefToHexChannelId(Hash.hashToHref(oldKey));
|
||||
var prefix = channel.slice(0,2);
|
||||
|
@ -97,7 +97,7 @@ define([
|
|||
};
|
||||
chan.on('GET_SESSION', function (data, cb) {
|
||||
var getHash = function () {
|
||||
isNew = true;
|
||||
//isNew = true;
|
||||
return Hash.createRandomHash('integration');
|
||||
};
|
||||
var oldKey = data.key;
|
||||
|
|
|
@ -128,9 +128,7 @@
|
|||
increment: function (N) {
|
||||
var l = N.length;
|
||||
while (l-- > 1) {
|
||||
/* .jshint probably suspects this is unsafe because we lack types
|
||||
but as long as this is only used on nonces, it should be safe */
|
||||
if (N[l] !== 255) { return void N[l]++; } // jshint ignore:line
|
||||
if (N[l] !== 255) { return void N[l]++; }
|
||||
|
||||
// you don't need to worry about this running out.
|
||||
// you'd need a REAAAALLY big file
|
||||
|
|
|
@ -48,8 +48,6 @@ define([
|
|||
|
||||
var Nacl = window.nacl;
|
||||
var common;
|
||||
var metadataMgr;
|
||||
var privateData;
|
||||
var sFrameChan;
|
||||
|
||||
var andThen = function (common, $container) {
|
||||
|
@ -468,7 +466,7 @@ define([
|
|||
row(archiveAccountLabel, archiveAccountButton);
|
||||
|
||||
// archive owned documents
|
||||
/* // TODO not implemented
|
||||
/* // TODO not implemented
|
||||
var archiveDocuments = () => {
|
||||
justifyRestorationDialog(Messages.admin_archiveDocumentsConfirm, reason => {
|
||||
sframeCommand('ARCHIVE_OWNED_DOCUMENTS', {
|
||||
|
@ -3401,8 +3399,6 @@ define([
|
|||
if (!common.isAdmin()) { return; }
|
||||
updateStatus(waitFor());
|
||||
}).nThen(function( /*waitFor*/ ) {
|
||||
metadataMgr = common.getMetadataMgr();
|
||||
privateData = metadataMgr.getPrivateData();
|
||||
common.setTabTitle(Messages.adminPage || 'Administration');
|
||||
|
||||
if (!common.isAdmin()) {
|
||||
|
|
|
@ -35,7 +35,7 @@ define([
|
|||
category = window.location.hash.slice(1);
|
||||
window.location.hash = '';
|
||||
}
|
||||
var addData = function (obj, Cryptpad, user, Utils) {
|
||||
var addData = function (obj) {
|
||||
if (category) { obj.category = category; }
|
||||
};
|
||||
SFCommonO.start({
|
||||
|
|
|
@ -185,8 +185,8 @@ define(['jquery'], function ($) {
|
|||
// for other browers, the 'src' attribute should be left empty to
|
||||
// trigger iframe's 'load' event.
|
||||
var src =
|
||||
CKEDITOR.env.air ? 'javascript:void(0)' : // jshint ignore:line
|
||||
( CKEDITOR.env.ie && !CKEDITOR.env.edge ) ? 'javascript:void(function(){' + encodeURIComponent( // jshint ignore:line
|
||||
CKEDITOR.env.air ? 'javascript:void(0)' :
|
||||
( CKEDITOR.env.ie && !CKEDITOR.env.edge ) ? 'javascript:void(function(){' + encodeURIComponent(
|
||||
'document.open();' +
|
||||
// In IE, the document domain must be set any time we call document.open().
|
||||
'(' + CKEDITOR.tools.fixDomain + ')();' +
|
||||
|
|
|
@ -31,9 +31,9 @@ define(['/api/config'], function (ApiConfig) {
|
|||
// trigger iframe's 'load' event.
|
||||
// Microsoft Edge throws "Permission Denied" if treated like an IE (http://dev.ckeditor.com/ticket/13441).
|
||||
if ( CKEDITOR.env.air ) {
|
||||
src = 'javascript:void(0)'; // jshint ignore:line
|
||||
src = 'javascript:void(0)';
|
||||
} else if ( CKEDITOR.env.ie && !CKEDITOR.env.edge ) {
|
||||
src = 'javascript:void(function(){' + encodeURIComponent( src ) + '}())'; // jshint ignore:line
|
||||
src = 'javascript:void(function(){' + encodeURIComponent( src ) + '}())';
|
||||
} else {
|
||||
src = '';
|
||||
}
|
||||
|
|
|
@ -93,7 +93,6 @@ define([
|
|||
var CREATE_ID = "cp-app-profile-create";
|
||||
var HEADER_ID = "cp-app-profile-header";
|
||||
var HEADER_RIGHT_ID = "cp-app-profile-rightside";
|
||||
var CREATE_INVITE_BUTTON = 'cp-app-profile-invite-button'; /* jshint ignore: line */
|
||||
var VIEW_PROFILE_BUTTON = 'cp-app-profile-viewprofile-button';
|
||||
|
||||
var common;
|
||||
|
|
|
@ -59,8 +59,6 @@ define([
|
|||
|
||||
var $register = $('button#register');
|
||||
|
||||
var registering = false;
|
||||
|
||||
var I_REALLY_WANT_TO_USE_MY_EMAIL_FOR_MY_USERNAME = false;
|
||||
var br = function () { return h('br'); };
|
||||
|
||||
|
@ -96,9 +94,7 @@ define([
|
|||
$uname.val(uname);
|
||||
if (uname.length > Cred.MAXIMUM_NAME_LENGTH) {
|
||||
let nameWarning = Messages._getKey('register_nameTooLong', [ Cred.MAXIMUM_NAME_LENGTH ]);
|
||||
return void UI.alert(nameWarning, function () {
|
||||
registering = false;
|
||||
});
|
||||
return void UI.alert(nameWarning);
|
||||
}
|
||||
|
||||
var passwd = $passwd.val();
|
||||
|
@ -139,9 +135,7 @@ define([
|
|||
var warning = Messages._getKey('register_passwordTooShort', [
|
||||
Cred.MINIMUM_PASSWORD_LENGTH
|
||||
]);
|
||||
return void UI.alert(warning, function () {
|
||||
registering = false;
|
||||
});
|
||||
return void UI.alert(warning);
|
||||
}
|
||||
|
||||
if (passwd !== confirmPassword) { // do their passwords match?
|
||||
|
@ -174,7 +168,6 @@ define([
|
|||
shouldImport,
|
||||
onOTP: UI.getOTPScreen
|
||||
});
|
||||
registering = true;
|
||||
}, {
|
||||
ok: Messages.register_writtenPassword,
|
||||
cancel: Messages.register_cancel,
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
@import (reference) '../../customize/src/less2/include/sidebar-layout.less';
|
||||
@import (reference) "../../customize/src/less2/include/limit-bar.less";
|
||||
@import (reference) "../../customize/src/less2/include/creation.less";
|
||||
@import (reference) '../../customize/src/less2/include/framework.less';
|
||||
@import (reference) '../../customize/src/less2/include/export.less';
|
||||
|
||||
&.cp-app-sidebar {
|
||||
.framework_min_main();
|
||||
.sidebar-layout_main();
|
||||
.limit-bar_main();
|
||||
.creation_main();
|
||||
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
font: @colortheme_app-font;
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
<!--
|
||||
SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CryptPad</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="referrer" content="no-referrer" />
|
||||
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
||||
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
||||
<script async data-bootload="main.js" data-main="/common/boot.js?ver=1.0" src="/components/requirejs/require.js?ver=2.3.5"></script>
|
||||
<link href="/customize/src/outer.css?ver=1.3.2" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<noscript></noscript>
|
||||
<iframe-placeholder>
|
|
@ -1,22 +0,0 @@
|
|||
<!--
|
||||
SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html class="cp-app-noscroll">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<script src="/customize/pre-loading.js?ver=1.1"></script>
|
||||
<link href="/customize/src/pre-loading.css?ver=1.0" rel="stylesheet" type="text/css">
|
||||
<script async data-bootload="/sidebar/inner.js" data-main="/common/sframe-boot.js?ver=1.11" src="/components/requirejs/require.js?ver=2.3.5"></script>
|
||||
<style>
|
||||
.loading-hidden { display: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="cp-app-sidebar">
|
||||
<div id="cp-toolbar" class="cp-toolbar-container"></div>
|
||||
<div id="cp-sidebarlayout-container"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,111 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'/common/toolbar.js',
|
||||
'/components/nthen/index.js',
|
||||
'/common/sframe-common.js',
|
||||
'/common/common-interface.js',
|
||||
'/common/common-ui-elements.js',
|
||||
'/common/common-util.js',
|
||||
'/common/common-hash.js',
|
||||
'/common/inner/sidebar-layout.js',
|
||||
'/customize/messages.js',
|
||||
'/common/hyperscript.js',
|
||||
'/customize/application_config.js',
|
||||
'/api/config',
|
||||
|
||||
'css!/components/bootstrap/dist/css/bootstrap.min.css',
|
||||
'css!/components/components-font-awesome/css/font-awesome.min.css',
|
||||
'less!/sidebar/app-sidebar.less',
|
||||
], function(
|
||||
$,
|
||||
Toolbar,
|
||||
nThen,
|
||||
SFCommon,
|
||||
UI,
|
||||
UIElements,
|
||||
Util,
|
||||
Hash,
|
||||
Sidebar,
|
||||
Messages,
|
||||
h,
|
||||
AppConfig,
|
||||
ApiConfig,
|
||||
) {
|
||||
var APP = window.APP = {};
|
||||
|
||||
var common;
|
||||
var metadataMgr;
|
||||
var privateData;
|
||||
var sframeChan;
|
||||
|
||||
var andThen = function (common, $container) {
|
||||
const sidebar = Sidebar.create(common, 'sidebar', $container);
|
||||
var categories = {
|
||||
'users': {
|
||||
icon: 'fa fa-users',
|
||||
content: [
|
||||
'invitations',
|
||||
'directory'
|
||||
]
|
||||
},
|
||||
'test': {
|
||||
icon: 'fa fa-bell',
|
||||
content: [
|
||||
]
|
||||
},
|
||||
'click': {
|
||||
icon: 'fa fa-file',
|
||||
onClick: () => {
|
||||
common.openUnsafeURL('https://cryptpad.fr');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const blocks = sidebar.blocks;
|
||||
sidebar.addItem('invitations', function (cb) {
|
||||
var input = h('input', {type:'number'});
|
||||
var label = blocks.labelledInput('Test Input label', input);
|
||||
var button = blocks.button('secondary', 'fa-question', "My Button text");
|
||||
var content = blocks.form(label, blocks.nav(button));
|
||||
cb(content);
|
||||
});
|
||||
|
||||
sidebar.makeLeftside(categories);
|
||||
};
|
||||
|
||||
|
||||
nThen(function(waitFor) {
|
||||
$(waitFor(UI.addLoadingScreen));
|
||||
SFCommon.create(waitFor(function(c) { APP.common = common = c; }));
|
||||
}).nThen(function(waitFor) {
|
||||
APP.$container = $('#cp-sidebarlayout-container');
|
||||
APP.$toolbar = $('#cp-toolbar');
|
||||
sframeChan = common.getSframeChannel();
|
||||
sframeChan.onReady(waitFor());
|
||||
}).nThen(function( /*waitFor*/ ) {
|
||||
metadataMgr = common.getMetadataMgr();
|
||||
privateData = metadataMgr.getPrivateData();
|
||||
|
||||
// Toolbar
|
||||
var displayed = ['useradmin', 'newpad', 'limit', 'pageTitle', 'notifications'];
|
||||
var configTb = {
|
||||
displayed: displayed,
|
||||
sfCommon: common,
|
||||
$container: APP.$toolbar,
|
||||
pageTitle: 'TEST SIDEBAR',
|
||||
metadataMgr: common.getMetadataMgr(),
|
||||
};
|
||||
APP.toolbar = Toolbar.create(configTb);
|
||||
APP.toolbar.$rightside.hide();
|
||||
|
||||
// Content
|
||||
andThen(common, APP.$container);
|
||||
|
||||
common.setTabTitle(Messages.settings_title);
|
||||
UI.removeLoadingScreen();
|
||||
});
|
||||
});
|
|
@ -1,32 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
// Load #1, load as little as possible because we are in a race to get the loading screen up.
|
||||
define([
|
||||
'/components/nthen/index.js',
|
||||
'/api/config',
|
||||
'/common/dom-ready.js',
|
||||
'/common/sframe-common-outer.js'
|
||||
], function (nThen, ApiConfig, DomReady, SFCommonO) {
|
||||
|
||||
// Loaded in load #2
|
||||
nThen(function (waitFor) {
|
||||
DomReady.onReady(waitFor());
|
||||
}).nThen(function (waitFor) {
|
||||
SFCommonO.initIframe(waitFor);
|
||||
}).nThen(function (/*waitFor*/) {
|
||||
var category;
|
||||
if (window.location.hash) {
|
||||
category = window.location.hash.slice(1);
|
||||
window.location.hash = '';
|
||||
}
|
||||
var addData = function (obj, Cryptpad, user, Utils) {
|
||||
if (category) { obj.category = category; }
|
||||
};
|
||||
SFCommonO.start({
|
||||
noRealtime: true,
|
||||
addData: addData
|
||||
});
|
||||
});
|
||||
});
|
|
@ -16,7 +16,6 @@ define([
|
|||
var ifrw;
|
||||
var $modal;
|
||||
var $content;
|
||||
var placeholder;
|
||||
var options;
|
||||
var separator = '<hr data-pewpew="pezpez">';
|
||||
var separatorReg = /<hr data\-pewpew="pezpez">/g;
|
||||
|
@ -314,7 +313,7 @@ define([
|
|||
$modal = Slide.$modal = $m;
|
||||
$content = Slide.$content = $c;
|
||||
ifrw = Slide.ifrw = window;
|
||||
placeholder = Slide.placeholder = ph;
|
||||
Slide.placeholder = ph;
|
||||
options = Slide.options = opt;
|
||||
addEvent();
|
||||
addSwipeEvents();
|
||||
|
|
|
@ -1485,7 +1485,6 @@ define([
|
|||
|
||||
var main = function () {
|
||||
var common;
|
||||
var readOnly;
|
||||
|
||||
nThen(function (waitFor) {
|
||||
$(waitFor(function () {
|
||||
|
@ -1507,7 +1506,7 @@ define([
|
|||
var privateData = metadataMgr.getPrivateData();
|
||||
var user = metadataMgr.getUserData();
|
||||
|
||||
readOnly = driveAPP.readOnly = metadataMgr.getPrivateData().readOnly;
|
||||
driveAPP.readOnly = metadataMgr.getPrivateData().readOnly;
|
||||
|
||||
driveAPP.loggedIn = common.isLoggedIn();
|
||||
//if (!driveAPP.loggedIn) { throw new Error('NOT_LOGGED_IN'); }
|
||||
|
|
|
@ -42,9 +42,6 @@ define([
|
|||
};
|
||||
var Fabric = APP.Fabric = window.fabric;
|
||||
|
||||
var verbose = function (x) { console.log(x); };
|
||||
verbose = function () {}; // comment out to enable verbose logging
|
||||
|
||||
var mkControls = function (framework, canvas) {
|
||||
var $pickers = $('#cp-app-whiteboard-pickers');
|
||||
var $colors = $('#cp-app-whiteboard-colors');
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint ignore:start */
|
||||
/* eslint-env worker */
|
||||
/* global clients */
|
||||
|
||||
var id;
|
||||
//= Math.floor(Math.random()*100000);
|
||||
|
||||
|
@ -17,17 +19,17 @@ var broadcast = function (data, excludes) {
|
|||
if (excludes.indexOf(client.id) === -1) {
|
||||
postMsg(client, data);
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
var sendTo = function (data, clientId){
|
||||
clients.matchAll().then(function (clients) {
|
||||
clients.some(function (client) {
|
||||
if (client.id === clientId) {
|
||||
postMsg(client, data)
|
||||
postMsg(client, data);
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
var getClients = function () {
|
||||
clients.matchAll().then(function (clients) {
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
/* jshint ignore:start */
|
||||
/* eslint-env worker */
|
||||
|
||||
var window = self;
|
||||
var window = self; // eslint-disable-line no-unused-vars
|
||||
var localStorage = {
|
||||
setItem: function (k, v) { localStorage[k] = v; },
|
||||
getItem: function (k) { return localStorage[k]; }
|
||||
|
|
Loading…
Reference in a new issue