feat: make progressive system config optional (#25486)
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Docker / pre-job (push) Has been cancelled
Docker / Re-Tag ML () (push) Has been cancelled
Docker / Re-Tag ML (-armnn) (push) Has been cancelled
Docker / Re-Tag ML (-cuda) (push) Has been cancelled
Docker / Re-Tag ML (-openvino) (push) Has been cancelled
Docker / Re-Tag ML (-rknn) (push) Has been cancelled
Docker / Re-Tag ML (-rocm) (push) Has been cancelled
Docker / Re-Tag Server () (push) Has been cancelled
Docker / Build and Push ML (armnn, linux/arm64, -armnn) (push) Has been cancelled
Docker / Build and Push ML (cpu) (push) Has been cancelled
Docker / Build and Push ML (cuda, linux/amd64, -cuda) (push) Has been cancelled
Docker / Build and Push ML (openvino, linux/amd64, -openvino) (push) Has been cancelled
Docker / Build and Push ML (rknn, linux/arm64, -rknn) (push) Has been cancelled
Docker / Build and Push ML (rocm, linux/amd64, {"linux/amd64": "mich"}, -rocm) (push) Has been cancelled
Docker / Build and Push Server (push) Has been cancelled
Docker / Docker Build & Push Server Success (push) Has been cancelled
Docker / Docker Build & Push ML Success (push) Has been cancelled
Docs build / pre-job (push) Has been cancelled
Docs build / Docs Build (push) Has been cancelled
Zizmor / Zizmor (push) Has been cancelled
Manage release PR / bump (push) Has been cancelled
Static Code Analysis / pre-job (push) Has been cancelled
Static Code Analysis / Run Dart Code Analysis (push) Has been cancelled
Test / pre-job (push) Has been cancelled
Test / Test & Lint Server (push) Has been cancelled
Test / Unit Test CLI (push) Has been cancelled
Test / Unit Test CLI (Windows) (push) Has been cancelled
Test / Lint Web (push) Has been cancelled
Test / Test Web (push) Has been cancelled
Test / Test i18n (push) Has been cancelled
Test / End-to-End Lint (push) Has been cancelled
Test / Medium Tests (Server) (push) Has been cancelled
Test / End-to-End Tests (Server & CLI) (ubuntu-24.04-arm) (push) Has been cancelled
Test / End-to-End Tests (Server & CLI) (ubuntu-latest) (push) Has been cancelled
Test / End-to-End Tests (Web) (ubuntu-24.04-arm) (push) Has been cancelled
Test / End-to-End Tests (Web) (ubuntu-latest) (push) Has been cancelled
Test / End-to-End Tests Success (push) Has been cancelled
Test / Unit Test Mobile (push) Has been cancelled
Test / Unit Test ML (push) Has been cancelled
Test / .github Files Formatting (push) Has been cancelled
Test / ShellCheck (push) Has been cancelled
Test / OpenAPI Clients (push) Has been cancelled
Test / SQL Schema Checks (push) Has been cancelled

This commit is contained in:
Min Idzelis
2026-01-24 00:18:02 -05:00
committed by GitHub
parent ccc0961ba3
commit 7e5592fec5
7 changed files with 42 additions and 16 deletions

View File

@@ -15,7 +15,7 @@ class SystemConfigGeneratedFullsizeImageDto {
SystemConfigGeneratedFullsizeImageDto({
required this.enabled,
required this.format,
required this.progressive,
this.progressive = false,
required this.quality,
});
@@ -67,7 +67,7 @@ class SystemConfigGeneratedFullsizeImageDto {
return SystemConfigGeneratedFullsizeImageDto(
enabled: mapValueOfType<bool>(json, r'enabled')!,
format: ImageFormat.fromJson(json[r'format'])!,
progressive: mapValueOfType<bool>(json, r'progressive')!,
progressive: mapValueOfType<bool>(json, r'progressive') ?? false,
quality: mapValueOfType<int>(json, r'quality')!,
);
}
@@ -118,7 +118,6 @@ class SystemConfigGeneratedFullsizeImageDto {
static const requiredKeys = <String>{
'enabled',
'format',
'progressive',
'quality',
};
}

View File

@@ -14,7 +14,7 @@ class SystemConfigGeneratedImageDto {
/// Returns a new [SystemConfigGeneratedImageDto] instance.
SystemConfigGeneratedImageDto({
required this.format,
required this.progressive,
this.progressive = false,
required this.quality,
required this.size,
});
@@ -67,7 +67,7 @@ class SystemConfigGeneratedImageDto {
return SystemConfigGeneratedImageDto(
format: ImageFormat.fromJson(json[r'format'])!,
progressive: mapValueOfType<bool>(json, r'progressive')!,
progressive: mapValueOfType<bool>(json, r'progressive') ?? false,
quality: mapValueOfType<int>(json, r'quality')!,
size: mapValueOfType<int>(json, r'size')!,
);
@@ -118,7 +118,6 @@ class SystemConfigGeneratedImageDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'format',
'progressive',
'quality',
'size',
};

View File

@@ -22625,6 +22625,7 @@
]
},
"progressive": {
"default": false,
"type": "boolean"
},
"quality": {
@@ -22636,7 +22637,6 @@
"required": [
"enabled",
"format",
"progressive",
"quality"
],
"type": "object"
@@ -22651,6 +22651,7 @@
]
},
"progressive": {
"default": false,
"type": "boolean"
},
"quality": {
@@ -22665,7 +22666,6 @@
},
"required": [
"format",
"progressive",
"quality",
"size"
],

