From 06629939be43eea5c1c78f7cc0fa7fa43dd3e570 Mon Sep 17 00:00:00 2001 From: Hamidreza Ghavami <70919649+hamid-gh98@users.noreply.github.com> Date: Wed, 31 May 2023 03:24:31 +0430 Subject: [PATCH] add an option for webDomain --- web/assets/js/model/models.js | 3 ++- web/controller/inbound.go | 1 + web/entity/entity.go | 1 + web/html/xui/settings.html | 3 ++- web/service/setting.go | 7 ++++++- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/web/assets/js/model/models.js b/web/assets/js/model/models.js index b6fb49c9..2af44ada 100644 --- a/web/assets/js/model/models.js +++ b/web/assets/js/model/models.js @@ -166,6 +166,7 @@ class AllSetting { constructor(data) { this.webListen = ""; + this.webDomain = ""; this.webPort = 54321; this.webCertFile = ""; this.webKeyFile = ""; @@ -184,7 +185,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/controller/inbound.go b/web/controller/inbound.go index 8c1b993c..1f5c0bd8 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -63,6 +63,7 @@ func (a *InboundController) getInbounds(c *gin.Context) { } jsonObj(c, inbounds, nil) } + func (a *InboundController) getInbound(c *gin.Context) { id, err := strconv.Atoi(c.Param("id")) if err != nil { diff --git a/web/entity/entity.go b/web/entity/entity.go index c9a90911..b171db77 100644 --- a/web/entity/entity.go +++ b/web/entity/entity.go @@ -28,6 +28,7 @@ type Pager struct { type AllSetting struct { WebListen string `json:"webListen" form:"webListen"` + WebDomain string `json:"webDomain" form:"webDomain"` WebPort int `json:"webPort" form:"webPort"` WebCertFile string `json:"webCertFile" form:"webCertFile"` WebKeyFile string `json:"webKeyFile" form:"webKeyFile"` diff --git a/web/html/xui/settings.html b/web/html/xui/settings.html index ed9c4cfe..eb565ec8 100644 --- a/web/html/xui/settings.html +++ b/web/html/xui/settings.html @@ -67,6 +67,7 @@ + @@ -315,9 +316,9 @@ + - diff --git a/web/service/setting.go b/web/service/setting.go index 510944b0..1e6451db 100644 --- a/web/service/setting.go +++ b/web/service/setting.go @@ -24,6 +24,7 @@ var xrayTemplateConfig string var defaultValueMap = map[string]string{ "xrayTemplateConfig": xrayTemplateConfig, "webListen": "", + "webDomain": "", "webPort": "54321", "webCertFile": "", "webKeyFile": "", @@ -43,7 +44,7 @@ var defaultValueMap = map[string]string{ "subEnable": "false", "subListen": "", "subPort": "2096", - "subPath": "sub/", + "subPath": "/sub/", "subDomain": "", "subCertFile": "", "subKeyFile": "", @@ -209,6 +210,10 @@ func (s *SettingService) GetListen() (string, error) { return s.getString("webListen") } +func (s *SettingService) GetWebDomain() (string, error) { + return s.getString("webDomain") +} + func (s *SettingService) GetTgBotToken() (string, error) { return s.getString("tgBotToken") }