diff --git a/index.html b/index.html index 2fcd8f1..5ecd53f 100644 --- a/index.html +++ b/index.html @@ -201,7 +201,7 @@

  • - +
  • @@ -257,6 +257,25 @@ (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(/&/, '#') + } else { + inputData = inputData.replace(/openpgp4fpr:/i, '') + } + + // '#' 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) + } + reactInput(window.location.hash.substr(1)); i18next.init({