mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 09:30:28 +00:00
fix(web): fix Theme Custom CSS endpoint requiring the user to be logged in as the server admin (#4633)
* fix custom css requiring the user to be the admin and logged in * move theme api to custom endpoint * add e2e test
This commit is contained in:
69
web/src/api/open-api/api.ts
generated
69
web/src/api/open-api/api.ts
generated
@@ -2958,6 +2958,19 @@ export interface ServerStatsResponseDto {
|
||||
*/
|
||||
'videos': number;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface ServerThemeDto
|
||||
*/
|
||||
export interface ServerThemeDto {
|
||||
/**
|
||||
*
|
||||
* @type {SystemConfigThemeDto}
|
||||
* @memberof ServerThemeDto
|
||||
*/
|
||||
'theme': SystemConfigThemeDto;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -13193,6 +13206,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}
|
||||
*/
|
||||
getTheme: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/server-info/theme`;
|
||||
// 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};
|
||||
@@ -13295,6 +13337,15 @@ export const ServerInfoApiFp = function(configuration?: Configuration) {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.getSupportedMediaTypes(options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async getTheme(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ServerThemeDto>> {
|
||||
const localVarAxiosArgs = await localVarAxiosParamCreator.getTheme(options);
|
||||
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {*} [options] Override http request option.
|
||||
@@ -13362,6 +13413,14 @@ export const ServerInfoApiFactory = function (configuration?: Configuration, bas
|
||||
getSupportedMediaTypes(options?: AxiosRequestConfig): AxiosPromise<ServerMediaTypesResponseDto> {
|
||||
return localVarFp.getSupportedMediaTypes(options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
getTheme(options?: AxiosRequestConfig): AxiosPromise<ServerThemeDto> {
|
||||
return localVarFp.getTheme(options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {*} [options] Override http request option.
|
||||
@@ -13440,6 +13499,16 @@ export class ServerInfoApi extends BaseAPI {
|
||||
return ServerInfoApiFp(this.configuration).getSupportedMediaTypes(options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof ServerInfoApi
|
||||
*/
|
||||
public getTheme(options?: AxiosRequestConfig) {
|
||||
return ServerInfoApiFp(this.configuration).getTheme(options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} [options] Override http request option.
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { RequestHandler, text } from '@sveltejs/kit';
|
||||
export const GET = (async ({ locals: { api } }) => {
|
||||
const { customCss } = await api.systemConfigApi.getConfig().then((res) => res.data.theme);
|
||||
const {
|
||||
data: {
|
||||
theme: { customCss },
|
||||
},
|
||||
} = await api.serverInfoApi.getTheme();
|
||||
return text(customCss, {
|
||||
headers: {
|
||||
'Content-Type': 'text/css',
|
||||
|
||||
Reference in New Issue
Block a user