Fixed a really stupid mistake

This commit is contained in:
ION606
2022-08-14 11:21:20 -07:00
parent 1f1043f864
commit adaf982273
+49 -46
View File
@@ -394,9 +394,9 @@
window.onload = () => { window.onload = () => {
var serverSettings = JSON.parse(window.localStorage.getItem('serverInfo')); var sessionId = window.localStorage.getItem('sessionId');
if (!serverSettings) { if (!sessionId) {
alert("Please log in to continue"); alert("Please log in to continue");
if (window.location.href.indexOf('localhost') != -1) { if (window.location.href.indexOf('localhost') != -1) {
window.location = 'https://discord.com/api/oauth2/authorize?client_id=926551095352901632&redirect_uri=http%3A%2F%2Flocalhost%3A53134%2F&response_type=token&scope=identify%20guilds'; window.location = 'https://discord.com/api/oauth2/authorize?client_id=926551095352901632&redirect_uri=http%3A%2F%2Flocalhost%3A53134%2F&response_type=token&scope=identify%20guilds';
@@ -406,60 +406,63 @@
} }
//Get serverId //Get serverId
const id = serverSettings.Id; // window.localStorage.getItem('Id').toString(); // const id = serverSettings.Id; // window.localStorage.getItem('Id').toString();
const session = getSessionData();
//Check if the user has premium session.then((sessionInfo) => {
var xhrverify = new XMLHttpRequest(); const id = sessionInfo.userId;
xhrverify.open('post', 'http://www.selmerbot.com/verifypremium/', true); //Check if the user has premium
xhrverify.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); var xhrverify = new XMLHttpRequest();
xhrverify.open('post', 'http://www.selmerbot.com/verifypremium/', true);
//Use the guild Id as the userId xhrverify.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xhrverify.setRequestHeader('userId', id);
xhrverify.onloadend = (e) => {
if (xhrverify.response == "Unauthorized") {
document.getElementById("unauth").style.display = "block";
return;
}
var xhr2 = new XMLHttpRequest();
xhr2.open('get', 'http://www.selmerbot.com/getCal/', true);
xhr2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
//Use the guild Id as the userId //Use the guild Id as the userId
xhr2.setRequestHeader('userId', id); xhrverify.setRequestHeader('userId', id);
xhrverify.onloadend = (e) => {
if (xhrverify.response == "Unauthorized") {
document.getElementById("unauth").style.display = "block";
return;
}
xhr2.onloadend = (e) => { var xhr2 = new XMLHttpRequest();
const calList = new Map(); xhr2.open('get', 'http://www.selmerbot.com/getCal/', true);
xhr2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
const res = JSON.parse(xhr2.response); //Use the guild Id as the userId
const times = res[0]; xhr2.setRequestHeader('userId', id);
const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
document.getElementById('monthName').innerText = `Editing Reminders for the Month of ${monthNames[(new Date()).getMonth()]}`;
times.forEach((time, ind) => { xhr2.onloadend = (e) => {
const fullDate = new Date(Number(time)); const calList = new Map();
const month = fullDate.getMonth();
const day = fullDate.getDate();
//Make sure it's the right month (old ones should be removed, this is just a catch) const res = JSON.parse(xhr2.response);
if (month == (new Date()).getMonth()) { const times = res[0];
if (calList.has(day)) { const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var temp = calList.get(day); document.getElementById('monthName').innerText = `Editing Reminders for the Month of ${monthNames[(new Date()).getMonth()]}`;
temp.push(res[1][ind]);
calList.set(day, temp); times.forEach((time, ind) => {
} else { const fullDate = new Date(Number(time));
calList.set(day, [res[1][ind]]); const month = fullDate.getMonth();
const day = fullDate.getDate();
//Make sure it's the right month (old ones should be removed, this is just a catch)
if (month == (new Date()).getMonth()) {
if (calList.has(day)) {
var temp = calList.get(day);
temp.push(res[1][ind]);
calList.set(day, temp);
} else {
calList.set(day, [res[1][ind]]);
}
} }
} });
});
calSetup(calList); calSetup(calList);
}
xhr2.send();
} }
xhr2.send(); xhrverify.send();
} });
xhrverify.send();
} }
</script> </script>
</head> </head>