Bootstrap
-- Congratulations on successfully installing this Hub server! - Below is the bootstrap invite link, a one-time invite that will - set you up as the admin of this Hub. -
- Claim invite - -diff --git a/lib/public/bootstrap.js b/lib/public/bootstrap.js index 2f28862..e2c6d2b 100644 --- a/lib/public/bootstrap.js +++ b/lib/public/bootstrap.js @@ -30,3 +30,23 @@ inviteLinkElem.onclick = function handleURI(ev) { }, 5000) window.location.replace(uri) } + +function copyText(text) { + const textArea = document.createElement("textarea") + textArea.value = text + + textArea.style.position = "absolute" + textArea.style.left = "-999999px" + document.body.prepend(textArea) + + textArea.select() + document.execCommand('copy') + + textArea.remove() +} + +const copyLinkElem = document.getElementById('copy') +copyLinkElem.onclick = function handleCopy(ev) { + copyText(uri); + copyLinkElem.innerHTML = copyLinkElem.innerHTML += '✓' +} diff --git a/lib/public/invite.js b/lib/public/invite.js index 241ad77..5c10759 100644 --- a/lib/public/invite.js +++ b/lib/public/invite.js @@ -35,6 +35,27 @@ if (hash) { // }, 5000); // window.location.replace(uri); // }; + + + function copyText(text) { + const textArea = document.createElement("textarea") + textArea.value = text + + textArea.style.position = "absolute" + textArea.style.left = "-999999px" + document.body.prepend(textArea) + + textArea.select() + document.execCommand('copy') + + textArea.remove() + } + + const copyLinkElem = document.getElementById('copy') + copyLinkElem.onclick = function handleCopy(ev) { + copyText(uri); + copyLinkElem.innerHTML = copyLinkElem.innerHTML += '✓' + } } else { inviteLinkElem.classList.add('hidden') failureElem.classList.remove('hidden') diff --git a/lib/views/bootstrap.ejs b/lib/views/bootstrap.ejs index 469b0d9..5bc97a9 100644 --- a/lib/views/bootstrap.ejs +++ b/lib/views/bootstrap.ejs @@ -1,25 +1,30 @@ -
- - - -- Congratulations on successfully installing this Hub server! - Below is the bootstrap invite link, a one-time invite that will - set you up as the admin of this Hub. -
- Claim invite - -+ Congratulations on successfully installing this Hub server! + Below is the bootstrap invite link, a one-time invite that will + set you up as the admin of this Hub. +
+ Claim invite + or + Copy invite + +