From 087a847d98a8cae73c04cc58c4c5018da0556f6f Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Thu, 20 Apr 2023 19:32:11 +0200 Subject: [PATCH] try to save data while onResponse --- clear_data.sh | 4 ---- src/workers/CommandorPage.js | 17 +++++++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/clear_data.sh b/clear_data.sh index 744840f..bb2c533 100644 --- a/clear_data.sh +++ b/clear_data.sh @@ -13,10 +13,6 @@ adb -s 07f9c883 shell am start -n com.android.chrome/com.google.android.apps.chr adb -s 76a3ac8d shell pm clear com.android.chrome adb -s 76a3ac8d shell am set-debug-app --persistent com.android.chrome adb -s 76a3ac8d shell am start -n com.android.chrome/com.google.android.apps.chrome.Main -#xiao mi -adb -s 47e7e36b shell pm clear com.android.chrome -adb -s 47e7e36b shell am set-debug-app --persistent com.android.chrome -adb -s 47e7e36b shell am start -n com.android.chrome/com.google.android.apps.chrome.Main #huawei adb -s EPHUT20825001518 shell pm clear com.android.chrome adb -s EPHUT20825001518 shell am set-debug-app --persistent com.android.chrome diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index b3811cc..a8029e3 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -418,16 +418,21 @@ class CommandorPage { } async onResponse(response) { - // let rex = new RegExp(REGEX_RDV_URL) - // log("onResponse with url:" + response.url()) - // if (rex.test(response.url())) { - // log("rdv url found:" + response.url()) - // await this.push_message_to_db(PublishType.SUCCESS, response.url()) - // } + let rex = new RegExp(REGEX_RDV_URL) + log("onResponse with url:" + response.url()) + // log("onResponse with url:" + response.body()) + if (rex.test(response.url())) { + log("rdv url found:" + response.url()) + await this.push_message_to_db(PublishType.SUCCESS, response.url()) + } } async push_message_to_queue(publishType) { let url = this.page.url(); + await this.push_message_to_db(publishType, url) + } + + async push_message_to_db(publishType, url) { let splitedUrl = url.split("/"); let id = splitedUrl[splitedUrl.length - 1]; if (url === "https://rendezvousparis.hermes.com/client/welcome") {