Skip to content

Commit

Permalink
allow pasting already generated link to generator
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Jan 28, 2024
1 parent 984de39 commit 3c4dbca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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/, '#')
Expand Down

0 comments on commit 3c4dbca

Please sign in to comment.