fix(subscribe): rename variable for clarity and add special handling for Stash user agent
This commit is contained in:
parent
3a98616093
commit
bc1e6315a8
@ -28,9 +28,9 @@ func SubscribeHandler(svcCtx *svc.ServiceContext) func(c *gin.Context) {
|
|||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
browserKeywords := strings.Split(svcCtx.Config.Subscribe.UserAgentList, "\n")
|
clientUserAgents := strings.Split(svcCtx.Config.Subscribe.UserAgentList, "\n")
|
||||||
var allow = false
|
var allow = false
|
||||||
for _, keyword := range browserKeywords {
|
for _, keyword := range clientUserAgents {
|
||||||
if strings.Contains(strings.ToLower(ua), strings.ToLower(keyword)) {
|
if strings.Contains(strings.ToLower(ua), strings.ToLower(keyword)) {
|
||||||
allow = true
|
allow = true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,7 +53,12 @@ func (l *SubscribeLogic) Handler(req *types.SubscribeRequest) (resp *types.Subsc
|
|||||||
if item.IsDefault {
|
if item.IsDefault {
|
||||||
defaultApp = item
|
defaultApp = item
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(userAgent, u) {
|
if strings.Contains(userAgent, u) {
|
||||||
|
// Special handling for Stash
|
||||||
|
if strings.Contains(userAgent, "stash") && !strings.Contains(u, "stash") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
targetApp = item
|
targetApp = item
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user