From 2dd2324b1ffcbe387777f6cca91d8a2be2ca720f Mon Sep 17 00:00:00 2001 From: SimplifiedPrivacy Date: Tue, 23 Jun 2026 19:28:27 -0400 Subject: [PATCH] Tor Folder adjustment on new features to match legacy's patterns --- core/controllers/ConnectionController.py | 7 +++++++ core/services/networking/use_tor.py | 7 ++++--- pyproject.toml | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/controllers/ConnectionController.py b/core/controllers/ConnectionController.py index f4a7686..29f7386 100644 --- a/core/controllers/ConnectionController.py +++ b/core/controllers/ConnectionController.py @@ -144,8 +144,15 @@ class ConnectionController: if profile.connection.code == 'tor': + print("starting tor connection...") + port_number = ConnectionService.get_random_available_port_number() + + print(f"port_number is {port_number}") + ConnectionController.establish_tor_session_connection(port_number, connection_observer=connection_observer) + print(f"finished with establish_tor_session_connection") + session_state.network_port_numbers.tor.append(port_number) elif profile.connection.code == 'wireguard': diff --git a/core/services/networking/use_tor.py b/core/services/networking/use_tor.py index 7f8483d..7479a7c 100644 --- a/core/services/networking/use_tor.py +++ b/core/services/networking/use_tor.py @@ -15,6 +15,7 @@ from core.errors.logger import logger # generic import json, os from typing import Any +from core.Constants import Constants def tor_get_request(custom_url: str, connection_observer: ConnectionObserver) -> dict: @@ -24,7 +25,7 @@ def tor_get_request(custom_url: str, connection_observer: ConnectionObserver) -> logger.debug(f"Using Tor on port number {port_number}") try: - tor_module = TorModule(os.path.expanduser("~/sp-tor-test")) + tor_module = TorModule(Constants.HV_TOR_STATE_HOME) tor_module.create_session(port_number, connection_observer) @@ -34,7 +35,7 @@ def tor_get_request(custom_url: str, connection_observer: ConnectionObserver) -> } logger.debug(f"Doing Request through Tor via port {port_number}") - response = requests.get(custom_url, proxies=proxies) + response = requests.get(custom_url, proxies=proxies, timeout=5) logger.debug("Request through Tor successful.") # if it crashes from the above error check, then it won't destroy the proxy, @@ -83,7 +84,7 @@ def tor_post_request( logger.debug(f"Using Tor on port number {port_number}") try: - tor_module = TorModule(os.path.expanduser("~/sp-tor-test")) + tor_module = TorModule(Constants.HV_TOR_STATE_HOME) tor_module.create_session(port_number, connection_observer) diff --git a/pyproject.toml b/pyproject.toml index cf2bb84..b0894f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dependencies = [ "pysocks ~= 1.7.1", "python-dateutil ~= 2.9.0.post0", "requests ~= 2.32.5", - "sp-essentials ~= 1.0.0", + "sp-essentials ~= 1.1.0", "annotated-types==0.7.0", "certifi==2026.4.22", "charset-normalizer==3.4.7", @@ -38,6 +38,7 @@ dependencies = [ "pydeps==3.0.6", "pytokens==0.4.1", "stdlib-list==0.12.0", + "SQLAlchemy==2.0.51", "toolz==1.1.0", "typing-inspect==0.9.0", "typing-inspection==0.4.2",