mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
* feat(server): extract full-size previews from RAW images * feat(web): load fullsize preview for RAW images when zoomed in * refactor: tweaks for code review * refactor: rename "converted" preview/assets to "fullsize" * feat(web/server): fullsize preview for non-web-friendly images * feat: tweaks for code review * feat(server): require ASSET_DOWNLOAD premission for fullsize previews * test: fix types and interfaces * chore: gen open-api * feat(server): keep only essential exif in fullsize preview * chore: regen openapi * test: revert unnecessary timeout * feat: move full-size preview config to standalone entry * feat(i18n): update en texts * fix: don't return fullsizePath when disabled * test: full-size previews * test(web): full-size previews * chore: make open-api * feat(server): redirect to preview/original URL when fullsize thumbnail not available * fix(server): delete fullsize preview image on thumbnail regen after fullsize preview turned off * refactor(server): AssetRepository.deleteFiles with Kysely * fix(server): type of MediaRepository.writeExif * minor simplification * minor styling changes and condensed wording * simplify * chore: reuild open-api * test(server): fix media.service tests * test(web): fix photo-viewer test * fix(server): use fullsize image when requested * fix file path extension * formatting * use fullsize when zooming back out or when "display original photos" is enabled * simplify condition --------- Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
100 lines
2.3 KiB
TypeScript
100 lines
2.3 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import { ArrayNotEmpty, IsArray, IsEnum, IsNotEmpty, IsString, ValidateNested } from 'class-validator';
|
|
import { Optional, ValidateBoolean, ValidateDate, ValidateUUID } from 'src/validation';
|
|
|
|
export enum AssetMediaSize {
|
|
/**
|
|
* An full-sized image extracted/converted from non-web-friendly formats like RAW/HIF.
|
|
* or otherwise the original image itself.
|
|
*/
|
|
FULLSIZE = 'fullsize',
|
|
PREVIEW = 'preview',
|
|
THUMBNAIL = 'thumbnail',
|
|
}
|
|
|
|
export class AssetMediaOptionsDto {
|
|
@Optional()
|
|
@IsEnum(AssetMediaSize)
|
|
@ApiProperty({ enumName: 'AssetMediaSize', enum: AssetMediaSize })
|
|
size?: AssetMediaSize;
|
|
}
|
|
|
|
export enum UploadFieldName {
|
|
ASSET_DATA = 'assetData',
|
|
SIDECAR_DATA = 'sidecarData',
|
|
PROFILE_DATA = 'file',
|
|
}
|
|
|
|
class AssetMediaBase {
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
deviceAssetId!: string;
|
|
|
|
@IsNotEmpty()
|
|
@IsString()
|
|
deviceId!: string;
|
|
|
|
@ValidateDate()
|
|
fileCreatedAt!: Date;
|
|
|
|
@ValidateDate()
|
|
fileModifiedAt!: Date;
|
|
|
|
@Optional()
|
|
@IsString()
|
|
duration?: string;
|
|
|
|
// The properties below are added to correctly generate the API docs
|
|
// and client SDKs. Validation should be handled in the controller.
|
|
@ApiProperty({ type: 'string', format: 'binary' })
|
|
[UploadFieldName.ASSET_DATA]!: any;
|
|
}
|
|
|
|
export class AssetMediaCreateDto extends AssetMediaBase {
|
|
@ValidateBoolean({ optional: true })
|
|
isFavorite?: boolean;
|
|
|
|
@ValidateBoolean({ optional: true })
|
|
isArchived?: boolean;
|
|
|
|
@ValidateBoolean({ optional: true })
|
|
isVisible?: boolean;
|
|
|
|
@ValidateUUID({ optional: true })
|
|
livePhotoVideoId?: string;
|
|
|
|
@ApiProperty({ type: 'string', format: 'binary', required: false })
|
|
[UploadFieldName.SIDECAR_DATA]?: any;
|
|
}
|
|
|
|
export class AssetMediaReplaceDto extends AssetMediaBase {}
|
|
|
|
export class AssetBulkUploadCheckItem {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
id!: string;
|
|
|
|
/** base64 or hex encoded sha1 hash */
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
checksum!: string;
|
|
}
|
|
|
|
export class AssetBulkUploadCheckDto {
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => AssetBulkUploadCheckItem)
|
|
assets!: AssetBulkUploadCheckItem[];
|
|
}
|
|
|
|
export class CheckExistingAssetsDto {
|
|
@ArrayNotEmpty()
|
|
@IsString({ each: true })
|
|
@IsNotEmpty({ each: true })
|
|
deviceAssetIds!: string[];
|
|
|
|
@IsNotEmpty()
|
|
deviceId!: string;
|
|
}
|