From 03b7a3479394f54a2e793f23f35e0f2b8a4b4a6a Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Wed, 21 Feb 2024 14:17:52 +0330 Subject: [sub] json + fragment Co-Authored-By: Alireza Ahmadi --- web/assets/js/model/setting.js | 3 ++ web/controller/xray_setting.go | 1 - web/entity/entity.go | 10 ++++ web/html/common/qrcode_modal.html | 24 +++++++-- web/html/xui/inbound_info_modal.html | 17 +++++- web/html/xui/inbounds.html | 23 ++++---- web/html/xui/settings.html | 96 ++++++++++++++++++++++++++++++---- web/service/setting.go | 45 +++++++++------- web/translation/translate.en_US.toml | 3 ++ web/translation/translate.es_ES.toml | 3 ++ web/translation/translate.fa_IR.toml | 3 ++ web/translation/translate.id_ID.toml | 3 ++ web/translation/translate.ru_RU.toml | 3 ++ web/translation/translate.vi_VN.toml | 3 ++ web/translation/translate.zh_Hans.toml | 3 ++ 15 files changed, 190 insertions(+), 50 deletions(-) (limited to 'web') diff --git a/web/assets/js/model/setting.js b/web/assets/js/model/setting.js index ddf1a0e1..637830e8 100644 --- a/web/assets/js/model/setting.js +++ b/web/assets/js/model/setting.js @@ -28,6 +28,7 @@ class AllSetting { this.subListen = ""; this.subPort = "2096"; this.subPath = "/sub/"; + this.subJsonPath = "/json/"; this.subDomain = ""; this.subCertFile = ""; this.subKeyFile = ""; @@ -35,6 +36,8 @@ class AllSetting { this.subEncrypt = true; this.subShowInfo = false; this.subURI = ''; + this.subJsonURI = ''; + this.subJsonFragment = ''; this.timeLocation = "Asia/Tehran"; diff --git a/web/controller/xray_setting.go b/web/controller/xray_setting.go index 28f55b54..2dddb44b 100644 --- a/web/controller/xray_setting.go +++ b/web/controller/xray_setting.go @@ -81,7 +81,6 @@ func (a *XraySettingController) warp(c *gin.Context) { resp, err = a.XraySettingService.RegWarp(skey, pkey) case "license": license := c.PostForm("license") - println(license) resp, err = a.XraySettingService.SetWarpLicence(license) } diff --git a/web/entity/entity.go b/web/entity/entity.go index 8ab06399..06850128 100644 --- a/web/entity/entity.go +++ b/web/entity/entity.go @@ -48,6 +48,9 @@ type AllSetting struct { SubEncrypt bool `json:"subEncrypt" form:"subEncrypt"` SubShowInfo bool `json:"subShowInfo" form:"subShowInfo"` SubURI string `json:"subURI" form:"subURI"` + SubJsonPath string `json:"subJsonPath" form:"subJsonPath"` + SubJsonURI string `json:"subJsonURI" form:"subJsonURI"` + SubJsonFragment string `json:"subJsonFragment" form:"subJsonFragment"` Datepicker string `json:"datepicker" form:"datepicker"` } @@ -105,6 +108,13 @@ func (s *AllSetting) CheckValid() error { s.SubPath += "/" } + if !strings.HasPrefix(s.SubJsonPath, "/") { + s.SubJsonPath = "/" + s.SubJsonPath + } + if !strings.HasSuffix(s.SubJsonPath, "/") { + s.SubJsonPath += "/" + } + _, err := time.LoadLocation(s.TimeLocation) if err != nil { return common.NewError("time location not exist:", s.TimeLocation) diff --git a/web/html/common/qrcode_modal.html b/web/html/common/qrcode_modal.html index 3bda4c29..7cc317ef 100644 --- a/web/html/common/qrcode_modal.html +++ b/web/html/common/qrcode_modal.html @@ -8,13 +8,23 @@ {{ i18n "pages.inbounds.clickOnQRcode" }} {{ i18n "pages.inbounds.client" }} @@ -82,12 +92,16 @@ }, genSubLink(subID) { return app.subSettings.subURI+subID; + }, + genSubJsonLink(subID) { + return app.subSettings.subJsonURI+subID; } }, updated() { if (qrModal.client && qrModal.client.subId) { qrModal.subId = qrModal.client.subId; this.setQrCode("qrCode-sub", this.genSubLink(qrModal.subId)); + this.setQrCode("qrCode-subJson", this.genSubJsonLink(qrModal.subId)); } qrModal.qrcodes.forEach((element, index) => { this.setQrCode("qrCode-" + index, element.link); @@ -96,4 +110,4 @@ }); -{{end}} +{{end}} \ No newline at end of file diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index 23f8bd47..c8341651 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -166,7 +166,7 @@