main
Bob Mottram 2024-05-08 11:44:38 +01:00
parent ff221fabfe
commit 9e16199344
3 changed files with 14 additions and 8 deletions

View File

@ -1,3 +1,5 @@
""" ActivityPub Accept or Reject json """
__filename__ = "acceptreject.py" __filename__ = "acceptreject.py"
__author__ = "Bob Mottram" __author__ = "Bob Mottram"
__license__ = "AGPL3+" __license__ = "AGPL3+"
@ -25,7 +27,7 @@ from utils import has_object_string_type
from utils import get_actor_from_post from utils import get_actor_from_post
def _create_accept_reject(base_dir: str, federation_list: [], def _create_accept_reject(federation_list: [],
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
to_url: str, cc_url: str, http_prefix: str, to_url: str, cc_url: str, http_prefix: str,
object_json: {}, accept_type: str) -> {}: object_json: {}, accept_type: str) -> {}:
@ -58,21 +60,23 @@ def _create_accept_reject(base_dir: str, federation_list: [],
return new_accept return new_accept
def create_accept(base_dir: str, federation_list: [], def create_accept(federation_list: [],
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
to_url: str, cc_url: str, http_prefix: str, to_url: str, cc_url: str, http_prefix: str,
object_json: {}) -> {}: object_json: {}) -> {}:
return _create_accept_reject(base_dir, federation_list, """ Create json for ActivityPub Accept """
return _create_accept_reject(federation_list,
nickname, domain, port, nickname, domain, port,
to_url, cc_url, http_prefix, to_url, cc_url, http_prefix,
object_json, 'Accept') object_json, 'Accept')
def create_reject(base_dir: str, federation_list: [], def create_reject(federation_list: [],
nickname: str, domain: str, port: int, nickname: str, domain: str, port: int,
to_url: str, cc_url: str, http_prefix: str, to_url: str, cc_url: str, http_prefix: str,
object_json: {}) -> {}: object_json: {}) -> {}:
return _create_accept_reject(base_dir, federation_list, """ Create json for ActivityPub Reject """
return _create_accept_reject(federation_list,
nickname, domain, port, nickname, domain, port,
to_url, cc_url, to_url, cc_url,
http_prefix, object_json, 'Reject') http_prefix, object_json, 'Reject')
@ -82,7 +86,7 @@ def _accept_follow(base_dir: str, message_json: {},
federation_list: [], debug: bool, federation_list: [], debug: bool,
curr_domain: str, curr_domain: str,
onion_domain: str, i2p_domain: str) -> None: onion_domain: str, i2p_domain: str) -> None:
"""Receiving a follow Accept activity """ Receiving an ActivityPub follow Accept activity
""" """
if not has_object_string_type(message_json, debug): if not has_object_string_type(message_json, debug):
return return

View File

@ -1,3 +1,5 @@
""" HTTP GET for buttons within the user interface """
__filename__ = "daemon_get_buttons.py" __filename__ = "daemon_get_buttons.py"
__author__ = "Bob Mottram" __author__ = "Bob Mottram"
__license__ = "AGPL3+" __license__ = "AGPL3+"

View File

@ -777,7 +777,7 @@ def followed_account_accepts(session, base_dir: str, http_prefix: str,
'follow request which arrived at ' + 'follow request which arrived at ' +
nickname_to_follow + '@' + domain_to_follow + nickname_to_follow + '@' + domain_to_follow +
' back to ' + accept_handle) ' back to ' + accept_handle)
accept_json = create_accept(base_dir, federation_list, accept_json = create_accept(federation_list,
nickname_to_follow, domain_to_follow, port, nickname_to_follow, domain_to_follow, port,
person_url, '', http_prefix, person_url, '', http_prefix,
follow_json) follow_json)
@ -864,7 +864,7 @@ def followed_account_rejects(session, session_onion, session_i2p,
# create the reject activity # create the reject activity
reject_json = \ reject_json = \
create_reject(base_dir, federation_list, create_reject(federation_list,
nickname_to_follow, domain_to_follow, port, nickname_to_follow, domain_to_follow, port,
person_url, '', http_prefix, follow_json) person_url, '', http_prefix, follow_json)
if debug: if debug: