mirror of
https://github.com/immich-app/immich.git
synced 2024-12-26 10:50:29 +02:00
chore(web): Only show Copy button in HTTPS context (#2983)
This commit is contained in:
parent
f5d9826b12
commit
b3e97a1a0c
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher, onMount } from 'svelte';
|
||||||
import KeyVariant from 'svelte-material-icons/KeyVariant.svelte';
|
import KeyVariant from 'svelte-material-icons/KeyVariant.svelte';
|
||||||
import { handleError } from '../../utils/handle-error';
|
import { handleError } from '../../utils/handle-error';
|
||||||
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
||||||
@ -13,6 +13,12 @@
|
|||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
const handleDone = () => dispatch('done');
|
const handleDone = () => dispatch('done');
|
||||||
|
let canCopyImagesToClipboard = true;
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
const module = await import('copy-image-clipboard');
|
||||||
|
canCopyImagesToClipboard = module.canCopyImagesToClipboard();
|
||||||
|
});
|
||||||
const handleCopy = async () => {
|
const handleCopy = async () => {
|
||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(secret);
|
await navigator.clipboard.writeText(secret);
|
||||||
@ -55,7 +61,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex w-full px-4 gap-4 mt-8">
|
<div class="flex w-full px-4 gap-4 mt-8">
|
||||||
<Button on:click={() => handleCopy()} fullwidth>Copy to Clipboard</Button>
|
{#if canCopyImagesToClipboard}
|
||||||
|
<Button on:click={() => handleCopy()} fullwidth>Copy to Clipboard</Button>
|
||||||
|
{/if}
|
||||||
<Button on:click={() => handleDone()} fullwidth>Done</Button>
|
<Button on:click={() => handleDone()} fullwidth>Done</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
let showExif = true;
|
let showExif = true;
|
||||||
let expirationTime = '';
|
let expirationTime = '';
|
||||||
let shouldChangeExpirationTime = false;
|
let shouldChangeExpirationTime = false;
|
||||||
|
let canCopyImagesToClipboard = true;
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
const expiredDateOption: ImmichDropDownOption = {
|
const expiredDateOption: ImmichDropDownOption = {
|
||||||
@ -39,7 +39,7 @@
|
|||||||
options: ['Never', '30 minutes', '1 hour', '6 hours', '1 day', '7 days', '30 days']
|
options: ['Never', '30 minutes', '1 hour', '6 hours', '1 day', '7 days', '30 days']
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(() => {
|
onMount(async () => {
|
||||||
if (editingLink) {
|
if (editingLink) {
|
||||||
if (editingLink.description) {
|
if (editingLink.description) {
|
||||||
description = editingLink.description;
|
description = editingLink.description;
|
||||||
@ -48,6 +48,9 @@
|
|||||||
allowDownload = editingLink.allowDownload;
|
allowDownload = editingLink.allowDownload;
|
||||||
showExif = editingLink.showExif;
|
showExif = editingLink.showExif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const module = await import('copy-image-clipboard');
|
||||||
|
canCopyImagesToClipboard = module.canCopyImagesToClipboard();
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleCreateSharedLink = async () => {
|
const handleCreateSharedLink = async () => {
|
||||||
@ -247,7 +250,9 @@
|
|||||||
<div class="flex w-full gap-4">
|
<div class="flex w-full gap-4">
|
||||||
<input class="immich-form-input w-full" bind:value={sharedLink} disabled />
|
<input class="immich-form-input w-full" bind:value={sharedLink} disabled />
|
||||||
|
|
||||||
<Button on:click={() => handleCopy()}>Copy</Button>
|
{#if canCopyImagesToClipboard}
|
||||||
|
<Button on:click={() => handleCopy()}>Copy</Button>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
Reference in New Issue
Block a user