mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-01 16:07:17 +00:00
fix(links): use configured domain for panel copy/QR links on loopback
The panel's copy/QR share links are built client-side and fell back to window.location.hostname, so reaching the panel over an SSH tunnel (127.0.0.1/localhost) leaked localhost into the links - unlike the backend subscription path, which falls back to the configured Sub/Web Domain (issue #4829). Expose webDomain/subDomain via /defaultSettings and add preferPublicHost: when the browser host is loopback, prefer the configured Sub Domain (then Web Domain) for share/QR links. An explicit node override or per-inbound listen still wins; a routable browser host is kept as-is. Closes #4829
This commit is contained in:
@@ -18,6 +18,10 @@ export interface SubSettings {
|
||||
subURI: string;
|
||||
subJsonURI: string;
|
||||
subJsonEnable: boolean;
|
||||
// Configured public host (Sub Domain, else Web Domain) used as the share/QR
|
||||
// link host when the panel is reached on a loopback address. Empty if neither
|
||||
// is set.
|
||||
publicHost: string;
|
||||
}
|
||||
|
||||
type DBInboundInstance = InstanceType<typeof DBInbound>;
|
||||
@@ -135,7 +139,8 @@ export function useInbounds() {
|
||||
subURI: defaults.subURI || '',
|
||||
subJsonURI: defaults.subJsonURI || '',
|
||||
subJsonEnable: !!defaults.subJsonEnable,
|
||||
}), [defaults.subEnable, defaults.subTitle, defaults.subURI, defaults.subJsonURI, defaults.subJsonEnable]);
|
||||
publicHost: defaults.subDomain || defaults.webDomain || '',
|
||||
}), [defaults.subEnable, defaults.subTitle, defaults.subURI, defaults.subJsonURI, defaults.subJsonEnable, defaults.subDomain, defaults.webDomain]);
|
||||
|
||||
useEffect(() => {
|
||||
if (defaults.datepicker) setDatepicker(datepicker);
|
||||
|
||||
Reference in New Issue
Block a user