|
|
@@ -48,6 +48,7 @@ type SUBController struct {
|
|
|
subAnnounce string
|
|
|
subEnableRouting bool
|
|
|
subRoutingRules string
|
|
|
+ subHideSettings bool
|
|
|
subPath string
|
|
|
subJsonPath string
|
|
|
subClashPath string
|
|
|
@@ -87,6 +88,7 @@ func NewSUBController(
|
|
|
subAnnounce string,
|
|
|
subEnableRouting bool,
|
|
|
subRoutingRules string,
|
|
|
+ subHideSettings bool,
|
|
|
) *SUBController {
|
|
|
sub := NewSubService(remarkTemplate)
|
|
|
a := &SUBController{
|
|
|
@@ -96,6 +98,7 @@ func NewSUBController(
|
|
|
subAnnounce: subAnnounce,
|
|
|
subEnableRouting: subEnableRouting,
|
|
|
subRoutingRules: subRoutingRules,
|
|
|
+ subHideSettings: subHideSettings,
|
|
|
subPath: subPath,
|
|
|
subJsonPath: jsonPath,
|
|
|
subClashPath: clashPath,
|
|
|
@@ -178,7 +181,7 @@ func (a *SUBController) subs(c *gin.Context) {
|
|
|
if profileUrl == "" {
|
|
|
profileUrl = fmt.Sprintf("%s://%s%s", scheme, hostWithPort, c.Request.RequestURI)
|
|
|
}
|
|
|
- a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle, a.subSupportUrl, profileUrl, a.subAnnounce, a.subEnableRouting, a.subRoutingRules)
|
|
|
+ a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle, a.subSupportUrl, profileUrl, a.subAnnounce, a.subEnableRouting, a.subRoutingRules, a.subHideSettings)
|
|
|
|
|
|
if a.subEncrypt {
|
|
|
c.String(200, base64.StdEncoding.EncodeToString([]byte(result.String())))
|
|
|
@@ -357,7 +360,7 @@ func (a *SUBController) subJsons(c *gin.Context) {
|
|
|
if profileUrl == "" {
|
|
|
profileUrl = fmt.Sprintf("%s://%s%s", scheme, hostWithPort, c.Request.RequestURI)
|
|
|
}
|
|
|
- a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle, a.subSupportUrl, profileUrl, a.subAnnounce, a.subEnableRouting, a.subRoutingRules)
|
|
|
+ a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle, a.subSupportUrl, profileUrl, a.subAnnounce, a.subEnableRouting, a.subRoutingRules, a.subHideSettings)
|
|
|
|
|
|
c.String(200, jsonSub)
|
|
|
}
|
|
|
@@ -374,7 +377,7 @@ func (a *SUBController) subClashs(c *gin.Context) {
|
|
|
if profileUrl == "" {
|
|
|
profileUrl = fmt.Sprintf("%s://%s%s", scheme, hostWithPort, c.Request.RequestURI)
|
|
|
}
|
|
|
- a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle, a.subSupportUrl, profileUrl, a.subAnnounce, a.subEnableRouting, a.subRoutingRules)
|
|
|
+ a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle, a.subSupportUrl, profileUrl, a.subAnnounce, a.subEnableRouting, a.subRoutingRules, a.subHideSettings)
|
|
|
if a.subTitle != "" {
|
|
|
// Clash clients commonly use Content-Disposition to choose the imported profile name.
|
|
|
c.Writer.Header().Set("Content-Disposition", fmt.Sprintf(`attachment; filename*=UTF-8''%s`, url.PathEscape(a.subTitle)))
|
|
|
@@ -394,6 +397,7 @@ func (a *SUBController) ApplyCommonHeaders(
|
|
|
profileAnnounce string,
|
|
|
profileEnableRouting bool,
|
|
|
profileRoutingRules string,
|
|
|
+ profileHideSettings bool,
|
|
|
) {
|
|
|
c.Writer.Header().Set("Subscription-Userinfo", header)
|
|
|
c.Writer.Header().Set("Profile-Update-Interval", updateInterval)
|
|
|
@@ -417,4 +421,7 @@ func (a *SUBController) ApplyCommonHeaders(
|
|
|
if profileRoutingRules != "" {
|
|
|
c.Writer.Header().Set("Routing", profileRoutingRules)
|
|
|
}
|
|
|
+ if profileHideSettings {
|
|
|
+ c.Writer.Header().Set("Hide-Settings", "1")
|
|
|
+ }
|
|
|
}
|