chore (refactoring): migrate webdav to pkg/share

This commit is contained in:
MickaelK
2026-08-20 15:57:54 +10:00
parent f2a2cb3cb5
commit cd102dae1e
3 changed files with 14 additions and 7 deletions
+2
View File
@@ -59,6 +59,8 @@ var (
ShareDelete = share.ShareDeleteHandler
ShareUpsert = share.ShareUpsertHandler
ShareVerifyProof = share.ShareVerifyProofHandler
WebdavHandler = share.WebdavHandler
WebdavBlacklist = share.WebdavBlacklist
)
// frontend
@@ -1,13 +1,15 @@
package ctrl
package share
import (
"net/http"
"path/filepath"
"strings"
. "github.com/mickael-kerjean/filestash/server/common"
"github.com/mickael-kerjean/filestash/server/model"
. "github.com/mickael-kerjean/filestash/server/pkg/core"
. "github.com/mickael-kerjean/filestash/server/pkg/kernel"
"github.com/mickael-kerjean/filestash/server/pkg/permissions"
. "github.com/mickael-kerjean/filestash/server/pkg/utils"
"github.com/mickael-kerjean/net/webdav"
)
@@ -54,8 +56,8 @@ func WebdavHandler(ctx *App, res http.ResponseWriter, req *http.Request) {
h := &webdav.Handler{
Prefix: "/s/" + ctx.Share.Id,
FileSystem: model.NewWebdavFs(ctx.Backend, ctx.Share.Backend, ctx.Share.Path, req),
LockSystem: model.NewWebdavLock(),
FileSystem: NewWebdavFs(ctx.Backend, ctx.Share.Backend, ctx.Share.Path, req),
LockSystem: NewWebdavLock(),
}
h.ServeHTTP(res, req)
}
@@ -1,4 +1,4 @@
package model
package share
/*
* Implementation of a webdav.FileSystem: https://godoc.org/golang.org/x/net/webdav#FileSystem that is used
@@ -17,7 +17,10 @@ import (
"strings"
"time"
. "github.com/mickael-kerjean/filestash/server/common"
. "github.com/mickael-kerjean/filestash/server/pkg/core"
. "github.com/mickael-kerjean/filestash/server/pkg/env"
. "github.com/mickael-kerjean/filestash/server/pkg/utils"
"github.com/mickael-kerjean/net/webdav"
)