From bc213d82b21f82b16f2dfae301849d5c08bacd4e Mon Sep 17 00:00:00 2001 From: JabLuszko Date: Fri, 20 Sep 2024 11:32:51 +0200 Subject: [PATCH 1/5] Update screenPath.py (#1385) --- mapadroid/ocr/screenPath.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mapadroid/ocr/screenPath.py b/mapadroid/ocr/screenPath.py index e70146214..787b20909 100644 --- a/mapadroid/ocr/screenPath.py +++ b/mapadroid/ocr/screenPath.py @@ -465,6 +465,10 @@ async def __handle_ptc_login(self) -> ScreenType: exit_keyboard_y: int = 300 for item in xmlroot.iter('node'): + if "android.widget.ProgressBar" in item.attrib["class"]: + logger.warning("PTC page still loading, sleeping for extra 12 seconds") + await asyncio.sleep(12) + return ScreenType.PTC if "Access denied" in item.attrib["text"]: logger.warning("WAF on PTC login attempt detected") # Reload the page 1-3 times From e846590f1598a7ee80d0f499af712cedd6b330b2 Mon Sep 17 00:00:00 2001 From: JabLuszko Date: Fri, 20 Sep 2024 11:33:29 +0200 Subject: [PATCH 2/5] Click CONTINUE on hardware not supported unity screen (#1384) * Update utils.py * Update screenPath.py * Update screen_type.py --- mapadroid/ocr/screenPath.py | 8 ++++++++ mapadroid/ocr/screen_type.py | 1 + mapadroid/ocr/utils.py | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mapadroid/ocr/screenPath.py b/mapadroid/ocr/screenPath.py index 787b20909..88aad679f 100644 --- a/mapadroid/ocr/screenPath.py +++ b/mapadroid/ocr/screenPath.py @@ -277,6 +277,9 @@ async def __handle_screentype(self, screentype: ScreenType, screentype = await self.__handle_adventure_sync_screen(screentype) elif screentype == ScreenType.WILLOWGO: screentype = await self.__handle_tutorial_end() + elif screentype == ScreenType.HARDWARE_UNITY_UNSUPPORTED: + logger.warning('Detected unsupported hardware screen, PD could not handle that?') + screentype = await self.__handle_hardware_unsupported_unity_screen(diff, global_dict) elif screentype == ScreenType.SN: self._nextscreen = ScreenType.UNDEFINED elif screentype == ScreenType.UPDATE: @@ -1018,6 +1021,11 @@ async def __handle_login_timeout(self, diff, global_dict) -> None: self._nextscreen = ScreenType.UNDEFINED click_text = 'SIGNOUT,SIGN,ABMELDEN,_DECONNECTER' await self.__click_center_button_text(click_text, diff, global_dict) + + async def __handle_hardware_unsupported_unity_screen(self, diff, global_dict) -> None: + self._nextscreen = ScreenType.UNDEFINED + click_text = 'CONTINUE' # no idea if this gets translated to different lang? + await self.__click_center_button_text(click_text, diff, global_dict) async def _take_and_analyze_screenshot(self, delay_after=0.0, delay_before=0.0, errorscreen: bool = False) -> \ Optional[Tuple[ScreenType, diff --git a/mapadroid/ocr/screen_type.py b/mapadroid/ocr/screen_type.py index a45875c10..9c5878c3f 100644 --- a/mapadroid/ocr/screen_type.py +++ b/mapadroid/ocr/screen_type.py @@ -11,6 +11,7 @@ class ScreenType(Enum): RETRY = 6 # Failed to log in. Green button on top: RETRY - no background button below: TRY A DIFFERENT ACCOUNT WRONG = 7 # incorrect credentials? GAMEDATA = 8 # game data could not be fetched from server + HARDWARE_UNITY_UNSUPPORTED = 9 # Your device does not match hardware requirements for this application CONTINUE GGL = 10 # Google account picker PERMISSION = 11 # permission grant overlay (Android) MARKETING = 12 # marketing notification request (pogo) diff --git a/mapadroid/ocr/utils.py b/mapadroid/ocr/utils.py index a4f145423..5cf8dc525 100644 --- a/mapadroid/ocr/utils.py +++ b/mapadroid/ocr/utils.py @@ -18,9 +18,10 @@ 'AUTRE', 'AUTORISER'], 7: ['incorrect.', 'attempts', 'falsch.', 'gesperrt'], 8: ['Spieldaten', 'abgerufen', 'lecture', 'depuis', 'server', 'data'], + 9: ['hardware', 'requirements'], 12: ['Events,', 'Benachrichtigungen', 'Einstellungen', 'events,', 'offers,', 'notifications', 'évenements,', 'evenements,', 'offres'], - 14: ['kompatibel', 'compatible', 'OS', 'software', 'device', 'Gerät', + 14: ['kompatibel', 'compatible', 'OS', 'software', 'Gerät', 'Betriebssystem', 'logiciel'], 15: ['continuer...', 'aktualisieren?', 'now?', 'Aktualisieren', 'Aktualisieren,', 'aktualisieren', 'update', 'continue...', 'Veux-tu', 'Fais', 'continuer'], From 6e4e58c8bfb3336a4c69a3578d38127c617598a0 Mon Sep 17 00:00:00 2001 From: JabLuszko Date: Fri, 20 Sep 2024 11:33:58 +0200 Subject: [PATCH 3/5] Change log line for filtering accounts (#1382) * Adjust logging for filtered out accounts, more info. So we can spend less time on Discord :-P * Update AccountHandler.py --- mapadroid/account_handler/AccountHandler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapadroid/account_handler/AccountHandler.py b/mapadroid/account_handler/AccountHandler.py index c4160b42b..a25c4a8bf 100644 --- a/mapadroid/account_handler/AccountHandler.py +++ b/mapadroid/account_handler/AccountHandler.py @@ -48,13 +48,13 @@ async def get_account(self, device_id: int, purpose: AccountPurpose, # TODO: Filter only unassigned or assigned to same device first logins: Dict[int, SettingsPogoauth] = await SettingsPogoauthHelper.get_avail_accounts( session, self._db_wrapper.get_instance_id(), auth_type=None, device_id=device_id) - logger.info("Got {} before filtering for burnt or not fitting the usage.", len(logins)) # Filter all burnt and all which do not match the purpose. E.g., if the purpose is mon scanning. logins_filtered: List[SettingsPogoauth] = [auth_entry for auth_id, auth_entry in logins.items() if not self._is_burnt(auth_entry) and self._is_usable_for_purpose(auth_entry, purpose, location_to_scan)] logins_filtered.sort(key=lambda x: DatetimeWrapper.fromtimestamp(0) if x.last_burn is None else x.last_burn) + logger.info("Got {} before filtering and {} after (burnt, wrong level)", len(logins), len(logins_filtered)) login_to_use: Optional[SettingsPogoauth] = None if not logins_filtered: logger.warning("No auth found for {}", device_id) From aaf16a3190ac77f30b6c3651922555107c94f40c Mon Sep 17 00:00:00 2001 From: JabLuszko Date: Fri, 20 Sep 2024 11:34:19 +0200 Subject: [PATCH 4/5] Log exception for webhook worker (#1377) .warning sometimes shows empty message rather than actual error --- mapadroid/webhook/webhookworker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mapadroid/webhook/webhookworker.py b/mapadroid/webhook/webhookworker.py index 53c2b91da..25490d14f 100644 --- a/mapadroid/webhook/webhookworker.py +++ b/mapadroid/webhook/webhookworker.py @@ -120,6 +120,7 @@ async def __send_webhook(self, payloads): whcount_text, await mad_json_dumps(self.__payload_type_count(payload_chunk))) except Exception as e: logger.warning("Exception occured while sending webhook: {}", e) + logger.exception(e) current_pl_num += 1 current_wh_num += 1 From fd76cb901a27d734838e34c3e6a0e7f35eed3d1f Mon Sep 17 00:00:00 2001 From: JabLuszko Date: Fri, 20 Sep 2024 11:34:54 +0200 Subject: [PATCH 5/5] Disable get_external_ip if login_tracking disabled (#1383) --- mapadroid/worker/strategy/AbstractWorkerStrategy.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mapadroid/worker/strategy/AbstractWorkerStrategy.py b/mapadroid/worker/strategy/AbstractWorkerStrategy.py index 47edf779b..bee73f10d 100644 --- a/mapadroid/worker/strategy/AbstractWorkerStrategy.py +++ b/mapadroid/worker/strategy/AbstractWorkerStrategy.py @@ -257,11 +257,12 @@ async def start_pogo(self) -> bool: if start_result: logger.success("startPogo: Started pogo successfully...") - ip_of_device: Optional[str] = await self._communicator.get_external_ip() - if not ip_of_device: - logger.warning("Cannot retrieve IP of device.") - else: - await self._mapping_manager.login_tracking_set_ip(self._worker_state.origin, ip_of_device) + if MadGlobals.application_args.enable_login_tracking: + ip_of_device: Optional[str] = await self._communicator.get_external_ip() + if not ip_of_device: + logger.warning("Cannot retrieve IP of device.") + else: + await self._mapping_manager.login_tracking_set_ip(self._worker_state.origin, ip_of_device) await self._wait_pogo_start_delay() start_delay: int = await self.get_devicesettings_value(