From 33d64d346f377dc83a98348cc41dacf22ebcf66d Mon Sep 17 00:00:00 2001 From: JabLuszko Date: Thu, 4 Apr 2024 20:33:02 +0200 Subject: [PATCH] Fix raid mode proto timeout (#1379) * forts -> fort * forts -> fort * Drop isinstance checks * Update external IP check to IPv4 only service --- mapadroid/utils/walkerArgs.py | 2 +- mapadroid/worker/strategy/AbstractMitmBaseStrategy.py | 4 ++-- mapadroid/worker/strategy/plain/WorkerInitStrategy.py | 2 +- mapadroid/worker/strategy/plain/WorkerRaidsMitmStrategy.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mapadroid/utils/walkerArgs.py b/mapadroid/utils/walkerArgs.py index 7faccf464..683b372f5 100644 --- a/mapadroid/utils/walkerArgs.py +++ b/mapadroid/utils/walkerArgs.py @@ -368,7 +368,7 @@ def parse_args(): dest='autoconfig_no_auth') # PTC Login tracking - parser.add_argument('-ips', '--ip_service', default='http://ifconfig.me', + parser.add_argument('-ips', '--ip_service', default='https://checkip.amazonaws.com', help=('Host to use to request the external IPv4 address of the device. ' 'MAD will search for the first IPv4 address via regex.')) parser.add_argument('-elt', '--enable_login_tracking', action='store_true', default=False, diff --git a/mapadroid/worker/strategy/AbstractMitmBaseStrategy.py b/mapadroid/worker/strategy/AbstractMitmBaseStrategy.py index f29582505..afdb34409 100644 --- a/mapadroid/worker/strategy/AbstractMitmBaseStrategy.py +++ b/mapadroid/worker/strategy/AbstractMitmBaseStrategy.py @@ -464,12 +464,12 @@ def _gmo_cells_contain_multiple_of_key(gmo: pogoprotos.GetMapObjectsOutProto, else: keys.extend(keys_in_cell) cells: RepeatedCompositeFieldContainer[pogoprotos.ClientMapCellProto] = gmo.map_cell - if not cells or not isinstance(cells, RepeatedCompositeFieldContainer): + if not cells: return False for cell in cells: for key in keys: value_of_key: Optional[Any] = getattr(cell, key, None) - if value_of_key and isinstance(value_of_key, list) and len(value_of_key) > 0: + if value_of_key and len(value_of_key) > 0: return True return False diff --git a/mapadroid/worker/strategy/plain/WorkerInitStrategy.py b/mapadroid/worker/strategy/plain/WorkerInitStrategy.py index 725f3988b..94359ba0a 100644 --- a/mapadroid/worker/strategy/plain/WorkerInitStrategy.py +++ b/mapadroid/worker/strategy/plain/WorkerInitStrategy.py @@ -22,7 +22,7 @@ class InitTypes(Enum): # Rural areas may not be populated with forts but wild or nearby mons... -KEY_TO_CHECK_FORTS: List[str] = ["forts", "wild_pokemon", "nearby_pokemon"] +KEY_TO_CHECK_FORTS: List[str] = ["fort", "wild_pokemon", "nearby_pokemon"] class WorkerInitStrategy(AbstractWorkerMitmStrategy): diff --git a/mapadroid/worker/strategy/plain/WorkerRaidsMitmStrategy.py b/mapadroid/worker/strategy/plain/WorkerRaidsMitmStrategy.py index 89adf95cd..a23c971ce 100644 --- a/mapadroid/worker/strategy/plain/WorkerRaidsMitmStrategy.py +++ b/mapadroid/worker/strategy/plain/WorkerRaidsMitmStrategy.py @@ -37,7 +37,7 @@ async def _check_for_data_content(self, latest: Optional[LatestMitmDataEntry], return ReceivedType.UNDEFINED, data_found elif proto_to_wait_for == ProtoIdentifier.GMO: gmo: pogoprotos.GetMapObjectsOutProto = ProtoHelper.parse(ProtoIdentifier.GMO, latest_proto_data) - if self._gmo_cells_contain_multiple_of_key(gmo, "forts"): + if self._gmo_cells_contain_multiple_of_key(gmo, "fort"): data_found = latest_proto_data type_of_data_found = ReceivedType.GMO else: