summaryrefslogtreecommitdiff
path: root/cmd/gotosocial/action/admin/media
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-08-13 12:24:40 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-08-13 12:24:40 +0200
commit7f8cb204cd5a58eb143ab20a21bfa32bd8c3c26b (patch)
treee8a10032b73bd1c60df5c8e8fdf7817410d67e1a /cmd/gotosocial/action/admin/media
parent[chore] bump to code.superseriousbusiness.org/oauth2/v4@ssb-v4.5.3-2 (#4367) (diff)
downloadgotosocial-7f8cb204cd5a58eb143ab20a21bfa32bd8c3c26b.tar.xz
[feature] 2fa management via CLI (#4368)
Adds 2FA management to the admin CLI. Also does some CLI refactoring so the functions we pass around are exported functions instead of changeable global variables. closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4320 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4368 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'cmd/gotosocial/action/admin/media')
-rw-r--r--cmd/gotosocial/action/admin/media/list.go8
-rw-r--r--cmd/gotosocial/action/admin/media/prune/all.go5
-rw-r--r--cmd/gotosocial/action/admin/media/prune/orphaned.go5
-rw-r--r--cmd/gotosocial/action/admin/media/prune/remote.go5
4 files changed, 18 insertions, 5 deletions
diff --git a/cmd/gotosocial/action/admin/media/list.go b/cmd/gotosocial/action/admin/media/list.go
index a07bf4145..8b8df204b 100644
--- a/cmd/gotosocial/action/admin/media/list.go
+++ b/cmd/gotosocial/action/admin/media/list.go
@@ -35,6 +35,10 @@ import (
"code.superseriousbusiness.org/gotosocial/internal/state"
)
+// check function conformance.
+var _ action.GTSAction = ListAttachments
+var _ action.GTSAction = ListEmojis
+
type list struct {
dbService db.DB
state *state.State
@@ -155,7 +159,7 @@ func (l *list) shutdown() error {
}
// ListAttachments lists local, remote, or all attachment paths.
-var ListAttachments action.GTSAction = func(ctx context.Context) error {
+func ListAttachments(ctx context.Context) error {
list, err := setupList(ctx)
if err != nil {
return err
@@ -214,7 +218,7 @@ var ListAttachments action.GTSAction = func(ctx context.Context) error {
}
// ListEmojis lists local, remote, or all emoji filepaths.
-var ListEmojis action.GTSAction = func(ctx context.Context) error {
+func ListEmojis(ctx context.Context) error {
list, err := setupList(ctx)
if err != nil {
return err
diff --git a/cmd/gotosocial/action/admin/media/prune/all.go b/cmd/gotosocial/action/admin/media/prune/all.go
index 9c2a6a99f..f030517e7 100644
--- a/cmd/gotosocial/action/admin/media/prune/all.go
+++ b/cmd/gotosocial/action/admin/media/prune/all.go
@@ -26,8 +26,11 @@ import (
"code.superseriousbusiness.org/gotosocial/internal/log"
)
+// check function conformance.
+var _ action.GTSAction = All
+
// All performs all media clean actions
-var All action.GTSAction = func(ctx context.Context) error {
+func All(ctx context.Context) error {
// Setup pruning utilities.
prune, err := setupPrune(ctx)
if err != nil {
diff --git a/cmd/gotosocial/action/admin/media/prune/orphaned.go b/cmd/gotosocial/action/admin/media/prune/orphaned.go
index 4894e8900..a58485455 100644
--- a/cmd/gotosocial/action/admin/media/prune/orphaned.go
+++ b/cmd/gotosocial/action/admin/media/prune/orphaned.go
@@ -26,8 +26,11 @@ import (
"code.superseriousbusiness.org/gotosocial/internal/log"
)
+// check function conformance.
+var _ action.GTSAction = Orphaned
+
// Orphaned prunes orphaned media from storage.
-var Orphaned action.GTSAction = func(ctx context.Context) error {
+func Orphaned(ctx context.Context) error {
// Setup pruning utilities.
prune, err := setupPrune(ctx)
if err != nil {
diff --git a/cmd/gotosocial/action/admin/media/prune/remote.go b/cmd/gotosocial/action/admin/media/prune/remote.go
index fdb3a3ce9..270c9baaf 100644
--- a/cmd/gotosocial/action/admin/media/prune/remote.go
+++ b/cmd/gotosocial/action/admin/media/prune/remote.go
@@ -27,8 +27,11 @@ import (
"code.superseriousbusiness.org/gotosocial/internal/log"
)
+// check function conformance.
+var _ action.GTSAction = Remote
+
// Remote prunes old and/or unused remote media.
-var Remote action.GTSAction = func(ctx context.Context) error {
+func Remote(ctx context.Context) error {
// Setup pruning utilities.
prune, err := setupPrune(ctx)
if err != nil {