From a374e09d19d6fa445a11cd8dcf8e69098abac9d9 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:50:39 +0100 Subject: [PATCH 01/12] fix: fallback for copy button --- .../components/modal-confirmation.blade.php | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php index 8495417ac..6f1dad8c9 100644 --- a/resources/views/components/modal-confirmation.blade.php +++ b/resources/views/components/modal-confirmation.blade.php @@ -92,11 +92,33 @@ }); }, copyConfirmationText() { - navigator.clipboard.writeText(this.confirmationText); - this.copied = true; - setTimeout(() => { - this.copied = false; - }, 2000); + if (navigator.clipboard && window.isSecureContext) { + navigator.clipboard.writeText(this.confirmationText) + .then(() => { + this.copied = true; + setTimeout(() => { + this.copied = false; + }, 2000); + }); + } else { + const textarea = document.createElement('textarea'); + textarea.value = this.confirmationText; + textarea.style.position = 'fixed'; + textarea.style.opacity = '0'; + document.body.appendChild(textarea); + textarea.select(); + try { + document.execCommand('copy'); + this.copied = true; + setTimeout(() => { + this.copied = false; + }, 2000); + } catch (err) { + console.error('Failed to copy text:', err); + } finally { + document.body.removeChild(textarea); + } + } }, toggleAction(id) { const index = this.selectedActions.indexOf(id); From 9701c8aa6b6b0c7d8379ac3e25657f96bab61c3c Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:56:59 +0100 Subject: [PATCH 02/12] fix: copy the right text --- resources/views/components/modal-confirmation.blade.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php index 6f1dad8c9..4620d35ed 100644 --- a/resources/views/components/modal-confirmation.blade.php +++ b/resources/views/components/modal-confirmation.blade.php @@ -92,8 +92,9 @@ }); }, copyConfirmationText() { + const textToCopy = this.confirmationText; if (navigator.clipboard && window.isSecureContext) { - navigator.clipboard.writeText(this.confirmationText) + navigator.clipboard.writeText(textToCopy) .then(() => { this.copied = true; setTimeout(() => { @@ -102,7 +103,7 @@ }); } else { const textarea = document.createElement('textarea'); - textarea.value = this.confirmationText; + textarea.value = textToCopy; textarea.style.position = 'fixed'; textarea.style.opacity = '0'; document.body.appendChild(textarea); From b25463b084b2be5398feb3abdc3680e38c3d159e Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:05:31 +0100 Subject: [PATCH 03/12] fix: maybe fallback is now working --- .../views/components/modal-confirmation.blade.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php index 4620d35ed..94f1f84f4 100644 --- a/resources/views/components/modal-confirmation.blade.php +++ b/resources/views/components/modal-confirmation.blade.php @@ -92,9 +92,8 @@ }); }, copyConfirmationText() { - const textToCopy = this.confirmationText; if (navigator.clipboard && window.isSecureContext) { - navigator.clipboard.writeText(textToCopy) + navigator.clipboard.writeText(this.confirmationText) .then(() => { this.copied = true; setTimeout(() => { @@ -103,9 +102,10 @@ }); } else { const textarea = document.createElement('textarea'); - textarea.value = textToCopy; - textarea.style.position = 'fixed'; - textarea.style.opacity = '0'; + textarea.value = this.confirmationText; + textarea.style.position = 'absolute'; + textarea.style.left = '-9999px'; + textarea.style.top = '0'; document.body.appendChild(textarea); textarea.select(); try { From 89a0fb1dd66228ecf814f236b69081d95ed6f0f9 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:10:37 +0100 Subject: [PATCH 04/12] new fallback approach --- .../components/modal-confirmation.blade.php | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php index 94f1f84f4..e23393abb 100644 --- a/resources/views/components/modal-confirmation.blade.php +++ b/resources/views/components/modal-confirmation.blade.php @@ -101,24 +101,18 @@ }, 2000); }); } else { - const textarea = document.createElement('textarea'); - textarea.value = this.confirmationText; - textarea.style.position = 'absolute'; - textarea.style.left = '-9999px'; - textarea.style.top = '0'; - document.body.appendChild(textarea); - textarea.select(); - try { - document.execCommand('copy'); - this.copied = true; - setTimeout(() => { - this.copied = false; - }, 2000); - } catch (err) { - console.error('Failed to copy text:', err); - } finally { - document.body.removeChild(textarea); - } + const input = document.createElement('input'); + input.setAttribute('readonly', ''); + input.setAttribute('value', this.confirmationText); + document.body.appendChild(input); + input.select(); + input.setSelectionRange(0, 99999); + document.execCommand('copy'); + document.body.removeChild(input); + this.copied = true; + setTimeout(() => { + this.copied = false; + }, 2000); } }, toggleAction(id) { From 94bc604fbea9625d10dfd421c051a44ace235bd5 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:15:18 +0100 Subject: [PATCH 05/12] never mind fuck the fallback just use https --- .../components/modal-confirmation.blade.php | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php index e23393abb..8495417ac 100644 --- a/resources/views/components/modal-confirmation.blade.php +++ b/resources/views/components/modal-confirmation.blade.php @@ -92,28 +92,11 @@ }); }, copyConfirmationText() { - if (navigator.clipboard && window.isSecureContext) { - navigator.clipboard.writeText(this.confirmationText) - .then(() => { - this.copied = true; - setTimeout(() => { - this.copied = false; - }, 2000); - }); - } else { - const input = document.createElement('input'); - input.setAttribute('readonly', ''); - input.setAttribute('value', this.confirmationText); - document.body.appendChild(input); - input.select(); - input.setSelectionRange(0, 99999); - document.execCommand('copy'); - document.body.removeChild(input); - this.copied = true; - setTimeout(() => { - this.copied = false; - }, 2000); - } + navigator.clipboard.writeText(this.confirmationText); + this.copied = true; + setTimeout(() => { + this.copied = false; + }, 2000); }, toggleAction(id) { const index = this.selectedActions.indexOf(id); From 06ce7b0a2a3eb40cbc509d44147f07c8275d6890 Mon Sep 17 00:00:00 2001 From: Eric Dahl Date: Fri, 13 Dec 2024 11:30:55 -0500 Subject: [PATCH 06/12] Fix typo in fileflows.yaml The service was called `radarr` instead of `fileflows` --- templates/compose/fileflows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/compose/fileflows.yaml b/templates/compose/fileflows.yaml index 7e2d9f7d9..2cfafb83f 100644 --- a/templates/compose/fileflows.yaml +++ b/templates/compose/fileflows.yaml @@ -5,7 +5,7 @@ # port: 5000 services: - radarr: + fileflows: image: revenz/fileflows environment: - SERVICE_FQDN_FILEFLOWS_5000 From 260e44d3dbd3009052f545690e52b89ae6fcada8 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Fri, 13 Dec 2024 20:57:58 +0100 Subject: [PATCH 07/12] fix: only show copy button on secure context --- resources/views/components/modal-confirmation.blade.php | 1 + resources/views/livewire/profile/index.blade.php | 2 ++ 2 files changed, 3 insertions(+) diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php index 8495417ac..e98a494c5 100644 --- a/resources/views/components/modal-confirmation.blade.php +++ b/resources/views/components/modal-confirmation.blade.php @@ -258,6 +258,7 @@