From cfc11151d29dee39b906f30253ea1a9548a653a3 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Sun, 19 Nov 2023 04:00:41 +0100 Subject: [PATCH] Optimizing loading of script files --- .../js/model/{models.js => dbinbound.js} | 72 ------------------- web/assets/js/model/setting.js | 44 ++++++++++++ web/assets/js/util/utils.js | 18 +++++ web/html/common/js.html | 6 -- web/html/login.html | 12 ++++ web/html/xui/inbounds.html | 6 ++ web/html/xui/index.html | 2 +- web/html/xui/settings.html | 1 + 8 files changed, 82 insertions(+), 79 deletions(-) rename web/assets/js/model/{models.js => dbinbound.js} (69%) create mode 100644 web/assets/js/model/setting.js diff --git a/web/assets/js/model/models.js b/web/assets/js/model/dbinbound.js similarity index 69% rename from web/assets/js/model/models.js rename to web/assets/js/model/dbinbound.js index 3a37bcb6..a8810899 100644 --- a/web/assets/js/model/models.js +++ b/web/assets/js/model/dbinbound.js @@ -1,30 +1,3 @@ -class User { - - constructor() { - this.username = ""; - this.password = ""; - } -} - -class Msg { - - constructor(success, msg, obj) { - this.success = false; - this.msg = ""; - this.obj = null; - - if (success != null) { - this.success = success; - } - if (msg != null) { - this.msg = msg; - } - if (obj != null) { - this.obj = obj; - } - } -} - class DBInbound { constructor(data) { @@ -173,49 +146,4 @@ class DBInbound { const inbound = this.toInbound(); return inbound.genInboundLinks(this.address, this.remark); } -} - -class AllSetting { - - constructor(data) { - this.webListen = ""; - this.webDomain = ""; - this.webPort = 54321; - this.webCertFile = ""; - this.webKeyFile = ""; - this.webBasePath = "/"; - this.sessionMaxAge = ""; - this.pageSize = 0; - this.expireDiff = ""; - this.trafficDiff = ""; - this.tgBotEnable = false; - this.tgBotToken = ""; - this.tgBotChatId = ""; - this.tgRunTime = "@daily"; - this.tgBotBackup = false; - this.tgBotLoginNotify = false; - this.tgCpu = ""; - this.tgLang = ""; - this.subEnable = false; - this.subListen = ""; - this.subPort = "2096"; - this.subPath = "/sub/"; - this.subDomain = ""; - this.subCertFile = ""; - this.subKeyFile = ""; - this.subUpdates = 0; - this.subEncrypt = true; - this.subShowInfo = false; - - this.timeLocation = "Asia/Tehran"; - - if (data == null) { - return - } - ObjectUtil.cloneProps(this, data); - } - - equals(other) { - return ObjectUtil.equals(this, other); - } } \ No newline at end of file diff --git a/web/assets/js/model/setting.js b/web/assets/js/model/setting.js new file mode 100644 index 00000000..f299e90b --- /dev/null +++ b/web/assets/js/model/setting.js @@ -0,0 +1,44 @@ +class AllSetting { + + constructor(data) { + this.webListen = ""; + this.webDomain = ""; + this.webPort = 54321; + this.webCertFile = ""; + this.webKeyFile = ""; + this.webBasePath = "/"; + this.sessionMaxAge = ""; + this.pageSize = 0; + this.expireDiff = ""; + this.trafficDiff = ""; + this.tgBotEnable = false; + this.tgBotToken = ""; + this.tgBotChatId = ""; + this.tgRunTime = "@daily"; + this.tgBotBackup = false; + this.tgBotLoginNotify = false; + this.tgCpu = ""; + this.tgLang = ""; + this.subEnable = false; + this.subListen = ""; + this.subPort = "2096"; + this.subPath = "/sub/"; + this.subDomain = ""; + this.subCertFile = ""; + this.subKeyFile = ""; + this.subUpdates = 0; + this.subEncrypt = true; + this.subShowInfo = false; + + this.timeLocation = "Asia/Tehran"; + + if (data == null) { + return + } + ObjectUtil.cloneProps(this, data); + } + + equals(other) { + return ObjectUtil.equals(this, other); + } +} \ No newline at end of file diff --git a/web/assets/js/util/utils.js b/web/assets/js/util/utils.js index 41346adf..f0f99eb9 100644 --- a/web/assets/js/util/utils.js +++ b/web/assets/js/util/utils.js @@ -1,3 +1,21 @@ +class Msg { + constructor(success, msg, obj) { + this.success = false; + this.msg = ""; + this.obj = null; + + if (success != null) { + this.success = success; + } + if (msg != null) { + this.msg = msg; + } + if (obj != null) { + this.obj = obj; + } + } +} + class HttpUtil { static _handleMsg(msg) { if (!(msg instanceof Msg)) { diff --git a/web/html/common/js.html b/web/html/common/js.html index e3fcdba9..661a0b87 100644 --- a/web/html/common/js.html +++ b/web/html/common/js.html @@ -2,18 +2,12 @@ - - - - - - + + + + + {{template "component/themeSwitcher" .}} {{template "component/themeSwitcher" .}} {{template "textModal"}} {{template "component/themeSwitcher" .}} {{template "component/password" .}} {{template "component/setting"}}