Support multiple consulates

This commit is contained in:
2024-04-24 15:12:19 -07:00
parent c5582e7662
commit 30438a68e8
3 changed files with 64 additions and 12 deletions

View File

@@ -22,7 +22,6 @@ let config = {
consulates: null,
deltaAppt: null,
deltaNow: null,
autobook: null,
};
let isRunning = false;
let msg = "";
@@ -128,6 +127,7 @@ async function getConsulates() {
"bestDate": null,
"currentDate": null,
"nextCheckAt": getFutureDate(0, config.frequency * MINUTE),
"autobook": false,
};
}
return consulatesDict;
@@ -187,7 +187,6 @@ async function runner() {
config.consulates = result['__consulates'] || null;
config.deltaAppt = result['__deltaAppt'] || 1;
config.deltaNow = result['__deltaNow'] || 1;
config.autobook = result['__autobook'] || false;
if (prev_config.activate === null) {
console.log('Reading config: ' + JSON.stringify(config));
@@ -479,7 +478,7 @@ async function runner() {
console.log(msg);
await sendNotification(msg);
if (config.autobook) {
if (config.consulates[consulate].autobook) {
await delay(PAGE_WAIT_TIME);
console.log('Auto booking');
document.querySelector(".reveal-overlay:last-child [data-reveal] .button.alert").click();