Add the optional Immich integration and manual gallery push
Immich connections stay server-side with an encrypted API key, albums can be imported, and photos are only sent back when an event's push button is pressed: originals upload once, edited photos re-render, and edits hashes plus checksums skip anything already in Immich. This also lands the accompanying editor, cloud and administration work that was still uncommitted. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
+183
-1
@@ -1,4 +1,4 @@
|
||||
import type { EventRecord, PhotoRecord, Preset } from '../types';
|
||||
import type { EventRecord, Flag, PhotoRecord, Preset } from '../types';
|
||||
|
||||
export interface Health {
|
||||
ok: boolean;
|
||||
@@ -418,6 +418,75 @@ export interface MailStatus {
|
||||
gmail: boolean;
|
||||
}
|
||||
|
||||
export interface ImmichStatus {
|
||||
configured: boolean;
|
||||
enabled: boolean;
|
||||
/** The connection is configured server-wide by an administrator. */
|
||||
managed?: boolean;
|
||||
url: string;
|
||||
hasKey: boolean;
|
||||
autoSync: boolean;
|
||||
syncMinutes: number;
|
||||
trashOriginal: boolean;
|
||||
syncMetadata: boolean;
|
||||
lastSyncAt: number | null;
|
||||
lastError: string | null;
|
||||
version: string | null;
|
||||
albumCount: number;
|
||||
}
|
||||
|
||||
export interface ImmichAlbum {
|
||||
id: string;
|
||||
name: string;
|
||||
assetCount: number;
|
||||
/** A gallery created from a Luminary event is an upload destination, not an import source. */
|
||||
kind?: 'import' | 'gallery';
|
||||
updatedAt: number | null;
|
||||
startDate: number | null;
|
||||
endDate: number | null;
|
||||
thumbnailAssetId: string | null;
|
||||
/** Set when this account already imported the album. */
|
||||
eventId?: string | null;
|
||||
lastSyncAt?: number | null;
|
||||
}
|
||||
|
||||
export interface ImmichImportJob {
|
||||
id: string;
|
||||
albumId: string;
|
||||
albumName: string;
|
||||
eventId: string | null;
|
||||
state: 'running' | 'done' | 'error';
|
||||
scheduled?: boolean;
|
||||
total: number;
|
||||
done: number;
|
||||
skipped: number;
|
||||
failed: number;
|
||||
bytes: number;
|
||||
message: string;
|
||||
errors: string[];
|
||||
startedAt: number;
|
||||
finishedAt: number | null;
|
||||
}
|
||||
|
||||
export interface ImmichTestResult {
|
||||
ok: boolean;
|
||||
url: string;
|
||||
version: string;
|
||||
major: number;
|
||||
albumCount: number;
|
||||
}
|
||||
|
||||
export interface ImmichPushResult {
|
||||
ok: boolean;
|
||||
assetId: string;
|
||||
alreadyPushed: boolean;
|
||||
/** True when the photo already existed in Immich and no upload was made. */
|
||||
skipped?: boolean;
|
||||
trashed: boolean;
|
||||
associations: Partial<Record<'albums' | 'stack' | 'favorite' | 'sidecar', boolean>>;
|
||||
warning: string;
|
||||
}
|
||||
|
||||
export interface AdminOverview {
|
||||
users: AdminUser[];
|
||||
events: AdminEvent[];
|
||||
@@ -426,6 +495,7 @@ export interface AdminOverview {
|
||||
storage: { root: string; defaultRoot: string; custom: boolean; diskBytes?: number };
|
||||
quotas: AdminQuota[];
|
||||
mail: MailStatus;
|
||||
immich: ImmichStatus;
|
||||
}
|
||||
|
||||
export interface StorageChange {
|
||||
@@ -576,6 +646,118 @@ export function adminSetStorage(root: string): Promise<StorageChange> {
|
||||
});
|
||||
}
|
||||
|
||||
export function adminSaveImmich(input: {
|
||||
url: string;
|
||||
apiKey?: string;
|
||||
enabled?: boolean;
|
||||
}): Promise<ImmichStatus> {
|
||||
return request<{ immich: ImmichStatus }>('/api/admin/immich', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(input),
|
||||
}).then((res) => res.immich);
|
||||
}
|
||||
|
||||
export function adminTestImmich(): Promise<ImmichTestResult> {
|
||||
return request<ImmichTestResult>('/api/admin/immich/test', { method: 'POST' });
|
||||
}
|
||||
|
||||
export function adminDisconnectImmich(): Promise<ImmichStatus> {
|
||||
return request<{ immich: ImmichStatus }>('/api/admin/immich', { method: 'DELETE' }).then(
|
||||
(res) => res.immich,
|
||||
);
|
||||
}
|
||||
|
||||
export function getImmichStatus(): Promise<ImmichStatus> {
|
||||
return request<{ immich: ImmichStatus }>('/api/immich').then((res) => res.immich);
|
||||
}
|
||||
|
||||
export function saveImmichSettings(input: {
|
||||
url: string;
|
||||
apiKey?: string;
|
||||
enabled?: boolean;
|
||||
autoSync?: boolean;
|
||||
syncMinutes?: number;
|
||||
trashOriginal?: boolean;
|
||||
syncMetadata?: boolean;
|
||||
}): Promise<ImmichStatus> {
|
||||
return request<{ immich: ImmichStatus }>('/api/immich', {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(input),
|
||||
}).then((res) => res.immich);
|
||||
}
|
||||
|
||||
export function disconnectImmich(): Promise<ImmichStatus> {
|
||||
return request<{ immich: ImmichStatus }>('/api/immich', { method: 'DELETE' }).then(
|
||||
(res) => res.immich,
|
||||
);
|
||||
}
|
||||
|
||||
export function testImmich(): Promise<ImmichTestResult> {
|
||||
return request<ImmichTestResult>('/api/immich/test', { method: 'POST' });
|
||||
}
|
||||
|
||||
export function pushImmichPhoto(photoId: string, jpegBase64: string): Promise<ImmichPushResult> {
|
||||
return request<ImmichPushResult>(
|
||||
`/api/immich/photos/${encodeURIComponent(photoId)}/push`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ jpeg: jpegBase64 }),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export interface ImmichQueueEntry {
|
||||
photoId: string;
|
||||
name: string;
|
||||
/** Upload the untouched original, or the current rendered edit. */
|
||||
mode: 'original' | 'edit';
|
||||
}
|
||||
|
||||
/** The manual push plan for an event: originals and edits changed since last push. */
|
||||
export function immichEventQueue(
|
||||
eventId: string,
|
||||
): Promise<{ queue: ImmichQueueEntry[]; total: number }> {
|
||||
return request(`/api/immich/events/${encodeURIComponent(eventId)}/queue`);
|
||||
}
|
||||
|
||||
export function publishImmichOriginal(photoId: string): Promise<ImmichPushResult> {
|
||||
return request(
|
||||
`/api/immich/photos/${encodeURIComponent(photoId)}/publish`,
|
||||
{ method: 'POST' },
|
||||
);
|
||||
}
|
||||
|
||||
export function createImmichEventAlbum(
|
||||
eventId: string,
|
||||
name: string,
|
||||
): Promise<{ album: ImmichAlbum; event: EventRecord }> {
|
||||
return request('/api/immich/albums', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ eventId, name }),
|
||||
});
|
||||
}
|
||||
|
||||
export function immichAlbums(): Promise<ImmichAlbum[]> {
|
||||
return request<{ albums: ImmichAlbum[] }>('/api/immich/albums').then((res) => res.albums ?? []);
|
||||
}
|
||||
|
||||
export function immichImportAlbum(albumId: string): Promise<ImmichImportJob> {
|
||||
return request<{ job: ImmichImportJob }>(
|
||||
`/api/immich/albums/${encodeURIComponent(albumId)}/import`,
|
||||
{ method: 'POST' },
|
||||
).then((res) => res.job);
|
||||
}
|
||||
|
||||
export function getImmichJob(jobId: string): Promise<ImmichImportJob> {
|
||||
return request<{ job: ImmichImportJob }>(
|
||||
`/api/immich/jobs/${encodeURIComponent(jobId)}`,
|
||||
).then((res) => res.job);
|
||||
}
|
||||
|
||||
export function pushPresets(presets: Preset[]): Promise<void> {
|
||||
return request('/api/presets', {
|
||||
method: 'PUT',
|
||||
|
||||
+46
-29
@@ -106,6 +106,14 @@ const PRINT: [number, number][] = [
|
||||
[1, 0.98],
|
||||
];
|
||||
|
||||
/** Ektar's steeper negative curve: dense blacks without a slide's clipped highlights. */
|
||||
const EKTAR: [number, number][] = [
|
||||
[0, 0.015],
|
||||
[0.25, 0.23],
|
||||
[0.75, 0.79],
|
||||
[1, 0.985],
|
||||
];
|
||||
|
||||
/** Lifted blacks of instant film. */
|
||||
const INSTANT: [number, number][] = [
|
||||
[0, 0.09],
|
||||
@@ -164,15 +172,24 @@ const FILM_PACK: FilmSpec[] = [
|
||||
id: 'film-ektar-100',
|
||||
name: 'Kodak Ektar 100',
|
||||
group: 'Kodak',
|
||||
contrast: 18,
|
||||
blacks: -10,
|
||||
vibrance: 26,
|
||||
saturation: 8,
|
||||
clarity: 6,
|
||||
curve: SLIDE,
|
||||
hsl: { red: { sat: 12 }, green: { sat: 6, hue: -4 }, blue: { sat: 14, lum: -4 }, aqua: { sat: 8 } },
|
||||
grade: { shadows: [214, 6], highlights: [45, 4] },
|
||||
grain: [6, 22],
|
||||
temp: -2,
|
||||
contrast: 10,
|
||||
highlights: -4,
|
||||
shadows: 3,
|
||||
blacks: -6,
|
||||
vibrance: 14,
|
||||
saturation: 2,
|
||||
clarity: 3,
|
||||
curve: EKTAR,
|
||||
hsl: {
|
||||
red: { sat: 8 },
|
||||
orange: { sat: 4, lum: 2 },
|
||||
green: { sat: 3, hue: -2 },
|
||||
blue: { sat: 9, lum: -2 },
|
||||
aqua: { sat: 4 },
|
||||
},
|
||||
grade: { shadows: [214, 4], highlights: [45, 3] },
|
||||
grain: [5, 20],
|
||||
},
|
||||
{
|
||||
id: 'film-gold-200',
|
||||
@@ -463,11 +480,11 @@ const FILM_PACK: FilmSpec[] = [
|
||||
name: 'Fujifilm Velvia 50',
|
||||
group: 'Fujifilm',
|
||||
temp: -8,
|
||||
contrast: 26,
|
||||
blacks: -14,
|
||||
clarity: 8,
|
||||
vibrance: 34,
|
||||
saturation: 18,
|
||||
contrast: 20,
|
||||
blacks: -10,
|
||||
clarity: 6,
|
||||
vibrance: 26,
|
||||
saturation: 12,
|
||||
curve: SLIDE,
|
||||
hsl: {
|
||||
red: { sat: 18 },
|
||||
@@ -484,11 +501,11 @@ const FILM_PACK: FilmSpec[] = [
|
||||
name: 'Fujifilm Velvia 100',
|
||||
group: 'Fujifilm',
|
||||
temp: -7,
|
||||
contrast: 24,
|
||||
blacks: -12,
|
||||
clarity: 6,
|
||||
vibrance: 30,
|
||||
saturation: 14,
|
||||
contrast: 18,
|
||||
blacks: -8,
|
||||
clarity: 5,
|
||||
vibrance: 22,
|
||||
saturation: 8,
|
||||
curve: SLIDE,
|
||||
hsl: {
|
||||
red: { sat: 16 },
|
||||
@@ -532,10 +549,10 @@ const FILM_PACK: FilmSpec[] = [
|
||||
name: 'Fujifilm Fortia SP',
|
||||
group: 'Fujifilm',
|
||||
temp: -4,
|
||||
contrast: 20,
|
||||
blacks: -10,
|
||||
vibrance: 30,
|
||||
saturation: 24,
|
||||
contrast: 16,
|
||||
blacks: -8,
|
||||
vibrance: 22,
|
||||
saturation: 16,
|
||||
curve: SLIDE,
|
||||
hsl: { green: { sat: 18 }, red: { sat: 20 }, blue: { sat: 16 }, magenta: { sat: 12 } },
|
||||
grain: [6, 22],
|
||||
@@ -687,9 +704,9 @@ const FILM_PACK: FilmSpec[] = [
|
||||
name: 'Agfa Ultra 100',
|
||||
group: 'Agfa',
|
||||
temp: 4,
|
||||
contrast: 14,
|
||||
vibrance: 20,
|
||||
saturation: 26,
|
||||
contrast: 10,
|
||||
vibrance: 14,
|
||||
saturation: 16,
|
||||
curve: SLIDE,
|
||||
hsl: { red: { sat: 18 }, blue: { sat: 12 }, green: { sat: 8 } },
|
||||
grain: [8, 24],
|
||||
@@ -765,9 +782,9 @@ const FILM_PACK: FilmSpec[] = [
|
||||
name: 'Lomography Color Negative 100',
|
||||
group: 'Lomography',
|
||||
temp: 6,
|
||||
contrast: 18,
|
||||
vibrance: 20,
|
||||
saturation: 14,
|
||||
contrast: 14,
|
||||
vibrance: 14,
|
||||
saturation: 8,
|
||||
curve: SLIDE,
|
||||
hsl: { green: { sat: 14 }, blue: { sat: 10 }, red: { sat: 8 } },
|
||||
grade: { shadows: [220, 10], highlights: [45, 6] },
|
||||
|
||||
Reference in New Issue
Block a user