fix: resolve null destination when enabling AntiLeech for deployment mode websites (#10125)

* fix: Add proxy_pass directive for deployment model in UpdateAntiLeech

* fix: Update UpdateAntiLeech to use constant for deployment type
This commit is contained in:
KOMATA 2025-08-25 16:00:35 +08:00 committed by GitHub
parent 99b04e3635
commit dd6a709053
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2278,6 +2278,12 @@ func (w WebsiteService) UpdateAntiLeech(req request.NginxAntiLeechUpdate) (err e
},
}
newBlock.Directives = append(newBlock.Directives, ifDir)
if website.Type == constant.Deployment {
newBlock.Directives = append(newBlock.Directives, &components.Directive{
Name: "proxy_pass",
Parameters: []string{fmt.Sprintf("http://%s", website.Proxy)},
})
}
newDirective.Block = newBlock
index := -1
for i, directive := range block.Directives {