atexit moved to ui repo
This commit is contained in:
parent
df751949a4
commit
7c291997b2
1 changed files with 0 additions and 69 deletions
|
|
@ -1,10 +1,8 @@
|
||||||
from core.services.networking.general_connection_tools.connection_enable import establish_connection
|
from core.services.networking.general_connection_tools.connection_enable import establish_connection
|
||||||
from core.controllers.ConfigurationController import ConfigurationController
|
from core.controllers.ConfigurationController import ConfigurationController
|
||||||
# from core.infrastructure.global_state import ProfileStateRepository
|
|
||||||
from core.controllers.ProfileController import ProfileController
|
from core.controllers.ProfileController import ProfileController
|
||||||
from core.controllers.SystemStateController import SystemStateController
|
from core.controllers.SystemStateController import SystemStateController
|
||||||
from core.controllers.SessionStateController import SessionStateController
|
from core.controllers.SessionStateController import SessionStateController
|
||||||
# from core.models.system.SystemState import SystemState
|
|
||||||
from core.models.enum_models import ProtocolChoice
|
from core.models.enum_models import ProtocolChoice
|
||||||
from core.models.Result import Result, ResultError
|
from core.models.Result import Result, ResultError
|
||||||
from core.services.networking.systemwide import killswitch
|
from core.services.networking.systemwide import killswitch
|
||||||
|
|
@ -21,71 +19,11 @@ from core.errors.logger import logger
|
||||||
# generic
|
# generic
|
||||||
from functools import partial
|
from functools import partial
|
||||||
import time
|
import time
|
||||||
# import atexit
|
|
||||||
|
|
||||||
|
|
||||||
SINGBOX_PROTOCOLS = (ProtocolChoice.HYSTERIA2, ProtocolChoice.VLESS)
|
SINGBOX_PROTOCOLS = (ProtocolChoice.HYSTERIA2, ProtocolChoice.VLESS)
|
||||||
|
|
||||||
|
|
||||||
# def is_systemwide_on() -> bool:
|
|
||||||
# """Returns a boolean if systemwide is connected. True is Yes, False is No"""
|
|
||||||
# state_repo = ProfileStateRepository()
|
|
||||||
# if not state_repo.global_state.verified_working:
|
|
||||||
# return False
|
|
||||||
|
|
||||||
# return state_repo.global_state.systemwide_active
|
|
||||||
|
|
||||||
|
|
||||||
# def verified_system_profile_id() -> int|None:
|
|
||||||
# state_repo = ProfileStateRepository()
|
|
||||||
# if not state_repo.global_state.verified_working:
|
|
||||||
# return False
|
|
||||||
# else:
|
|
||||||
# return state_repo.global_state.systemwide_profile_id
|
|
||||||
|
|
||||||
|
|
||||||
# def connected_system_profile_id() -> int|None:
|
|
||||||
# """Returns a single number of the connected system profile"""
|
|
||||||
# state_repo = ProfileStateRepository()
|
|
||||||
# print(f"state_repo is {state_repo.global_state}")
|
|
||||||
# return state_repo.global_state.systemwide_profile_id
|
|
||||||
|
|
||||||
# def connected_session_profile_ids() -> list|None:
|
|
||||||
# """Returns a list of the currently connected session profile IDs"""
|
|
||||||
# state_repo = ProfileStateRepository()
|
|
||||||
# return state_repo.active_session_ids
|
|
||||||
|
|
||||||
|
|
||||||
# def get_all_connected() -> list|None:
|
|
||||||
# profile_ids = connected_session_profile_ids()
|
|
||||||
# system = connected_system_profile_id()
|
|
||||||
# if system:
|
|
||||||
# profile_ids.append(system)
|
|
||||||
# return profile_ids
|
|
||||||
|
|
||||||
# def quantity_connected() -> list|None:
|
|
||||||
# connected = get_all_connected()
|
|
||||||
# if connected:
|
|
||||||
# return len(connected)
|
|
||||||
# else:
|
|
||||||
# return None
|
|
||||||
|
|
||||||
|
|
||||||
# def is_connected(profile_id: int) -> bool:
|
|
||||||
# """Returns a boolean if a given profile is connected"""
|
|
||||||
|
|
||||||
# # system-wide:
|
|
||||||
# systemwide_profile_id = connected_system_profile_id()
|
|
||||||
# if profile_id == systemwide_profile_id:
|
|
||||||
# return True
|
|
||||||
|
|
||||||
# # session:
|
|
||||||
# state_repo = ProfileStateRepository()
|
|
||||||
# is_session_connected = state_repo.is_profile_active(profile_id)
|
|
||||||
# print(f"Is this session profile connected? {profile_id}")
|
|
||||||
# return is_session_connected
|
|
||||||
|
|
||||||
|
|
||||||
def coordinate_evaluation(connection_observer: ConnectionObserver) -> Result:
|
def coordinate_evaluation(connection_observer: ConnectionObserver) -> Result:
|
||||||
"""See if a connection can be salvaged. If not, rip it down & start over."""
|
"""See if a connection can be salvaged. If not, rip it down & start over."""
|
||||||
|
|
||||||
|
|
@ -231,10 +169,3 @@ def evaluate_state_on_startup() -> Result:
|
||||||
time.sleep(4)
|
time.sleep(4)
|
||||||
|
|
||||||
return Result(valid=True)
|
return Result(valid=True)
|
||||||
|
|
||||||
|
|
||||||
# def cleanup_all_processes():
|
|
||||||
# connected_system_profile_id()
|
|
||||||
|
|
||||||
|
|
||||||
# atexit.register(cleanup_all_processes)
|
|
||||||
Loading…
Reference in a new issue