Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
opiran-club authored Aug 17, 2024
1 parent b9c4fd1 commit dfe0944
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ function convertToURL() {
const url = `wireguard://${encodeURIComponent(peerSecretKey)}@${address}:${port}/?publickey=${encodeURIComponent(peerPublicKey)}&address=${encodeURIComponent(allowedIPs)}&mtu=${encodeURIComponent(mtu)#${encodeURIComponent(name)}`;
document.getElementById('wg-uri').innerText = url;
}

function copyToClipboard() {
const urlElement = document.getElementById('wg-uri');
const urlText = urlElement.innerText;
navigator.clipboard.writeText(urlText).then(() => {
alert("URL copied to clipboard!");
}).catch(err => {
console.error('Failed to copy: ', err);
});
}

0 comments on commit dfe0944

Please sign in to comment.