Singbox dependency check in the launcher, forwards to GUI error handler to coordinate setup
This commit is contained in:
parent
9948ac0454
commit
57206dde46
2 changed files with 17 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ class ResultError(Enum):
|
||||||
MISSING_DEPENDENCY = "missing_dependency"
|
MISSING_DEPENDENCY = "missing_dependency"
|
||||||
MISSING_DATA = "missing_data"
|
MISSING_DATA = "missing_data"
|
||||||
MISSING_SOFTWARE = "missing_software"
|
MISSING_SOFTWARE = "missing_software"
|
||||||
|
SETUP_SINGBOX = "setup_singbox"
|
||||||
FILE_SYSTEM = "filesystem"
|
FILE_SYSTEM = "filesystem"
|
||||||
CONNECTION = "connection"
|
CONNECTION = "connection"
|
||||||
DATABASE = "database"
|
DATABASE = "database"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
|
from core.services.helpers.install_dependencies import SUDO_SINGBOX_LOCATION
|
||||||
|
from core.services.helpers.setup_sudo_scripts import is_singbox_wrapper_ready
|
||||||
from core.services.networking.systemwide.encrypted_proxy.configure_singbox import configure_singbox
|
from core.services.networking.systemwide.encrypted_proxy.configure_singbox import configure_singbox
|
||||||
from core.services.networking.systemwide.encrypted_proxy.singbox_runner import start_singbox
|
from core.services.networking.systemwide.encrypted_proxy.singbox_runner import start_singbox
|
||||||
from core.utils.basic_operations.write_or_read_from_json import get_value_from_json_file
|
from core.utils.basic_operations.write_or_read_from_json import get_value_from_json_file
|
||||||
|
from core.utils.basic_operations.does_file_exist import does_file_exist
|
||||||
from core.observers.ConnectionObserver import ConnectionObserver
|
from core.observers.ConnectionObserver import ConnectionObserver
|
||||||
from core.models.BaseProfile import BaseProfile as Profile
|
from core.models.BaseProfile import BaseProfile as Profile
|
||||||
from core.models.Result import Result, ResultError
|
from core.models.Result import Result, ResultError
|
||||||
|
|
@ -40,7 +43,19 @@ def launch_encrypted_proxy(
|
||||||
connection_observer: Optional[ConnectionObserver]
|
connection_observer: Optional[ConnectionObserver]
|
||||||
) -> Result:
|
) -> Result:
|
||||||
"""Launch & Setup an Encrypted proxy with a single-refresh retry policy."""
|
"""Launch & Setup an Encrypted proxy with a single-refresh retry policy."""
|
||||||
|
|
||||||
|
logger.info("Preparing to launch encrypted proxy..")
|
||||||
|
|
||||||
|
# Pre-reqs
|
||||||
|
if not is_singbox_wrapper_ready():
|
||||||
|
logger.info("Missing singbox wrapper")
|
||||||
|
return Result(valid=False, error_type=ResultError.SETUP_SINGBOX, message="The pre-req Singbox sudo wrappers are not setup, would you like to set it up?")
|
||||||
|
|
||||||
|
if not does_file_exist(SUDO_SINGBOX_LOCATION):
|
||||||
|
logger.info("Missing singbox binary")
|
||||||
|
return Result(valid=False, error_type=ResultError.SETUP_SINGBOX, message="The pre-req software Singbox is not setup, would you like to set it up?")
|
||||||
|
|
||||||
|
|
||||||
server_ip = get_existing_server_ip(profile)
|
server_ip = get_existing_server_ip(profile)
|
||||||
has_refreshed = False # Tracks if we have already fetched a new config this session
|
has_refreshed = False # Tracks if we have already fetched a new config this session
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue