59bb727636
* implement method to read config file * getConfig returns config file if present * return isConfigFile for http requests * disable elements if config file is used, show message if config file is set, copy existing config to clipboard * fix allowing partial configuration files * add new env variable to docs * fix tests * minor refactoring, address review * adapt config type in frontend * remove unnecessary imports * move config file reading to system-config repo * add documentation * fix code formatting in system settings page * add validator for config file * fix formatting in docs * update generated files * throw error when trying to update config. e.g. via cli or api * switch to feature flags for isConfigFile * refactoring * refactor: config file * chore: open api * feat: always show copy/export buttons * fix: default flags * refactor: copy to clipboard --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
95 lines
2.1 KiB
TypeScript
95 lines
2.1 KiB
TypeScript
import { FeatureFlags, IServerVersion } from '@app/domain';
|
|
import { ApiProperty, ApiResponseProperty } from '@nestjs/swagger';
|
|
|
|
export class ServerPingResponse {
|
|
@ApiResponseProperty({ type: String, example: 'pong' })
|
|
res!: string;
|
|
}
|
|
|
|
export class ServerInfoResponseDto {
|
|
diskSize!: string;
|
|
diskUse!: string;
|
|
diskAvailable!: string;
|
|
|
|
@ApiProperty({ type: 'integer', format: 'int64' })
|
|
diskSizeRaw!: number;
|
|
|
|
@ApiProperty({ type: 'integer', format: 'int64' })
|
|
diskUseRaw!: number;
|
|
|
|
@ApiProperty({ type: 'integer', format: 'int64' })
|
|
diskAvailableRaw!: number;
|
|
|
|
@ApiProperty({ type: 'number', format: 'float' })
|
|
diskUsagePercentage!: number;
|
|
}
|
|
|
|
export class ServerVersionResponseDto implements IServerVersion {
|
|
@ApiProperty({ type: 'integer' })
|
|
major!: number;
|
|
@ApiProperty({ type: 'integer' })
|
|
minor!: number;
|
|
@ApiProperty({ type: 'integer' })
|
|
patch!: number;
|
|
}
|
|
|
|
export class UsageByUserDto {
|
|
@ApiProperty({ type: 'string' })
|
|
userId!: string;
|
|
@ApiProperty({ type: 'string' })
|
|
userFirstName!: string;
|
|
@ApiProperty({ type: 'string' })
|
|
userLastName!: string;
|
|
@ApiProperty({ type: 'integer' })
|
|
photos!: number;
|
|
@ApiProperty({ type: 'integer' })
|
|
videos!: number;
|
|
@ApiProperty({ type: 'integer', format: 'int64' })
|
|
usage!: number;
|
|
}
|
|
|
|
export class ServerStatsResponseDto {
|
|
@ApiProperty({ type: 'integer' })
|
|
photos = 0;
|
|
|
|
@ApiProperty({ type: 'integer' })
|
|
videos = 0;
|
|
|
|
@ApiProperty({ type: 'integer', format: 'int64' })
|
|
usage = 0;
|
|
|
|
@ApiProperty({
|
|
isArray: true,
|
|
type: UsageByUserDto,
|
|
title: 'Array of usage for each user',
|
|
example: [
|
|
{
|
|
photos: 1,
|
|
videos: 1,
|
|
diskUsageRaw: 1,
|
|
},
|
|
],
|
|
})
|
|
usageByUser: UsageByUserDto[] = [];
|
|
}
|
|
|
|
export class ServerMediaTypesResponseDto {
|
|
video!: string[];
|
|
image!: string[];
|
|
sidecar!: string[];
|
|
}
|
|
|
|
export class ServerFeaturesDto implements FeatureFlags {
|
|
configFile!: boolean;
|
|
clipEncode!: boolean;
|
|
facialRecognition!: boolean;
|
|
sidecar!: boolean;
|
|
search!: boolean;
|
|
tagImage!: boolean;
|
|
|
|
// TODO: use these instead of `POST oauth/config`
|
|
oauth!: boolean;
|
|
oauthAutoLaunch!: boolean;
|
|
passwordLogin!: boolean;
|
|
}
|