diff --git a/fe-app-podkop/src/helpers/getBaseUrl.ts b/fe-app-podkop/src/helpers/getBaseUrl.ts new file mode 100644 index 0000000..88b82ff --- /dev/null +++ b/fe-app-podkop/src/helpers/getBaseUrl.ts @@ -0,0 +1,4 @@ +export function getBaseUrl(): string { + const { protocol, hostname } = window.location; + return `${protocol}//${hostname}`; +} diff --git a/fe-app-podkop/src/helpers/index.ts b/fe-app-podkop/src/helpers/index.ts new file mode 100644 index 0000000..b3fe842 --- /dev/null +++ b/fe-app-podkop/src/helpers/index.ts @@ -0,0 +1 @@ +export * from './getBaseUrl'; diff --git a/fe-app-podkop/src/main.ts b/fe-app-podkop/src/main.ts index fad5419..5a2e1ba 100644 --- a/fe-app-podkop/src/main.ts +++ b/fe-app-podkop/src/main.ts @@ -3,3 +3,4 @@ export * from './validators'; export * from './constants'; +export * from './helpers'; diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/additionalTab.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/additionalTab.js index d16b68b..aa07a8a 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/additionalTab.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/additionalTab.js @@ -7,7 +7,7 @@ function createAdditionalSection(mainSection) { let o = mainSection.tab('additional', _('Additional Settings')); - o = mainSection.taboption('additional', form.Flag, 'yacd', _('Yacd enable'), 'openwrt.lan:9090/ui'); + o = mainSection.taboption('additional', form.Flag, 'yacd', _('Yacd enable'), `${main.getBaseUrl()}:9090/ui`); o.default = '0'; o.rmempty = false; o.ucisection = 'main'; diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js index de2c75a..6e7f3e7 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js @@ -189,6 +189,12 @@ var COMMAND_SCHEDULING = { P10_PRIORITY: 1900 // Lowest priority }; + +// src/helpers/getBaseUrl.ts +function getBaseUrl() { + const { protocol, hostname } = window.location; + return `${protocol}//${hostname}`; +} return baseclass.extend({ ALLOWED_WITH_RUSSIA_INSIDE, BOOTSTRAP_DNS_SERVER_OPTIONS, @@ -207,6 +213,7 @@ return baseclass.extend({ REGIONAL_OPTIONS, STATUS_COLORS, UPDATE_INTERVAL_OPTIONS, + getBaseUrl, validateDNS, validateDomain, validateIPV4,