1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

refactor(server, web): standardize theme api response (#4664)

* web: standardize theme api response

* revert makefile change that i didn't mean to commit
This commit is contained in:
Wingy 2023-10-26 19:32:33 -07:00 committed by GitHub
parent 7ff68223ab
commit a08a687951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 11 additions and 17 deletions

View File

@ -2966,10 +2966,10 @@ export interface ServerStatsResponseDto {
export interface ServerThemeDto { export interface ServerThemeDto {
/** /**
* *
* @type {SystemConfigThemeDto} * @type {string}
* @memberof ServerThemeDto * @memberof ServerThemeDto
*/ */
'theme': SystemConfigThemeDto; 'customCss': string;
} }
/** /**
* *

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -7836,12 +7836,12 @@
}, },
"ServerThemeDto": { "ServerThemeDto": {
"properties": { "properties": {
"theme": { "customCss": {
"$ref": "#/components/schemas/SystemConfigThemeDto" "type": "string"
} }
}, },
"required": [ "required": [
"theme" "customCss"
], ],
"type": "object" "type": "object"
}, },

View File

@ -80,9 +80,7 @@ export class ServerMediaTypesResponseDto {
sidecar!: string[]; sidecar!: string[];
} }
export class ServerThemeDto { export class ServerThemeDto extends SystemConfigThemeDto {}
theme!: SystemConfigThemeDto;
}
export class ServerConfigDto { export class ServerConfigDto {
oauthButtonText!: string; oauthButtonText!: string;

View File

@ -72,7 +72,7 @@ export class ServerInfoService {
async getTheme() { async getTheme() {
const { theme } = await this.configCore.getConfig(); const { theme } = await this.configCore.getConfig();
return { theme }; return theme;
} }
async getConfig(): Promise<ServerConfigDto> { async getConfig(): Promise<ServerConfigDto> {

View File

@ -161,9 +161,7 @@ describe(`${ServerInfoController.name} (e2e)`, () => {
const { status, body } = await request(server).get('/server-info/theme'); const { status, body } = await request(server).get('/server-info/theme');
expect(status).toBe(200); expect(status).toBe(200);
expect(body).toEqual({ expect(body).toEqual({
theme: { customCss: '',
customCss: '',
},
}); });
}); });
}); });

View File

@ -2966,10 +2966,10 @@ export interface ServerStatsResponseDto {
export interface ServerThemeDto { export interface ServerThemeDto {
/** /**
* *
* @type {SystemConfigThemeDto} * @type {string}
* @memberof ServerThemeDto * @memberof ServerThemeDto
*/ */
'theme': SystemConfigThemeDto; 'customCss': string;
} }
/** /**
* *

View File

@ -1,9 +1,7 @@
import { RequestHandler, text } from '@sveltejs/kit'; import { RequestHandler, text } from '@sveltejs/kit';
export const GET = (async ({ locals: { api } }) => { export const GET = (async ({ locals: { api } }) => {
const { const {
data: { data: { customCss },
theme: { customCss },
},
} = await api.serverInfoApi.getTheme(); } = await api.serverInfoApi.getTheme();
return text(customCss, { return text(customCss, {
headers: { headers: {