From 3677534a8ccc32336696ae3dc8579dd647af2796 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 29 Jan 2024 00:27:42 +0100 Subject: [PATCH] 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/, '#')