Fix settings page compatibility and add debug access

This commit is contained in:
ajp_anton committed 2026-08-02 15:28:45 +00:00
1 parent a0a535c64a
commit ef4cd3dc9c
7 files changed
+128 -12

No files matched your search

@@ -1,4 +1,11 @@
(function () {
if (!Element.prototype.replaceChildren) {
Element.prototype.replaceChildren = function () {
this.textContent = "";
for (let index = 0; index < arguments.length; index++) this.appendChild(arguments[index]);
};
}
const basePath = () => {
const path = window.location.pathname || "";
const marker = "/web/";
@@ -37,6 +44,15 @@
return h;
}
function debugUrl(itemId, userId) {
const query = new URLSearchParams();
const t = token() || new URLSearchParams(location.search).get("token") || new URLSearchParams(location.search).get("api_key") || "";
if (t) query.set("token", t);
if (userId) query.set("userId", userId);
const suffix = query.toString();
return `${basePath()}/Multilang/DebugUi/${encodeURIComponent(String(itemId || "").trim())}${suffix ? `?${suffix}` : ""}`;
}
async function request(path, options) {
const response = await fetch(`${basePath()}${path}`, {
cache: "no-store",
@@ -142,6 +158,7 @@
get: (path) => request(path),
post: (path, body) => request(path, { method: "POST", body: JSON.stringify(body) }),
basePath,
debugUrl,
authHeaders,
splitList,
setStatus,