sdfsdf
All checks were successful
Deploy / deploy-staging (push) Successful in 24s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-06-21 01:15:38 +02:00
parent 0d7f0681c2
commit dc9cf350d6
7 changed files with 48 additions and 1 deletions

View File

@@ -276,6 +276,27 @@
return formatDateByParts(value, true);
}
function normalizeApiUrl(rawUrl) {
const url = String(rawUrl || '');
if (!url || !apiBase.includes('?path=')) {
return url;
}
if (!url.startsWith(apiBase)) {
return url;
}
const [baseRoot, basePath = ''] = apiBase.split('?path=');
const suffix = url.slice(apiBase.length);
const [routeSuffix, extraQuery = ''] = suffix.split('?');
const normalizedPath = [basePath, routeSuffix]
.map((part) => String(part || '').replace(/^\/+|\/+$/g, ''))
.filter(Boolean)
.join('/');
return `${baseRoot}?path=${encodeURIComponent(normalizedPath)}${extraQuery ? `&${extraQuery}` : ''}`;
}
async function request(path, options) {
const requestOptions = options && typeof options === 'object' ? { ...options } : {};
const debugEnabled = !!debugBus.enabled;
@@ -287,7 +308,7 @@
const controller = new AbortController();
const timeoutId = window.setTimeout(() => controller.abort(), timeoutMs);
const requestUrl = path;
const requestUrl = normalizeApiUrl(path);
const headers = { ...(requestOptions.headers || {}) };
if (debugEnabled) {
headers['X-Mining-Debug'] = '1';