mirror of https://gitlab.com/bashrc2/epicyon
Send follow requests using the appropriate session
parent
1119f10140
commit
ca24fa3265
23
daemon.py
23
daemon.py
|
@ -3275,14 +3275,31 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
follower_nickname + ' to ' + following_actor)
|
follower_nickname + ' to ' + following_actor)
|
||||||
if not self.server.signing_priv_key_pem:
|
if not self.server.signing_priv_key_pem:
|
||||||
print('Sending follow request with no signing key')
|
print('Sending follow request with no signing key')
|
||||||
|
|
||||||
|
curr_domain = domain
|
||||||
|
curr_port = port
|
||||||
|
curr_http_prefix = http_prefix
|
||||||
|
if onion_domain:
|
||||||
|
if following_domain.endswith('.onion'):
|
||||||
|
curr_session = self.server.session_onion
|
||||||
|
curr_domain = onion_domain
|
||||||
|
curr_port = 80
|
||||||
|
curr_http_prefix = 'http'
|
||||||
|
if i2p_domain:
|
||||||
|
if following_domain.endswith('.i2p'):
|
||||||
|
curr_session = self.server.session_i2p
|
||||||
|
curr_domain = i2p_domain
|
||||||
|
curr_port = 80
|
||||||
|
curr_http_prefix = 'http'
|
||||||
|
|
||||||
send_follow_request(curr_session,
|
send_follow_request(curr_session,
|
||||||
base_dir, follower_nickname,
|
base_dir, follower_nickname,
|
||||||
domain, port,
|
domain, curr_domain, curr_port,
|
||||||
http_prefix,
|
curr_http_prefix,
|
||||||
following_nickname,
|
following_nickname,
|
||||||
following_domain,
|
following_domain,
|
||||||
following_actor,
|
following_actor,
|
||||||
following_port, http_prefix,
|
following_port, curr_http_prefix,
|
||||||
False, self.server.federation_list,
|
False, self.server.federation_list,
|
||||||
self.server.send_threads,
|
self.server.send_threads,
|
||||||
self.server.postLog,
|
self.server.postLog,
|
||||||
|
|
|
@ -852,7 +852,8 @@ def followed_account_rejects(session, base_dir: str, http_prefix: str,
|
||||||
|
|
||||||
|
|
||||||
def send_follow_request(session, base_dir: str,
|
def send_follow_request(session, base_dir: str,
|
||||||
nickname: str, domain: str, port: int,
|
nickname: str, domain: str,
|
||||||
|
sender_domain: str, sender_port: int,
|
||||||
http_prefix: str,
|
http_prefix: str,
|
||||||
follow_nickname: str, follow_domain: str,
|
follow_nickname: str, follow_domain: str,
|
||||||
followedActor: str,
|
followedActor: str,
|
||||||
|
@ -870,7 +871,7 @@ def send_follow_request(session, base_dir: str,
|
||||||
print('You are not permitted to follow the domain ' + follow_domain)
|
print('You are not permitted to follow the domain ' + follow_domain)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
full_domain = get_full_domain(domain, port)
|
full_domain = get_full_domain(sender_domain, sender_port)
|
||||||
follow_actor = local_actor_url(http_prefix, nickname, full_domain)
|
follow_actor = local_actor_url(http_prefix, nickname, full_domain)
|
||||||
|
|
||||||
request_domain = get_full_domain(follow_domain, followPort)
|
request_domain = get_full_domain(follow_domain, followPort)
|
||||||
|
@ -934,7 +935,7 @@ def send_follow_request(session, base_dir: str,
|
||||||
follow_handle, debug)
|
follow_handle, debug)
|
||||||
|
|
||||||
send_signed_json(new_follow_json, session, base_dir,
|
send_signed_json(new_follow_json, session, base_dir,
|
||||||
nickname, domain, port,
|
nickname, sender_domain, sender_port,
|
||||||
follow_nickname, follow_domain, followPort,
|
follow_nickname, follow_domain, followPort,
|
||||||
'https://www.w3.org/ns/activitystreams#Public',
|
'https://www.w3.org/ns/activitystreams#Public',
|
||||||
http_prefix, True, client_to_server,
|
http_prefix, True, client_to_server,
|
||||||
|
|
12
tests.py
12
tests.py
|
@ -1590,7 +1590,8 @@ def test_follow_between_servers(base_dir: str) -> None:
|
||||||
signing_priv_key_pem = None
|
signing_priv_key_pem = None
|
||||||
send_result = \
|
send_result = \
|
||||||
send_follow_request(session_alice, alice_dir,
|
send_follow_request(session_alice, alice_dir,
|
||||||
'alice', alice_domain, alice_port, http_prefix,
|
'alice', alice_domain,
|
||||||
|
alice_domain, alice_port, http_prefix,
|
||||||
'bob', bob_domain, bob_actor,
|
'bob', bob_domain, bob_actor,
|
||||||
bob_port, http_prefix,
|
bob_port, http_prefix,
|
||||||
client_to_server, federation_list,
|
client_to_server, federation_list,
|
||||||
|
@ -1810,7 +1811,8 @@ def test_shared_items_federation(base_dir: str) -> None:
|
||||||
bob_actor = http_prefix + '://' + bob_address + '/users/bob'
|
bob_actor = http_prefix + '://' + bob_address + '/users/bob'
|
||||||
send_result = \
|
send_result = \
|
||||||
send_follow_request(session_alice, alice_dir,
|
send_follow_request(session_alice, alice_dir,
|
||||||
'alice', alice_domain, alice_port, http_prefix,
|
'alice', alice_domain,
|
||||||
|
alice_domain, alice_port, http_prefix,
|
||||||
'bob', bob_domain, bob_actor,
|
'bob', bob_domain, bob_actor,
|
||||||
bob_port, http_prefix,
|
bob_port, http_prefix,
|
||||||
client_to_server, federation_list,
|
client_to_server, federation_list,
|
||||||
|
@ -2261,7 +2263,8 @@ def test_group_follow(base_dir: str) -> None:
|
||||||
signing_priv_key_pem = None
|
signing_priv_key_pem = None
|
||||||
send_result = \
|
send_result = \
|
||||||
send_follow_request(session_alice, alice_dir,
|
send_follow_request(session_alice, alice_dir,
|
||||||
'alice', alice_domain, alice_port, http_prefix,
|
'alice', alice_domain,
|
||||||
|
alice_domain, alice_port, http_prefix,
|
||||||
'testgroup', testgroup_domain, testgroup_actor,
|
'testgroup', testgroup_domain, testgroup_actor,
|
||||||
testgroupPort, http_prefix,
|
testgroupPort, http_prefix,
|
||||||
client_to_server, federation_list,
|
client_to_server, federation_list,
|
||||||
|
@ -2338,7 +2341,8 @@ def test_group_follow(base_dir: str) -> None:
|
||||||
signing_priv_key_pem = None
|
signing_priv_key_pem = None
|
||||||
send_result = \
|
send_result = \
|
||||||
send_follow_request(session_bob, bob_dir,
|
send_follow_request(session_bob, bob_dir,
|
||||||
'bob', bob_domain, bob_port, http_prefix,
|
'bob', bob_domain,
|
||||||
|
bob_domain, bob_port, http_prefix,
|
||||||
'testgroup', testgroup_domain, testgroup_actor,
|
'testgroup', testgroup_domain, testgroup_actor,
|
||||||
testgroupPort, http_prefix,
|
testgroupPort, http_prefix,
|
||||||
client_to_server, federation_list,
|
client_to_server, federation_list,
|
||||||
|
|
Loading…
Reference in New Issue