refactor(server): decouple generated images from image formats (#8246)

* rename

thumbnail config

update target paths, fix tests

rename to image settings

replace legacy enum

better typing

update sql

update api

remove config option

fix

* update docs

* update other thumbnail configs in migration

* keep legacy enum for now

* fix jumbled job names

* fix jumbled job names in tests

* rename thumbhash job

* rename dto

* fix tests

* preserve order

* remove unused import

* keep old fields in dto, marked deprecated

* update sql

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Mert 2024-04-02 00:56:56 -04:00 committed by GitHub
parent e520c0d1f5
commit 8edc2fb46f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 916 additions and 547 deletions

View file

@ -2101,10 +2101,19 @@
}
}
},
{
"name": "previewPath",
"required": false,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "resizePath",
"required": false,
"in": "query",
"deprecated": true,
"schema": {
"type": "string"
}
@ -2143,6 +2152,14 @@
"type": "string"
}
},
{
"name": "thumbnailPath",
"required": false,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "trashedAfter",
"required": false,
@ -2191,6 +2208,7 @@
"name": "webpPath",
"required": false,
"in": "query",
"deprecated": true,
"schema": {
"type": "string"
}
@ -8114,6 +8132,13 @@
],
"type": "object"
},
"ImageFormat": {
"enum": [
"jpeg",
"webp"
],
"type": "string"
},
"JobCommand": {
"enum": [
"start",
@ -8555,7 +8580,11 @@
},
"type": "array"
},
"previewPath": {
"type": "string"
},
"resizePath": {
"deprecated": true,
"type": "string"
},
"size": {
@ -8572,6 +8601,9 @@
"format": "date-time",
"type": "string"
},
"thumbnailPath": {
"type": "string"
},
"trashedAfter": {
"format": "date-time",
"type": "string"
@ -8592,6 +8624,7 @@
"type": "string"
},
"webpPath": {
"deprecated": true,
"type": "string"
},
"withArchived": {
@ -8746,8 +8779,8 @@
"PathType": {
"enum": [
"original",
"jpeg_thumbnail",
"webp_thumbnail",
"preview",
"thumbnail",
"encoded_video",
"sidecar",
"face",
@ -9743,6 +9776,9 @@
"ffmpeg": {
"$ref": "#/components/schemas/SystemConfigFFmpegDto"
},
"image": {
"$ref": "#/components/schemas/SystemConfigImageDto"
},
"job": {
"$ref": "#/components/schemas/SystemConfigJobDto"
},
@ -9779,9 +9815,6 @@
"theme": {
"$ref": "#/components/schemas/SystemConfigThemeDto"
},
"thumbnail": {
"$ref": "#/components/schemas/SystemConfigThumbnailDto"
},
"trash": {
"$ref": "#/components/schemas/SystemConfigTrashDto"
},
@ -9791,6 +9824,7 @@
},
"required": [
"ffmpeg",
"image",
"job",
"library",
"logging",
@ -9803,7 +9837,6 @@
"server",
"storageTemplate",
"theme",
"thumbnail",
"trash",
"user"
],
@ -9902,6 +9935,37 @@
],
"type": "object"
},
"SystemConfigImageDto": {
"properties": {
"colorspace": {
"$ref": "#/components/schemas/Colorspace"
},
"previewFormat": {
"$ref": "#/components/schemas/ImageFormat"
},
"previewSize": {
"type": "integer"
},
"quality": {
"type": "integer"
},
"thumbnailFormat": {
"$ref": "#/components/schemas/ImageFormat"
},
"thumbnailSize": {
"type": "integer"
}
},
"required": [
"colorspace",
"previewFormat",
"previewSize",
"quality",
"thumbnailFormat",
"thumbnailSize"
],
"type": "object"
},
"SystemConfigJobDto": {
"properties": {
"backgroundTask": {
@ -10251,29 +10315,6 @@
],
"type": "object"
},
"SystemConfigThumbnailDto": {
"properties": {
"colorspace": {
"$ref": "#/components/schemas/Colorspace"
},
"jpegSize": {
"type": "integer"
},
"quality": {
"type": "integer"
},
"webpSize": {
"type": "integer"
}
},
"required": [
"colorspace",
"jpegSize",
"quality",
"webpSize"
],
"type": "object"
},
"SystemConfigTrashDto": {
"properties": {
"days": {

View file

@ -640,11 +640,13 @@ export type MetadataSearchDto = {
originalPath?: string;
page?: number;
personIds?: string[];
previewPath?: string;
resizePath?: string;
size?: number;
state?: string;
takenAfter?: string;
takenBefore?: string;
thumbnailPath?: string;
trashedAfter?: string;
trashedBefore?: string;
"type"?: AssetTypeEnum;
@ -827,6 +829,14 @@ export type SystemConfigFFmpegDto = {
transcode: TranscodePolicy;
twoPass: boolean;
};
export type SystemConfigImageDto = {
colorspace: Colorspace;
previewFormat: ImageFormat;
previewSize: number;
quality: number;
thumbnailFormat: ImageFormat;
thumbnailSize: number;
};
export type JobSettingsDto = {
concurrency: number;
};
@ -919,12 +929,6 @@ export type SystemConfigStorageTemplateDto = {
export type SystemConfigThemeDto = {
customCss: string;
};
export type SystemConfigThumbnailDto = {
colorspace: Colorspace;
jpegSize: number;
quality: number;
webpSize: number;
};
export type SystemConfigTrashDto = {
days: number;
enabled: boolean;
@ -934,6 +938,7 @@ export type SystemConfigUserDto = {
};
export type SystemConfigDto = {
ffmpeg: SystemConfigFFmpegDto;
image: SystemConfigImageDto;
job: SystemConfigJobDto;
library: SystemConfigLibraryDto;
logging: SystemConfigLoggingDto;
@ -946,7 +951,6 @@ export type SystemConfigDto = {
server: SystemConfigServerDto;
storageTemplate: SystemConfigStorageTemplateDto;
theme: SystemConfigThemeDto;
thumbnail: SystemConfigThumbnailDto;
trash: SystemConfigTrashDto;
user: SystemConfigUserDto;
};
@ -1497,7 +1501,7 @@ export function updateAsset({ id, updateAssetDto }: {
body: updateAssetDto
})));
}
export function searchAssets({ checksum, city, country, createdAfter, createdBefore, deviceAssetId, deviceId, encodedVideoPath, id, isArchived, isEncoded, isExternal, isFavorite, isMotion, isNotInAlbum, isOffline, isReadOnly, isVisible, lensModel, libraryId, make, model, order, originalFileName, originalPath, page, personIds, resizePath, size, state, takenAfter, takenBefore, trashedAfter, trashedBefore, $type, updatedAfter, updatedBefore, webpPath, withArchived, withDeleted, withExif, withPeople, withStacked }: {
export function searchAssets({ checksum, city, country, createdAfter, createdBefore, deviceAssetId, deviceId, encodedVideoPath, id, isArchived, isEncoded, isExternal, isFavorite, isMotion, isNotInAlbum, isOffline, isReadOnly, isVisible, lensModel, libraryId, make, model, order, originalFileName, originalPath, page, personIds, previewPath, resizePath, size, state, takenAfter, takenBefore, thumbnailPath, trashedAfter, trashedBefore, $type, updatedAfter, updatedBefore, webpPath, withArchived, withDeleted, withExif, withPeople, withStacked }: {
checksum?: string;
city?: string;
country?: string;
@ -1525,11 +1529,13 @@ export function searchAssets({ checksum, city, country, createdAfter, createdBef
originalPath?: string;
page?: number;
personIds?: string[];
previewPath?: string;
resizePath?: string;
size?: number;
state?: string;
takenAfter?: string;
takenBefore?: string;
thumbnailPath?: string;
trashedAfter?: string;
trashedBefore?: string;
$type?: AssetTypeEnum;
@ -1573,11 +1579,13 @@ export function searchAssets({ checksum, city, country, createdAfter, createdBef
originalPath,
page,
personIds,
previewPath,
resizePath,
size,
state,
takenAfter,
takenBefore,
thumbnailPath,
trashedAfter,
trashedBefore,
"type": $type,
@ -2802,8 +2810,8 @@ export enum PathEntityType {
}
export enum PathType {
Original = "original",
JpegThumbnail = "jpeg_thumbnail",
WebpThumbnail = "webp_thumbnail",
Preview = "preview",
Thumbnail = "thumbnail",
EncodedVideo = "encoded_video",
Sidecar = "sidecar",
Face = "face",
@ -2885,6 +2893,14 @@ export enum TranscodePolicy {
Required = "required",
Disabled = "disabled"
}
export enum Colorspace {
Srgb = "srgb",
P3 = "p3"
}
export enum ImageFormat {
Jpeg = "jpeg",
Webp = "webp"
}
export enum LogLevel {
Verbose = "verbose",
Debug = "debug",
@ -2901,10 +2917,6 @@ export enum ModelType {
FacialRecognition = "facial-recognition",
Clip = "clip"
}
export enum Colorspace {
Srgb = "srgb",
P3 = "p3"
}
export enum MapTheme {
Light = "light",
Dark = "dark"