mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
* feat(server,web,mobile): Add optional password option for share links. Signed-off-by: jarvis2f <137974272+jarvis2f@users.noreply.github.com> * feat(server,web): Update shared-link.controller and page.svelte for improved cookie handling and metadata updates. Signed-off-by: jarvis2f <137974272+jarvis2f@users.noreply.github.com> --------- Signed-off-by: jarvis2f <137974272+jarvis2f@users.noreply.github.com>
83 lines
1.7 KiB
TypeScript
83 lines
1.7 KiB
TypeScript
import { SharedLinkType } from '@app/infra/entities';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import { IsBoolean, IsDate, IsEnum, IsString } from 'class-validator';
|
|
import { Optional, ValidateUUID } from '../domain.util';
|
|
|
|
export class SharedLinkCreateDto {
|
|
@IsEnum(SharedLinkType)
|
|
@ApiProperty({ enum: SharedLinkType, enumName: 'SharedLinkType' })
|
|
type!: SharedLinkType;
|
|
|
|
@ValidateUUID({ each: true, optional: true })
|
|
assetIds?: string[];
|
|
|
|
@ValidateUUID({ optional: true })
|
|
albumId?: string;
|
|
|
|
@IsString()
|
|
@Optional()
|
|
description?: string;
|
|
|
|
@IsString()
|
|
@Optional()
|
|
password?: string;
|
|
|
|
@IsDate()
|
|
@Type(() => Date)
|
|
@Optional({ nullable: true })
|
|
expiresAt?: Date | null = null;
|
|
|
|
@Optional()
|
|
@IsBoolean()
|
|
allowUpload?: boolean = false;
|
|
|
|
@Optional()
|
|
@IsBoolean()
|
|
allowDownload?: boolean = true;
|
|
|
|
@Optional()
|
|
@IsBoolean()
|
|
showMetadata?: boolean = true;
|
|
}
|
|
|
|
export class SharedLinkEditDto {
|
|
@Optional()
|
|
description?: string;
|
|
|
|
@Optional()
|
|
password?: string;
|
|
|
|
@Optional({ nullable: true })
|
|
expiresAt?: Date | null;
|
|
|
|
@Optional()
|
|
allowUpload?: boolean;
|
|
|
|
@Optional()
|
|
allowDownload?: boolean;
|
|
|
|
@Optional()
|
|
showMetadata?: boolean;
|
|
|
|
/**
|
|
* Few clients cannot send null to set the expiryTime to never.
|
|
* Setting this flag and not sending expiryAt is considered as null instead.
|
|
* Clients that can send null values can ignore this.
|
|
*/
|
|
@Optional()
|
|
@IsBoolean()
|
|
changeExpiryTime?: boolean;
|
|
}
|
|
|
|
export class SharedLinkPasswordDto {
|
|
@IsString()
|
|
@Optional()
|
|
@ApiProperty({ example: 'password' })
|
|
password?: string;
|
|
|
|
@IsString()
|
|
@Optional()
|
|
token?: string;
|
|
}
|