Skip to content

High performance self-hosted photo and video management solution.

chore!: remove /api/server/theme endpoint (#27880)

Jason Rasmussen2f8be45fe0fc
diff --git a/e2e/src/specs/server/api/server.e2e-spec.ts b/e2e/src/specs/server/api/server.e2e-spec.ts
index 3dd6f15e71..1220e6cab5 100644
--- a/e2e/src/specs/server/api/server.e2e-spec.ts
+++ b/e2e/src/specs/server/api/server.e2e-spec.ts
@@ -207,16 +207,6 @@ describe('/server', () => {
});
});
- describe('GET /server/theme', () => {
- it('should respond with the server theme', async () => {
- const { status, body } = await request(app).get('/server/theme');
- expect(status).toBe(200);
- expect(body).toEqual({
- customCss: '',
- });
- });
- });
-
describe('GET /server/license', () => {
it('should require authentication', async () => {
const { status, body } = await request(app).get('/server/license');
diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md
index df469cee3e..138cf1735a 100644
--- a/mobile/openapi/README.md
+++ b/mobile/openapi/README.md
@@ -231,7 +231,6 @@ Class | Method | HTTP request | Description
*ServerApi* | [**getServerVersion**](doc//ServerApi.md#getserverversion) | **GET** /server/version | Get server version
*ServerApi* | [**getStorage**](doc//ServerApi.md#getstorage) | **GET** /server/storage | Get storage
*ServerApi* | [**getSupportedMediaTypes**](doc//ServerApi.md#getsupportedmediatypes) | **GET** /server/media-types | Get supported media types
-*ServerApi* | [**getTheme**](doc//ServerApi.md#gettheme) | **GET** /server/theme | Get theme
*ServerApi* | [**getVersionCheck**](doc//ServerApi.md#getversioncheck) | **GET** /server/version-check | Get version check status
*ServerApi* | [**getVersionHistory**](doc//ServerApi.md#getversionhistory) | **GET** /server/version-history | Get version history
*ServerApi* | [**pingServer**](doc//ServerApi.md#pingserver) | **GET** /server/ping | Ping
@@ -536,7 +535,6 @@ Class | Method | HTTP request | Description
- [ServerPingResponse](doc//ServerPingResponse.md)
- [ServerStatsResponseDto](doc//ServerStatsResponseDto.md)
- [ServerStorageResponseDto](doc//ServerStorageResponseDto.md)
- - [ServerThemeDto](doc//ServerThemeDto.md)
- [ServerVersionHistoryResponseDto](doc//ServerVersionHistoryResponseDto.md)
- [ServerVersionResponseDto](doc//ServerVersionResponseDto.md)
- [SessionCreateDto](doc//SessionCreateDto.md)
diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart
index ec1ea6e6b2..9eca7a2ab7 100644
--- a/mobile/openapi/lib/api.dart
+++ b/mobile/openapi/lib/api.dart
@@ -284,7 +284,6 @@ part 'model/server_media_types_response_dto.dart';
part 'model/server_ping_response.dart';
part 'model/server_stats_response_dto.dart';
part 'model/server_storage_response_dto.dart';
-part 'model/server_theme_dto.dart';
part 'model/server_version_history_response_dto.dart';
part 'model/server_version_response_dto.dart';
part 'model/session_create_dto.dart';
diff --git a/mobile/openapi/lib/api/server_api.dart b/mobile/openapi/lib/api/server_api.dart
index 4e43ec28eb..dd38ade167 100644
--- a/mobile/openapi/lib/api/server_api.dart
+++ b/mobile/openapi/lib/api/server_api.dart
@@ -488,54 +488,6 @@ class ServerApi {
return null;
}
- /// Get theme
- ///
- /// Retrieve the custom CSS, if existent.
- ///
- /// Note: This method returns the HTTP [Response].
- Future<Response> getThemeWithHttpInfo() async {
- // ignore: prefer_const_declarations
- final apiPath = r'/server/theme';
-
- // ignore: prefer_final_locals
- Object? postBody;
-
- final queryParams = <QueryParam>[];
- final headerParams = <String, String>{};
- final formParams = <String, String>{};
-
- const contentTypes = <String>[];
-
-
- return apiClient.invokeAPI(
- apiPath,
- 'GET',
- queryParams,
- postBody,
- headerParams,
- formParams,
- contentTypes.isEmpty ? null : contentTypes.first,
- );
- }
-
- /// Get theme
- ///
- /// Retrieve the custom CSS, if existent.
- Future<ServerThemeDto?> getTheme() async {
- final response = await getThemeWithHttpInfo();
- if (response.statusCode >= HttpStatus.badRequest) {
- throw ApiException(response.statusCode, await _decodeBodyBytes(response));
- }
- // When a remote server returns no body with a status of 204, we shall not decode it.
- // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
- // FormatException when trying to decode an empty string.
- if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
- return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ServerThemeDto',) as ServerThemeDto;
-
- }
- return null;
- }
-
/// Get version check status
///
/// Retrieve information about the last time the version check ran.
diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart
index 3bc85a9070..b8799a7be5 100644
--- a/mobile/openapi/lib/api_client.dart
+++ b/mobile/openapi/lib/api_client.dart
@@ -614,8 +614,6 @@ class ApiClient {
return ServerStatsResponseDto.fromJson(value);
case 'ServerStorageResponseDto':
return ServerStorageResponseDto.fromJson(value);
- case 'ServerThemeDto':
- return ServerThemeDto.fromJson(value);
case 'ServerVersionHistoryResponseDto':
return ServerVersionHistoryResponseDto.fromJson(value);
case 'ServerVersionResponseDto':
diff --git a/mobile/openapi/lib/model/server_theme_dto.dart b/mobile/openapi/lib/model/server_theme_dto.dart
deleted file mode 100644
index 957cf84d55..0000000000
--- a/mobile/openapi/lib/model/server_theme_dto.dart
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-// AUTO-GENERATED FILE, DO NOT MODIFY!
-//
-// @dart=2.18
-
-// ignore_for_file: unused_element, unused_import
-// ignore_for_file: always_put_required_named_parameters_first
-// ignore_for_file: constant_identifier_names
-// ignore_for_file: lines_longer_than_80_chars
-
-part of openapi.api;
-
-class ServerThemeDto {
- /// Returns a new [ServerThemeDto] instance.
- ServerThemeDto({
- required this.customCss,
- });
-
- /// Custom CSS for theming
- String customCss;
-
- @override
- bool operator ==(Object other) => identical(this, other) || other is ServerThemeDto &&
- other.customCss == customCss;
-
- @override
- int get hashCode =>
- // ignore: unnecessary_parenthesis
- (customCss.hashCode);
-
- @override
- String toString() => 'ServerThemeDto[customCss=$customCss]';
-
- Map<String, dynamic> toJson() {
- final json = <String, dynamic>{};
- json[r'customCss'] = this.customCss;
- return json;
- }
-
- /// Returns a new [ServerThemeDto] instance and imports its values from
- /// [value] if it's a [Map], null otherwise.
- // ignore: prefer_constructors_over_static_methods
- static ServerThemeDto? fromJson(dynamic value) {
- upgradeDto(value, "ServerThemeDto");
- if (value is Map) {
- final json = value.cast<String, dynamic>();
-
- return ServerThemeDto(
- customCss: mapValueOfType<String>(json, r'customCss')!,
- );
- }
- return null;
- }
-
- static List<ServerThemeDto> listFromJson(dynamic json, {bool growable = false,}) {
- final result = <ServerThemeDto>[];
- if (json is List && json.isNotEmpty) {
- for (final row in json) {
- final value = ServerThemeDto.fromJson(row);
- if (value != null) {
- result.add(value);
- }
- }
- }
- return result.toList(growable: growable);
- }
-
- static Map<String, ServerThemeDto> mapFromJson(dynamic json) {
- final map = <String, ServerThemeDto>{};
- if (json is Map && json.isNotEmpty) {
- json = json.cast<String, dynamic>(); // ignore: parameter_assignments
- for (final entry in json.entries) {
- final value = ServerThemeDto.fromJson(entry.value);
- if (value != null) {
- map[entry.key] = value;
- }
- }
- }
- return map;
- }
-
- // maps a json object with a list of ServerThemeDto-objects as value to a dart map
- static Map<String, List<ServerThemeDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
- final map = <String, List<ServerThemeDto>>{};
- if (json is Map && json.isNotEmpty) {
- // ignore: parameter_assignments
- json = json.cast<String, dynamic>();
- for (final entry in json.entries) {
- map[entry.key] = ServerThemeDto.listFromJson(entry.value, growable: growable,);
- }
- }
- return map;
- }
-
- /// The list of required keys that must be present in a JSON.
- static const requiredKeys = <String>{
- 'customCss',
- };
-}
-
diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json
index 68dc98e807..85816e8eda 100644
--- a/open-api/immich-openapi-specs.json
+++ b/open-api/immich-openapi-specs.json
@@ -10550,44 +10550,6 @@
"x-immich-state": "Stable"
}
},
- "/server/theme": {
- "get": {
- "description": "Retrieve the custom CSS, if existent.",
- "operationId": "getTheme",
- "parameters": [],
- "responses": {
- "200": {
- "content": {
- "application/json": {
- "schema": {
- "$ref": "#/components/schemas/ServerThemeDto"
- }
- }
- },
- "description": ""
- }
- },
- "summary": "Get theme",
- "tags": [
- "Server"
- ],
- "x-immich-history": [
- {
- "version": "v1",
- "state": "Added"
- },
- {
- "version": "v1",
- "state": "Beta"
- },
- {
- "version": "v2",
- "state": "Stable"
- }
- ],
- "x-immich-state": "Stable"
- }
- },
"/server/version": {
"get": {
"description": "Retrieve the current server version in semantic versioning (semver) format.",
@@ -21373,18 +21335,6 @@
],
"type": "object"
},
- "ServerThemeDto": {
- "properties": {
- "customCss": {
- "description": "Custom CSS for theming",
- "type": "string"
- }
- },
- "required": [
- "customCss"
- ],
- "type": "object"
- },
"ServerVersionHistoryResponseDto": {
"properties": {
"createdAt": {
diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts
index 538fb9f01a..6277df805c 100644
--- a/open-api/typescript-sdk/src/fetch-client.ts
+++ b/open-api/typescript-sdk/src/fetch-client.ts
@@ -2123,10 +2123,6 @@ export type ServerStorageResponseDto = {
/** Used disk space in bytes */
diskUseRaw: number;
};
-export type ServerThemeDto = {
- /** Custom CSS for theming */
- customCss: string;
-};
export type ServerVersionResponseDto = {
/** Major version number */
major: number;
@@ -5643,17 +5639,6 @@ export function getStorage(opts?: Oazapfts.RequestOpts) {
...opts
}));
}
-/**
- * Get theme
- */
-export function getTheme(opts?: Oazapfts.RequestOpts) {
- return oazapfts.ok(oazapfts.fetchJson<{
- status: 200;
- data: ServerThemeDto;
- }>("/server/theme", {
- ...opts
- }));
-}
/**
* Get server version
*/
diff --git a/server/src/controllers/server.controller.ts b/server/src/controllers/server.controller.ts
index ffcb50c674..f5ce4b851c 100644
--- a/server/src/controllers/server.controller.ts
+++ b/server/src/controllers/server.controller.ts
@@ -11,7 +11,6 @@ import {
ServerPingResponse,
ServerStatsResponseDto,
ServerStorageResponseDto,
- ServerThemeDto,
ServerVersionHistoryResponseDto,
ServerVersionResponseDto,
} from 'src/dtos/server.dto';
@@ -104,16 +103,6 @@ export class ServerController {
return this.service.getFeatures();
}
- @Get('theme')
- @Endpoint({
- summary: 'Get theme',
- description: 'Retrieve the custom CSS, if existent.',
- history: new HistoryBuilder().added('v1').beta('v1').stable('v2'),
- })
- getTheme(): Promise<ServerThemeDto> {
- return this.service.getTheme();
- }
-
@Get('config')
@Endpoint({
summary: 'Get config',
diff --git a/server/src/dtos/server.dto.ts b/server/src/dtos/server.dto.ts
index bd42032771..57a58e1dd7 100644
--- a/server/src/dtos/server.dto.ts
+++ b/server/src/dtos/server.dto.ts
@@ -104,12 +104,6 @@ const ServerMediaTypesResponseSchema = z
})
.meta({ id: 'ServerMediaTypesResponseDto' });
-const ServerThemeSchema = z
- .object({
- customCss: z.string().describe('Custom CSS for theming'),
- })
- .meta({ id: 'ServerThemeDto' });
-
const ServerConfigSchema = z
.object({
oauthButtonText: z.string().describe('OAuth button text'),
@@ -161,7 +155,6 @@ export class ServerVersionHistoryResponseDto extends createZodDto(ServerVersionH
export class UsageByUserDto extends createZodDto(UsageByUserSchema) {}
export class ServerStatsResponseDto extends createZodDto(ServerStatsResponseSchema) {}
export class ServerMediaTypesResponseDto extends createZodDto(ServerMediaTypesResponseSchema) {}
-export class ServerThemeDto extends createZodDto(ServerThemeSchema) {}
export class ServerConfigDto extends createZodDto(ServerConfigSchema) {}
export class ServerFeaturesDto extends createZodDto(ServerFeaturesSchema) {}
diff --git a/server/src/services/server.service.ts b/server/src/services/server.service.ts
index 77636acfd2..ff9e90f7e0 100644
--- a/server/src/services/server.service.ts
+++ b/server/src/services/server.service.ts
@@ -109,11 +109,6 @@ export class ServerService extends BaseService {
};
}
- async getTheme() {
- const { theme } = await this.getConfig({ withCache: false });
- return theme;
- }
-
async getSystemConfig(): Promise<ServerConfigDto> {
const { setup } = this.configRepository.getEnv();
const config = await this.getConfig({ withCache: false });