From c774a5d06e755d1113ff2ee70cc4b276fc91dc9c Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 12 Jul 2021 13:24:32 +0530 Subject: [PATCH 1/7] time out if checkup test #7 doesn't call back in 30s --- www/checkup/main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/www/checkup/main.js b/www/checkup/main.js index f4a40d11e..a8a69d737 100644 --- a/www/checkup/main.js +++ b/www/checkup/main.js @@ -255,6 +255,11 @@ define([ ])); })); + // time out after 30 seconds + setTimeout(function () { + cb('TIMEOUT'); + }, 30000); + var bytes = new Uint8Array(Login.requiredBytes); var opt = Login.allocateBytes(bytes); @@ -727,8 +732,6 @@ define([ '. ', RESTART_WARNING(), ])); - - console.error("HTTPS?", trimmedUnsafe, trimmedSafe); cb(isHTTPS(trimmedUnsafe) && isHTTPS(trimmedSafe)); }); From 4fe5b11370a893f017741d4789831c4a49cf4c2c Mon Sep 17 00:00:00 2001 From: Weblate Date: Tue, 27 Jul 2021 17:47:04 +0200 Subject: [PATCH 2/7] Translated using Weblate (French) Currently translated at 100.0% (1379 of 1379 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/fr/ --- www/common/translations/messages.fr.json | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/www/common/translations/messages.fr.json b/www/common/translations/messages.fr.json index 1ea01009b..5974401e7 100644 --- a/www/common/translations/messages.fr.json +++ b/www/common/translations/messages.fr.json @@ -1315,7 +1315,7 @@ "form_updateWarning": "Mettre à jour avec erreurs", "form_submitWarning": "Envoyer avec erreurs", "form_delete": "Supprimer", - "form_sent": "Envoyé", + "form_sent": "Votre réponse a été envoyée", "form_reset": "Effacer", "form_update": "Mettre à jour", "form_submit": "Envoyer", @@ -1368,5 +1368,16 @@ "admin_purpose_business": "Usage en entreprise", "admin_instancePurposeHint": "À quel usage cette instance est-elle destinée ? Votre réponse sera utilisée pour définir la planification de nouvelles fonctionnalités (si votre télémétrie est activée).", "team_leaveOwner": "Veuillez vous rétrograder de votre rôle de propriétaire avant de quitter l'équipe. Notez que les équipes doivent avoir au moins un propriétaire, veuillez en ajouter un autre avant de poursuivre si vous êtes actuellement le seul propriétaire.", - "form_exportCSV": "Exporter en CSV" + "form_exportCSV": "Exporter en CSV", + "fm_link_invalid": "URL invalide", + "fm_link_warning": "Attention : l'URL dépasse 200 caractères", + "form_answerAs": "Répondre en tant que", + "form_anonName": "Votre nom", + "notification_linkShared": "{0} a partagé un lien avec vous : {1}", + "fm_link_name_placeholder": "Nouveau lien", + "fm_link_url": "URL", + "fm_link_name": "Titre du lien", + "fm_link_type": "Lien", + "fm_link_new": "Nouveau Lien", + "notification_openLink": "Vous avez reçu un lien {0} de {1} :" } From 9256c45a264727b4afebe220e045b9ea96dbfd28 Mon Sep 17 00:00:00 2001 From: Weblate Date: Tue, 27 Jul 2021 17:47:04 +0200 Subject: [PATCH 3/7] Translated using Weblate (German) Currently translated at 100.0% (1379 of 1379 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/de/ --- www/common/translations/messages.de.json | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/www/common/translations/messages.de.json b/www/common/translations/messages.de.json index 226e57c7c..259a19928 100644 --- a/www/common/translations/messages.de.json +++ b/www/common/translations/messages.de.json @@ -1332,7 +1332,7 @@ "form_cantFindAnswers": "Deine vorigen Antworten für dieses Formular konnten nicht geladen werden.", "form_updateWarning": "Trotzdem aktualisieren", "form_submitWarning": "Trotzdem absenden", - "form_sent": "Gesendet", + "form_sent": "Deine Antwort wurde gesendet", "form_update": "Aktualisieren", "form_submit": "Absenden", "form_type_checkbox": "Mehrfachauswahl", @@ -1368,5 +1368,16 @@ "admin_purpose_public": "Zur Bereitstellung eines kostenlosen Dienstes für die Allgemeinheit", "resources_learnWhy": "Mehr über die Gründe erfahren", "team_leaveOwner": "Bitte entferne dich von der Rolle des Eigentümers, bevor du das Teams verlässt. Beachte, dass Teams mindestens einen Eigentümer haben müssen. Bitte füge daher zunächst einen weiteren Eigentümer hinzu, sofern du derzeit der alleinige Eigentümer bist.", - "form_exportCSV": "Als CSV exportieren" + "form_exportCSV": "Als CSV exportieren", + "form_answerAs": "Antworten als", + "notification_openLink": "Du hast einen Link {0} von {1} erhalten:", + "fm_link_warning": "Warnung: URL ist länger als 200 Zeichen", + "notification_linkShared": "{0} hat einen Link mit dir geteilt: {1}", + "fm_link_name": "Bezeichnung des Links", + "fm_link_invalid": "Ungültige URL", + "form_anonName": "Dein Name", + "fm_link_name_placeholder": "Mein Link", + "fm_link_url": "URL", + "fm_link_type": "Link", + "fm_link_new": "Neuer Link" } From ef56a8f863ccceb8492dd1ad3d10717f55709fa8 Mon Sep 17 00:00:00 2001 From: Weblate Date: Tue, 27 Jul 2021 17:47:04 +0200 Subject: [PATCH 4/7] Translated using Weblate (Japanese) Currently translated at 99.8% (1377 of 1379 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/ja/ --- www/common/translations/messages.ja.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/www/common/translations/messages.ja.json b/www/common/translations/messages.ja.json index 83f22925b..3d68dbab9 100644 --- a/www/common/translations/messages.ja.json +++ b/www/common/translations/messages.ja.json @@ -1377,5 +1377,6 @@ "form_anonName": "あなたの名前", "notification_linkShared": "{0}があなたとリンクを共有しました: {1}", "fm_link_name_placeholder": "あなたのリンク", - "fm_link_warning": "注意:URLが200字を超えています" + "fm_link_warning": "注意:URLが200字を超えています", + "fm_link_invalid": "URLが無効です" } From a613b64b77c0e01f9b5dfb98a1ec655fae834745 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 28 Jul 2021 03:43:25 +0530 Subject: [PATCH 5/7] use brand link color for links in the form app --- www/form/app-form.less | 3 +++ 1 file changed, 3 insertions(+) diff --git a/www/form/app-form.less b/www/form/app-form.less index 60da1daff..ad26863bb 100644 --- a/www/form/app-form.less +++ b/www/form/app-form.less @@ -561,6 +561,9 @@ margin-right: 5px; } } + a, a:visited { + color: @cryptpad_color_link; + } } } } From f80aacc1770d9f4401fe4f364387beb15037c1af Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 28 Jul 2021 15:17:25 +0530 Subject: [PATCH 6/7] prevent incorrect removal of form submission buttons ...by guarding against overflow of a setTimeout delay --- www/form/inner.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/www/form/inner.js b/www/form/inner.js index 1b555be5d..cdd99e512 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -2784,6 +2784,11 @@ define([ var endDateEl = h('div.alert.alert-warning.cp-burn-after-reading'); var endDate; var endDateTo; + + // numbers greater than this overflow the maximum delay for a setTimeout + // which results in it being executed immediately (oops) + // https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#maximum_delay_value + var MAX_TIMEOUT_DELAY = 2147483647; var refreshEndDateBanner = function (force) { if (APP.isEditor) { return; } var _endDate = content.answers.endDate; @@ -2804,10 +2809,21 @@ define([ APP.isClosed = endDate && endDate < (+new Date()); clearTimeout(endDateTo); if (!APP.isClosed && endDate) { - setTimeout(function () { + // calculate how many ms in the future the poll will be closed + var diff = (endDate - +new Date() + 100); + // if that value would overflow, then check again in a day + // (if the tab is still open) + if (diff > MAX_TIMEOUT_DELAY) { + endDateTo = setTimeout(function () { + refreshEndDateBanner(true); + }, 1000 * 3600 * 24); + return; + } + + endDateTo = setTimeout(function () { refreshEndDateBanner(true); - $('.cp-form-send-container').find('.cp-open').remove(); - },(endDate - +new Date() + 100)); + $('.cp-form-send-container').find('.cp-open').hide(); + }, diff); } }; From b3a7d5c42c6504b99149e6d6257268d7afda0fd5 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 28 Jul 2021 15:19:05 +0530 Subject: [PATCH 7/7] factor out some duplicated code for handling 24 dates --- www/admin/inner.js | 5 +---- www/common/common-ui-elements.js | 7 +++++++ www/form/inner.js | 6 +----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/www/admin/inner.js b/www/admin/inner.js index b35059df0..e8d567d41 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -1472,11 +1472,8 @@ define([ var end = h('input'); var $start = $(start); var $end = $(end); - var is24h = false; + var is24h = UIElements.is24h(); var dateFormat = "Y-m-d H:i"; - try { - is24h = !new Intl.DateTimeFormat(navigator.language, { hour: 'numeric' }).format(0).match(/AM/); - } catch (e) {} if (!is24h) { dateFormat = "Y-m-d h:i K"; } var endPickr = Flatpickr(end, { diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 99d506347..c0b052737 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -3696,6 +3696,13 @@ define([ return (pos.bottom < size) && (pos.y > 0); }; + UIElements.is24h = function () { + try { + return !new Intl.DateTimeFormat(navigator.language, { hour: 'numeric' }).format(0).match(/AM/); + } catch (e) {} + return false; + }; + UIElements.openSnapshotsModal = function (common, load, make, remove) { var modal; var readOnly = common.getMetadataMgr().getPrivateData().readOnly; diff --git a/www/form/inner.js b/www/form/inner.js index cdd99e512..410918787 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -68,13 +68,9 @@ define([ var APP = window.APP = { }; - var is24h = false; + var is24h = UIElements.is24h(); var dateFormat = "Y-m-d H:i"; var timeFormat = "H:i"; - try { - is24h = !new Intl.DateTimeFormat(navigator.language, { hour: 'numeric' }).format(0).match(/AM/); - } catch (e) {} - is24h = false; if (!is24h) { dateFormat = "Y-m-d h:i K"; timeFormat = "h:i K";