Merge branch 'staging' into support2

This commit is contained in:
yflory 2024-03-13 16:38:49 +01:00
commit 6a050ad736
87 changed files with 1526 additions and 488 deletions

View file

@ -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
View 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'],
}
};

View file

@ -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
}
}

View file

@ -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
* ===================== */

View file

@ -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;

View file

@ -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:

View file

@ -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);

View file

@ -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");

View file

@ -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");

View file

@ -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");
@ -18,9 +17,7 @@ const Moderators = require("./moderators");
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");
@ -86,7 +83,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');
}

View file

@ -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");

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/*jshint esversion: 6 */
const Channel = module.exports;
const Util = require("../common-util");

View file

@ -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");

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/*jshint esversion: 6 */
const Invitation = module.exports;
const Invite = require('../storage/invite');

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/*jshint esversion: 6 */
const Data = module.exports;
const Meta = require("../metadata");

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/*jshint esversion: 6 */
const Core = require("./core");
const Pinning = module.exports;

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/*jshint esversion: 6 */
/* globals Buffer*/
const Quota = module.exports;

View file

@ -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");

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/*jshint esversion: 6 */
const Users = module.exports;
const User = require('../storage/user');

View file

@ -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: '',

View file

@ -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;
};

View file

@ -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");
@ -105,8 +103,14 @@ module.exports.create = function (Env, cb) {
cb("ERESTRICTED", allowed);
});
},
sessionClose: function (userId, reason) {
sessionClose: function (userId, reason, ip) {
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, oo) {
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

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/* jshint esversion: 6 */
/* global Buffer */
var HK = module.exports;

View file

@ -198,6 +198,9 @@ const wsProxy = createProxyMiddleware({
target: proxyTarget.href,
ws: true,
logLevel: 'error',
onProxyReqWs: function (proxyReq, req, socket, options, head) {
proxyReq.setHeader('X-Real-Ip', req.socket.remoteAddress);
},
logProvider: (p) => {
p.error = (data) => {
if (/ECONNRESET/.test(data)) { return; }

View file

@ -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");

View file

@ -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': {

View file

@ -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);
});

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/*jshint esversion: 6 */
const Stats = module.exports;
var truthyStringOrNothing = function (s) {

View file

@ -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");

View file

@ -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);
});

View file

@ -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) {

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/* jshint esversion: 6 */
/* global Buffer */
const ToPull = require('stream-to-pull-stream');

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/* jshint esversion: 6 */
/* globals process, Buffer */
const HK = require("../hk-util");

View file

@ -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');

1355
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -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"]
}

View file

@ -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');

View file

@ -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");

View file

@ -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();

View file

@ -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');

View file

@ -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

View file

@ -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);

View file

@ -2,7 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/*jshint esversion: 6 */
const Pins = require("../../lib/pins");
var stats = {

View file

@ -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) {

View file

@ -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 () {

View file

@ -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 */);
}

View file

@ -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

View file

@ -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();
}

View file

@ -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); }

View file

@ -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;'

View file

@ -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);

View file

@ -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

View file

@ -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; }
/*

View file

@ -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;

View file

@ -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

View file

@ -2,6 +2,8 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/* eslint compat/compat: "off" */
define(['/api/config'], function (ApiConfig) {
var Module = {};

View file

@ -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,9 +681,11 @@ define([
}
return new Blob([newText], {type: 'text/plain'});
};
var loadLastDocument = function (lastCp, onCpError, cb) {
const loadLastDocument = function (lastCp) {
return new Promise((resolve, reject) => {
if (!lastCp || !lastCp.file) {
return void onCpError('EEMPTY');
return void reject('EEMPTY');
}
ooChannel.cpIndex = lastCp.index || 0;
ooChannel.lastHash = lastCp.hash;
@ -700,7 +702,7 @@ define([
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
if (/^4/.test('' + this.status)) {
onCpError(this.status);
reject(this.status);
return void console.error('XHR error', this.status);
}
var arrayBuffer = xhr.response;
@ -710,22 +712,20 @@ define([
if (err) {
if (err === "DECRYPTION_ERROR") {
console.warn(err);
return void onCpError(err);
return void reject(err);
}
return void console.error(err);
}
var blob = new Blob([decrypted.content], {type: 'plain/text'});
if (cb) {
return cb(blob, getFileType());
}
startOO(blob, getFileType());
resolve({blob, fileType: getFileType()});
});
}
};
xhr.onerror = function (err) {
onCpError(err);
reject(err);
};
xhr.send(null);
});
};
/*
@ -825,7 +825,13 @@ define([
if (!exists) { return void UI.removeLoadingScreen(); }
loadLastDocument(cp, function () {
loadLastDocument(cp)
.then(({blob, fileType}) => {
ooChannel.queue = messages;
resetData(blob, fileType);
UI.removeLoadingScreen();
})
.catch(() => {
if (cp.hash && vHashEl) {
// We requested a checkpoint but we can't find it...
UI.removeLoadingScreen();
@ -840,10 +846,6 @@ define([
ooChannel.queue = messages;
resetData(blob, file);
UI.removeLoadingScreen();
}, function (blob, file) {
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,26 +2361,16 @@ 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 () {
loadLastDocument(lastCp)
.then(({blob, fileType}) => {
startOO(blob, fileType);
})
.catch(() => {
// 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 = '';
}
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,12 +3204,14 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
isLockedModal.modal = UI.openCustomModal(isLockedModal.content);
}
var lastCp = getLastCp();
loadLastDocument(lastCp, function (err) {
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?
}, function (blob, type) {
resetData(blob, type);
});
};

View file

@ -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 {

View file

@ -546,12 +546,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;
}
});

View file

@ -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; }

View file

@ -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);
};

View file

@ -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!');
});

View file

@ -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);
}
};
};
});

View file

@ -2,7 +2,8 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/* jshint ignore:start */
/* global importScripts */
importScripts('/components/requirejs/require.js');
window = self;

View file

@ -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) {

View file

@ -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) {

View file

@ -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 () { };

View file

@ -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 || $();
};

View file

@ -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");
});

View file

@ -68,7 +68,6 @@ define([], function () {
}
};
// jshint -W103
var errProto = (new Error()).__proto__;
var doLog = function (o) {
var s;

View file

@ -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);

View file

@ -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) => {

View file

@ -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', {

View file

@ -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;
}

View file

@ -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;
}
});

View file

@ -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,

View file

@ -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;

View file

@ -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

View file

@ -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 + ')();' +

View file

@ -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 = '';
}

View file

@ -95,7 +95,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;

View file

@ -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,

View file

@ -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();

View file

@ -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'); }

View file

@ -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');

View file

@ -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) {

View file

@ -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]; }