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:
authorAlireza Ahmadi <alireza7@gmail.com>2025-09-14 20:44:26 +0300
committerAlireza Ahmadi <alireza7@gmail.com>2025-09-14 20:44:26 +0300
commit3ac1d7f5460b4e89d8057c27d7772bd34519269d (patch)
tree09d4595fe1dbb58e9c5ec2abb13ab9fe718a52ef /sub/subController.go
parent10025ffa66c011fd756af780772260d833460795 (diff)
enhancements
Diffstat (limited to 'sub/subController.go')
-rw-r--r--sub/subController.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/sub/subController.go b/sub/subController.go
index ac0c09a1..c37ff5a9 100644
--- a/sub/subController.go
+++ b/sub/subController.go
@@ -3,6 +3,7 @@ package sub
import (
"encoding/base64"
"strings"
+ "x-ui/config"
"github.com/gin-gonic/gin"
)
@@ -67,10 +68,6 @@ func (a *SUBController) subs(c *gin.Context) {
result += sub + "\n"
}
- // Add headers via service
- a.subService.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle)
- a.subService.ApplyBase64ContentHeader(c, result)
-
// If the request expects HTML (e.g., browser) or explicitly asked (?html=1 or ?view=html), render the info page here
accept := c.GetHeader("Accept")
if strings.Contains(strings.ToLower(accept), "text/html") || c.Query("html") == "1" || strings.EqualFold(c.Query("view"), "html") {
@@ -79,6 +76,7 @@ func (a *SUBController) subs(c *gin.Context) {
page := a.subService.BuildPageData(subId, hostHeader, header, lastOnline, subs, subURL, subJsonURL)
c.HTML(200, "subscription.html", gin.H{
"title": "subscription.title",
+ "cur_ver": config.GetVersion(),
"host": page.Host,
"base_path": page.BasePath,
"sId": page.SId,
@@ -100,6 +98,9 @@ func (a *SUBController) subs(c *gin.Context) {
return
}
+ // Add headers
+ a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle)
+
if a.subEncrypt {
c.String(200, base64.StdEncoding.EncodeToString([]byte(result)))
} else {
@@ -116,11 +117,15 @@ func (a *SUBController) subJsons(c *gin.Context) {
c.String(400, "Error!")
} else {
- // Add headers via service
- a.subService.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle)
+ // Add headers
+ a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle)
c.String(200, jsonSub)
}
}
-// Note: host parsing and page data preparation moved to SubService
+func (a *SUBController) ApplyCommonHeaders(c *gin.Context, header, updateInterval, profileTitle string) {
+ c.Writer.Header().Set("Subscription-Userinfo", header)
+ c.Writer.Header().Set("Profile-Update-Interval", updateInterval)
+ c.Writer.Header().Set("Profile-Title", "base64:"+base64.StdEncoding.EncodeToString([]byte(profileTitle)))
+}