Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import export #194

Merged
merged 35 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ea00ba6
start with export/import code
tsmethurst Sep 6, 2021
7d371eb
messing about with decoding/encoding
tsmethurst Sep 7, 2021
fb17c33
some more fiddling
tsmethurst Sep 7, 2021
1a836de
stuff is WORKING
tsmethurst Sep 7, 2021
f1e60e7
working pretty alright!
tsmethurst Sep 7, 2021
9191e96
go fmt
tsmethurst Sep 7, 2021
da8e1cd
fix up tests, add docs
tsmethurst Sep 8, 2021
8cd327d
start backup/restore doc
tsmethurst Sep 8, 2021
11c7620
tweaks
tsmethurst Sep 8, 2021
1ca0a16
credits
tsmethurst Sep 8, 2021
5f322e0
update advancedVisibility settings
tsmethurst Sep 8, 2021
bdcc090
update bun library -> v1.0.4
NyaaaWhatsUpDoc Sep 8, 2021
fce3ba6
update oauth library -> v4.3.1-SSB
NyaaaWhatsUpDoc Sep 8, 2021
299801f
Merge pull request #195 from NyaaaWhatsUpDoc/update/bun-library
NyaaaWhatsUpDoc Sep 8, 2021
d2a85f2
handle oauth token scope, fix user.SigninCount + token.UserID
NyaaaWhatsUpDoc Sep 8, 2021
0ea131f
update oauth library --> v4.3.2-SSB
NyaaaWhatsUpDoc Sep 8, 2021
151069c
Merge remote-tracking branch 'upstream/main' into update/oauth-library
NyaaaWhatsUpDoc Sep 8, 2021
71a4f86
update sqlite library -> v1.13.0
NyaaaWhatsUpDoc Sep 8, 2021
6a2d0d9
Merge remote-tracking branch 'upstream/main' into update/sqlite-library
NyaaaWhatsUpDoc Sep 8, 2021
f44cc51
Merge pull request #196 from NyaaaWhatsUpDoc/update/oauth-library
NyaaaWhatsUpDoc Sep 8, 2021
a027da0
Merge pull request #198 from NyaaaWhatsUpDoc/update/sqlite-library
NyaaaWhatsUpDoc Sep 8, 2021
3db03ab
review changes
tsmethurst Sep 9, 2021
2ec3634
start with export/import code
tsmethurst Sep 6, 2021
3641d47
messing about with decoding/encoding
tsmethurst Sep 7, 2021
11d64db
some more fiddling
tsmethurst Sep 7, 2021
a125327
stuff is WORKING
tsmethurst Sep 7, 2021
7e80eaf
working pretty alright!
tsmethurst Sep 7, 2021
28f8989
go fmt
tsmethurst Sep 7, 2021
e2d97c1
fix up tests, add docs
tsmethurst Sep 8, 2021
22da478
start backup/restore doc
tsmethurst Sep 8, 2021
62d98f7
tweaks
tsmethurst Sep 8, 2021
0852b20
credits
tsmethurst Sep 8, 2021
6114917
update advancedVisibility settings
tsmethurst Sep 8, 2021
2f44633
review changes
tsmethurst Sep 9, 2021
ca79bc4
Merge branch 'import_export' of github.com:superseriousbusiness/gotos…
tsmethurst Sep 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ The following libraries and frameworks are used by GoToSocial, with gratitude
* [gorilla/websocket](https://github.com/gorilla/websocket); Websocket connectivity. [BSD-2-Clause License](https://spdx.org/licenses/BSD-2-Clause.html).
* [h2non/filetype](https://github.com/h2non/filetype); filetype checking. [MIT License](https://spdx.org/licenses/MIT.html).
* [jackc/pgx](https://github.com/jackc/pgx); Postgres driver. [MIT License](https://spdx.org/licenses/MIT.html).
* [microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday); HTML user-input sanitization. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
* [mitchellh/mapstructure](https://github.com/mitchellh/mapstructure); Go interface => struct parsing. [MIT License](https://spdx.org/licenses/MIT.html).
* [modernc.org/sqlite](https://gitlab.com/cznic/sqlite); cgo-free port of SQLite. [Other License](https://gitlab.com/cznic/sqlite/-/blob/master/LICENSE).
* [modernc.org/ccgo](https://gitlab.com/cznic/ccgo); c99 AST -> Go translater. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
* [modernc.org/libc](https://gitlab.com/cznic/libc); C-runtime services. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
* [microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday); HTML user-input sanitization. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
* [mvdan/xurls](https://github.com/mvdan/xurls); URL parsing regular expressions. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
* [nfnt/resize](https://github.com/nfnt/resize); convenient image resizing. [ISC License](https://spdx.org/licenses/ISC.html).
* [oklog/ulid](https://github.com/oklog/ulid); sequential, database-friendly ID generation. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
Expand Down
79 changes: 59 additions & 20 deletions cmd/gotosocial/admincommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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)
},
},
},
},
}
Expand Down
Loading