1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-30 05:29:30 +02:00

refactor(web): shared link key auth (#3855)

This commit is contained in:
Jason Rasmussen
2023-08-25 00:03:28 -04:00
committed by GitHub
parent 10c2bda3a9
commit 9bbef4a97b
21 changed files with 115 additions and 108 deletions

View File

@ -9,21 +9,20 @@
import ImageOutline from 'svelte-material-icons/ImageOutline.svelte';
import MapMarkerOutline from 'svelte-material-icons/MapMarkerOutline.svelte';
import { createEventDispatcher } from 'svelte';
import { AssetResponseDto, AlbumResponseDto, api, ThumbnailFormat, SharedLinkResponseDto } from '@api';
import { AssetResponseDto, AlbumResponseDto, api, ThumbnailFormat } from '@api';
import { asByteUnitString } from '../../utils/byte-units';
import ImageThumbnail from '../assets/thumbnail/image-thumbnail.svelte';
import { getAssetFilename } from '$lib/utils/asset-utils';
export let asset: AssetResponseDto;
export let albums: AlbumResponseDto[] = [];
export let sharedLink: SharedLinkResponseDto | undefined = undefined;
let textarea: HTMLTextAreaElement;
let description: string;
$: {
// Get latest description from server
if (asset.id && !sharedLink) {
if (asset.id && !api.isSharedLink) {
api.assetApi.getAssetById({ id: asset.id }).then((res) => {
people = res.data?.people || [];
textarea.value = res.data?.exifInfo?.description || '';
@ -91,13 +90,15 @@
<p class="text-lg text-immich-fg dark:text-immich-dark-fg">Info</p>
</div>
<section class="mx-4 mt-10">
<section
class="mx-4 mt-10"
style:display={$page?.data?.user?.id !== asset.ownerId && textarea?.value == '' ? 'none' : 'block'}
>
<textarea
bind:this={textarea}
class="max-h-[500px]
w-full resize-none overflow-hidden border-b border-gray-500 bg-transparent text-base text-black outline-none transition-all focus:border-b-2 focus:border-immich-primary disabled:border-none dark:text-white dark:focus:border-immich-dark-primary"
placeholder={$page?.data?.user?.id !== asset.ownerId ? '' : 'Add a description'}
style:display={$page?.data?.user?.id !== asset.ownerId && textarea?.value == '' ? 'none' : 'block'}
on:focusin={handleFocusIn}
on:focusout={handleFocusOut}
on:input={autoGrowHeight}
@ -106,7 +107,7 @@
/>
</section>
{#if people.length > 0}
{#if !api.isSharedLink && people.length > 0}
<section class="px-4 py-4 text-sm">
<h2>PEOPLE</h2>