From b2e260475bada3d4398e06fe5817fded5f3c99ff Mon Sep 17 00:00:00 2001 From: codeking Date: Tue, 18 Nov 2025 02:40:41 +0100 Subject: [PATCH] Add support for non-proxy capable locations --- core/models/Location.py | 14 ++++++++++++-- core/services/WebServiceApiService.py | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/models/Location.py b/core/models/Location.py index 89c23d5..6fa3fa3 100644 --- a/core/models/Location.py +++ b/core/models/Location.py @@ -15,6 +15,8 @@ _table_definition: str = """ 'time_zone' varchar, 'operator_id' int, 'provider_name' varchar, + 'is_proxy_capable' bool, + 'is_wireguard_capable' bool, UNIQUE(code, country_code) """ @@ -44,6 +46,14 @@ class Location(Model): default=None, metadata=config(exclude=Exclude.ALWAYS) ) + is_proxy_capable: Optional[bool] = field( + default=None, + metadata=config(exclude=Exclude.ALWAYS) + ) + is_wireguard_capable: Optional[bool] = field( + default=None, + metadata=config(exclude=Exclude.ALWAYS) + ) operator: Optional[Operator] = field( default=None, metadata=config(exclude=Exclude.ALWAYS) @@ -87,7 +97,7 @@ class Location(Model): @staticmethod def save_many(locations): Model._create_table_if_not_exists(table_name=_table_name, table_definition=_table_definition) - Model._insert_many('INSERT INTO locations VALUES(?, ?, ?, ?, ?, ?, ?, ?)', Location.tuple_factory, locations) + Model._insert_many('INSERT INTO locations VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', Location.tuple_factory, locations) @staticmethod def factory(cursor, row): @@ -96,4 +106,4 @@ class Location(Model): @staticmethod def tuple_factory(location): - return location.id, location.country_code, location.country_name, location.code, location.name, location.time_zone, location.operator_id, location.provider_name + return location.id, location.country_code, location.country_name, location.code, location.name, location.time_zone, location.operator_id, location.provider_name, location.is_proxy_capable, location.is_wireguard_capable diff --git a/core/services/WebServiceApiService.py b/core/services/WebServiceApiService.py index d7df3cc..fb4aad4 100644 --- a/core/services/WebServiceApiService.py +++ b/core/services/WebServiceApiService.py @@ -72,7 +72,7 @@ class WebServiceApiService: if response.status_code == requests.codes.ok: for location in response.json()['data']: - locations.append(Location(location['country']['code'], location['code'], location['id'], location['country']['name'], location['name'], location['time_zone']['code'], location['operator_id'], location['provider']['name'])) + locations.append(Location(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'])) return locations