limit public toot to local_only
This commit is contained in:
parent
32860bbe82
commit
b480033935
2 changed files with 4 additions and 3 deletions
|
@ -227,7 +227,7 @@ def create_update_mark(request):
|
||||||
words = BookMarkStatusTranslator(int(form.cleaned_data['status'])) +\
|
words = BookMarkStatusTranslator(int(form.cleaned_data['status'])) +\
|
||||||
f"《{book.title}》" + rating_to_emoji(form.cleaned_data['rating'])
|
f"《{book.title}》" + rating_to_emoji(form.cleaned_data['rating'])
|
||||||
content = words + '\n' + url + '\n' + form.cleaned_data['text']
|
content = words + '\n' + url + '\n' + form.cleaned_data['text']
|
||||||
post_toot(content, visibility, request.session['oauth_token'])
|
post_toot(content, visibility, request.session['oauth_token'], local_only=True)
|
||||||
else:
|
else:
|
||||||
return HttpResponseBadRequest()
|
return HttpResponseBadRequest()
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ def check_visibility(user_owned_entity, token, visitor):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def post_toot(content, visibility, token):
|
def post_toot(content, visibility, token, local_only=False):
|
||||||
url = 'https://' + MASTODON_DOMAIN_NAME + API_PUBLISH_TOOT
|
url = 'https://' + MASTODON_DOMAIN_NAME + API_PUBLISH_TOOT
|
||||||
headers = {
|
headers = {
|
||||||
'Authorization': f'Bearer {token}',
|
'Authorization': f'Bearer {token}',
|
||||||
|
@ -74,7 +74,8 @@ def post_toot(content, visibility, token):
|
||||||
}
|
}
|
||||||
payload = {
|
payload = {
|
||||||
'status': content,
|
'status': content,
|
||||||
'visibility': visibility
|
'visibility': visibility,
|
||||||
|
'local_only': local_only,
|
||||||
}
|
}
|
||||||
response = post(url, headers=headers, data=payload)
|
response = post(url, headers=headers, data=payload)
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Add table
Reference in a new issue