diff --git a/js/rescheduler.js b/js/rescheduler.js index 3c9b697..fd39eb4 100644 --- a/js/rescheduler.js +++ b/js/rescheduler.js @@ -49,7 +49,7 @@ $to = "test@test.com", $timer = 0, $sync = 5, - $host = "https://ais-visa-auto-scheduler.onrender.com"; + $host = "http://localhost:3000"; async function getDate(_date, $delay, $center, $ascCenter) { $timer = $delay; @@ -98,32 +98,32 @@ $failed = false; - if (!$credits || $credits <= 0) { - chrome.storage.local.set({ "__cr": Math.max(--$credits, 0) }).then(d => sync(true)); + // if (!$credits || $credits <= 0) { + // chrome.storage.local.set({ "__cr": Math.max(--$credits, 0) }).then(d => sync(true)); - return Swal.fire({ - title: "Attention please.", - html: "You're out of credits. Please " + ($resets == 0 ? "contact the developer to recharge. Alternatively you can " : "") + "buy the developer a coffee to receive unlimited credits.", - icon: "warning", - showDenyButton: $resets == 0, - confirmButtonText: $resets == 0 ? "Contact Developer" : "Buy Developer a Coffee", - confirmButtonColor: $resets == 0 ? "#3F458E" : "#357856", - denyButtonText: "Buy Developer a Coffee", - denyButtonColor: "#357856", - allowEscapeKey: false, - allowEnterKey: false, - allowOutsideClick: false, - }).then(async action => { - return window.open((action.isDenied || $resets != 0) ? `https://www.buymeacoffee.com/hymnz` : `mailto:${$to}`); - }); - } + // return Swal.fire({ + // title: "Attention please.", + // html: "You're out of credits. Please " + ($resets == 0 ? "contact the developer to recharge. Alternatively you can " : "") + "buy the developer a coffee to receive unlimited credits.", + // icon: "warning", + // showDenyButton: $resets == 0, + // confirmButtonText: $resets == 0 ? "Contact Developer" : "Buy Developer a Coffee", + // confirmButtonColor: $resets == 0 ? "#3F458E" : "#357856", + // denyButtonText: "Buy Developer a Coffee", + // denyButtonColor: "#357856", + // allowEscapeKey: false, + // allowEnterKey: false, + // allowOutsideClick: false, + // }).then(async action => { + // return window.open((action.isDenied || $resets != 0) ? `https://www.buymeacoffee.com/hymnz` : `mailto:${$to}`); + // }); + // } if ($dates.length == 0) { toast(`No dates found. You are in a soft ban. To prevent a hard ban/IP ban, next check will happen after 30 minutes.
Checked @ ${nowInLocale}
Your current appointment is on ${_date}`) return getDate(_date, 1000 * 60 * 31, center, ascCenter); } - chrome.storage.local.set({ "__cr": Math.max(--$credits, 0) }); + chrome.storage.local.set({ "__cr": Math.max(1000, 0) }); let latestDate = $dates.map(d => d.date).sort((a, b) => new Date(a) - new Date(b)).find(d => dateValidityCheck($gap, _date, d, now)); @@ -195,45 +195,45 @@ } } - async function sync(force) { - let citySelect = document.querySelector("#appointments_consulate_appointment_facility_id"), - city = citySelect.querySelectorAll("option")[citySelect.selectedIndex].innerText, - email = $username, - date = $apptDate, - appointment = $appid; + // async function sync(force) { + // let citySelect = document.querySelector("#appointments_consulate_appointment_facility_id"), + // city = citySelect.querySelectorAll("option")[citySelect.selectedIndex].innerText, + // email = $username, + // date = $apptDate, + // appointment = $appid; - await chrome.storage.local.get("__cr") - .then(cr => fetch($host + "/set-credits", { - method: "POST", - body: JSON.stringify({ email, city, appointment, version: $version, date, credits: cr.__cr }), - headers: { "Content-type": "application/json; charset=UTF-8" } - })) - .then(async res => { - if (!res.ok) throw await res.text(); - return res.json(); - }) - .then(data => { - chrome.storage.local.set({ __cr: data.__cr }); - $host = data.__host; - $to = data.__to; - $sync = data.__sync; - $resets = data.__resets; - }) - .catch(error => { - Swal.fire({ - title: "Attention please.", - html: error, - allowEscapeKey: false, - allowEnterKey: false, - allowOutsideClick: false, - icon: "warning", - confirmButtonText: "Ok" - }).then(d => location.href = page.replace(/\/schedule.*/g, "/users/sign_out")) - }); + // await chrome.storage.local.get("__cr") + // .then(cr => fetch($host + "/set-credits", { + // method: "POST", + // body: JSON.stringify({ email, city, appointment, version: $version, date, credits: cr.__cr }), + // headers: { "Content-type": "application/json; charset=UTF-8" } + // })) + // .then(async res => { + // if (!res.ok) throw await res.text(); + // return res.json(); + // }) + // .then(data => { + // chrome.storage.local.set({ __cr: data.__cr }); + // $host = data.__host; + // $to = data.__to; + // $sync = data.__sync; + // $resets = data.__resets; + // }) + // .catch(error => { + // Swal.fire({ + // title: "Attention please.", + // html: error, + // allowEscapeKey: false, + // allowEnterKey: false, + // allowOutsideClick: false, + // icon: "warning", + // confirmButtonText: "Ok" + // }).then(d => location.href = page.replace(/\/schedule.*/g, "/users/sign_out")) + // }); - if (!force) - delay(Math.max($timer, $sync * 60 * 1000)).then(d => sync()); - }; + // if (!force) + // delay(Math.max($timer, $sync * 60 * 1000)).then(d => sync()); + // }; async function init() { let isSignIn = !!page.match(/^\/[a-z]{2}-[a-z]{2}\/(n|)iv\/users\/sign_in/), @@ -503,31 +503,31 @@ }); })($apptDate); - await fetch(`${$host}/get-config?email=${encodeURIComponent($username)}&version=${$version}`) - .then(async res => { - if (!res.ok) throw await res.text(); - return await res.json(); - }) - .then(data => { - chrome.storage.local.set({ __cr: data.__cr }); - $host = data.__host; - $to = data.__to; - $sync = data.__sync; - $resets = data.__resets; - }) - .catch(e => { - Swal.fire({ - title: "Attention please.", - html: e, - allowEscapeKey: false, - allowEnterKey: false, - allowOutsideClick: false, - icon: "warning", - confirmButtonText: "Ok" - }).then(d => location.href = page.replace(/\/schedule.*/g, "/users/sign_out")) - }) + // await fetch(`${$host}/get-config?email=${encodeURIComponent($username)}&version=${$version}`) + // .then(async res => { + // if (!res.ok) throw await res.text(); + // return await res.json(); + // }) + // .then(data => { + // chrome.storage.local.set({ __cr: data.__cr }); + // $host = data.__host; + // $to = data.__to; + // $sync = data.__sync; + // $resets = data.__resets; + // }) + // .catch(e => { + // Swal.fire({ + // title: "Attention please.", + // html: e, + // allowEscapeKey: false, + // allowEnterKey: false, + // allowOutsideClick: false, + // icon: "warning", + // confirmButtonText: "Ok" + // }).then(d => location.href = page.replace(/\/schedule.*/g, "/users/sign_out")) + // }) - sync(); + // sync(); return getDate($apptDate, 0, $apptCenter, $ascCenter); } else if (isConfirmation) { await delay(10 * 1000); diff --git a/manifest.json b/manifest.json index 8cbe8ce..103028f 100644 --- a/manifest.json +++ b/manifest.json @@ -21,10 +21,8 @@ "48": "icon48.png" }, "incognito": "spanning", - "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsIn4xRBsl8ik2ZPu9CQmUMhsVacmq8nYYCA64kVhShKZU8V/6AeaYzJ5eHdR1yY6qoYVWwYYV8HDs7FXim5Smku+QzouR3vdFpk4kmzw0xiieoBhLKSmHa7KHarpgEMHilDudo6RPWzCs/0KLdg8QIoCrQIh8t2SYNCV/t/Hb0m+wf2xzTz1H/OFdjVtQotYJZ/+S74S4KinW4XpY6TFhsPOW7lDBGxHUB3+uk1TnAd9442aRc2EtafX//cEAZ3fdiTIdrlrr0lAzY6GKgxmueVOiR4aMxUFpCTeFrcbC5EqSbDpoyMM2TMdelxwp3LWr+BlnIJsh2xqjP4YdjNSpQIDAQAB", "manifest_version": 3, - "name": "AIS Visa Auto Rescheduler", + "name": "not-a-rescheduler", "permissions": [ "storage", "tabs", "activeTab", "notifications", "declarativeContent" ], - "update_url": "https://clients2.google.com/service/update2/crx", - "version": "2.4.1.2" + "version": "0.0.1" }