Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'web/assets')
-rw-r--r--web/assets/js/model/models.js3
-rw-r--r--web/assets/js/util/common.js18
2 files changed, 20 insertions, 1 deletions
diff --git a/web/assets/js/model/models.js b/web/assets/js/model/models.js
index 9a5dcc85..e1a766dc 100644
--- a/web/assets/js/model/models.js
+++ b/web/assets/js/model/models.js
@@ -168,6 +168,7 @@ class AllSetting {
constructor(data) {
this.webListen = "";
+ this.webDomain = "";
this.webPort = 2053;
this.webCertFile = "";
this.webKeyFile = "";
@@ -187,7 +188,7 @@ class AllSetting {
this.subEnable = false;
this.subListen = "";
this.subPort = "2096";
- this.subPath = "sub/";
+ this.subPath = "/sub/";
this.subDomain = "";
this.subCertFile = "";
this.subKeyFile = "";
diff --git a/web/assets/js/util/common.js b/web/assets/js/util/common.js
index 563bfd45..8e30bce7 100644
--- a/web/assets/js/util/common.js
+++ b/web/assets/js/util/common.js
@@ -135,3 +135,21 @@ function doAllItemsExist(array1, array2) {
}
return true;
}
+
+function buildURL({ host, port, isTLS, base, path }) {
+ if (!host || host.length === 0) host = window.location.hostname;
+ if (!port || port.length === 0) port = window.location.port;
+
+ if (isTLS === undefined) isTLS = window.location.protocol === "https:";
+
+ const protocol = isTLS ? "https:" : "http:";
+
+ port = String(port);
+ if (port === "" || (isTLS && port === "443") || (!isTLS && port === "80")) {
+ port = "";
+ } else {
+ port = `:${port}`;
+ }
+
+ return `${protocol}//${host}${port}${base}${path}`;
+}