diff --git a/cli/src/api/open-api/api.ts b/cli/src/api/open-api/api.ts index b0bf9a8f2f..f6a1127a58 100644 --- a/cli/src/api/open-api/api.ts +++ b/cli/src/api/open-api/api.ts @@ -2085,6 +2085,31 @@ export interface ServerInfoResponseDto { */ 'diskAvailable': string; } +/** + * + * @export + * @interface ServerMediaTypesResponseDto + */ +export interface ServerMediaTypesResponseDto { + /** + * + * @type {Array} + * @memberof ServerMediaTypesResponseDto + */ + 'video': Array; + /** + * + * @type {Array} + * @memberof ServerMediaTypesResponseDto + */ + 'image': Array; + /** + * + * @type {Array} + * @memberof ServerMediaTypesResponseDto + */ + 'sidecar': Array; +} /** * * @export @@ -9711,6 +9736,35 @@ export const ServerInfoApiAxiosParamCreator = function (configuration?: Configur + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSupportedMediaTypes: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/server-info/media-types`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -9786,6 +9840,15 @@ export const ServerInfoApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.getStats(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getSupportedMediaTypes(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getSupportedMediaTypes(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {*} [options] Override http request option. @@ -9829,6 +9892,14 @@ export const ServerInfoApiFactory = function (configuration?: Configuration, bas getStats(options?: AxiosRequestConfig): AxiosPromise { return localVarFp.getStats(options).then((request) => request(axios, basePath)); }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSupportedMediaTypes(options?: AxiosRequestConfig): AxiosPromise { + return localVarFp.getSupportedMediaTypes(options).then((request) => request(axios, basePath)); + }, /** * * @param {*} [options] Override http request option. @@ -9877,6 +9948,16 @@ export class ServerInfoApi extends BaseAPI { return ServerInfoApiFp(this.configuration).getStats(options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ServerInfoApi + */ + public getSupportedMediaTypes(options?: AxiosRequestConfig) { + return ServerInfoApiFp(this.configuration).getSupportedMediaTypes(options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {*} [options] Override http request option. diff --git a/mobile/openapi/.openapi-generator/FILES b/mobile/openapi/.openapi-generator/FILES index f098bf4ffe..5c610108b5 100644 --- a/mobile/openapi/.openapi-generator/FILES +++ b/mobile/openapi/.openapi-generator/FILES @@ -88,6 +88,7 @@ doc/SearchFacetResponseDto.md doc/SearchResponseDto.md doc/ServerInfoApi.md doc/ServerInfoResponseDto.md +doc/ServerMediaTypesResponseDto.md doc/ServerPingResponse.md doc/ServerStatsResponseDto.md doc/ServerVersionReponseDto.md @@ -221,6 +222,7 @@ lib/model/search_facet_count_response_dto.dart lib/model/search_facet_response_dto.dart lib/model/search_response_dto.dart lib/model/server_info_response_dto.dart +lib/model/server_media_types_response_dto.dart lib/model/server_ping_response.dart lib/model/server_stats_response_dto.dart lib/model/server_version_reponse_dto.dart @@ -337,6 +339,7 @@ test/search_facet_response_dto_test.dart test/search_response_dto_test.dart test/server_info_api_test.dart test/server_info_response_dto_test.dart +test/server_media_types_response_dto_test.dart test/server_ping_response_test.dart test/server_stats_response_dto_test.dart test/server_version_reponse_dto_test.dart diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index 3d9dc92110..b8fa7a4d24 100644 Binary files a/mobile/openapi/README.md and b/mobile/openapi/README.md differ diff --git a/mobile/openapi/doc/ServerInfoApi.md b/mobile/openapi/doc/ServerInfoApi.md index 3b39ef93ee..0666c7d414 100644 Binary files a/mobile/openapi/doc/ServerInfoApi.md and b/mobile/openapi/doc/ServerInfoApi.md differ diff --git a/mobile/openapi/doc/ServerMediaTypesResponseDto.md b/mobile/openapi/doc/ServerMediaTypesResponseDto.md new file mode 100644 index 0000000000..78253e27f7 Binary files /dev/null and b/mobile/openapi/doc/ServerMediaTypesResponseDto.md differ diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index ef9544c856..32420b9c29 100644 Binary files a/mobile/openapi/lib/api.dart and b/mobile/openapi/lib/api.dart differ diff --git a/mobile/openapi/lib/api/server_info_api.dart b/mobile/openapi/lib/api/server_info_api.dart index 8cc3460c9b..fb34e09ce8 100644 Binary files a/mobile/openapi/lib/api/server_info_api.dart and b/mobile/openapi/lib/api/server_info_api.dart differ diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index 824d4c9eb4..b2208df562 100644 Binary files a/mobile/openapi/lib/api_client.dart and b/mobile/openapi/lib/api_client.dart differ diff --git a/mobile/openapi/lib/model/server_media_types_response_dto.dart b/mobile/openapi/lib/model/server_media_types_response_dto.dart new file mode 100644 index 0000000000..2cba41363d Binary files /dev/null and b/mobile/openapi/lib/model/server_media_types_response_dto.dart differ diff --git a/mobile/openapi/test/server_info_api_test.dart b/mobile/openapi/test/server_info_api_test.dart index b662587eef..4fee682a25 100644 Binary files a/mobile/openapi/test/server_info_api_test.dart and b/mobile/openapi/test/server_info_api_test.dart differ diff --git a/mobile/openapi/test/server_media_types_response_dto_test.dart b/mobile/openapi/test/server_media_types_response_dto_test.dart new file mode 100644 index 0000000000..041e646805 Binary files /dev/null and b/mobile/openapi/test/server_media_types_response_dto_test.dart differ diff --git a/server/immich-openapi-specs.json b/server/immich-openapi-specs.json index c2c006744c..877ea38673 100644 --- a/server/immich-openapi-specs.json +++ b/server/immich-openapi-specs.json @@ -3040,6 +3040,27 @@ ] } }, + "/server-info/media-types": { + "get": { + "operationId": "getSupportedMediaTypes", + "parameters": [], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServerMediaTypesResponseDto" + } + } + } + } + }, + "tags": [ + "Server Info" + ] + } + }, "/server-info/ping": { "get": { "operationId": "pingServer", @@ -6118,6 +6139,34 @@ "diskAvailable" ] }, + "ServerMediaTypesResponseDto": { + "type": "object", + "properties": { + "video": { + "type": "array", + "items": { + "type": "string" + } + }, + "image": { + "type": "array", + "items": { + "type": "string" + } + }, + "sidecar": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "video", + "image", + "sidecar" + ] + }, "ServerPingResponse": { "type": "object", "properties": { diff --git a/server/src/domain/server-info/response-dto/server-stats-response.dto.ts b/server/src/domain/server-info/response-dto/server-stats-response.dto.ts index ed7a071769..1459ba452a 100644 --- a/server/src/domain/server-info/response-dto/server-stats-response.dto.ts +++ b/server/src/domain/server-info/response-dto/server-stats-response.dto.ts @@ -25,3 +25,9 @@ export class ServerStatsResponseDto { }) usageByUser: UsageByUserDto[] = []; } + +export class ServerMediaTypesResponseDto { + video!: string[]; + image!: string[]; + sidecar!: string[]; +} diff --git a/server/src/domain/server-info/server-info.service.ts b/server/src/domain/server-info/server-info.service.ts index 9d36f1b66d..ceeb85e295 100644 --- a/server/src/domain/server-info/server-info.service.ts +++ b/server/src/domain/server-info/server-info.service.ts @@ -1,9 +1,15 @@ import { Inject, Injectable } from '@nestjs/common'; -import { serverVersion } from '../domain.constant'; +import { mimeTypes, serverVersion } from '../domain.constant'; import { asHumanReadable } from '../domain.util'; import { IStorageRepository, StorageCore, StorageFolder } from '../storage'; import { IUserRepository, UserStatsQueryResponse } from '../user'; -import { ServerInfoResponseDto, ServerPingResponse, ServerStatsResponseDto, UsageByUserDto } from './response-dto'; +import { + ServerInfoResponseDto, + ServerMediaTypesResponseDto, + ServerPingResponse, + ServerStatsResponseDto, + UsageByUserDto, +} from './response-dto'; @Injectable() export class ServerInfoService { @@ -60,4 +66,12 @@ export class ServerInfoService { return serverStats; } + + getSupportedMediaTypes(): ServerMediaTypesResponseDto { + return { + video: [...Object.keys(mimeTypes.video)], + image: [...Object.keys(mimeTypes.image)], + sidecar: [...Object.keys(mimeTypes.sidecar)], + }; + } } diff --git a/server/src/immich/controllers/server-info.controller.ts b/server/src/immich/controllers/server-info.controller.ts index e98485cbe8..59b6351787 100644 --- a/server/src/immich/controllers/server-info.controller.ts +++ b/server/src/immich/controllers/server-info.controller.ts @@ -1,6 +1,7 @@ import { ServerInfoResponseDto, ServerInfoService, + ServerMediaTypesResponseDto, ServerPingResponse, ServerStatsResponseDto, ServerVersionReponseDto, @@ -39,4 +40,10 @@ export class ServerInfoController { getStats(): Promise { return this.service.getStats(); } + + @PublicRoute() + @Get('/media-types') + getSupportedMediaTypes(): ServerMediaTypesResponseDto { + return this.service.getSupportedMediaTypes(); + } } diff --git a/web/src/api/open-api/api.ts b/web/src/api/open-api/api.ts index 66c717c814..414f7b147d 100644 --- a/web/src/api/open-api/api.ts +++ b/web/src/api/open-api/api.ts @@ -2085,6 +2085,31 @@ export interface ServerInfoResponseDto { */ 'diskAvailable': string; } +/** + * + * @export + * @interface ServerMediaTypesResponseDto + */ +export interface ServerMediaTypesResponseDto { + /** + * + * @type {Array} + * @memberof ServerMediaTypesResponseDto + */ + 'video': Array; + /** + * + * @type {Array} + * @memberof ServerMediaTypesResponseDto + */ + 'image': Array; + /** + * + * @type {Array} + * @memberof ServerMediaTypesResponseDto + */ + 'sidecar': Array; +} /** * * @export @@ -9771,6 +9796,35 @@ export const ServerInfoApiAxiosParamCreator = function (configuration?: Configur + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSupportedMediaTypes: async (options: AxiosRequestConfig = {}): Promise => { + const localVarPath = `/server-info/media-types`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -9846,6 +9900,15 @@ export const ServerInfoApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.getStats(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getSupportedMediaTypes(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getSupportedMediaTypes(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {*} [options] Override http request option. @@ -9889,6 +9952,14 @@ export const ServerInfoApiFactory = function (configuration?: Configuration, bas getStats(options?: any): AxiosPromise { return localVarFp.getStats(options).then((request) => request(axios, basePath)); }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSupportedMediaTypes(options?: any): AxiosPromise { + return localVarFp.getSupportedMediaTypes(options).then((request) => request(axios, basePath)); + }, /** * * @param {*} [options] Override http request option. @@ -9937,6 +10008,16 @@ export class ServerInfoApi extends BaseAPI { return ServerInfoApiFp(this.configuration).getStats(options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ServerInfoApi + */ + public getSupportedMediaTypes(options?: AxiosRequestConfig) { + return ServerInfoApiFp(this.configuration).getSupportedMediaTypes(options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {*} [options] Override http request option.