diff options
author | 2021-09-09 16:15:25 +0200 | |
---|---|---|
committer | 2021-09-09 16:15:25 +0200 | |
commit | 555ea8edfb2c30d149b3ca6cb0fbe53f2798c7bc (patch) | |
tree | 24567c4c365a007fcd2d6603e696b363129abb77 /cmd/gotosocial/admincommands.go | |
parent | Merge pull request #198 from NyaaaWhatsUpDoc/update/sqlite-library (diff) | |
download | gotosocial-555ea8edfb2c30d149b3ca6cb0fbe53f2798c7bc.tar.xz |
Import export (#194)
* start with export/import code
* messing about with decoding/encoding
* some more fiddling
* stuff is WORKING
* working pretty alright!
* go fmt
* fix up tests, add docs
* start backup/restore doc
* tweaks
* credits
* update advancedVisibility settings
* update bun library -> v1.0.4
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
* update oauth library -> v4.3.1-SSB
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
* handle oauth token scope, fix user.SigninCount + token.UserID
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
* update oauth library --> v4.3.2-SSB
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
* update sqlite library -> v1.13.0
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
* review changes
* start with export/import code
* messing about with decoding/encoding
* some more fiddling
* stuff is WORKING
* working pretty alright!
* go fmt
* fix up tests, add docs
* start backup/restore doc
* tweaks
* credits
* update advancedVisibility settings
* review changes
Co-authored-by: kim (grufwub) <grufwub@gmail.com>
Co-authored-by: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>
Diffstat (limited to 'cmd/gotosocial/admincommands.go')
-rw-r--r-- | cmd/gotosocial/admincommands.go | 79 |
1 files changed, 59 insertions, 20 deletions
diff --git a/cmd/gotosocial/admincommands.go b/cmd/gotosocial/admincommands.go index a777ee525..5d505fe77 100644 --- a/cmd/gotosocial/admincommands.go +++ b/cmd/gotosocial/admincommands.go @@ -20,6 +20,7 @@ package main import ( "github.com/superseriousbusiness/gotosocial/internal/cliactions/admin/account" + "github.com/superseriousbusiness/gotosocial/internal/cliactions/admin/trans" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/urfave/cli/v2" ) @@ -39,16 +40,19 @@ func adminCommands() []*cli.Command { Usage: "create a new account", Flags: []cli.Flag{ &cli.StringFlag{ - Name: config.UsernameFlag, - Usage: config.UsernameUsage, + Name: config.UsernameFlag, + Usage: config.UsernameUsage, + Required: true, }, &cli.StringFlag{ - Name: config.EmailFlag, - Usage: config.EmailUsage, + Name: config.EmailFlag, + Usage: config.EmailUsage, + Required: true, }, &cli.StringFlag{ - Name: config.PasswordFlag, - Usage: config.PasswordUsage, + Name: config.PasswordFlag, + Usage: config.PasswordUsage, + Required: true, }, }, Action: func(c *cli.Context) error { @@ -60,8 +64,9 @@ func adminCommands() []*cli.Command { Usage: "confirm an existing account manually, thereby skipping email confirmation", Flags: []cli.Flag{ &cli.StringFlag{ - Name: config.UsernameFlag, - Usage: config.UsernameUsage, + Name: config.UsernameFlag, + Usage: config.UsernameUsage, + Required: true, }, }, Action: func(c *cli.Context) error { @@ -73,8 +78,9 @@ func adminCommands() []*cli.Command { Usage: "promote an account to admin", Flags: []cli.Flag{ &cli.StringFlag{ - Name: config.UsernameFlag, - Usage: config.UsernameUsage, + Name: config.UsernameFlag, + Usage: config.UsernameUsage, + Required: true, }, }, Action: func(c *cli.Context) error { @@ -86,8 +92,9 @@ func adminCommands() []*cli.Command { Usage: "demote an account from admin to normal user", Flags: []cli.Flag{ &cli.StringFlag{ - Name: config.UsernameFlag, - Usage: config.UsernameUsage, + Name: config.UsernameFlag, + Usage: config.UsernameUsage, + Required: true, }, }, Action: func(c *cli.Context) error { @@ -99,8 +106,9 @@ func adminCommands() []*cli.Command { Usage: "prevent an account from signing in or posting etc, but don't delete anything", Flags: []cli.Flag{ &cli.StringFlag{ - Name: config.UsernameFlag, - Usage: config.UsernameUsage, + Name: config.UsernameFlag, + Usage: config.UsernameUsage, + Required: true, }, }, Action: func(c *cli.Context) error { @@ -112,8 +120,9 @@ func adminCommands() []*cli.Command { Usage: "completely remove an account and all of its posts, media, etc", Flags: []cli.Flag{ &cli.StringFlag{ - Name: config.UsernameFlag, - Usage: config.UsernameUsage, + Name: config.UsernameFlag, + Usage: config.UsernameUsage, + Required: true, }, }, Action: func(c *cli.Context) error { @@ -125,12 +134,14 @@ func adminCommands() []*cli.Command { Usage: "set a new password for the given account", Flags: []cli.Flag{ &cli.StringFlag{ - Name: config.UsernameFlag, - Usage: config.UsernameUsage, + Name: config.UsernameFlag, + Usage: config.UsernameUsage, + Required: true, }, &cli.StringFlag{ - Name: config.PasswordFlag, - Usage: config.PasswordUsage, + Name: config.PasswordFlag, + Usage: config.PasswordUsage, + Required: true, }, }, Action: func(c *cli.Context) error { @@ -139,6 +150,34 @@ func adminCommands() []*cli.Command { }, }, }, + { + Name: "export", + Usage: "export data from the database to file at the given path", + Flags: []cli.Flag{ + &cli.StringFlag{ + Name: config.TransPathFlag, + Usage: config.TransPathUsage, + Required: true, + }, + }, + Action: func(c *cli.Context) error { + return runAction(c, trans.Export) + }, + }, + { + Name: "import", + Usage: "import data from a file into the database", + Flags: []cli.Flag{ + &cli.StringFlag{ + Name: config.TransPathFlag, + Usage: config.TransPathUsage, + Required: true, + }, + }, + Action: func(c *cli.Context) error { + return runAction(c, trans.Import) + }, + }, }, }, } |