diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2025-09-24 20:51:01 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2025-09-24 20:51:01 +0300 |
| commit | 5822758b7c2431f8f952432a4e67cd0c2c6237e1 (patch) | |
| tree | 32e5719510735acd671afaeaef76de6de3b384aa /sub/subController.go | |
| parent | 49430b39919867b4e0bbdcab9e127daca37c3d47 (diff) | |
tiny changes
Diffstat (limited to 'sub/subController.go')
| -rw-r--r-- | sub/subController.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sub/subController.go b/sub/subController.go index 42a33ee6..ec574d6e 100644 --- a/sub/subController.go +++ b/sub/subController.go @@ -87,7 +87,20 @@ func (a *SUBController) subs(c *gin.Context) { if !a.jsonEnabled { subJsonURL = "" } - page := a.subService.BuildPageData(subId, hostHeader, traffic, lastOnline, subs, subURL, subJsonURL) + // Get base_path from context (set by middleware) + basePath, exists := c.Get("base_path") + if !exists { + basePath = "/" + } + // Add subId to base_path for asset URLs + basePathStr := basePath.(string) + if basePathStr == "/" { + basePathStr = "/" + subId + "/" + } else { + // Remove trailing slash if exists, add subId, then add trailing slash + basePathStr = strings.TrimRight(basePathStr, "/") + "/" + subId + "/" + } + page := a.subService.BuildPageData(subId, hostHeader, traffic, lastOnline, subs, subURL, subJsonURL, basePathStr) c.HTML(200, "subpage.html", gin.H{ "title": "subscription.title", "cur_ver": config.GetVersion(), |
