feat: 完成了 新建桶; 上传文件(基本功能)

todo: 上传 rename, 上传 public 权限选择
bug: 首次加载 conns list; 上传的时候前缀过滤失败
This commit is contained in:
zhaoyupeng
2024-10-12 17:35:59 +08:00
parent 1c818daf16
commit 777253063b
28 changed files with 791 additions and 96 deletions

View File

@ -9,6 +9,11 @@ import (
"github.com/loveuer/nf-disk/internal/tool"
"github.com/loveuer/nf-disk/ndh"
"github.com/loveuer/nf/nft/log"
"github.com/wailsapp/wails/v2/pkg/runtime"
)
var (
app *App
)
type App struct {
@ -16,23 +21,24 @@ type App struct {
handlers map[string]ndh.Handler
}
func NewApp() *App {
return &App{
func NewApp(gctx context.Context) *App {
app = &App{
handlers: make(map[string]ndh.Handler),
}
go func() {
<-gctx.Done()
runtime.Quit(app.ctx)
}()
return app
}
func (a *App) Init(ctx context.Context) {
log.Info("app init!!!")
func (a *App) Startup(ctx context.Context) {
log.Info("app startup!!!")
a.ctx = ctx
tool.Must(db.Init(ctx, "sqlite::memory", db.OptSqliteByMem(nil)))
tool.Must(model.Init(db.Default.Session()))
tool.Must(manager.Init(ctx))
tool.Must(api.Init(ctx))
}
func (a *App) Startup(ctx context.Context) {
log.Info("app startup!!!")
}