Create session for manual follow approve if needed

merge-requests/30/head
Bob Mottram 2022-03-13 20:38:08 +00:00
parent 74dc33b96a
commit ed820dbcfc
3 changed files with 17 additions and 6 deletions

View File

@ -8548,7 +8548,7 @@ class PubServer(BaseHTTPRequestHandler):
port = 80
curr_session = \
self._establish_session("followApproveButton",
self._establish_session("follow_approve_button",
curr_session, proxy_type)
if not curr_session:
print('WARN: unable to establish session ' +
@ -8573,7 +8573,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.person_cache,
debug,
self.server.project_version,
signing_priv_key_pem)
signing_priv_key_pem,
proxy_type)
origin_path_str_absolute = \
http_prefix + '://' + domain_full + origin_path_str
if calling_domain.endswith('.onion') and onion_domain:

View File

@ -1293,7 +1293,7 @@ if args.approve:
send_threads, postLog,
cached_webfingers, person_cache,
debug, __version__,
signing_priv_key_pem)
signing_priv_key_pem, proxy_type)
sys.exit()
if args.deny:

View File

@ -17,6 +17,7 @@ from utils import get_port_from_domain
from utils import get_user_paths
from utils import acct_dir
from threads import thread_with_trace
from session import create_session
def manual_deny_follow_request(session, session_onion, session_i2p,
@ -136,7 +137,8 @@ def manual_approve_follow_request(session, session_onion, session_i2p,
cached_webfingers: {}, person_cache: {},
debug: bool,
project_version: str,
signing_priv_key_pem: str) -> None:
signing_priv_key_pem: str,
proxy_type: str) -> None:
"""Manually approve a follow request
"""
handle = nickname + '@' + domain
@ -218,6 +220,7 @@ def manual_approve_follow_request(session, session_onion, session_i2p,
curr_port = port
curr_session = session
curr_http_prefix = http_prefix
curr_proxy_type = proxy_type
if onion_domain and \
approve_domain.endswith('.onion'):
curr_domain = onion_domain
@ -225,6 +228,7 @@ def manual_approve_follow_request(session, session_onion, session_i2p,
approve_port = 80
curr_session = session_onion
curr_http_prefix = 'http'
curr_proxy_type = 'tor'
elif (i2p_domain and
approve_domain.endswith('.i2p')):
curr_domain = i2p_domain
@ -232,6 +236,10 @@ def manual_approve_follow_request(session, session_onion, session_i2p,
approve_port = 80
curr_session = session_i2p
curr_http_prefix = 'http'
curr_proxy_type = 'i2p'
if not curr_session:
curr_session = create_session(curr_proxy_type)
print('Manual follow accept: Sending Accept for ' +
handle + ' follow request from ' +
@ -323,7 +331,8 @@ def manual_approve_follow_request_thread(session, session_onion, session_i2p,
person_cache: {},
debug: bool,
project_version: str,
signing_priv_key_pem: str) -> None:
signing_priv_key_pem: str,
proxy_type: str) -> None:
"""Manually approve a follow request, in a thread so as not to cause
the UI to lag
"""
@ -340,6 +349,7 @@ def manual_approve_follow_request_thread(session, session_onion, session_i2p,
cached_webfingers, person_cache,
debug,
project_version,
signing_priv_key_pem), daemon=True)
signing_priv_key_pem,
proxy_type), daemon=True)
thr.start()
send_threads.append(thr)