diff --git a/changelog.yaml b/changelog.yaml index 47ae919..96e7938 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -5,6 +5,7 @@ - "Add `--scheduled-at` option to `toot post`, allows scheduling toots" - "Add `--description` option to `toot post`, for adding descriptions to media attachments (thanks @ansuz)" - "Add `--mentions` option to `toot notifications` to show only mentions (thanks @alexwennerberg)" + - "Add `--content-type` option to `toot post` to allow specifying mime type, used on Pleroma (thanks Sandra Snan)" - "Allow post IDs to be strings as used on Pleroma (thanks Sandra Snan)" - "TUI: Allow posts longer than 500 characters if so configured on the server (thanks Sandra Snan)" - "Allow piping the password to login_cli for testing purposes (thanks @NinjaTrappeur)" diff --git a/toot/api.py b/toot/api.py index da5f6f0..a499a7b 100644 --- a/toot/api.py +++ b/toot/api.py @@ -93,6 +93,7 @@ def post_status( in_reply_to_id=None, language=None, scheduled_at=None, + content_type=None, ): """ Posts a new status. @@ -103,7 +104,7 @@ def post_status( # if the request is retried. headers = {"Idempotency-Key": uuid.uuid4().hex} - return http.post(app, user, '/api/v1/statuses', { + params = { 'status': status, 'media_ids[]': media_ids, 'visibility': visibility, @@ -112,7 +113,12 @@ def post_status( 'in_reply_to_id': in_reply_to_id, 'language': language, 'scheduled_at': scheduled_at - }, headers=headers).json() + } + + if content_type: + params['content_type'] = content_type + + return http.post(app, user, '/api/v1/statuses', params, headers=headers).json() def delete_status(app, user, status_id): diff --git a/toot/commands.py b/toot/commands.py index 7d8e37e..36109be 100644 --- a/toot/commands.py +++ b/toot/commands.py @@ -120,6 +120,7 @@ def post(app, user, args): in_reply_to_id=args.reply_to, language=args.language, scheduled_at=args.scheduled_at, + content_type=args.content_type ) if "scheduled_at" in response: diff --git a/toot/console.py b/toot/console.py index 6a004ca..e90a808 100644 --- a/toot/console.py +++ b/toot/console.py @@ -337,6 +337,10 @@ POST_COMMANDS = [ "help": "ISO 8601 Datetime at which to schedule a status. Must " "be at least 5 minutes in the future.", }), + (["-t", "--content-type"], { + "type": str, + "help": "MIME type for the status text (not supported on all instances)", + }), ], require_auth=True, ),