Verify Sing-box before the connection
This commit is contained in:
parent
4605f1b9cc
commit
cd4ee8aaaa
1 changed files with 4 additions and 1 deletions
|
|
@ -11,6 +11,7 @@ from core.models.system.SystemConnection import SystemConnection
|
|||
from core.models.system.SystemProfile import SystemProfile
|
||||
from cli.helpers import sanitize_profile, parse_application_argument, parse_location_argument
|
||||
from cli.observers import profile_observer, application_version_observer, connection_observer, invoice_observer
|
||||
from core.Errors import SingboxNotInstalledException
|
||||
import pprint
|
||||
|
||||
NAME = 'profile'
|
||||
|
|
@ -112,6 +113,8 @@ def handle(arguments, main_parser):
|
|||
main_parser.error('the following argument should be a valid reference: --id/-i')
|
||||
try:
|
||||
ProfileController.enable(profile, ignore=ignore, pristine=arguments.pristine, asynchronous=True, profile_observer=profile_observer, application_version_observer=application_version_observer, connection_observer=connection_observer)
|
||||
except SingboxNotInstalledException as exception:
|
||||
main_parser.error('sing-box is not installed. Please run the installation script first.')
|
||||
except (InvalidSubscriptionError, MissingSubscriptionError) as exception:
|
||||
_handle_subscription_error(exception, profile, ignore, arguments, main_parser)
|
||||
|
||||
|
|
@ -175,7 +178,7 @@ def _handle_subscription_error(exception, profile, ignore, arguments, main_parse
|
|||
pass
|
||||
else:
|
||||
print('\nInput appears to be invalid. Please try again.\n')
|
||||
|
||||
|
||||
def _build_ignore(arguments):
|
||||
ignore = []
|
||||
if getattr(arguments, 'without_connection_protection', False):
|
||||
|
|
|
|||
Loading…
Reference in a new issue