more fields
This commit is contained in:
@@ -33,7 +33,8 @@ const EMPTY_RESPONSE_ERROR = "ERR_EMPTY_RESPONSE"
|
|||||||
const MESSAGE_URL_VALIDATION_FR = "Nous avons envoyé un lien par e-mail."
|
const MESSAGE_URL_VALIDATION_FR = "Nous avons envoyé un lien par e-mail."
|
||||||
const MESSAGE_URL_VALIDATION_EN = "Please click on the link we sent by email"
|
const MESSAGE_URL_VALIDATION_EN = "Please click on the link we sent by email"
|
||||||
const REGEX_RDV_URL = "https:\/\/rendezvousparis\.hermes\.com\/client\/register\/[A-Z0-9]+"
|
const REGEX_RDV_URL = "https:\/\/rendezvousparis\.hermes\.com\/client\/register\/[A-Z0-9]+"
|
||||||
const DEFAULT_STORE = 'faubourg';
|
// const DEFAULT_STORE = 'faubourg';
|
||||||
|
const DEFAULT_STORE = 'random';
|
||||||
const timeout = (prom, time) =>
|
const timeout = (prom, time) =>
|
||||||
Promise.race([prom, new Promise((_r, rej) => setTimeout(rej, time))]);
|
Promise.race([prom, new Promise((_r, rej) => setTimeout(rej, time))]);
|
||||||
|
|
||||||
@@ -76,13 +77,15 @@ 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, onlyForCookies = false) {
|
constructor(contact, device, sender, mongoManager, selectedStore = DEFAULT_STORE, audioAnalyse = false, alertBeep = false, port = 9000, shareCookiesWithRequests = true) {
|
||||||
this.contact = contact;
|
this.contact = contact;
|
||||||
|
// to remove this line if we want to use store in contacts
|
||||||
|
this.contact.store = DEFAULT_STORE
|
||||||
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.shareCookiesWithRequests = shareCookiesWithRequests;
|
||||||
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);
|
||||||
@@ -759,10 +762,8 @@ class CommandorPage {
|
|||||||
let url = this.page.url();
|
let url = this.page.url();
|
||||||
logWithDevice("successful url is " + url, this.device)
|
logWithDevice("successful url is " + url, this.device)
|
||||||
await this.push_message_to_db(publishType, url)
|
await this.push_message_to_db(publishType, url)
|
||||||
if (this.onlyForCookies) {
|
if (this.shareCookiesWithRequests) {
|
||||||
await this.sendCookiesToQueue();
|
await this.sendCookiesToQueue();
|
||||||
this.isTerminated = true;
|
|
||||||
await this.resetBrowser()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1274,13 +1275,14 @@ 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.shareCookiesWithRequests) {
|
||||||
let pojoToSend = await this.getRequestData()
|
let pojoToSend = await this.getRequestData()
|
||||||
pojoToSend.cookiesStr = cookiesString
|
pojoToSend.cookiesStr = cookiesString
|
||||||
// this.sender.sendMessage(JSON.stringify(pojoToSend), REQUEST_DATA_OBJECT)
|
// this.sender.sendMessage(JSON.stringify(pojoToSend), REQUEST_DATA_OBJECT)
|
||||||
this.sender.sendMessage(JSON.stringify(pojoToSend), TEST_QUEUE)
|
this.sender.sendMessage(JSON.stringify(pojoToSend), TEST_QUEUE)
|
||||||
} else
|
} else {
|
||||||
this.sender.sendMessage(cookiesString)
|
this.sender.sendMessage(cookiesString)
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user