forked from Cutlery/immich
* implement method to read config file * getConfig returns config file if present * return isConfigFile for http requests * disable elements if config file is used, show message if config file is set, copy existing config to clipboard * fix allowing partial configuration files * add new env variable to docs * fix tests * minor refactoring, address review * adapt config type in frontend * remove unnecessary imports * move config file reading to system-config repo * add documentation * fix code formatting in system settings page * add validator for config file * fix formatting in docs * update generated files * throw error when trying to update config. e.g. via cli or api * switch to feature flags for isConfigFile * refactoring * refactor: config file * chore: open api * feat: always show copy/export buttons * fix: default flags * refactor: copy to clipboard --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
48 lines
1.8 KiB
Svelte
48 lines
1.8 KiB
Svelte
<script lang="ts">
|
|
import { createEventDispatcher, onMount } from 'svelte';
|
|
import KeyVariant from 'svelte-material-icons/KeyVariant.svelte';
|
|
import { copyToClipboard } from '@api';
|
|
import Button from '../elements/buttons/button.svelte';
|
|
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
|
|
|
export let secret = '';
|
|
|
|
const dispatch = createEventDispatcher();
|
|
const handleDone = () => dispatch('done');
|
|
let canCopyImagesToClipboard = true;
|
|
|
|
onMount(async () => {
|
|
const module = await import('copy-image-clipboard');
|
|
canCopyImagesToClipboard = module.canCopyImagesToClipboard();
|
|
});
|
|
</script>
|
|
|
|
<FullScreenModal>
|
|
<div
|
|
class="w-[500px] max-w-[95vw] rounded-3xl border bg-immich-bg p-4 py-8 shadow-sm dark:border-immich-dark-gray dark:bg-immich-dark-gray dark:text-immich-dark-fg"
|
|
>
|
|
<div
|
|
class="flex flex-col place-content-center place-items-center gap-4 px-4 text-immich-primary dark:text-immich-dark-primary"
|
|
>
|
|
<KeyVariant size="4em" />
|
|
<h1 class="text-2xl font-medium text-immich-primary dark:text-immich-dark-primary">API Key</h1>
|
|
|
|
<p class="text-sm dark:text-immich-dark-fg">
|
|
This value will only be shown once. Please be sure to copy it before closing the window.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="m-4 flex flex-col gap-2">
|
|
<!-- <label class="immich-form-label" for="secret">API Key</label> -->
|
|
<textarea class="immich-form-input" id="secret" name="secret" readonly={true} value={secret} />
|
|
</div>
|
|
|
|
<div class="mt-8 flex w-full gap-4 px-4">
|
|
{#if canCopyImagesToClipboard}
|
|
<Button on:click={() => copyToClipboard(secret)} fullwidth>Copy to Clipboard</Button>
|
|
{/if}
|
|
<Button on:click={() => handleDone()} fullwidth>Done</Button>
|
|
</div>
|
|
</div>
|
|
</FullScreenModal>
|