mirror of https://github.com/Xhofe/alist
✨ support native proxy url
parent
511efce624
commit
2f8258053f
|
@ -84,16 +84,13 @@ func GetDrivers() map[string][]Item {
|
||||||
},
|
},
|
||||||
}, v.Items()...)
|
}, v.Items()...)
|
||||||
}
|
}
|
||||||
// 不支持给本地文件添加中转
|
res[k] = append(res[k], Item{
|
||||||
if v.Config().Name != "Native" {
|
Name: "proxy_url",
|
||||||
res[k] = append(res[k], Item{
|
Label: "proxy_url",
|
||||||
Name: "proxy_url",
|
Type: TypeString,
|
||||||
Label: "proxy_url",
|
Required: false,
|
||||||
Type: TypeString,
|
Description: "proxy url",
|
||||||
Required: false,
|
})
|
||||||
Description: "proxy url",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,8 @@ func Proxy(c *gin.Context) {
|
||||||
common.ErrorResp(c, fmt.Errorf("[%s] not allowed proxy", account.Name), 403)
|
common.ErrorResp(c, fmt.Errorf("[%s] not allowed proxy", account.Name), 403)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 中转时有中转机器使用中转机器
|
// 中转时有中转机器使用中转机器,若携带标志位则表明不能再走中转机器了
|
||||||
if account.ProxyUrl != "" {
|
if account.ProxyUrl != "" && c.Param("d") != "1" {
|
||||||
name := utils.Base(rawPath)
|
name := utils.Base(rawPath)
|
||||||
link := fmt.Sprintf("%s%s?sign=%s", account.ProxyUrl, rawPath, utils.SignWithToken(name, conf.Token))
|
link := fmt.Sprintf("%s%s?sign=%s", account.ProxyUrl, rawPath, utils.SignWithToken(name, conf.Token))
|
||||||
c.Redirect(302, link)
|
c.Redirect(302, link)
|
||||||
|
|
|
@ -95,7 +95,7 @@ func Link(c *gin.Context) {
|
||||||
}
|
}
|
||||||
if driver.Config().NoLink {
|
if driver.Config().NoLink {
|
||||||
common.SuccessResp(c, base.Link{
|
common.SuccessResp(c, base.Link{
|
||||||
Url: fmt.Sprintf("//%s/d%s?sign=%s", c.Request.Host, req.Path, utils.SignWithToken(utils.Base(rawPath), conf.Token)),
|
Url: fmt.Sprintf("//%s/d%s?d=1&sign=%s", c.Request.Host, req.Path, utils.SignWithToken(utils.Base(rawPath), conf.Token)),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue