From ba0518eb566bd6bd814c3e25839e61532eac4ea9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 12 Jun 2022 23:14:47 +0100 Subject: [PATCH] Tidying --- daemon.py | 4 ++-- outbox.py | 5 ++--- shares.py | 13 ++++--------- tests.py | 2 +- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/daemon.py b/daemon.py index 0e5f7508b..d29c90af0 100644 --- a/daemon.py +++ b/daemon.py @@ -4551,7 +4551,7 @@ class PubServer(BaseHTTPRequestHandler): get_domain_from_actor(share_actor) remove_shared_item(base_dir, share_nickname, share_domain, item_id, - http_prefix, domain_full, 'shares') + 'shares') if calling_domain.endswith('.onion') and onion_domain: origin_path_str = 'http://' + onion_domain + users_path @@ -4624,7 +4624,7 @@ class PubServer(BaseHTTPRequestHandler): get_domain_from_actor(share_actor) remove_shared_item(base_dir, share_nickname, share_domain, item_id, - http_prefix, domain_full, 'wanted') + 'wanted') if calling_domain.endswith('.onion') and onion_domain: origin_path_str = 'http://' + onion_domain + users_path diff --git a/outbox.py b/outbox.py index b423c666c..bcd0a072f 100644 --- a/outbox.py +++ b/outbox.py @@ -656,9 +656,8 @@ def post_message_to_outbox(session, translate: {}, if debug: print('DEBUG: handle undo share uploads') - outbox_undo_share_upload(base_dir, http_prefix, - post_to_nickname, domain, - port, message_json, debug) + outbox_undo_share_upload(base_dir, post_to_nickname, domain, + message_json, debug) if debug: print('DEBUG: handle actor updates from c2s') diff --git a/shares.py b/shares.py index 548838958..850039c8b 100644 --- a/shares.py +++ b/shares.py @@ -119,9 +119,7 @@ def _get_valid_shared_item_id(actor: str, display_name: str) -> str: def remove_shared_item(base_dir: str, nickname: str, domain: str, - item_id: str, - http_prefix: str, domain_full: str, - shares_file_type: str) -> None: + item_id: str, shares_file_type: str) -> None: """Removes a share for a person """ shares_filename = \ @@ -992,8 +990,7 @@ def send_undo_wanted_via_server(base_dir: str, session, return undo_share_json -def get_shared_items_catalog_via_server(base_dir, session, - nickname: str, password: str, +def get_shared_items_catalog_via_server(session, nickname: str, password: str, domain: str, port: int, http_prefix: str, debug: bool, signing_priv_key_pem: str) -> {}: @@ -1100,8 +1097,7 @@ def outbox_share_upload(base_dir: str, http_prefix: str, print('DEBUG: shared item received via c2s') -def outbox_undo_share_upload(base_dir: str, http_prefix: str, - nickname: str, domain: str, port: int, +def outbox_undo_share_upload(base_dir: str, nickname: str, domain: str, message_json: {}, debug: bool) -> None: """ When a shared item is removed via c2s """ @@ -1119,10 +1115,9 @@ def outbox_undo_share_upload(base_dir: str, http_prefix: str, if debug: print('DEBUG: displayName missing from Offer') return - domain_full = get_full_domain(domain, port) remove_shared_item(base_dir, nickname, domain, message_json['object']['displayName'], - http_prefix, domain_full, 'shares') + 'shares') if debug: print('DEBUG: shared item removed via c2s') diff --git a/tests.py b/tests.py index 3ddfea801..b1cb3618e 100644 --- a/tests.py +++ b/tests.py @@ -1994,7 +1994,7 @@ def test_shared_items_federation(base_dir: str) -> None: print('Bob can read the shared items catalog on his own instance') signing_priv_key_pem = None catalog_json = \ - get_shared_items_catalog_via_server(bob_dir, session_bob, + get_shared_items_catalog_via_server(session_bob, 'bob', bob_password, bob_domain, bob_port, http_prefix, True,