add onlyForCookies boolean

This commit is contained in:
Lei PAN
2024-03-13 18:46:29 +01:00
parent 0859b01c12
commit e6384136d5
+6 -6
View File
@@ -74,12 +74,13 @@ function logWithDevice(message, device) {
const searchTexts = ['hermes+rdv+online+paris', 'hermes+rdv+enligne+paris', 'hermes+rdv+en+ligne+paris', 'hermes+rendezvous+en+ligne+paris', 'hermes+appointment+online+paris', 'hermes+appointment+online+paris', 'appointment+hermes+paris+on+line', 'hermes+rendez+vous+online+paris', 'hermes+rendez+vous+paris+en+ligne', 'hermes+rendez+vous+paris+enligne', 'hermes+rendez+vous+paris+online', 'online+appointment+hermes+paris', 'hermes+online+appointment+paris', 'paris+hermes+online+appointment'] const searchTexts = ['hermes+rdv+online+paris', 'hermes+rdv+enligne+paris', 'hermes+rdv+en+ligne+paris', 'hermes+rendezvous+en+ligne+paris', 'hermes+appointment+online+paris', 'hermes+appointment+online+paris', 'appointment+hermes+paris+on+line', 'hermes+rendez+vous+online+paris', 'hermes+rendez+vous+paris+en+ligne', 'hermes+rendez+vous+paris+enligne', 'hermes+rendez+vous+paris+online', 'online+appointment+hermes+paris', 'hermes+online+appointment+paris', 'paris+hermes+online+appointment']
class CommandorPage { class CommandorPage {
constructor(contact, device, sender, mongoManager, selectedStore = DEFAULT_STORE, audioAnalyse = false, alertBeep = false, port = 9000) { constructor(contact, device, sender, mongoManager, selectedStore = DEFAULT_STORE, audioAnalyse = false, alertBeep = false, port = 9000, onlyForCookies = false) {
this.contact = contact; this.contact = contact;
this.device = device; this.device = device;
this.mongoManager = mongoManager; this.mongoManager = mongoManager;
this.selectedStore = selectedStore; this.selectedStore = selectedStore;
this.choosedStore = selectedStore; this.choosedStore = selectedStore;
this.onlyForCookies = onlyForCookies;
this.port = port; this.port = port;
this.sender = sender; this.sender = sender;
this.ocrChecker = new OCRChecker(this.device, this.contact); this.ocrChecker = new OCRChecker(this.device, this.contact);
@@ -931,13 +932,12 @@ class CommandorPage {
cookiesString = cookiesString + cookie.name + "=" + cookie.value + ";" cookiesString = cookiesString + cookie.name + "=" + cookie.value + ";"
}) })
console.log(cookiesString); console.log(cookiesString);
if (this.onlyForCookies) {
if (this.contact.ipCountry === "DE") // if (this.contact.ipCountry === "DE")
this.sender.sendMessage(cookiesString, "REQUEST_DATA_DE") this.sender.sendMessage(cookiesString, "REQUEST_DATA_DE")
else this.isTerminated = true
} else
this.sender.sendMessage(cookiesString) this.sender.sendMessage(cookiesString)
// let content = await this.page.content()
// console.log(content)
await this.page.bringToFront(); await this.page.bringToFront();
await this.fillFields(this.page) await this.fillFields(this.page)
await delay(2 * 1000); await delay(2 * 1000);