mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-09-20 20:56:20 +08:00
20 lines
423 B
Go
20 lines
423 B
Go
![]() |
package middlewares
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"github.com/Xhofe/alist/server/common"
|
||
|
"github.com/Xhofe/alist/utils"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func DownCheck(c *gin.Context) {
|
||
|
rawPath := c.Param("path")
|
||
|
rawPath = utils.ParsePath(rawPath)
|
||
|
pw := c.Query("pw")
|
||
|
if !common.CheckDownLink(utils.Dir(rawPath), pw, utils.Base(rawPath)) {
|
||
|
common.ErrorResp(c, fmt.Errorf("wrong password"), 401)
|
||
|
c.Abort()
|
||
|
return
|
||
|
}
|
||
|
c.Next()
|
||
|
}
|