鉴权兼容 IPv6 本机回环地址 (#6400)

* 🐛 fix #5857

* 🎨 #5990 桌面端 `SiYuan` 可执行程序支持使用参数连接非本机内核服务

* 🎨 style

* 🎨 style

* 🎨 style

* 🎨 改进伺服代码片段 `/snippets/` #6356

* 🎨 调整 win 安装包打包选项

* 🎨 鉴权支持 IPv6 本机回环地址
This commit is contained in:
颖逸 2022-10-29 23:31:48 +08:00 committed by GitHub
parent e6365543d0
commit a6e9199d88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -171,8 +171,10 @@ func CheckAuth(c *gin.Context) {
}
// 放过来自本机的某些请求
if strings.HasPrefix(c.Request.RemoteAddr, util.LocalHost) || strings.HasPrefix(c.Request.RemoteAddr, "127.0.0.1") {
if strings.HasPrefix(c.Request.RequestURI, "/assets/") || strings.HasPrefix(c.Request.RequestURI, "/history/assets/") {
if strings.HasPrefix(c.Request.RemoteAddr, util.LocalHost) ||
strings.HasPrefix(c.Request.RemoteAddr, "127.0.0.1") ||
strings.HasPrefix(c.Request.RemoteAddr, "[::1]") {
if strings.HasPrefix(c.Request.RequestURI, "/assets/") {
c.Next()
return
}