Tor Folder adjustment on new features to match legacy's patterns

This commit is contained in:
SimplifiedPrivacy 2026-06-23 19:28:27 -04:00
parent 28d4f3d276
commit 2dd2324b1f
3 changed files with 13 additions and 4 deletions

View file

@ -144,8 +144,15 @@ class ConnectionController:
if profile.connection.code == 'tor': if profile.connection.code == 'tor':
print("starting tor connection...")
port_number = ConnectionService.get_random_available_port_number() 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) 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) session_state.network_port_numbers.tor.append(port_number)
elif profile.connection.code == 'wireguard': elif profile.connection.code == 'wireguard':

View file

@ -15,6 +15,7 @@ from core.errors.logger import logger
# generic # generic
import json, os import json, os
from typing import Any from typing import Any
from core.Constants import Constants
def tor_get_request(custom_url: str, connection_observer: ConnectionObserver) -> dict: 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}") logger.debug(f"Using Tor on port number {port_number}")
try: 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) 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}") 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.") logger.debug("Request through Tor successful.")
# if it crashes from the above error check, then it won't destroy the proxy, # 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}") logger.debug(f"Using Tor on port number {port_number}")
try: 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) tor_module.create_session(port_number, connection_observer)

View file

@ -18,7 +18,7 @@ dependencies = [
"pysocks ~= 1.7.1", "pysocks ~= 1.7.1",
"python-dateutil ~= 2.9.0.post0", "python-dateutil ~= 2.9.0.post0",
"requests ~= 2.32.5", "requests ~= 2.32.5",
"sp-essentials ~= 1.0.0", "sp-essentials ~= 1.1.0",
"annotated-types==0.7.0", "annotated-types==0.7.0",
"certifi==2026.4.22", "certifi==2026.4.22",
"charset-normalizer==3.4.7", "charset-normalizer==3.4.7",
@ -38,6 +38,7 @@ dependencies = [
"pydeps==3.0.6", "pydeps==3.0.6",
"pytokens==0.4.1", "pytokens==0.4.1",
"stdlib-list==0.12.0", "stdlib-list==0.12.0",
"SQLAlchemy==2.0.51",
"toolz==1.1.0", "toolz==1.1.0",
"typing-inspect==0.9.0", "typing-inspect==0.9.0",
"typing-inspection==0.4.2", "typing-inspection==0.4.2",