Add --content-type option to toot post

This commit is contained in:
Sandra Snan 2021-08-28 21:08:44 +02:00 committed by Ivan Habunek
parent fb505a160c
commit 9e046b6d86
No known key found for this signature in database
GPG Key ID: CDBD63C43A30BB95
4 changed files with 14 additions and 2 deletions

View File

@ -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)"

View File

@ -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):

View File

@ -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:

View File

@ -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,
),