feat: use cobra and add some command

pull/1604/head
Noah Hsu 2022-08-07 13:09:59 +08:00
parent 2b5da3ef34
commit 0df3473337
20 changed files with 279 additions and 96 deletions

View File

@ -1,59 +0,0 @@
package main
import (
"flag"
"fmt"
"os"
"github.com/alist-org/alist/v3/cmd/args"
_ "github.com/alist-org/alist/v3/drivers"
"github.com/alist-org/alist/v3/internal/bootstrap"
"github.com/alist-org/alist/v3/internal/bootstrap/data"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/server"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
)
func init() {
flag.StringVar(&args.Config, "conf", "data/config.json", "config file")
flag.BoolVar(&args.Debug, "debug", false, "start with debug mode")
flag.BoolVar(&args.Version, "version", false, "print version info")
flag.BoolVar(&args.Password, "password", false, "print current password")
flag.BoolVar(&args.NoPrefix, "no-prefix", false, "disable env prefix")
flag.BoolVar(&args.Dev, "dev", false, "start with dev mode")
flag.Parse()
}
func Init() {
if args.Version {
fmt.Printf("Built At: %s\nGo Version: %s\nAuthor: %s\nCommit ID: %s\nVersion: %s\nWebVersion: %s\n",
conf.BuiltAt, conf.GoVersion, conf.GitAuthor, conf.GitCommit, conf.Version, conf.WebVersion)
os.Exit(0)
}
bootstrap.InitConfig()
bootstrap.Log()
bootstrap.InitDB()
data.InitData()
bootstrap.InitAria2()
}
func main() {
Init()
if !args.Debug && !args.Dev {
gin.SetMode(gin.ReleaseMode)
}
r := gin.New()
r.Use(gin.LoggerWithWriter(log.StandardLogger().Out), gin.RecoveryWithWriter(log.StandardLogger().Out))
server.Init(r)
base := fmt.Sprintf("%s:%d", conf.Conf.Address, conf.Conf.Port)
log.Infof("start server @ %s", base)
var err error
if conf.Conf.Scheme.Https {
err = r.RunTLS(base, conf.Conf.Scheme.CertFile, conf.Conf.Scheme.KeyFile)
} else {
err = r.Run(base)
}
if err != nil {
log.Errorf("failed to start: %s", err.Error())
}
}

43
cmd/cancel2FA.go Normal file
View File

