mirror of
https://github.com/AlistGo/alist.git
synced 2025-06-22 21:51:35 +08:00
🚧 support proxy url
This commit is contained in:
@ -23,7 +23,7 @@ func Down(c *gin.Context) {
|
||||
common.ErrorResp(c, err, 500)
|
||||
return
|
||||
}
|
||||
if driver.Config().OnlyProxy {
|
||||
if driver.Config().OnlyProxy || account.Proxy {
|
||||
Proxy(c)
|
||||
return
|
||||
}
|
||||
@ -45,6 +45,12 @@ func Proxy(c *gin.Context) {
|
||||
common.ErrorResp(c, err, 500)
|
||||
return
|
||||
}
|
||||
if account.ProxyUrl != "" {
|
||||
name := utils.Base(rawPath)
|
||||
link := fmt.Sprintf("%s%s?sign=%s", account.ProxyUrl, rawPath, utils.SignWithToken(name, conf.Token))
|
||||
c.Redirect(302, link)
|
||||
return
|
||||
}
|
||||
if !account.Proxy && utils.GetFileType(filepath.Ext(rawPath)) != conf.TEXT {
|
||||
common.ErrorResp(c, fmt.Errorf("[%s] not allowed proxy", account.Name), 403)
|
||||
return
|
||||
|
Reference in New Issue
Block a user