zhaoyupeng 777253063b feat: 完成了 新建桶; 上传文件(基本功能)
todo: 上传 rename, 上传 public 权限选择
bug: 首次加载 conns list; 上传的时候前缀过滤失败
2024-10-12 17:46:20 +08:00

45 lines
904 B
Go

package controller
import (
"context"
"github.com/loveuer/nf-disk/internal/api"
"github.com/loveuer/nf-disk/internal/db"
"github.com/loveuer/nf-disk/internal/manager"
"github.com/loveuer/nf-disk/internal/model"
"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 {
ctx context.Context
handlers map[string]ndh.Handler
}
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) 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))
}