View File

@@ -1538,12 +1538,12 @@ export type SystemConfigFFmpegDto = {
export type SystemConfigGeneratedFullsizeImageDto = {
enabled: boolean;
format: ImageFormat;
progressive: boolean;
progressive?: boolean;
quality: number;
};
export type SystemConfigGeneratedImageDto = {
format: ImageFormat;
progressive: boolean;
progressive?: boolean;
quality: number;
size: number;
};

View File

@@ -70,5 +70,33 @@ describe(SystemConfigController.name, () => {
expect(body).toEqual(errorDto.badRequest(['nightlyTasks.databaseCleanup must be a boolean value']));
});
});
describe('image', () => {
it('should accept config without optional progressive property', async () => {
const config = _.cloneDeep(defaults);
delete config.image.thumbnail.progressive;
delete config.image.preview.progressive;
delete config.image.fullsize.progressive;
const { status } = await request(ctx.getHttpServer()).put('/system-config').send(config);
expect(status).toBe(200);
});
it('should accept config with progressive set to true', async () => {
const config = _.cloneDeep(defaults);
config.image.thumbnail.progressive = true;
config.image.preview.progressive = true;
config.image.fullsize.progressive = true;
const { status } = await request(ctx.getHttpServer()).put('/system-config').send(config);
expect(status).toBe(200);
});
it('should reject invalid progressive value', async () => {
const config = _.cloneDeep(defaults);
(config.image.thumbnail.progressive as any) = 'invalid';
const { status, body } = await request(ctx.getHttpServer()).put('/system-config').send(config);
expect(status).toBe(400);
expect(body).toEqual(errorDto.badRequest(['image.thumbnail.progressive must be a boolean value']));
});
});
});
});

View File

@@ -586,8 +586,8 @@ class SystemConfigGeneratedImageDto {
@ApiProperty({ type: 'integer' })
size!: number;
@ValidateBoolean()
progressive!: boolean;
@ValidateBoolean({ optional: true, default: false })
progressive?: boolean;
}
class SystemConfigGeneratedFullsizeImageDto {
@@ -604,8 +604,8 @@ class SystemConfigGeneratedFullsizeImageDto {
@ApiProperty({ type: 'integer' })
quality!: number;
@ValidateBoolean()
progressive!: boolean;
@ValidateBoolean({ optional: true, default: false })
progressive?: boolean;
}
export class SystemConfigImageDto {

View File

@@ -36,14 +36,14 @@ export type FullsizeImageOptions = {
format: ImageFormat;
quality: number;
enabled: boolean;
progressive: boolean;
progressive?: boolean;
};
export type ImageOptions = {
format: ImageFormat;
quality: number;
size: number;
progressive: boolean;
progressive?: boolean;
};
export type RawImageInfo = {