mirror of
https://github.com/immich-app/immich.git
synced 2026-04-30 13:00:40 -04:00
chore!: remove /api/server/theme endpoint (#27880)
chore: remove server/theme endpoint
This commit is contained in:
parent
41968fdcac
commit
2f8be45fe0
@ -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', () => {
|
describe('GET /server/license', () => {
|
||||||
it('should require authentication', async () => {
|
it('should require authentication', async () => {
|
||||||
const { status, body } = await request(app).get('/server/license');
|
const { status, body } = await request(app).get('/server/license');
|
||||||
|
|||||||
2
mobile/openapi/README.md
generated
2
mobile/openapi/README.md
generated
@ -231,7 +231,6 @@ Class | Method | HTTP request | Description
|
|||||||
*ServerApi* | [**getServerVersion**](doc//ServerApi.md#getserverversion) | **GET** /server/version | Get server version
|
*ServerApi* | [**getServerVersion**](doc//ServerApi.md#getserverversion) | **GET** /server/version | Get server version
|
||||||
*ServerApi* | [**getStorage**](doc//ServerApi.md#getstorage) | **GET** /server/storage | Get storage
|
*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* | [**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* | [**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* | [**getVersionHistory**](doc//ServerApi.md#getversionhistory) | **GET** /server/version-history | Get version history
|
||||||
*ServerApi* | [**pingServer**](doc//ServerApi.md#pingserver) | **GET** /server/ping | Ping
|
*ServerApi* | [**pingServer**](doc//ServerApi.md#pingserver) | **GET** /server/ping | Ping
|
||||||
@ -536,7 +535,6 @@ Class | Method | HTTP request | Description
|
|||||||
- [ServerPingResponse](doc//ServerPingResponse.md)
|
- [ServerPingResponse](doc//ServerPingResponse.md)
|
||||||
- [ServerStatsResponseDto](doc//ServerStatsResponseDto.md)
|
- [ServerStatsResponseDto](doc//ServerStatsResponseDto.md)
|
||||||
- [ServerStorageResponseDto](doc//ServerStorageResponseDto.md)
|
- [ServerStorageResponseDto](doc//ServerStorageResponseDto.md)
|
||||||
- [ServerThemeDto](doc//ServerThemeDto.md)
|
|
||||||
- [ServerVersionHistoryResponseDto](doc//ServerVersionHistoryResponseDto.md)
|
- [ServerVersionHistoryResponseDto](doc//ServerVersionHistoryResponseDto.md)
|
||||||
- [ServerVersionResponseDto](doc//ServerVersionResponseDto.md)
|
- [ServerVersionResponseDto](doc//ServerVersionResponseDto.md)
|
||||||
- [SessionCreateDto](doc//SessionCreateDto.md)
|
- [SessionCreateDto](doc//SessionCreateDto.md)
|
||||||
|
|||||||
1
mobile/openapi/lib/api.dart
generated
1
mobile/openapi/lib/api.dart
generated
@ -284,7 +284,6 @@ part 'model/server_media_types_response_dto.dart';
|
|||||||
part 'model/server_ping_response.dart';
|
part 'model/server_ping_response.dart';
|
||||||
part 'model/server_stats_response_dto.dart';
|
part 'model/server_stats_response_dto.dart';
|
||||||
part 'model/server_storage_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_history_response_dto.dart';
|
||||||
part 'model/server_version_response_dto.dart';
|
part 'model/server_version_response_dto.dart';
|
||||||
part 'model/session_create_dto.dart';
|
part 'model/session_create_dto.dart';
|
||||||
|
|||||||
48
mobile/openapi/lib/api/server_api.dart
generated
48
mobile/openapi/lib/api/server_api.dart
generated
@ -488,54 +488,6 @@ class ServerApi {
|
|||||||
return null;
|
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
|
/// Get version check status
|
||||||
///
|
///
|
||||||
/// Retrieve information about the last time the version check ran.
|
/// Retrieve information about the last time the version check ran.
|
||||||
|
|||||||
2
mobile/openapi/lib/api_client.dart
generated
2
mobile/openapi/lib/api_client.dart
generated
@ -614,8 +614,6 @@ class ApiClient {
|
|||||||
return ServerStatsResponseDto.fromJson(value);
|
return ServerStatsResponseDto.fromJson(value);
|
||||||
case 'ServerStorageResponseDto':
|
case 'ServerStorageResponseDto':
|
||||||
return ServerStorageResponseDto.fromJson(value);
|
return ServerStorageResponseDto.fromJson(value);
|
||||||
case 'ServerThemeDto':
|
|
||||||
return ServerThemeDto.fromJson(value);
|
|
||||||
case 'ServerVersionHistoryResponseDto':
|
case 'ServerVersionHistoryResponseDto':
|
||||||
return ServerVersionHistoryResponseDto.fromJson(value);
|
return ServerVersionHistoryResponseDto.fromJson(value);
|
||||||
case 'ServerVersionResponseDto':
|
case 'ServerVersionResponseDto':
|
||||||
|
|||||||
100
mobile/openapi/lib/model/server_theme_dto.dart
generated
100
mobile/openapi/lib/model/server_theme_dto.dart
generated
@ -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',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -10550,44 +10550,6 @@
|
|||||||
"x-immich-state": "Stable"
|
"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": {
|
"/server/version": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Retrieve the current server version in semantic versioning (semver) format.",
|
"description": "Retrieve the current server version in semantic versioning (semver) format.",
|
||||||
@ -21373,18 +21335,6 @@
|
|||||||
],
|
],
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"ServerThemeDto": {
|
|
||||||
"properties": {
|
|
||||||
"customCss": {
|
|
||||||
"description": "Custom CSS for theming",
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"customCss"
|
|
||||||
],
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"ServerVersionHistoryResponseDto": {
|
"ServerVersionHistoryResponseDto": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"createdAt": {
|
"createdAt": {
|
||||||
|
|||||||
@ -2123,10 +2123,6 @@ export type ServerStorageResponseDto = {
|
|||||||
/** Used disk space in bytes */
|
/** Used disk space in bytes */
|
||||||
diskUseRaw: number;
|
diskUseRaw: number;
|
||||||
};
|
};
|
||||||
export type ServerThemeDto = {
|
|
||||||
/** Custom CSS for theming */
|
|
||||||
customCss: string;
|
|
||||||
};
|
|
||||||
export type ServerVersionResponseDto = {
|
export type ServerVersionResponseDto = {
|
||||||
/** Major version number */
|
/** Major version number */
|
||||||
major: number;
|
major: number;
|
||||||
@ -5643,17 +5639,6 @@ export function getStorage(opts?: Oazapfts.RequestOpts) {
|
|||||||
...opts
|
...opts
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Get theme
|
|
||||||
*/
|
|
||||||
export function getTheme(opts?: Oazapfts.RequestOpts) {
|
|
||||||
return oazapfts.ok(oazapfts.fetchJson<{
|
|
||||||
status: 200;
|
|
||||||
data: ServerThemeDto;
|
|
||||||
}>("/server/theme", {
|
|
||||||
...opts
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Get server version
|
* Get server version
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import {
|
|||||||
ServerPingResponse,
|
ServerPingResponse,
|
||||||
ServerStatsResponseDto,
|
ServerStatsResponseDto,
|
||||||
ServerStorageResponseDto,
|
ServerStorageResponseDto,
|
||||||
ServerThemeDto,
|
|
||||||
ServerVersionHistoryResponseDto,
|
ServerVersionHistoryResponseDto,
|
||||||
ServerVersionResponseDto,
|
ServerVersionResponseDto,
|
||||||
} from 'src/dtos/server.dto';
|
} from 'src/dtos/server.dto';
|
||||||
@ -104,16 +103,6 @@ export class ServerController {
|
|||||||
return this.service.getFeatures();
|
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')
|
@Get('config')
|
||||||
@Endpoint({
|
@Endpoint({
|
||||||
summary: 'Get config',
|
summary: 'Get config',
|
||||||
|
|||||||
@ -104,12 +104,6 @@ const ServerMediaTypesResponseSchema = z
|
|||||||
})
|
})
|
||||||
.meta({ id: 'ServerMediaTypesResponseDto' });
|
.meta({ id: 'ServerMediaTypesResponseDto' });
|
||||||
|
|
||||||
const ServerThemeSchema = z
|
|
||||||
.object({
|
|
||||||
customCss: z.string().describe('Custom CSS for theming'),
|
|
||||||
})
|
|
||||||
.meta({ id: 'ServerThemeDto' });
|
|
||||||
|
|
||||||
const ServerConfigSchema = z
|
const ServerConfigSchema = z
|
||||||
.object({
|
.object({
|
||||||
oauthButtonText: z.string().describe('OAuth button text'),
|
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 UsageByUserDto extends createZodDto(UsageByUserSchema) {}
|
||||||
export class ServerStatsResponseDto extends createZodDto(ServerStatsResponseSchema) {}
|
export class ServerStatsResponseDto extends createZodDto(ServerStatsResponseSchema) {}
|
||||||
export class ServerMediaTypesResponseDto extends createZodDto(ServerMediaTypesResponseSchema) {}
|
export class ServerMediaTypesResponseDto extends createZodDto(ServerMediaTypesResponseSchema) {}
|
||||||
export class ServerThemeDto extends createZodDto(ServerThemeSchema) {}
|
|
||||||
export class ServerConfigDto extends createZodDto(ServerConfigSchema) {}
|
export class ServerConfigDto extends createZodDto(ServerConfigSchema) {}
|
||||||
export class ServerFeaturesDto extends createZodDto(ServerFeaturesSchema) {}
|
export class ServerFeaturesDto extends createZodDto(ServerFeaturesSchema) {}
|
||||||
|
|
||||||
|
|||||||
@ -109,11 +109,6 @@ export class ServerService extends BaseService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTheme() {
|
|
||||||
const { theme } = await this.getConfig({ withCache: false });
|
|
||||||
return theme;
|
|
||||||
}
|
|
||||||
|
|
||||||
async getSystemConfig(): Promise<ServerConfigDto> {
|
async getSystemConfig(): Promise<ServerConfigDto> {
|
||||||
const { setup } = this.configRepository.getEnv();
|
const { setup } = this.configRepository.getEnv();
|
||||||
const config = await this.getConfig({ withCache: false });
|
const config = await this.getConfig({ withCache: false });
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user