@ -0,0 +1,43 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package cmd
import (
"github.com/alist-org/alist/v3/internal/db"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
// cancel2FACmd represents the delete2fa command
var cancel2FACmd = &cobra.Command{
Use: "cancel2fa",
Short: "Delete 2FA of admin user",
Run: func(cmd *cobra.Command, args []string) {
Init()
admin, err := db.GetAdmin()
if err != nil {
log.Errorf("failed to get admin user: %+v", err)
} else {
err := db.Cancel2FAByUser(admin)
if err != nil {
log.Errorf("failed to cancel 2FA: %+v", err)
}
}
},
}
func init() {
rootCmd.AddCommand(cancel2FACmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// cancel2FACmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// cancel2FACmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}

14
cmd/common.go Normal file
View File

@ -0,0 +1,14 @@
package cmd
import (
"github.com/alist-org/alist/v3/internal/bootstrap"
"github.com/alist-org/alist/v3/internal/bootstrap/data"
)
func Init() {
bootstrap.InitConfig()
bootstrap.Log()
bootstrap.InitDB()
data.InitData()
bootstrap.InitAria2()
}

View File

@ -1,10 +1,8 @@
package args
package flags
var (
Config string // config file
Debug bool
Version bool
Password bool
NoPrefix bool
Dev bool
)

40
cmd/password.go Normal file
View File

@ -0,0 +1,40 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package cmd
import (
"github.com/alist-org/alist/v3/internal/db"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
// passwordCmd represents the password command
var passwordCmd = &cobra.Command{
Use: "password",
Short: "Show admin user's password",
Run: func(cmd *cobra.Command, args []string) {
Init()
admin, err := db.GetAdmin()
if err != nil {
log.Errorf("failed get admin user: %+v", err)
} else {
log.Infof("admin user's password is: %s", admin.Password)
}
},
}
func init() {
rootCmd.AddCommand(passwordCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// passwordCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// passwordCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}

31
cmd/root.go Normal file
View File

@ -0,0 +1,31 @@
package cmd
import (
"fmt"
"os"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "alist",
Short: "A file list program that supports multiple storage.",
Long: `A file list program that supports multiple storage,
built with love by Xhofe and friends in Go/Solid.js.
Complete documentation is available at https://alist.nn.ci/`,
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
func init() {
rootCmd.PersistentFlags().StringVar(&flags.Config, "conf", "data/config.json", "config file")
rootCmd.PersistentFlags().BoolVar(&flags.Debug, "debug", false, "start with debug mode")
rootCmd.PersistentFlags().BoolVar(&flags.NoPrefix, "no-prefix", false, "disable env prefix")
rootCmd.PersistentFlags().BoolVar(&flags.Dev, "dev", false, "start with dev mode")
}

54
cmd/server.go Normal file
View File

@ -0,0 +1,54 @@
package cmd
import (
"fmt"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/server"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
// serverCmd represents the server command
var serverCmd = &cobra.Command{
Use: "server",
Short: "Start the server at the specified address",
Long: `Start the server at the specified address
the address is defined in config file`,
Run: func(cmd *cobra.Command, args []string) {
Init()
if !flags.Debug && !flags.Dev {
gin.SetMode(gin.ReleaseMode)
}
r := gin.New()
r.Use(gin.LoggerWithWriter(log.StandardLogger().Out), gin.RecoveryWithWriter(log.StandardLogger().Out))
server.Init(r)
base := fmt.Sprintf("%s:%d", conf.Conf.Address, conf.Conf.Port)
log.Infof("start server @ %s", base)
var err error
if conf.Conf.Scheme.Https {
err = r.RunTLS(base, conf.Conf.Scheme.CertFile, conf.Conf.Scheme.KeyFile)
} else {
err = r.Run(base)
}
if err != nil {
log.Errorf("failed to start: %s", err.Error())
}
},
}
func init() {
rootCmd.AddCommand(serverCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// serverCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// serverCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}

44
cmd/version.go Normal file
View File

@ -0,0 +1,44 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package cmd
import (
"fmt"
"github.com/alist-org/alist/v3/internal/conf"
"os"
"github.com/spf13/cobra"
)
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "Show current version of AList",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf(`Built At: %s
Go Version: %s
Author: %s
Commit ID: %s
Version: %s
WebVersion: %s
`,
conf.BuiltAt, conf.GoVersion, conf.GitAuthor, conf.GitCommit, conf.Version, conf.WebVersion)
os.Exit(0)
},
}
func init() {
rootCmd.AddCommand(versionCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// versionCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// versionCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}

3
go.mod
View File

@ -30,6 +30,7 @@ require (
github.com/go-playground/validator/v10 v10.11.0 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/goccy/go-json v0.9.7 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.12.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
@ -48,6 +49,8 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/spf13/cobra v1.5.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/net v0.0.0-20220531201128-c960675eff93 // indirect

8
go.sum
View File

@ -11,6 +11,7 @@ github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -54,6 +55,8 @@ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
@ -171,6 +174,7 @@ github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6po
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
@ -179,6 +183,10 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=

View File

@ -5,7 +5,7 @@ import (
"os"
"path/filepath"
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/pkg/utils"
"github.com/caarlos0/env/v6"
@ -13,36 +13,35 @@ import (
)
func InitConfig() {
log.Infof("reading config file: %s", args.Config)
if !utils.Exists(args.Config) {
log.Infof("reading config file: %s", flags.Config)
if !utils.Exists(flags.Config) {
log.Infof("config file not exists, creating default config file")
_, err := utils.CreateNestedFile(args.Config)
_, err := utils.CreateNestedFile(flags.Config)
if err != nil {
log.Fatalf("failed to create config file: %+v", err)
}
conf.Conf = conf.DefaultConfig()
if !utils.WriteToJson(args.Config, conf.Conf) {
if !utils.WriteToJson(flags.Config, conf.Conf) {
log.Fatalf("failed to create default config file")
}
} else {
configBytes, err := ioutil.ReadFile(args.Config)
configBytes, err := ioutil.ReadFile(flags.Config)
if err != nil {
log.Fatalf("reading config file error:%s", err.Error())
log.Fatalf("reading config file error: %+v", err)
}
conf.Conf = conf.DefaultConfig()
err = utils.Json.Unmarshal(configBytes, conf.Conf)
if err != nil {
log.Fatalf("load config error: %s", err.Error())
log.Fatalf("load config error: %+v", err)
}
log.Debugf("config:%+v", conf.Conf)
// update config.json struct
confBody, err := utils.Json.MarshalIndent(conf.Conf, "", " ")
if err != nil {
log.Fatalf("marshal config error:%s", err.Error())
log.Fatalf("marshal config error: %+v", err)
}
err = ioutil.WriteFile(args.Config, confBody, 0777)
err = ioutil.WriteFile(flags.Config, confBody, 0777)
if err != nil {
log.Fatalf("update config struct error: %s", err.Error())
log.Fatalf("update config struct error: %+v", err)
}
}
if !conf.Conf.Force {
@ -54,7 +53,7 @@ func InitConfig() {
if !filepath.IsAbs(conf.Conf.TempDir) {
absPath, err = filepath.Abs(conf.Conf.TempDir)
if err != nil {
log.Fatalf("get abs path error: %s", err.Error())
log.Fatalf("get abs path error: %+v", err)
}
}
conf.Conf.TempDir = absPath
@ -64,20 +63,20 @@ func InitConfig() {
}
err = os.MkdirAll(conf.Conf.TempDir, 0700)
if err != nil {
log.Fatalf("create temp dir error: %s", err.Error())
log.Fatalf("create temp dir error: %+v", err)
}
log.Debugf("config: %+v", conf.Conf)
}
func confFromEnv() {
prefix := "ALIST_"
if args.NoPrefix {
if flags.NoPrefix {
prefix = ""
}
log.Infof("load config from env with prefix: %s", prefix)
if err := env.Parse(conf.Conf, env.Options{
Prefix: prefix,
}); err != nil {
log.Fatalf("load config from env error: %s", err.Error())
log.Fatalf("load config from env error: %+v", err)
}
}

View File

@ -1,11 +1,11 @@
package data
import "github.com/alist-org/alist/v3/cmd/args"
import "github.com/alist-org/alist/v3/cmd/flags"
func InitData() {
initUser()
initSettings()
if args.Dev {
if flags.Dev {
initDevData()
initDevDo()
}

View File

@ -3,7 +3,7 @@ package data
import (
"context"
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/alist-org/alist/v3/internal/db"
"github.com/alist-org/alist/v3/internal/message"
"github.com/alist-org/alist/v3/internal/model"
@ -35,7 +35,7 @@ func initDevData() {
}
func initDevDo() {
if args.Dev {
if flags.Dev {
go func() {
err := message.GetMessenger().WaitSend(map[string]string{
"type": "dev",

View File

@ -1,7 +1,7 @@
package data
import (
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/db"
"github.com/alist-org/alist/v3/internal/model"
@ -60,7 +60,7 @@ func isActive(key string) bool {
func initialSettings() {
var token string
if args.Dev {
if flags.Dev {
token = "dev_token"
} else {
token = random.Token()
@ -96,7 +96,7 @@ func initialSettings() {
// single settings
{Key: conf.Token, Value: token, Type: conf.TypeString, Group: model.SINGLE, Flag: model.PRIVATE},
}
if args.Dev {
if flags.Dev {
initialSettingItems = append(initialSettingItems, model.SettingItem{Key: "test_deprecated", Value: "test_value", Type: conf.TypeString, Flag: model.DEPRECATED})
}
}

View File

@ -1,7 +1,7 @@
package data
import (
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/alist-org/alist/v3/internal/db"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/pkg/utils/random"
@ -13,7 +13,7 @@ import (
func initUser() {
admin, err := db.GetAdmin()
adminPassword := random.String(8)
if args.Dev {
if flags.Dev {
adminPassword = "admin"
}
if err != nil {
@ -26,6 +26,8 @@ func initUser() {
}
if err := db.CreateUser(admin); err != nil {
panic(err)
} else {
log.Infof("Successfully created the administrator user and the initial password is: %s", admin.Password)
}
} else {
panic(err)
@ -48,5 +50,4 @@ func initUser() {
panic(err)
}
}
log.Infof("admin password: %+v", admin.Password)
}

View File

@ -6,7 +6,7 @@ import (
"strings"
"time"
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/db"
log "github.com/sirupsen/logrus"
@ -36,7 +36,7 @@ func InitDB() {
}
var dB *gorm.DB
var err error
if args.Dev {
if flags.Dev {
dB, err = gorm.Open(sqlite.Open("file::memory:?cache=shared"), gormConfig)
} else {
database := conf.Conf.Database

View File

@ -4,7 +4,7 @@ import (
"log"
"time"
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/alist-org/alist/v3/internal/conf"
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
"github.com/sirupsen/logrus"
@ -22,7 +22,7 @@ func init() {
func Log() {
log.SetOutput(logrus.StandardLogger().Out)
if args.Debug || args.Dev {
if flags.Debug || flags.Dev {
logrus.SetLevel(logrus.DebugLevel)
logrus.SetReportCaller(true)
} else {

7
main.go Normal file
View File

@ -0,0 +1,7 @@
package main
import "github.com/alist-org/alist/v3/cmd"
func main() {
cmd.Execute()
}

View File

@ -1,7 +1,7 @@
package common
import (
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
)
@ -10,7 +10,7 @@ import (
// @param l: if true, log error
func ErrorResp(c *gin.Context, err error, code int, l ...bool) {
if len(l) > 0 && l[0] {
if args.Debug || args.Dev {
if flags.Debug || flags.Dev {
log.Errorf("%+v", err)
} else {
log.Errorf("%v", err)

View File

@ -1,7 +1,7 @@
package server
import (
"github.com/alist-org/alist/v3/cmd/args"
"github.com/alist-org/alist/v3/cmd/flags"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/message"
"github.com/alist-org/alist/v3/server/common"
@ -34,7 +34,7 @@ func Init(r *gin.Engine) {
fs(auth.Group("/fs"))
admin(auth.Group("/admin", middlewares.AuthAdmin))
if args.Dev {
if flags.Dev {
dev(r.Group("/dev"))
}
}