Skip to content

Fix: respect localStorage base URL override in Web UI #15048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified tools/server/public/index.html.gz
Binary file not shown.
15 changes: 12 additions & 3 deletions tools/server/webui/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ import { isNumeric } from './utils/misc';
export const isDev = import.meta.env.MODE === 'development';

// constants
export const BASE_URL = new URL('.', document.baseURI).href
.toString()
.replace(/\/$/, '');
let baseFromStorage = '';
try {
baseFromStorage = new URL(localStorage.getItem('base') ?? '')
.toString()
.replace(/\/$/, '');
} catch {
baseFromStorage = '';
}

export const BASE_URL =
baseFromStorage ||
new URL('.', document.baseURI).href.toString().replace(/\/$/, '');

export const CONFIG_DEFAULT = {
// Note: in order not to introduce breaking changes, please keep the same data type (number, string, etc) if you want to change the default value. Do not use null or undefined for default value.
Expand Down