ui: Constants refactor (#26908)

* refactor: Constants

* refactor: Constants/Enums cleanup

* refactor: Constant objects instead of multiple single value constants

* refactor: Cleanup constants
This commit is contained in:
Aleksander Grygier
2026-08-13 06:53:56 +02:00
committed by GitHub
parent 8e7f22b67e
commit e21152dc96
209 changed files with 1101 additions and 1137 deletions
+3 -7
View File
@@ -3,11 +3,7 @@
*/
import { base } from '$app/paths';
import {
CORS_PROXY_ENDPOINT,
CORS_PROXY_HEADER_PREFIX,
CORS_PROXY_URL_PARAM
} from '$lib/constants';
import { CORS_PROXY, CORS_PROXY_ENDPOINT } from '$lib/constants';
/**
* Build a proxied URL that routes through llama-server's CORS proxy.
@@ -18,7 +14,7 @@ export function buildProxiedUrl(targetUrl: string): URL {
const proxyPath = `${base}${CORS_PROXY_ENDPOINT}`;
const proxyUrl = new URL(proxyPath, window.location.origin);
proxyUrl.searchParams.set(CORS_PROXY_URL_PARAM, targetUrl);
proxyUrl.searchParams.set(CORS_PROXY.URL_PARAM, targetUrl);
return proxyUrl;
}
@@ -32,7 +28,7 @@ export function buildProxiedHeaders(headers: Record<string, string>): Record<str
const proxiedHeaders: Record<string, string> = {};
for (const [key, value] of Object.entries(headers)) {
proxiedHeaders[`${CORS_PROXY_HEADER_PREFIX}${key}`] = value;
proxiedHeaders[`${CORS_PROXY.HEADER_PREFIX}${key}`] = value;
}
return proxiedHeaders;