mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: sign file source url
This commit is contained in:
@@ -1,12 +1,26 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/HFO4/cloudreve/models"
|
||||
"github.com/HFO4/cloudreve/pkg/serializer"
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// SignRequired 验证请求签名
|
||||
func SignRequired() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// 获取待验证的签名正文
|
||||
queries := c.Request.URL.Query()
|
||||
queries.Del("sign")
|
||||
c.Request.URL.RawQuery = queries.Encode()
|
||||
requestURI := c.Request.URL.RequestURI()
|
||||
fmt.Println(requestURI)
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
// CurrentUser 获取登录用户
|
||||
func CurrentUser() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user