Add autobook feature

This commit is contained in:
2024-04-22 23:20:43 -07:00
parent bdf4b5a7c4
commit 9f5fa888ef
3 changed files with 24 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ let config = {
consulates: null,
deltaAppt: null,
deltaNow: null,
autobook: null,
};
let isRunning = false;
@@ -168,6 +169,7 @@ 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));
@@ -430,8 +432,16 @@ async function runner() {
document.getElementById("appointments_submit").removeAttribute("disabled");
document.getElementById("appointments_submit").click();
await sendNotification(`Found better appointment in ${consulate} at ${chosenDate} ${chosenTime}`);
}
msg = `Found better appointment in ${consulate} at ${chosenDate} ${chosenTime}`;
console.log(msg);
await sendNotification(msg);
if (config.autobook) {
await delay(PAGE_WAIT_TIME);
console.log('Auto booking');
document.querySelector(".reveal-overlay:last-child [data-reveal] .button.alert").click();
}
} // end consulates loop
}