mirror of
https://github.com/AlistGo/alist.git
synced 2025-11-25 03:15:10 +08:00
refactor: split the db package hook and cache to the op package (#2747)
* refactor:separate the setting method from the db package to the op package and add the cache
* refactor:separate the meta method from the db package to the op package
* fix:setting not load database data
* refactor:separate the user method from the db package to the op package
* refactor:remove user JoinPath error
* fix:op package user cache
* refactor:fs package list method
* fix:tile virtual paths (close #2743)
* Revert "refactor:remove user JoinPath error"
This reverts commit 4e20daaf9e.
* clean path directly may lead to unknown behavior
* fix: The path of the meta passed in must be prefix of reqPath
* chore: rename all virtualPath to mountPath
* fix: `getStoragesByPath` and `GetStorageVirtualFilesByPath`
is_sub_path:
/a/b isn't subpath of /a/bc
* fix: don't save setting if hook error
Co-authored-by: Noah Hsu <i@nn.ci>
This commit is contained in:
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/alist-org/alist/v3/internal/db"
|
||||
"github.com/alist-org/alist/v3/internal/model"
|
||||
"github.com/alist-org/alist/v3/internal/op"
|
||||
"github.com/alist-org/alist/v3/pkg/utils"
|
||||
"github.com/alist-org/alist/v3/server/webdav"
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -45,7 +45,7 @@ func ServeWebDAV(c *gin.Context) {
|
||||
}
|
||||
|
||||
func WebDAVAuth(c *gin.Context) {
|
||||
guest, _ := db.GetGuest()
|
||||
guest, _ := op.GetGuest()
|
||||
username, password, ok := c.Request.BasicAuth()
|
||||
if !ok {
|
||||
if c.Request.Method == "OPTIONS" {
|
||||
@@ -58,7 +58,7 @@ func WebDAVAuth(c *gin.Context) {
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
user, err := db.GetUserByName(username)
|
||||
user, err := op.GetUserByName(username)
|
||||
if err != nil || user.ValidatePassword(password) != nil {
|
||||
if c.Request.Method == "OPTIONS" {
|
||||
c.Set("user", guest)
|
||||
|
||||
Reference in New Issue
Block a user