From 59ea2645db827335a0689d2fb7aeeef4e52af52b Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Thu, 18 Sep 2025 13:56:04 +0200 Subject: new: subJsonEnable after this subEnable by default is true and subJsonEnable is false --- sub/subController.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sub/subController.go') 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", -- cgit v1.2.3