Skip to content

Modern Docker Management, Designed for Everyone

fix: disable copy button on non-ssl instances (#1309)

Kyle Mendell88a7824f598a
diff --git a/backend/go.mod b/backend/go.mod
index ac9dc4667..163201880 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -36,6 +36,7 @@ require (
github.com/stretchr/testify v1.11.1
go.podman.io/image/v5 v5.38.0
golang.org/x/crypto v0.46.0
+ golang.org/x/net v0.47.0
golang.org/x/oauth2 v0.34.0
golang.org/x/sync v0.19.0
golang.org/x/text v0.32.0
@@ -198,7 +199,6 @@ require (
go.yaml.in/yaml/v4 v4.0.0-rc.3 // indirect
golang.org/x/arch v0.21.0 // indirect
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
- golang.org/x/net v0.47.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/term v0.38.0 // indirect
golang.org/x/time v0.14.0 // indirect
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 7bf93b265..d48a5582c 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -213,6 +213,7 @@
"common_field_required": "{field} is required",
"common_copied": "Copied to clipboard",
"common_copy_failed": "Failed to copy to clipboard",
+ "common_copy_https_required": "Copying requires a secure connection (HTTPS)",
"_comment_resources": "=== RESOURCE NAMES ===",
"resource_volume": "volume",
"resource_volume_cap": "Volume",
diff --git a/frontend/src/lib/components/ui/copy-button/copy-button.svelte b/frontend/src/lib/components/ui/copy-button/copy-button.svelte
index 34cb6a539..2fb94dac4 100644
--- a/frontend/src/lib/components/ui/copy-button/copy-button.svelte
+++ b/frontend/src/lib/components/ui/copy-button/copy-button.svelte
@@ -9,6 +9,9 @@
import { scale } from 'svelte/transition';
import type { CopyButtonProps } from './types';
import { CopyIcon, CloseIcon, CheckIcon } from '$lib/icons';
+ import * as Tooltip from '$lib/components/ui/tooltip';
+ import { onMount } from 'svelte';
+ import { m } from '$lib/paraglide/messages';
let {
ref = $bindable(null),
@@ -26,42 +29,79 @@
const clipboard = new UseClipboard();
const resolvedSize = $derived(size === 'icon' && children ? 'default' : size);
+
+ let isSecure = $state(true);
+
+ onMount(() => {
+ isSecure = window.isSecureContext || window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1';
+ });
</script>
-<ArcaneButton
- bind:ref
- action="base"
- tone={variant === 'ghost' ? 'ghost' : variant === 'outline' ? 'outline' : 'outline'}
- size={resolvedSize}
- {tabindex}
- class={cn('flex items-center gap-2', className)}
- type="button"
- name="copy"
- onclick={async () => {
- const status = await clipboard.copy(text);
+{#if isSecure}
+ <ArcaneButton
+ bind:ref
+ action="base"
+ tone={variant === 'ghost' ? 'ghost' : variant === 'outline' ? 'outline' : 'outline'}
+ size={resolvedSize}
+ {tabindex}
+ class={cn('flex items-center gap-2', className)}
+ type="button"
+ name="copy"
+ onclick={async () => {
+ const status = await clipboard.copy(text);
- onCopy?.(status);
- }}
->
- {#if clipboard.status === 'success'}
- <div in:scale={{ duration: animationDuration, start: 0.85 }}>
- <CheckIcon tabindex={-1} />
- <span class="sr-only">Copied</span>
- </div>
- {:else if clipboard.status === 'failure'}
- <div in:scale={{ duration: animationDuration, start: 0.85 }}>
- <CloseIcon tabindex={-1} />
- <span class="sr-only">Failed to copy</span>
- </div>
- {:else}
- <div in:scale={{ duration: animationDuration, start: 0.85 }}>
- {#if icon}
- {@render icon()}
- {:else}
- <CopyIcon tabindex={-1} />
- {/if}
- <span class="sr-only">Copy</span>
- </div>
- {/if}
- {@render children?.()}
-</ArcaneButton>
+ onCopy?.(status);
+ }}
+ >
+ {#if clipboard.status === 'success'}
+ <div in:scale={{ duration: animationDuration, start: 0.85 }}>
+ <CheckIcon tabindex={-1} />
+ <span class="sr-only">Copied</span>
+ </div>
+ {:else if clipboard.status === 'failure'}
+ <div in:scale={{ duration: animationDuration, start: 0.85 }}>
+ <CloseIcon tabindex={-1} />
+ <span class="sr-only">Failed to copy</span>
+ </div>
+ {:else}
+ <div in:scale={{ duration: animationDuration, start: 0.85 }}>
+ {#if icon}
+ {@render icon()}
+ {:else}
+ <CopyIcon tabindex={-1} />
+ {/if}
+ <span class="sr-only">Copy</span>
+ </div>
+ {/if}
+ {@render children?.()}
+ </ArcaneButton>
+{:else}
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <ArcaneButton
+ bind:ref
+ action="base"
+ tone={variant === 'ghost' ? 'ghost' : variant === 'outline' ? 'outline' : 'outline'}
+ size={resolvedSize}
+ {tabindex}
+ class={cn('flex cursor-not-allowed items-center gap-2 opacity-50', className)}
+ type="button"
+ name="copy"
+ disabled
+ >
+ <div in:scale={{ duration: animationDuration, start: 0.85 }}>
+ {#if icon}
+ {@render icon()}
+ {:else}
+ <CopyIcon tabindex={-1} />
+ {/if}
+ <span class="sr-only">Copy</span>
+ </div>
+ {@render children?.()}
+ </ArcaneButton>
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p>{m.common_copy_https_required()}</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+{/if}