Cleanup of Legacy code and commented sections
This commit is contained in:
parent
fe19044928
commit
07f0cf8007
4 changed files with 29 additions and 65 deletions
|
|
@ -156,40 +156,40 @@ class ClientController:
|
|||
return path
|
||||
|
||||
|
||||
@staticmethod
|
||||
def __sync(changed_tables: list, client_observer: Optional[ClientObserver] = None, proxies: Optional[dict] = None):
|
||||
# @staticmethod
|
||||
# def __sync(changed_tables: list, client_observer: Optional[ClientObserver] = None, proxies: Optional[dict] = None):
|
||||
|
||||
if "applications" in changed_tables:
|
||||
logger.info("Sync applications..")
|
||||
if client_observer is not None:
|
||||
client_observer.notify('synchronizing', 'Fetching Browser List..')
|
||||
# noinspection PyProtectedMember
|
||||
ApplicationController._sync(proxies=proxies)
|
||||
# if "applications" in changed_tables:
|
||||
# logger.info("Sync applications..")
|
||||
# if client_observer is not None:
|
||||
# client_observer.notify('synchronizing', 'Fetching Browser List..')
|
||||
# # noinspection PyProtectedMember
|
||||
# ApplicationController._sync(proxies=proxies)
|
||||
|
||||
if "application_versions" in changed_tables:
|
||||
logger.info("Sync Application Versions..")
|
||||
if client_observer is not None:
|
||||
client_observer.notify('synchronizing', 'Fetching Browser Version List..')
|
||||
# noinspection PyProtectedMember
|
||||
ApplicationVersionController._sync(proxies=proxies)
|
||||
# if "application_versions" in changed_tables:
|
||||
# logger.info("Sync Application Versions..")
|
||||
# if client_observer is not None:
|
||||
# client_observer.notify('synchronizing', 'Fetching Browser Version List..')
|
||||
# # noinspection PyProtectedMember
|
||||
# ApplicationVersionController._sync(proxies=proxies)
|
||||
|
||||
if "client_version" in changed_tables:
|
||||
logger.info("Sync of client version")
|
||||
if client_observer is not None:
|
||||
client_observer.notify('synchronizing', 'Fetching Client Version List..')
|
||||
# noinspection PyProtectedMember
|
||||
ClientVersionController._sync(proxies=proxies)
|
||||
# if "client_version" in changed_tables:
|
||||
# logger.info("Sync of client version")
|
||||
# if client_observer is not None:
|
||||
# client_observer.notify('synchronizing', 'Fetching Client Version List..')
|
||||
# # noinspection PyProtectedMember
|
||||
# ClientVersionController._sync(proxies=proxies)
|
||||
|
||||
if "subscriptions" in changed_tables:
|
||||
logger.info("Sync of Subscriptions")
|
||||
if client_observer is not None:
|
||||
client_observer.notify('synchronizing', 'Fetching Subscription List..')
|
||||
# noinspection PyProtectedMember
|
||||
SubscriptionPlanController._sync(proxies=proxies)
|
||||
# if "subscriptions" in changed_tables:
|
||||
# logger.info("Sync of Subscriptions")
|
||||
# if client_observer is not None:
|
||||
# client_observer.notify('synchronizing', 'Fetching Subscription List..')
|
||||
# # noinspection PyProtectedMember
|
||||
# SubscriptionPlanController._sync(proxies=proxies)
|
||||
|
||||
ConfigurationController.update_last_synced_at()
|
||||
# ConfigurationController.update_last_synced_at()
|
||||
|
||||
logger.info("Real Data Fetch Completed Successfully")
|
||||
# logger.info("Real Data Fetch Completed Successfully")
|
||||
|
||||
@staticmethod
|
||||
def __update(client_observer: Optional[ClientObserver] = None, proxies: Optional[dict] = None):
|
||||
|
|
|
|||
|
|
@ -22,21 +22,6 @@ class LocationController:
|
|||
print(critical_error)
|
||||
return None
|
||||
|
||||
|
||||
# with get_session() as session:
|
||||
# location_object = session.execute(
|
||||
# select(Location)
|
||||
# .where((Location.country_code == country_code) & (Location.code == city_code))
|
||||
# .options(joinedload(Location.operator))
|
||||
# ).scalar_one_or_none()
|
||||
|
||||
# return location_object
|
||||
|
||||
# legacy:
|
||||
# Location.find(country_code, code)
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_all():
|
||||
with get_session() as session:
|
||||
|
|
@ -45,18 +30,3 @@ class LocationController:
|
|||
.options(joinedload(Location.operator))
|
||||
).scalars().all()
|
||||
return all_records
|
||||
|
||||
# legacy:
|
||||
# return Location.all()
|
||||
|
||||
|
||||
# Deprecated legacy sync,
|
||||
|
||||
# from core.services.WebServiceApiService import WebServiceApiService
|
||||
# @staticmethod
|
||||
# def _sync(proxies: Optional[dict] = None):
|
||||
|
||||
# locations = WebServiceApiService.get_locations(proxies)
|
||||
|
||||
# Location.truncate()
|
||||
# Location.save_many(locations)
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@ def update_profile(
|
|||
error_msg = f"Invalid profile id of {profile_id}"
|
||||
return Result(valid=False, message=error_msg, error_type=ResultError.INVALID_INPUT)
|
||||
|
||||
# logger.info(f"[UPDATE PROFILE] Found a relevant profile {profile_id}.")
|
||||
|
||||
if key == 'dimentions':
|
||||
profile.resolution = new_value
|
||||
|
||||
|
|
@ -84,10 +82,6 @@ def update_profile(
|
|||
# SQLAlchemy foreign key assignment — fills in id, timezone, operator, etc.
|
||||
profile.application_version = application_version
|
||||
|
||||
# legacy:
|
||||
# profile.application_version.application_code = browser_type
|
||||
# profile.application_version.version_number = browser_version
|
||||
|
||||
elif key == 'protocol':
|
||||
# ============= SAME VALUE =============
|
||||
if profile.connection.code == new_value:
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ def start_singbox(
|
|||
logger.info(f"Is the interface up? {interface_up}")
|
||||
|
||||
if interface_up:
|
||||
logger.info("INTERFACE IS UP")
|
||||
logger.info("Interface is confirmed to be Up")
|
||||
else:
|
||||
logger.error("Interface is DOWN")
|
||||
return Result(valid=False, error_type=ResultError.INTERFACE, data=process_id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue