Introduce a singleton instance_settings store and experimental settings API, add the Experimental instance settings page, and gate execution workspace behavior behind the new enableIsolatedWorkspaces flag. Co-Authored-By: Paperclip <noreply@paperclip.ing>
25 lines
767 B
TypeScript
25 lines
767 B
TypeScript
export const DEFAULT_INSTANCE_SETTINGS_PATH = "/instance/settings/heartbeats";
|
|
|
|
export function normalizeRememberedInstanceSettingsPath(rawPath: string | null): string {
|
|
if (!rawPath) return DEFAULT_INSTANCE_SETTINGS_PATH;
|
|
|
|
const match = rawPath.match(/^([^?#]*)(\?[^#]*)?(#.*)?$/);
|
|
const pathname = match?.[1] ?? rawPath;
|
|
const search = match?.[2] ?? "";
|
|
const hash = match?.[3] ?? "";
|
|
|
|
if (
|
|
pathname === "/instance/settings/heartbeats" ||
|
|
pathname === "/instance/settings/plugins" ||
|
|
pathname === "/instance/settings/experimental"
|
|
) {
|
|
return `${pathname}${search}${hash}`;
|
|
}
|
|
|
|
if (/^\/instance\/settings\/plugins\/[^/?#]+$/.test(pathname)) {
|
|
return `${pathname}${search}${hash}`;
|
|
}
|
|
|
|
return DEFAULT_INSTANCE_SETTINGS_PATH;
|
|
}
|