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:
authormhsanaei <ho3ein.sanaei@gmail.com>2025-09-18 14:56:04 +0300
committermhsanaei <ho3ein.sanaei@gmail.com>2025-09-18 14:56:04 +0300
commit59ea2645db827335a0689d2fb7aeeef4e52af52b (patch)
treea52caa80571fef4919c3df59a4bceacd60ba6aa6 /sub/subController.go
parent8c8d280f147ce4e8f604080d1dbf066332e55efc (diff)
new: subJsonEnable
after this subEnable by default is true and subJsonEnable is false
Diffstat (limited to 'sub/subController.go')
-rw-r--r--sub/subController.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/sub/subController.go b/sub/subController.go
index 170cfa74..b29d019e 100644
--- a/sub/subController.go
+++ b/sub/subController.go
@@ -13,6 +13,7 @@ type SUBController struct {
subTitle string
subPath string
subJsonPath string
+ jsonEnabled bool
subEncrypt bool
updateInterval string
@@ -24,6 +25,7 @@ func NewSUBController(
g *gin.RouterGroup,
subPath string,
jsonPath string,
+ jsonEnabled bool,
encrypt bool,
showInfo bool,
rModel string,
@@ -39,6 +41,7 @@ func NewSUBController(
subTitle: subTitle,
subPath: subPath,
subJsonPath: jsonPath,
+ jsonEnabled: jsonEnabled,
subEncrypt: encrypt,
updateInterval: update,
@@ -51,10 +54,11 @@ func NewSUBController(
func (a *SUBController) initRouter(g *gin.RouterGroup) {
gLink := g.Group(a.subPath)
- gJson := g.Group(a.subJsonPath)
-
gLink.GET(":subid", a.subs)
- gJson.GET(":subid", a.subJsons)
+ if a.jsonEnabled {
+ gJson := g.Group(a.subJsonPath)
+ gJson.GET(":subid", a.subJsons)
+ }
}
func (a *SUBController) subs(c *gin.Context) {
@@ -74,6 +78,9 @@ func (a *SUBController) subs(c *gin.Context) {
if strings.Contains(strings.ToLower(accept), "text/html") || c.Query("html") == "1" || strings.EqualFold(c.Query("view"), "html") {
// Build page data in service
subURL, subJsonURL := a.subService.BuildURLs(scheme, hostWithPort, a.subPath, a.subJsonPath, subId)
+ if !a.jsonEnabled {
+ subJsonURL = ""
+ }
page := a.subService.BuildPageData(subId, hostHeader, traffic, lastOnline, subs, subURL, subJsonURL)
c.HTML(200, "subpage.html", gin.H{
"title": "subscription.title",