Cleanup of Legacy code and commented sections

This commit is contained in:
SimplifiedPrivacy 2026-08-20 14:06:28 -04:00
parent fe19044928
commit 07f0cf8007
4 changed files with 29 additions and 65 deletions

View file

@ -156,40 +156,40 @@ class ClientController:
return path return path
@staticmethod # @staticmethod
def __sync(changed_tables: list, client_observer: Optional[ClientObserver] = None, proxies: Optional[dict] = None): # def __sync(changed_tables: list, client_observer: Optional[ClientObserver] = None, proxies: Optional[dict] = None):
if "applications" in changed_tables: # if "applications" in changed_tables:
logger.info("Sync applications..") # logger.info("Sync applications..")
if client_observer is not None: # if client_observer is not None:
client_observer.notify('synchronizing', 'Fetching Browser List..') # client_observer.notify('synchronizing', 'Fetching Browser List..')
# noinspection PyProtectedMember # # noinspection PyProtectedMember
ApplicationController._sync(proxies=proxies) # ApplicationController._sync(proxies=proxies)
if "application_versions" in changed_tables: # if "application_versions" in changed_tables:
logger.info("Sync Application Versions..") # logger.info("Sync Application Versions..")
if client_observer is not None: # if client_observer is not None:
client_observer.notify('synchronizing', 'Fetching Browser Version List..') # client_observer.notify('synchronizing', 'Fetching Browser Version List..')
# noinspection PyProtectedMember # # noinspection PyProtectedMember
ApplicationVersionController._sync(proxies=proxies) # ApplicationVersionController._sync(proxies=proxies)
if "client_version" in changed_tables: # if "client_version" in changed_tables:
logger.info("Sync of client version") # logger.info("Sync of client version")
if client_observer is not None: # if client_observer is not None:
client_observer.notify('synchronizing', 'Fetching Client Version List..') # client_observer.notify('synchronizing', 'Fetching Client Version List..')
# noinspection PyProtectedMember # # noinspection PyProtectedMember
ClientVersionController._sync(proxies=proxies) # ClientVersionController._sync(proxies=proxies)
if "subscriptions" in changed_tables: # if "subscriptions" in changed_tables:
logger.info("Sync of Subscriptions") # logger.info("Sync of Subscriptions")
if client_observer is not None: # if client_observer is not None:
client_observer.notify('synchronizing', 'Fetching Subscription List..') # client_observer.notify('synchronizing', 'Fetching Subscription List..')
# noinspection PyProtectedMember # # noinspection PyProtectedMember
SubscriptionPlanController._sync(proxies=proxies) # 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 @staticmethod
def __update(client_observer: Optional[ClientObserver] = None, proxies: Optional[dict] = None): def __update(client_observer: Optional[ClientObserver] = None, proxies: Optional[dict] = None):

View file

@ -22,21 +22,6 @@ class LocationController:
print(critical_error) print(critical_error)
return None 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 @staticmethod
def get_all(): def get_all():
with get_session() as session: with get_session() as session:
@ -45,18 +30,3 @@ class LocationController:
.options(joinedload(Location.operator)) .options(joinedload(Location.operator))
).scalars().all() ).scalars().all()
return all_records 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)

View file

@ -52,8 +52,6 @@ def update_profile(
error_msg = f"Invalid profile id of {profile_id}" error_msg = f"Invalid profile id of {profile_id}"
return Result(valid=False, message=error_msg, error_type=ResultError.INVALID_INPUT) 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': if key == 'dimentions':
profile.resolution = new_value profile.resolution = new_value
@ -84,10 +82,6 @@ def update_profile(
# SQLAlchemy foreign key assignment — fills in id, timezone, operator, etc. # SQLAlchemy foreign key assignment — fills in id, timezone, operator, etc.
profile.application_version = application_version profile.application_version = application_version
# legacy:
# profile.application_version.application_code = browser_type
# profile.application_version.version_number = browser_version
elif key == 'protocol': elif key == 'protocol':
# ============= SAME VALUE ============= # ============= SAME VALUE =============
if profile.connection.code == new_value: if profile.connection.code == new_value:

View file

@ -258,7 +258,7 @@ def start_singbox(
logger.info(f"Is the interface up? {interface_up}") logger.info(f"Is the interface up? {interface_up}")
if interface_up: if interface_up:
logger.info("INTERFACE IS UP") logger.info("Interface is confirmed to be Up")
else: else:
logger.error("Interface is DOWN") logger.error("Interface is DOWN")
return Result(valid=False, error_type=ResultError.INTERFACE, data=process_id) return Result(valid=False, error_type=ResultError.INTERFACE, data=process_id)