From d5f3710bb05a8d6279bdf26c02f5d36dc28f0508 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Sun, 28 Jan 2024 20:51:00 +0100 Subject: [PATCH 1/4] fix badly encoded %23 --- index.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 2fcd8f1..fabdd43 100644 --- a/index.html +++ b/index.html @@ -201,7 +201,7 @@

  • - +
  • @@ -257,6 +257,13 @@ (isValid ? document.querySelector('form') : document.querySelector('section')).classList.add('hidden'); }; + function textareaInput(inputData) { + // first # may be wrongly encoded to %23 by safari/iOS; convert it back. see issue #16 + inputData = inputData.replace(/%23/, '#') + + reactInput(inputData) + } + reactInput(window.location.hash.substr(1)); i18next.init({ From 984de39c8a23baa98ff91f126b498dbfbdba2e3a Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 29 Jan 2024 00:11:12 +0100 Subject: [PATCH 2/4] fix badly encoded %23 only if there is no correctly encoded # --- index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index fabdd43..269b503 100644 --- a/index.html +++ b/index.html @@ -258,8 +258,10 @@ }; function textareaInput(inputData) { - // first # may be wrongly encoded to %23 by safari/iOS; convert it back. see issue #16 - inputData = inputData.replace(/%23/, '#') + // '#' may be wrongly encoded to '%23' by Safari/iOS; convert it back. see issue #16 + if (inputData.indexOf('#') == -1) { + inputData = inputData.replace(/%23/, '#') + } reactInput(inputData) } From 3677534a8ccc32336696ae3dc8579dd647af2796 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 29 Jan 2024 00:27:42 +0100 Subject: [PATCH 3/4] allow pasting already generated link to generator --- index.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/index.html b/index.html index 269b503..16473d9 100644 --- a/index.html +++ b/index.html @@ -257,7 +257,15 @@ (isValid ? document.querySelector('form') : document.querySelector('section')).classList.add('hidden'); }; + // when all apps can generate invite links internally, we may decide to remove on-site generator + // and instead show a page with instructions how to generate links in Delta Chat function textareaInput(inputData) { + // be idempotent: allow pasting a already generated invite-link to the generator (esp. if generated by the app) + if (inputData.startsWith('https://i.delta.chat')) { + inputData = inputData.replace(/https:\/\/i.delta.chat\/?#/, '') + inputData = inputData.replace(/&/, '#') + } + // '#' may be wrongly encoded to '%23' by Safari/iOS; convert it back. see issue #16 if (inputData.indexOf('#') == -1) { inputData = inputData.replace(/%23/, '#') From 1386510fb35689c68e004d7b75bea4da98d4f0f4 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 29 Jan 2024 00:51:42 +0100 Subject: [PATCH 4/4] make sure OPENPGP4FPR is added only once (before it worked more by random as multiple schemes are converted to one by browsers --- index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.html b/index.html index 16473d9..5ecd53f 100644 --- a/index.html +++ b/index.html @@ -264,6 +264,8 @@ if (inputData.startsWith('https://i.delta.chat')) { inputData = inputData.replace(/https:\/\/i.delta.chat\/?#/, '') inputData = inputData.replace(/&/, '#') + } else { + inputData = inputData.replace(/openpgp4fpr:/i, '') } // '#' may be wrongly encoded to '%23' by Safari/iOS; convert it back. see issue #16