forked from Support/sp-hydra-veil-gui
GUI type checking for core's model changes, with Location & Operator being turned into SQLAlchemy models.
This commit is contained in:
parent
86348ce2e3
commit
b13c355888
12 changed files with 134 additions and 12373 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
|||
.dev
|
||||
may23.py
|
||||
old_main.py
|
||||
.idea
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from core.errors.logger import logger as core_logger
|
|||
|
||||
core_logger.propagate = False
|
||||
|
||||
from gui.v2.infrastructure import orm
|
||||
from gui.v2.infrastructure.navigator import Navigator
|
||||
from gui.v2.infrastructure.setup_observers import setup_observers
|
||||
from gui.v2.infrastructure.connection_manager import ConnectionManager
|
||||
|
|
@ -72,6 +73,9 @@ class CustomWindow(QMainWindow):
|
|||
gui_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
font_path = os.path.join(gui_dir, 'resources', 'fonts')
|
||||
|
||||
# Get's SQLAlchemy going,
|
||||
orm.start()
|
||||
|
||||
retro_gaming_path = os.path.join(font_path, 'retro-gaming.ttf')
|
||||
font_id = QFontDatabase.addApplicationFont(retro_gaming_path)
|
||||
font_family = QFontDatabase.applicationFontFamilies(font_id)[0]
|
||||
|
|
@ -649,6 +653,10 @@ class CustomWindow(QMainWindow):
|
|||
|
||||
def closeEvent(self, event=None):
|
||||
core_logger.info("HydraVeil application closing")
|
||||
|
||||
# Close SQLAlchemy,
|
||||
orm.stop()
|
||||
|
||||
connected_profiles = self.connection_manager.get_connected_profiles()
|
||||
if connected_profiles:
|
||||
self.update_status('Profiles are still connected (disconnect flow lands in Chunk 9).')
|
||||
|
|
|
|||
54
gui/assets/yaml_mappings/locations.yaml
Normal file
54
gui/assets/yaml_mappings/locations.yaml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
fields:
|
||||
- name: country_code
|
||||
path: ['country', 'code']
|
||||
required: true
|
||||
|
||||
- name: code # this is city code
|
||||
path: ['code']
|
||||
required: true
|
||||
|
||||
- name: id
|
||||
path: ['id']
|
||||
|
||||
- name: country_name
|
||||
path: ['country', 'name']
|
||||
|
||||
- name: name # this is CITY name
|
||||
path: ['name']
|
||||
|
||||
- name: time_zone
|
||||
path: ['time_zone', 'code']
|
||||
|
||||
- name: operator_id
|
||||
path: ['operator_id']
|
||||
required: true
|
||||
|
||||
- name: provider_name
|
||||
path: ['provider', 'name']
|
||||
|
||||
- name: is_proxy_capable
|
||||
path: ['is_proxy_capable']
|
||||
|
||||
- name: is_wireguard_capable
|
||||
path: ['is_wireguard_capable']
|
||||
required: true
|
||||
|
||||
- name: is_hysteria2_capable
|
||||
path: ['is_hysteria2_capable']
|
||||
|
||||
- name: is_vless_capable
|
||||
path: ['is_vless_capable']
|
||||
|
||||
|
||||
# original version:
|
||||
# locations.append((
|
||||
# location['country']['code'],
|
||||
# location['code'],
|
||||
# location['id'],
|
||||
# location['country']['name'],
|
||||
# location['name'],
|
||||
# location['time_zone']['code'],
|
||||
# location['operator_id'],
|
||||
# location['provider']['name'],
|
||||
# location['is_proxy_capable'],
|
||||
# location['is_wireguard_capable']))
|
||||
8
gui/assets/yaml_mappings/mapping_one.yaml
Normal file
8
gui/assets/yaml_mappings/mapping_one.yaml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fields:
|
||||
- name: group_a_code
|
||||
path: ['group_a', 'code']
|
||||
- name: code
|
||||
path: ['code']
|
||||
- name: id
|
||||
path: ['id']
|
||||
required: true
|
||||
19
gui/assets/yaml_mappings/operators.yaml
Normal file
19
gui/assets/yaml_mappings/operators.yaml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
fields:
|
||||
- name: id
|
||||
path: ['id']
|
||||
required: true
|
||||
|
||||
- name: name
|
||||
path: ['name']
|
||||
|
||||
- name: public_key # this is ed25519
|
||||
path: ['public_key']
|
||||
|
||||
- name: nostr_public_key
|
||||
path: ['nostr_public_key']
|
||||
|
||||
- name: nostr_profile_reference
|
||||
path: ['nostr_profile_reference']
|
||||
|
||||
- name: nostr_attestation_event_reference
|
||||
path: ['nostr_attestation', 'event_reference']
|
||||
12363
gui/main_v1.py
12363
gui/main_v1.py
File diff suppressed because it is too large
Load diff
8
gui/v2/infrastructure/orm.py
Normal file
8
gui/v2/infrastructure/orm.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
from core.models.manage.session_management import init_session, close_session
|
||||
|
||||
def start():
|
||||
init_session()
|
||||
|
||||
def stop():
|
||||
close_session()
|
||||
|
|
@ -6,7 +6,6 @@ from core.observers.ProfileObserver import ProfileObserver
|
|||
from core.observers.TicketObserver import TicketObserver
|
||||
from core.controllers.ApplicationController import ApplicationController
|
||||
|
||||
|
||||
application_version_observer = ApplicationVersionObserver()
|
||||
client_observer = ClientObserver()
|
||||
connection_observer = ConnectionObserver()
|
||||
|
|
@ -41,6 +40,7 @@ def setup_observers(update_status):
|
|||
f'Downloading {ApplicationController.get(event.subject.application_code).name}'))
|
||||
application_version_observer.subscribe('download_progressing', lambda event: update_status(
|
||||
f'Downloading {ApplicationController.get(event.subject.application_code).name} {event.meta.get('progress'):.2f}%'))
|
||||
|
||||
application_version_observer.subscribe('downloaded', lambda event: update_status(
|
||||
f'Downloaded {ApplicationController.get(event.subject.application_code).name}'))
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ class LocationPage(Page):
|
|||
self.verification_button.setEnabled(False)
|
||||
|
||||
def create_interface_elements(self, available_locations):
|
||||
|
||||
self.buttonGroup = QButtonGroup(self)
|
||||
self.buttons = []
|
||||
|
||||
|
|
@ -84,8 +85,15 @@ class LocationPage(Page):
|
|||
boton.setIcon(QIcon(icon_path))
|
||||
fallback_path = os.path.join(
|
||||
self.btn_path, "default_location_button.png")
|
||||
|
||||
if locations:
|
||||
try:
|
||||
provider = locations.operator.name if locations and hasattr(
|
||||
locations, 'operator') else None
|
||||
except:
|
||||
print("Assign none")
|
||||
provider = None
|
||||
|
||||
if boton.icon().isNull():
|
||||
if locations and hasattr(locations, 'country_name'):
|
||||
location_name = locations.country_name
|
||||
|
|
|
|||
|
|
@ -213,12 +213,26 @@ class MenuPage(Page):
|
|||
profiles_dict.keys())
|
||||
|
||||
for idx in profile_ids:
|
||||
try:
|
||||
profile = profiles_dict[idx]
|
||||
new_profile = {}
|
||||
|
||||
protocol = profile.connection.code
|
||||
|
||||
# print(f"DEBUG: the type is = {type(profile.location)}, value = {profile.location}")
|
||||
|
||||
if isinstance(profile.location, dict):
|
||||
# Fake/missing data — show placeholders from data,
|
||||
country_code = profile.location.get("country_code", "na")
|
||||
code = profile.location.get("code", "na")
|
||||
location = f'{country_code}_{code}'
|
||||
else:
|
||||
# Proper Location object
|
||||
location = f'{profile.location.country_code}_{profile.location.code}'
|
||||
except:
|
||||
import sys
|
||||
print(f"idx: {idx}")
|
||||
sys.exit("STOPPING TO READ PRINTS FOR IDX. this failed on getting the location data inside match_core_profiles")
|
||||
|
||||
new_profile['location'] = location
|
||||
|
||||
|
|
@ -255,6 +269,7 @@ class MenuPage(Page):
|
|||
|
||||
new_profile['name'] = profile.name
|
||||
|
||||
|
||||
new_dict[f'Profile_{idx}'] = new_profile
|
||||
|
||||
return new_dict
|
||||
|
|
|
|||
|
|
@ -229,9 +229,12 @@ class WorkerThread(QThread):
|
|||
else:
|
||||
ConfigurationController.set_connection('system')
|
||||
self.check_for_update()
|
||||
|
||||
locations = LocationController.get_all()
|
||||
|
||||
|
||||
browser = ApplicationVersionController.get_all()
|
||||
print('the browser is: ', browser)
|
||||
# print('the browser is: ', browser)
|
||||
all_browser_versions = [
|
||||
f"{browser.application_code}:{browser.version_number}" for browser in browser if browser.supported]
|
||||
all_location_codes = [
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "hydraveil-gui"
|
||||
version = "2.4.2"
|
||||
name = "sp-hydra-veil-gui"
|
||||
version = "2.4.3"
|
||||
authors = [
|
||||
{ name = "Simplified Privacy" },
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue