mirror of https://github.com/veypi/OneAuth.git
feat: update webda
parent
401b8c6305
commit
42115a4cee
@ -0,0 +1,16 @@
|
||||
#
|
||||
# Makefile
|
||||
# Copyright (C) 2024 veypi <i@veypi.com>
|
||||
# 2024-10-22 16:36
|
||||
# Distributed under terms of the GPL license.
|
||||
#
|
||||
cfg=~/.config/oa.yaml
|
||||
|
||||
run:
|
||||
@go run main.go -f ${cfg}
|
||||
|
||||
dbrest:
|
||||
@go run main.go -f ${cfg} db drop
|
||||
@go run main.go -f ${cfg} db migrate
|
||||
@go run main.go -f ${cfg} db init
|
||||
|
@ -0,0 +1,32 @@
|
||||
//
|
||||
// app.go
|
||||
// Copyright (C) 2024 veypi <i@veypi.com>
|
||||
// 2024-10-22 15:42
|
||||
// Distributed under terms of the GPL license.
|
||||
//
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"oa/cfg"
|
||||
"oa/libs/webdav"
|
||||
"os"
|
||||
|
||||
"github.com/veypi/utils"
|
||||
"github.com/veypi/utils/logv"
|
||||
)
|
||||
|
||||
func NewAppFs(prefix string) func(http.ResponseWriter, *http.Request) {
|
||||
apPath := utils.PathJoin(cfg.Config.FsPath, "app")
|
||||
if !utils.FileExists(apPath) {
|
||||
logv.AssertError(os.MkdirAll(apPath, 0744))
|
||||
}
|
||||
|
||||
client := webdav.NewWebdav(apPath)
|
||||
client.Prefix = prefix
|
||||
client.GenSubPathFunc = func(r *http.Request) string {
|
||||
return ""
|
||||
}
|
||||
return client.ServeHTTP
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
//
|
||||
// fs.go
|
||||
// Copyright (C) 2024 veypi <i@veypi.com>
|
||||
// 2024-10-22 15:51
|
||||
// Distributed under terms of the GPL license.
|
||||
//
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"oa/libs/webdav"
|
||||
)
|
||||
|
||||
func NewFs(dir_path, prefix string) *webdav.Handler {
|
||||
client := webdav.NewWebdav(dir_path)
|
||||
client.Prefix = prefix
|
||||
client.GenSubPathFunc = func(r *http.Request) string {
|
||||
return ""
|
||||
}
|
||||
return client
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
//
|
||||
// user.go
|
||||
// Copyright (C) 2024 veypi <i@veypi.com>
|
||||
// 2024-10-22 15:49
|
||||
// Distributed under terms of the GPL license.
|
||||
//
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"oa/cfg"
|
||||
"oa/libs/webdav"
|
||||
"os"
|
||||
|
||||
"github.com/veypi/utils"
|
||||
"github.com/veypi/utils/logv"
|
||||
)
|
||||
|
||||
func NewUserFs(prefix string) func(http.ResponseWriter, *http.Request) {
|
||||
tmp := utils.PathJoin(cfg.Config.FsPath, "u")
|
||||
if !utils.FileExists(tmp) {
|
||||
logv.AssertError(os.MkdirAll(tmp, 0744))
|
||||
}
|
||||
|
||||
client := webdav.NewWebdav(tmp)
|
||||
client.Prefix = prefix
|
||||
client.GenSubPathFunc = func(r *http.Request) string {
|
||||
return ""
|
||||
}
|
||||
return client.ServeHTTP
|
||||
}
|
Loading…
Reference in New Issue