support brave version 1.65.133

This commit is contained in:
2024-05-18 20:19:06 +02:00
parent ae2ad3f630
commit 14715d6bed
3 changed files with 33 additions and 14 deletions
+1
View File
@@ -25,6 +25,7 @@ const OCRResult = {
BRAVE_PRIVACY: Symbol("BRAVE_PRIVACY"), BRAVE_PRIVACY: Symbol("BRAVE_PRIVACY"),
BRAVE_PRIVACY_PUB: Symbol("BRAVE_PRIVACY_PUB"), BRAVE_PRIVACY_PUB: Symbol("BRAVE_PRIVACY_PUB"),
BRAVE_NOTIFICATION: Symbol("BRAVE_NOTIFICATION"), BRAVE_NOTIFICATION: Symbol("BRAVE_NOTIFICATION"),
BRAVE_PUSH_NOTIFICATION: Symbol("BRAVE_PUSH_NOTIFICATION"),
CHOOSE_POSITION: Symbol("CHOOSE_POSITION"), CHOOSE_POSITION: Symbol("CHOOSE_POSITION"),
BRAVE_VPN_SKIP: Symbol("BRAVE_VPN_SKIP"), BRAVE_VPN_SKIP: Symbol("BRAVE_VPN_SKIP"),
} }
+27 -14
View File
@@ -220,7 +220,7 @@ class CommandorPage {
if (this.isTerminated) { if (this.isTerminated) {
log(this.device.model() + ":request terminated, send cancel()"); log(this.device.model() + ":request terminated, send cancel()");
try { try {
if (this.page !== undefined) { if (this.page !== undefined && !this.page.isClosed()) {
await this.page.close() await this.page.close()
} }
} catch (e) { } catch (e) {
@@ -1048,6 +1048,12 @@ class CommandorPage {
await delay(2000); await delay(2000);
await this.checkResultWithOcr(); await this.checkResultWithOcr();
break; break;
case OCRResult.BRAVE_PUSH_NOTIFICATION:
logWithDevice("BRAVE_NOTIFICATION", this.device)
await this.handleBravePushNotification()
await delay(3000);
await this.checkResultWithOcr();
break
case OCRResult.BRAVE_NOTIFICATION: case OCRResult.BRAVE_NOTIFICATION:
logWithDevice("BRAVE_NOTIFICATION", this.device) logWithDevice("BRAVE_NOTIFICATION", this.device)
if (this.device.model() === "21091116C") { if (this.device.model() === "21091116C") {
@@ -1289,19 +1295,21 @@ class CommandorPage {
async sendCookiesToQueue() { async sendCookiesToQueue() {
try { try {
const cookiesSet = await this.page.cookies(); if (!this.page.isClosed()) {
let cookiesString = "" const cookiesSet = await this.page.cookies();
cookiesSet.forEach((cookie) => { let cookiesString = ""
cookiesString = cookiesString + cookie.name + "=" + cookie.value + ";" cookiesSet.forEach((cookie) => {
}) cookiesString = cookiesString + cookie.name + "=" + cookie.value + ";"
console.log(cookiesString); })
if (this.shareCookiesWithRequests) { console.log(cookiesString);
let pojoToSend = await this.getRequestData() if (this.shareCookiesWithRequests) {
pojoToSend.cookiesStr = cookiesString let pojoToSend = await this.getRequestData()
// this.sender.sendMessage(JSON.stringify(pojoToSend), REQUEST_DATA_OBJECT) pojoToSend.cookiesStr = cookiesString
this.sender.sendMessage(JSON.stringify(pojoToSend), TEST_QUEUE) // this.sender.sendMessage(JSON.stringify(pojoToSend), REQUEST_DATA_OBJECT)
} else { this.sender.sendMessage(JSON.stringify(pojoToSend), TEST_QUEUE)
this.sender.sendMessage(cookiesString) } else {
this.sender.sendMessage(cookiesString)
}
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)
@@ -1527,6 +1535,11 @@ class CommandorPage {
} }
return findIp return findIp
} }
async handleBravePushNotification() {
await this.tapForDevice(this.device, 100, 400)
}
} }
module module
+5
View File
@@ -77,6 +77,8 @@ const BRAVE_SKIP_PRIVACY_PAGE = "Partagez des informations"
const BRAVE_SKIP_PRIVACY_PAGE_3 = "Partagez de informations" const BRAVE_SKIP_PRIVACY_PAGE_3 = "Partagez de informations"
const BRAVE_SKIP_PRIVACY_PAGE_2 = "Partagez des renseignements" const BRAVE_SKIP_PRIVACY_PAGE_2 = "Partagez des renseignements"
const PUSH_NOTIFICATION_1 = "Brave à vous envoyer des notifications "
class OCRChecker { class OCRChecker {
constructor(device, contact) { constructor(device, contact) {
@@ -101,6 +103,9 @@ class OCRChecker {
} else if (result.includes(BRAVE_NOTIFICATION)) { } else if (result.includes(BRAVE_NOTIFICATION)) {
await this.deleteFile(fileName) await this.deleteFile(fileName)
return OCRResult.BRAVE_NOTIFICATION return OCRResult.BRAVE_NOTIFICATION
} else if (result.includes(PUSH_NOTIFICATION_1)) {
await this.deleteFile(fileName)
return OCRResult.BRAVE_PUSH_NOTIFICATION
} else if (result.includes(CHOOSE_POSITION_GOOGLE_FR)) { } else if (result.includes(CHOOSE_POSITION_GOOGLE_FR)) {
await this.deleteFile(fileName) await this.deleteFile(fileName)
return OCRResult.CHOOSE_POSITION return OCRResult.CHOOSE_POSITION