From 83ecc9994454af0a4df30b0024e6ea055cd2ce82 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 30 Apr 2026 16:40:42 +0200 Subject: [PATCH] chore: remove unnecessary console logs --- src/common/cryptget.js | 1 - src/worker/core/interface.js | 6 +++--- src/worker/modules/messenger.js | 1 - src/worker/modules/profile.js | 1 - www/common/common-login.js | 1 - www/cryptpad-api.js | 6 ++++-- www/integration/main.js | 16 +++++++++------- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/common/cryptget.js b/src/common/cryptget.js index 3d4b60921..d73a7e3ef 100644 --- a/src/common/cryptget.js +++ b/src/common/cryptget.js @@ -61,7 +61,6 @@ const factory = (Crypto, CPNetflux, Netflux, Util, nThen(function (waitFor) { Session.accessKeys.forEach(function (obj) { Pinpad.create(config.network, obj, waitFor(function (e) { - console.log('done', obj); if (e) { console.error(e); } })); }); diff --git a/src/worker/core/interface.js b/src/worker/core/interface.js index 5d921861a..1d7cde100 100644 --- a/src/worker/core/interface.js +++ b/src/worker/core/interface.js @@ -62,7 +62,7 @@ const factory = (SRpc, Channel, Util) => { } catch (e) { console.error('Error in webworker when executing query ' + q); console.error(e); - console.log(data); + //console.log(data); } if (q === "DISCONNECT") { onClose(); @@ -99,7 +99,7 @@ const factory = (SRpc, Channel, Util) => { } catch (e) { console.error('Error in webworker when executing query JOIN_PAD'); console.error(e); - console.log(data); + //console.log(data); } }); chan.on('SEND_PAD_MSG', function (msg, cb) { @@ -112,7 +112,7 @@ const factory = (SRpc, Channel, Util) => { } catch (e) { console.error('Error in webworker when executing query SEND_PAD_MSG'); console.error(e); - console.log(data); + //console.log(data); } }); diff --git a/src/worker/modules/messenger.js b/src/worker/modules/messenger.js index ad55143a7..6b6af904a 100644 --- a/src/worker/modules/messenger.js +++ b/src/worker/modules/messenger.js @@ -116,7 +116,6 @@ const factory = (Crypto, Hash, Util, Realtime, Messaging, var getChannelMessagesSince = function (ctx, channel, data, keys) { var network = ctx.store.network; - console.log('Fetching [%s] messages since [%s]', channel.id, data.lastKnownHash || ''); if (channel.isPadChat || channel.isTeamChat) { // We need to use GET_HISTORY_RANGE to make sure we won't get the full history diff --git a/src/worker/modules/profile.js b/src/worker/modules/profile.js index e9c14b8b7..fe085d161 100644 --- a/src/worker/modules/profile.js +++ b/src/worker/modules/profile.js @@ -170,7 +170,6 @@ const factory = (Util, Hash, Constants, Realtime, ctx.emit('UPDATE', ctx.listmap.proxy, ctx.clients); }; profile.execCommand = function (clientId, obj, cb) { - console.log(obj); var cmd = obj.cmd; var data = obj.data; if (cmd === 'SUBSCRIBE') { diff --git a/www/common/common-login.js b/www/common/common-login.js index 141e25621..48f48da54 100644 --- a/www/common/common-login.js +++ b/www/common/common-login.js @@ -213,7 +213,6 @@ define([ opt.channelHex = secret.channel; } - console.warn(opt); return opt; }; diff --git a/www/cryptpad-api.js b/www/cryptpad-api.js index 7dfbffa71..a5a059760 100644 --- a/www/cryptpad-api.js +++ b/www/cryptpad-api.js @@ -5,6 +5,8 @@ (function () { 'use strict'; var factory = function (/*Hash*/) { + let devMode = false; + try { devMode = localStorage.CryptPad_dev === "1"; } catch (e) {} // This API is used to load a CryptPad editor for a provided document in // an external platform. @@ -48,7 +50,7 @@ var msg = data.msg; var txid = data.txid; if (commands[msg.q]) { - console.warn('OUTER RECEIVED QUERY', msg.q, msg.data); + if (devMode) { console.warn('OUTER RECEIVED QUERY', msg.q, msg.data); } commands[msg.q](msg.data, function (args) { _sendCb(txid, args); }); @@ -62,7 +64,7 @@ var txid = getTxid(); if (cb) { handlers[txid] = cb; } - console.warn('OUTER SENT QUERY', q, data); + if (devMode) { console.warn('OUTER SENT QUERY', q, data); } iWindow.postMessage({ msg: { q: q, data: data, diff --git a/www/integration/main.js b/www/integration/main.js index e8c49bbdc..f5d31daa7 100644 --- a/www/integration/main.js +++ b/www/integration/main.js @@ -14,7 +14,10 @@ define([ return Math.random().toString(16).replace('0.', ''); }; var init = function () { - console.warn('INIT'); + let devMode = false; + try { devMode = localStorage.CryptPad_dev === "1"; } catch (e) {} + if (devMode) { console.warn('INIT'); } + var p = window.parent; var txid = getTxid(); p.postMessage({ q: 'INTEGRATION_READY', txid: txid }, '*'); @@ -86,7 +89,7 @@ define([ http.open('HEAD', url); http.onreadystatechange = function() { if (this.readyState === this.DONE) { - console.error(oldKey, this.status); + if (devMode) { console.error(oldKey, this.status); } if (this.status === 200) { return cb({state: true}); } @@ -150,7 +153,7 @@ define([ } if (data.keepOld) { // they provide their own key, we must turn it into a hash var key = sanitizeKey(data.key) + "000000000000000000000000000000000"; - console.warn('KEY', key); + if (devMode) { console.warn('KEY', key); } let hash = `/2/integration/edit/${key.slice(0,24)}/`; return void cb({ key: hash, @@ -265,7 +268,7 @@ define([ xhr.responseType = 'blob'; //xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onload = function () { - console.error(this.status); + if (devMode) { console.error(this.status); } if (this.status === 200) { cb(); } else { @@ -278,7 +281,7 @@ define([ xhr.send(blob); }; chan.on('START', function (data, cb) { - console.warn('INNER START', data); + if (devMode) { console.warn('INNER START', data); } // data.key is a hash var href = Hash.hashToHref(data.key, data.application); if (data.editorConfig.lang) { @@ -303,7 +306,7 @@ define([ }); }; - console.error(Hash.hrefToHexChannelId(href)); + if (devMode) { console.error(Hash.hrefToHexChannelId(href)); } let startApp = function (blob) { window.CP_integration_outer = { pathname: `/${data.application}/`, @@ -336,7 +339,6 @@ define([ path = '/common/onlyoffice/main.js'; } require([path], function () { - console.warn('SAO REQUIRED'); delete window.CP_integration_outer; cb(); });