From 39d7a345ed907ceebdc6350a4b7656b62ca84ae4 Mon Sep 17 00:00:00 2001 From: Florian Obser Date: Fri, 21 Jul 2023 16:02:52 +0200 Subject: [PATCH 1/2] Implemented "muted" command This lists accounts the logged in user has muted. It is useful for creating regular backups. --- toot/api.py | 4 ++++ toot/commands.py | 5 +++++ toot/console.py | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/toot/api.py b/toot/api.py index f0857a9..ad0859e 100644 --- a/toot/api.py +++ b/toot/api.py @@ -521,6 +521,10 @@ def unmute(app, user, account): return _account_action(app, user, account, 'unmute') +def muted(app, user): + return _get_response_list(app, user, "/api/v1/mutes") + + def block(app, user, account): return _account_action(app, user, account, 'block') diff --git a/toot/commands.py b/toot/commands.py index f74e3e6..c1bf0ab 100644 --- a/toot/commands.py +++ b/toot/commands.py @@ -493,6 +493,11 @@ def unmute(app, user, args): print_out("✓ {} is no longer muted".format(args.account)) +def muted(app, user, args): + response = api.muted(app, user) + print_acct_list(response) + + def block(app, user, args): account = api.find_account(app, user, args.account) api.block(app, user, account['id']) diff --git a/toot/console.py b/toot/console.py index 3076517..db21926 100644 --- a/toot/console.py +++ b/toot/console.py @@ -704,6 +704,12 @@ ACCOUNTS_COMMANDS = [ ], require_auth=True, ), + Command( + name="muted", + description="List accounts the given account muted", + arguments=[], + require_auth=True, + ), Command( name="block", description="Block an account", From acc80f6890e04a4c23ed7e2b1baf6999c5cc9f5b Mon Sep 17 00:00:00 2001 From: Florian Obser Date: Fri, 21 Jul 2023 16:15:13 +0200 Subject: [PATCH 2/2] Implemented "blocked" command This lists accounts the logged in user has blocked. It is useful for creating regular backups. --- toot/api.py | 4 ++++ toot/commands.py | 5 +++++ toot/console.py | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/toot/api.py b/toot/api.py index ad0859e..a5d5a14 100644 --- a/toot/api.py +++ b/toot/api.py @@ -533,6 +533,10 @@ def unblock(app, user, account): return _account_action(app, user, account, 'unblock') +def blocked(app, user): + return _get_response_list(app, user, "/api/v1/blocks") + + def verify_credentials(app, user): return http.get(app, user, '/api/v1/accounts/verify_credentials').json() diff --git a/toot/commands.py b/toot/commands.py index c1bf0ab..57a9756 100644 --- a/toot/commands.py +++ b/toot/commands.py @@ -510,6 +510,11 @@ def unblock(app, user, args): print_out("✓ {} is no longer blocked".format(args.account)) +def blocked(app, user, args): + response = api.blocked(app, user) + print_acct_list(response) + + def whoami(app, user, args): account = api.verify_credentials(app, user) print_account(account) diff --git a/toot/console.py b/toot/console.py index db21926..ecfc03f 100644 --- a/toot/console.py +++ b/toot/console.py @@ -726,6 +726,12 @@ ACCOUNTS_COMMANDS = [ ], require_auth=True, ), + Command( + name="blocked", + description="List accounts the given account muted", + arguments=[], + require_auth=True, + ), ] TAG_COMMANDS = [