forked from Support/sp-hydra-veil-gui
Compare commits
5 commits
50e9469178
...
25489bf203
| Author | SHA1 | Date | |
|---|---|---|---|
| 25489bf203 | |||
| e5c83e72b1 | |||
| 59cac90c58 | |||
| b536204048 | |||
| f8a09858cc |
7 changed files with 104 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from core.errors.logger import logger
|
||||
from core.models.manage.session_management import init_session, get_session, close_session, create_ALL_tables, create_ONLY_db_version_table, get_path, does_it_exist, does_db_version_table_exist
|
||||
from core.models.manage.version_check import check_database_compatibility, insert_new_version, get_custom_message
|
||||
from core.services.helpers.manage_assets import assets_folder_setup
|
||||
from core.Constants import Constants
|
||||
# generic
|
||||
import os
|
||||
|
|
@ -25,7 +26,7 @@ def recovery_dialog(custom_error, db_version_you_have):
|
|||
|
||||
elif choice == 2:
|
||||
logger.info(f"[DB MANAGEMENT] User opted to move the DB file.")
|
||||
from v2.ui.popups.pick_folder_to_move import launch_file_picker
|
||||
from gui.v2.ui.popups.pick_folder_to_move import launch_file_picker
|
||||
launch_file_picker(database_path)
|
||||
sys.exit()
|
||||
|
||||
|
|
@ -33,6 +34,14 @@ def recovery_dialog(custom_error, db_version_you_have):
|
|||
logger.error(f"[DB MANAGEMENT] User opted to close the app WITHOUT wiping the database, even though they need to.")
|
||||
sys.exit()
|
||||
|
||||
# ============================================================================
|
||||
# ASSETS FOLDER
|
||||
# ============================================================================
|
||||
if not assets_folder_setup():
|
||||
from gui.v2.ui.popups.generic_error_popup import show_error
|
||||
custom_error = "Unable to Setup your Assets Folder. Please create an assets directory at ~/.local/share/hydra-veil/assets"
|
||||
show_error(custom_error, "Critical Error")
|
||||
|
||||
# ============================================================================
|
||||
# INITIALIZE DATABASE
|
||||
# ============================================================================
|
||||
|
|
@ -57,7 +66,7 @@ if not version_table_exists and main_db_exists:
|
|||
close_session()
|
||||
|
||||
# THEN DISPLAY CHOICES AND RECOVERY UI
|
||||
custom_error = "You're using a Legacy version of the Database scheme. Please delete it and fetch the new data."
|
||||
custom_error = "Upgrade Time! We transitioned to a new Database format for new features! Please delete the old version and fetch the new public data (what locations, browsers, ect) This will NOT affect your profiles or browser sessions."
|
||||
db_version_you_have = "Old System"
|
||||
recovery_dialog(custom_error, db_version_you_have)
|
||||
sys.exit()
|
||||
|
|
@ -87,7 +96,7 @@ if is_compatable:
|
|||
custom_error = "Critical Failure with starting the models of the database."
|
||||
logger.error(f"[DB MANAGEMENT] {custom_error}")
|
||||
close_session()
|
||||
from v2.ui.popups.Database_version import show_recovery_dialog
|
||||
from gui.v2.ui.popups.Database_version import show_recovery_dialog
|
||||
choice = show_recovery_dialog({"message": custom_error, "db_version": 0, "status": "cant_make"})
|
||||
logger.info(f"[DB MANAGEMENT] From the database error options, the user picked {choice}")
|
||||
sys.exit()
|
||||
|
|
|
|||
Binary file not shown.
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']
|
||||
|
|
@ -56,7 +56,7 @@ class DatabaseConflictDialog(QDialog):
|
|||
|
||||
# First which messages to display,
|
||||
if check["status"] == "version_mismatch":
|
||||
error_title = "Database Compatibility"
|
||||
error_title = "Upgrade Time!"
|
||||
error_subtitle = "Your App version and Database don't match"
|
||||
else:
|
||||
error_title = "Database Error"
|
||||
|
|
|
|||
10
gui/v2/ui/popups/generic_error_popup.py
Normal file
10
gui/v2/ui/popups/generic_error_popup.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from PyQt6.QtWidgets import QApplication, QMessageBox
|
||||
import sys
|
||||
|
||||
def show_error(error_text, title="Error"):
|
||||
app = QApplication.instance()
|
||||
if app is None:
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
QMessageBox.critical(None, title, error_text)
|
||||
app.quit()
|
||||
Loading…
Reference in a new issue