From 8f44f32a41e5f630c1fb58221eba5a309a1ec72b Mon Sep 17 00:00:00 2001 From: czoczo Date: Sat, 7 Jun 2025 23:03:41 +0000 Subject: [PATCH] updated copy forms with generated URL and install cmd --- webpage/BetterBash/src/App.vue | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/webpage/BetterBash/src/App.vue b/webpage/BetterBash/src/App.vue index 6cd332f..cbfaa25 100644 --- a/webpage/BetterBash/src/App.vue +++ b/webpage/BetterBash/src/App.vue @@ -154,6 +154,13 @@
+

Quick install

+ +

Copied to clipboard!

+

Share Your Theme

Copied to clipboard!

-

Load Theme from URL

+
@@ -463,6 +470,11 @@ function parseShareCode(code) { } } +const installUrl = computed(() => { + const code = generateShareCode(selectedColorAttributes.value, showAvatar.value); + return `curl -sL https://betterbash.cz0.cz/${code}/getbb.sh`; +}); + const shareableUrl = computed(() => { const code = generateShareCode(selectedColorAttributes.value, showAvatar.value); return `${window.location.origin}${window.location.pathname}#${code}`; @@ -482,6 +494,20 @@ async function copyUrlToClipboard() { } } +const copyCmdSuccess = ref(false); +async function copyCmdToClipboard() { + try { + await navigator.clipboard.writeText(installUrl.value); + copyCmdSuccess.value = true; + setTimeout(() => { + copyCmdSuccess.value = false; + }, 2000); + } catch (err) { + console.error('Failed to copy install command: ', err); + alert('Failed to copy install command. Please copy it manually.'); + } +} + function selectUrlText() { const inputElement = document.getElementById('shareUrlInput'); if (inputElement) {