mirror of
https://github.com/immich-app/immich.git
synced 2026-07-10 06:03:14 -07:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| de9abf8ce9 |
+3
-2
@@ -814,7 +814,7 @@
|
||||
"custom_date": "Custom date",
|
||||
"custom_locale": "Custom locale",
|
||||
"custom_locale_description": "Format dates, times, and numbers based on the selected language and region",
|
||||
"custom_url": "Custom URL",
|
||||
"custom_url_name": "Custom URL name",
|
||||
"cutoff_date_description": "Keep photos from the last…",
|
||||
"cutoff_day": "{count, plural, one {day} other {days}}",
|
||||
"cutoff_year": "{count, plural, one {year} other {years}}",
|
||||
@@ -1948,7 +1948,8 @@
|
||||
"shared_link_app_bar_title": "Shared Links",
|
||||
"shared_link_clipboard_copied_massage": "Copied to clipboard",
|
||||
"shared_link_create_error": "Error while creating shared link",
|
||||
"shared_link_custom_url_description": "Access this shared link with a custom URL",
|
||||
"shared_link_custom_url_description": "Access this shared link with a custom URL name",
|
||||
"shared_link_custom_url_warning": "Warning: a custom URL name with a forward slash may not behave as you expect.",
|
||||
"shared_link_edit_description_hint": "Enter the share description",
|
||||
"shared_link_edit_expire_after_option_day": "1 day",
|
||||
"shared_link_edit_expire_after_option_days": "{count} days",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import SharedLinkExpiration from '$lib/components/SharedLinkExpiration.svelte';
|
||||
import { Field, Input, PasswordInput, Switch, Text } from '@immich/ui';
|
||||
import { Field, HelperText, Input, PasswordInput, Switch, Text } from '@immich/ui';
|
||||
import { t } from 'svelte-i18n';
|
||||
|
||||
type Props = {
|
||||
@@ -32,8 +32,11 @@
|
||||
|
||||
<div class="mt-4 flex flex-col gap-4">
|
||||
<div>
|
||||
<Field label={$t('custom_url')} description={$t('shared_link_custom_url_description')}>
|
||||
<Field label={$t('custom_url_name')} description={$t('shared_link_custom_url_description')}>
|
||||
<Input bind:value={slug} autocomplete="off" />
|
||||
{#if slug.includes('/')}
|
||||
<HelperText class="text-warning">{$t('shared_link_custom_url_warning')}</HelperText>
|
||||
{/if}
|
||||
</Field>
|
||||
{#if slug}
|
||||
<Text size="tiny" color="muted" class="pt-2 break-all">/s/{encodeURIComponent(slug)}</Text>
|
||||
|
||||
@@ -24,6 +24,20 @@ describe('Route', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe(Route.viewSharedLink.name, () => {
|
||||
it('should work with key', () => {
|
||||
expect(Route.viewSharedLink({ key: 'uuid-key' })).toBe('/share/uuid-key');
|
||||
});
|
||||
|
||||
it('should work with key and slug', () => {
|
||||
expect(Route.viewSharedLink({ key: 'uuid-key', slug: 'custom-slug' })).toBe('/s/custom-slug');
|
||||
});
|
||||
|
||||
it('should URI encode slug', () => {
|
||||
expect(Route.viewSharedLink({ key: 'uuid-key', slug: 'albums/the-moon?' })).toBe('/s/albums%2Fthe-moon%3F');
|
||||
});
|
||||
});
|
||||
|
||||
describe(Route.tags.name, () => {
|
||||
it('should work', () => {
|
||||
expect(Route.tags()).toBe('/tags');
|
||||
|
||||
@@ -120,7 +120,8 @@ export const Route = {
|
||||
// shared links
|
||||
sharedLinks: (params?: { filter?: SharedLinkTab }) => '/shared-links' + asQueryString(params),
|
||||
editSharedLink: ({ id }: { id: string }) => `/shared-links/${id}/edit`,
|
||||
viewSharedLink: ({ slug, key }: { slug?: string | null; key: string }) => (slug ? `/s/${slug}` : `/share/${key}`),
|
||||
viewSharedLink: ({ slug, key }: { slug?: string | null; key: string }) =>
|
||||
slug ? `/s/${encodeURIComponent(slug)}` : `/share/${key}`,
|
||||
|
||||
// settings
|
||||
userSettings: (params?: { isOpen?: OpenQueryParam }) => '/user-settings' + asQueryString(params),
|
||||
|
||||
@@ -60,9 +60,7 @@ export const getSharedLinkActions = ($t: MessageFormatter, sharedLink: SharedLin
|
||||
};
|
||||
|
||||
export const asUrl = (sharedLink: SharedLinkResponseDto) => {
|
||||
const path = sharedLink.slug
|
||||
? `s/${encodeURIComponent(sharedLink.slug)}`
|
||||
: `share/${encodeURIComponent(sharedLink.key)}`;
|
||||
const path = Route.viewSharedLink(sharedLink);
|
||||
return new URL(path, serverConfigManager.value.externalDomain || globalThis.location.origin).href;
|
||||
};
|
||||
|
||||
|
||||
@@ -56,8 +56,10 @@
|
||||
|
||||
{#if shareType === SharedLinkType.Individual}
|
||||
<div class="text-sm">
|
||||
{$t('individual_share')} |
|
||||
<span class="text-primary">{sharedLink.description || ''}</span>
|
||||
{$t('individual_share')}
|
||||
{#if description !== ''}
|
||||
| <span class="text-primary">{description}</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user