From 61df9214ffa5e362a02e253546d531967580b168 Mon Sep 17 00:00:00 2001 From: Weblate Date: Tue, 10 Aug 2021 11:50:32 +0200 Subject: [PATCH 1/9] Translated using Weblate (Japanese) Currently translated at 100.0% (1382 of 1382 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/ja/ --- www/common/translations/messages.ja.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/common/translations/messages.ja.json b/www/common/translations/messages.ja.json index 893bc45b3..96b678f22 100644 --- a/www/common/translations/messages.ja.json +++ b/www/common/translations/messages.ja.json @@ -1379,5 +1379,8 @@ "fm_link_name_placeholder": "あなたのリンク", "fm_link_warning": "注意:URLが200字を超えています", "fm_link_invalid": "URLが無効です", - "form_answerAs": "名前を記入してください" + "form_answerAs": "名前を記入してください", + "form_totalResponses": "回答数:{0}", + "ui_expand": "広げる", + "ui_collapse": "折りたたむ" } From 17ea1611e78dac7faabc4e8d11ee4d5a03f1e26f Mon Sep 17 00:00:00 2001 From: Weblate Date: Tue, 10 Aug 2021 11:50:32 +0200 Subject: [PATCH 2/9] Translated using Weblate (German) Currently translated at 100.0% (1382 of 1382 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/de/ Translated using Weblate (German) Currently translated at 99.8% (1380 of 1382 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/de/ --- www/common/translations/messages.de.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/common/translations/messages.de.json b/www/common/translations/messages.de.json index d8be458c0..e02219011 100644 --- a/www/common/translations/messages.de.json +++ b/www/common/translations/messages.de.json @@ -1379,5 +1379,8 @@ "fm_link_name_placeholder": "Mein Link", "fm_link_url": "URL", "fm_link_type": "Link", - "fm_link_new": "Neuer Link" + "fm_link_new": "Neuer Link", + "form_totalResponses": "Antworten insgesamt: {0}", + "ui_expand": "Ausklappen", + "ui_collapse": "Einklappen" } From a33774aa6f7184f7144e9f2fa6e42af32b391025 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 10 Aug 2021 15:24:23 +0530 Subject: [PATCH 3/9] properly abort from channel archival if no metadata is returned and add some logging when trimming history --- lib/commands/channel.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/commands/channel.js b/lib/commands/channel.js index e69f93180..c36c3424d 100644 --- a/lib/commands/channel.js +++ b/lib/commands/channel.js @@ -54,7 +54,8 @@ Channel.clearOwnedChannel = function (Env, safeKey, channelId, cb, Server) { }); }; -var archiveOwnedChannel = function (Env, safeKey, channelId, _cb, Server) { +var archiveOwnedChannel = function (Env, safeKey, channelId, __cb, Server) { + var _cb = Util.once(Util.mkAsync(__cb)); var unsafeKey = Util.unescapeKeyCharacters(safeKey); nThen(function (w) { // confirm that the channel exists before worrying about whether @@ -160,7 +161,10 @@ Channel.trimHistory = function (Env, safeKey, data, cb) { nThen(function (w) { Metadata.getMetadataRaw(Env, channelId, w(function (err, metadata) { - if (err) { return void cb(err); } + if (err) { + w.abort(); + return void cb(err); + } if (!Core.hasOwners(metadata)) { w.abort(); return void cb('E_NO_OWNERS'); @@ -173,6 +177,11 @@ Channel.trimHistory = function (Env, safeKey, data, cb) { })); }).nThen(function () { Env.msgStore.trimChannel(channelId, hash, function (err) { + Env.Log.info('HK_TRIM_HISTORY', { + unsafeKey: unsafeKey, + channelId: channelId, + status: err? String(e): 'SUCCESS', + }); if (err) { return void cb(err); } // clear historyKeeper's cache for this channel Env.historyKeeper.channelClose(channelId); From d960c10a31341502ae7e4a60128530b4adc48300 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 10 Aug 2021 18:46:10 +0530 Subject: [PATCH 4/9] clear login token when deleting your account and before logging in --- customize.dist/login.js | 1 + www/common/outer/local-store.js | 4 ++++ www/settings/inner.js | 10 +++++----- www/settings/main.js | 4 ++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/customize.dist/login.js b/customize.dist/login.js index 3309190c0..5cab49934 100644 --- a/customize.dist/login.js +++ b/customize.dist/login.js @@ -463,6 +463,7 @@ define([ var proceed = function (result) { hashing = false; if (test && typeof test === "function" && test()) { return; } + LocalStore.clearLoginToken(); Realtime.whenRealtimeSyncs(result.realtime, function () { Exports.redirect(); }); diff --git a/www/common/outer/local-store.js b/www/common/outer/local-store.js index fb49d084d..77d36645c 100644 --- a/www/common/outer/local-store.js +++ b/www/common/outer/local-store.js @@ -82,6 +82,10 @@ define([ } catch (err) { return; } }; + LocalStore.clearLoginToken = function () { + localStorage.removeItem(Constants.loginToken); + }; + LocalStore.setDriveRedirectPreference = function (bool) { localStorage.setItem(Constants.redirectToDriveKey, Boolean(bool)); }; diff --git a/www/settings/inner.js b/www/settings/inner.js index 2d29f0f05..798af282b 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -542,12 +542,12 @@ define([ } // Owned drive if (data.state === true) { - sframeChan.query('Q_SETTINGS_LOGOUT', null, function() {}); - UI.alert(Messages.settings_deleted, function() { - common.gotoURL('/'); + return void sframeChan.query('Q_SETTINGS_LOGOUT_PROPERLY', null, function() { + UI.alert(Messages.settings_deleted, function() { + common.gotoURL('/'); + }); + spinner.done(); }); - spinner.done(); - return; } // Not owned drive var msg = h('div.cp-app-settings-delete-alert', [ diff --git a/www/settings/main.js b/www/settings/main.js index 8101203b1..189d94eb5 100644 --- a/www/settings/main.js +++ b/www/settings/main.js @@ -57,6 +57,10 @@ define([ }); }); }); + sframeChan.on('Q_SETTINGS_LOGOUT_PROPERLY', function (data, cb) { + Utils.LocalStore.clearLoginToken(); + cb(); + }); sframeChan.on('Q_SETTINGS_DRIVE_RESET', function (data, cb) { Cryptpad.resetDrive(cb); }); From 1c08a27f607d690026913bb7fbb6a81b30ae910b Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 10 Aug 2021 18:48:34 +0530 Subject: [PATCH 5/9] fix a newly introduced reference error --- lib/commands/channel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/commands/channel.js b/lib/commands/channel.js index c36c3424d..5f8216434 100644 --- a/lib/commands/channel.js +++ b/lib/commands/channel.js @@ -180,7 +180,7 @@ Channel.trimHistory = function (Env, safeKey, data, cb) { Env.Log.info('HK_TRIM_HISTORY', { unsafeKey: unsafeKey, channelId: channelId, - status: err? String(e): 'SUCCESS', + status: err? String(err): 'SUCCESS', }); if (err) { return void cb(err); } // clear historyKeeper's cache for this channel From b9eced7bfdbb8ca028e5f3c2ee03c9ff7917a114 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 10 Aug 2021 18:49:29 +0530 Subject: [PATCH 6/9] remove unused 'noscriptfix' hack --- www/common/noscriptfix.js | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 www/common/noscriptfix.js diff --git a/www/common/noscriptfix.js b/www/common/noscriptfix.js deleted file mode 100644 index 532393248..000000000 --- a/www/common/noscriptfix.js +++ /dev/null @@ -1,3 +0,0 @@ -// Fix for noscript bugs when caching iframe content. -// Caution, this file will get cached, you must change the name if you change it. -document.getElementById('pad-iframe').setAttribute('src', 'inner.html?cb=' + (+new Date())); From d8af3a16ab369faad36b1a92c6480adacb3efbef Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 10 Aug 2021 18:51:00 +0530 Subject: [PATCH 7/9] exclude invalid channel and blob ids when fetching your channel list for all variations of the same API --- www/common/proxy-manager.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/www/common/proxy-manager.js b/www/common/proxy-manager.js index d6492c68c..d87572d7e 100644 --- a/www/common/proxy-manager.js +++ b/www/common/proxy-manager.js @@ -1167,6 +1167,13 @@ define([ Store */ + var excludeInvalidIdentifiers = function (result) { + return result.filter(function (channel) { + if (typeof(channel) !== 'string') { return; } + return [32, 48].indexOf(channel.length) !== -1; + }); + }; + // Get the list of channels filtered by a type (expirable channels, owned channels, pin list) var getChannelsList = function (Env, type) { var result = []; @@ -1228,8 +1235,8 @@ define([ } }; - if (type === 'owned' && !Env.edPublic) { return result; } - if (type === 'pin' && !Env.edPublic) { return result; } + if (type === 'owned' && !Env.edPublic) { return excludeInvalidIdentifiers(result); } + if (type === 'pin' && !Env.edPublic) { return excludeInvalidIdentifiers(result); } // Get the list of user objects var userObjects = _getUserObjects(Env); @@ -1256,10 +1263,7 @@ define([ Array.prototype.push.apply(result, sfChannels); } - return result.filter(function (channel) { - if (typeof(channel) !== 'string') { return; } - return [32, 48].indexOf(channel.length) !== -1; - }); + return excludeInvalidIdentifiers(result); }; var addPad = function (Env, path, pad, cb) { From 7647a602191f0a5818204c1000e793b2a42e964d Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 10 Aug 2021 19:48:15 +0530 Subject: [PATCH 8/9] guess OS version on checkup page --- www/checkup/app-checkup.less | 5 ++--- www/checkup/checkup-tools.js | 19 +++++++++++++++++++ www/checkup/main.js | 4 +++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/www/checkup/app-checkup.less b/www/checkup/app-checkup.less index 026d1952c..d5cab9c63 100644 --- a/www/checkup/app-checkup.less +++ b/www/checkup/app-checkup.less @@ -88,11 +88,10 @@ html, body { .cp-notice-browser, .cp-notice-details, .cp-notice-other { font-size: 70%; } - + .underline { text-decoration: underline; } .cp-app-checkup-version, .cp-app-checkup-browser { - text-decoration: underline; + .underline; } - iframe { display: none; } diff --git a/www/checkup/checkup-tools.js b/www/checkup/checkup-tools.js index 79fe1c4b3..f9259ff28 100644 --- a/www/checkup/checkup-tools.js +++ b/www/checkup/checkup-tools.js @@ -14,6 +14,25 @@ define([ return false; }; + var OS_HINTS = { + "Win": "Windows", + "Mac": "MacOS", + "X11": "UNIX", + "Linux": "Linux", + }; + + Tools.guessOS = function () { + var result = "UNKNOWN"; + if (!window.navigator || !window.navigator.appVersion) { return result; } + result = window.navigator.appVersion; + console.log(result); + Object.keys(OS_HINTS).some(function (key) { + if (result.indexOf(key) === -1) { return; } + result = OS_HINTS[key]; // else + return true; + }); + return result; + }; Tools.isSafari = function () { return navigator.vendor.match(/apple/i); diff --git a/www/checkup/main.js b/www/checkup/main.js index a1e458f34..a262d0e4c 100644 --- a/www/checkup/main.js +++ b/www/checkup/main.js @@ -932,7 +932,9 @@ define([ return h('p.cp-notice-browser', [ "You appear to be using a ", h('span.cp-app-checkup-browser', name), - ' browser to view this page.', + ' browser on ', + h('span.underline', Tools.guessOS()), + ' to view this page.', ]); }; From 2dc4ec1b241ec8355185c69bb75ab1866df497d7 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 10 Aug 2021 19:49:22 +0530 Subject: [PATCH 9/9] include vendor and appVersion in support ticket data --- www/support/ui.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/support/ui.js b/www/support/ui.js index f61ddac4b..31555dc64 100644 --- a/www/support/ui.js +++ b/www/support/ui.js @@ -39,7 +39,9 @@ define([ var teams = privateData.teams || {}; if (!ctx.isAdmin) { - data.sender.userAgent = window.navigator && window.navigator.userAgent; + data.sender.userAgent = Util.find(window, ['navigator', 'userAgent']); + data.sender.vendor = Util.find(window, ['navigator', 'vendor']); + data.sender.appVersion = Util.find(window, ['navigator', 'appVersion']); data.sender.blockLocation = privateData.blockLocation || ''; data.sender.teams = Object.keys(teams).map(function (key) { var team = teams[key];