mirror of
https://github.com/ION606/selmer-bot-website.git
synced 2026-05-15 06:26:54 +00:00
Added premium verification for the Reminders feature
This commit is contained in:
+26
-2
@@ -6,7 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<span id="IMPORTS">
|
<span id="IMPORTS">
|
||||||
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico?raw=true" type="image/x-icon">
|
||||||
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
@@ -370,6 +370,8 @@
|
|||||||
calSpacing.cellSpacing = 1;
|
calSpacing.cellSpacing = 1;
|
||||||
calSpacing.cellPadding = 1;
|
calSpacing.cellPadding = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.getElementById('calHeader').style.display = "block";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -389,6 +391,19 @@
|
|||||||
//Get serverId
|
//Get serverId
|
||||||
const id = window.localStorage.getItem('Id').toString();
|
const id = window.localStorage.getItem('Id').toString();
|
||||||
|
|
||||||
|
//Check if the user has premium
|
||||||
|
var xhrverify = new XMLHttpRequest();
|
||||||
|
xhrverify.open('post', 'http://www.selmerbot.com/verifypremium/', true);
|
||||||
|
xhrverify.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
|
|
||||||
|
//Use the guild Id as the userId
|
||||||
|
xhrverify.setRequestHeader('userId', id);
|
||||||
|
xhrverify.onloadend = (e) => {
|
||||||
|
if (xhrverify.response == "Unauthorized") {
|
||||||
|
document.getElementById("unauth").style.display = "block";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var xhr2 = new XMLHttpRequest();
|
var xhr2 = new XMLHttpRequest();
|
||||||
xhr2.open('get', 'http://www.selmerbot.com/getCal/', true);
|
xhr2.open('get', 'http://www.selmerbot.com/getCal/', true);
|
||||||
xhr2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
xhr2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
@@ -426,6 +441,9 @@
|
|||||||
|
|
||||||
xhr2.send();
|
xhr2.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xhrverify.send();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -473,8 +491,14 @@
|
|||||||
|
|
||||||
<caption style="caption-side: top;"></caption>
|
<caption style="caption-side: top;"></caption>
|
||||||
|
|
||||||
|
<div id="unauth" style="display: none;" class="text-center">
|
||||||
|
<h1 style="margin-bottom: 20px;">You have to be a premium subscriber to use this feature!</h1>
|
||||||
|
<h3 style="margin-bottom: 50px;">vvv GET PREMIUM NOW vvv</h3>
|
||||||
|
<a href="premium.html"><i class="fa-solid fa-crown" style="scale: 4; color: gold;" alt="PREMIUM"></i></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr id="calHeader" style="display: none;">
|
||||||
<th style="color: white; background: purple;">
|
<th style="color: white; background: purple;">
|
||||||
Sun</th>
|
Sun</th>
|
||||||
<th style="color: white; background: purple;">
|
<th style="color: white; background: purple;">
|
||||||
|
|||||||
+33
-6
@@ -6,7 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Selmer Bot Web Dashboard</title>
|
<title>Selmer Bot Web Dashboard</title>
|
||||||
|
|
||||||
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico?raw=true?raw=true" type="image/x-icon">
|
||||||
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
@@ -385,11 +385,32 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get serverId instead of the userId
|
||||||
|
const id = serverSettings.Id;
|
||||||
|
|
||||||
|
//Check if the user has premium
|
||||||
|
var xhrverify = new XMLHttpRequest();
|
||||||
|
xhrverify.open('post', 'http://www.selmerbot.com/verifypremium/', true);
|
||||||
|
xhrverify.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
|
|
||||||
|
//Use the guild Id as the userId
|
||||||
|
xhrverify.setRequestHeader('userId', id);
|
||||||
|
xhrverify.onloadend = (e) => {
|
||||||
|
console.log(xhrverify.response); //WHAT
|
||||||
|
if (xhrverify.response == "Unauthorized") {
|
||||||
|
document.getElementById("calForm").style.display = "none";
|
||||||
|
document.getElementById("unauth").style.display = "block";
|
||||||
|
return;
|
||||||
|
} else if (xhrverify.response == 'Internal Server Error') {
|
||||||
|
alert("Uh oh, an Internal Server Error has occured!\nPlease try again!");
|
||||||
|
return window.location.href = "index.html";
|
||||||
|
}
|
||||||
|
|
||||||
//Load the channels
|
//Load the channels
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('get', `http://www.selmerbot.com/getChannels/`, true);
|
xhr.open('get', `http://www.selmerbot.com/getChannels/`, true);
|
||||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
xhr.setRequestHeader('serverNumber', serverSettings.Id);
|
xhr.setRequestHeader('serverNumber', id);
|
||||||
xhr.onloadend = (e) => {
|
xhr.onloadend = (e) => {
|
||||||
//Channel Section
|
//Channel Section
|
||||||
const channels = JSON.parse(xhr.response);
|
const channels = JSON.parse(xhr.response);
|
||||||
@@ -443,9 +464,6 @@
|
|||||||
}
|
}
|
||||||
xhr.send();
|
xhr.send();
|
||||||
|
|
||||||
//Get serverId instead of the userId
|
|
||||||
const id = serverSettings.Id;
|
|
||||||
|
|
||||||
var xhr2 = new XMLHttpRequest();
|
var xhr2 = new XMLHttpRequest();
|
||||||
xhr2.open('get', 'http://www.selmerbot.com/getCal/', true);
|
xhr2.open('get', 'http://www.selmerbot.com/getCal/', true);
|
||||||
xhr2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
xhr2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
|
||||||
@@ -483,6 +501,9 @@
|
|||||||
xhr2.send();
|
xhr2.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xhrverify.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
window.localStorage.clear();
|
window.localStorage.clear();
|
||||||
@@ -670,6 +691,12 @@
|
|||||||
|
|
||||||
|
|
||||||
<div id="cal", class="hide wc" style="margin-top: 20px;">
|
<div id="cal", class="hide wc" style="margin-top: 20px;">
|
||||||
|
<div id="unauth" class="text-center">
|
||||||
|
<h1 style="margin-bottom: 20px;">You have to be a premium subscriber to use this feature!</h1>
|
||||||
|
<h3 style="margin-bottom: 50px;">vvv GET PREMIUM NOW vvv</h3>
|
||||||
|
<a href="premium.html"><i class="fa-solid fa-crown" style="scale: 4; color: gold;" alt="PREMIUM"></i></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h1 id="monthName", style="text-align: center; margin-top: 50px; margin-bottom: 25px;"></h1>
|
<h1 id="monthName", style="text-align: center; margin-top: 50px; margin-bottom: 25px;"></h1>
|
||||||
<form>
|
<form>
|
||||||
<table id="spaceId" style="background-color: lightgrey;"
|
<table id="spaceId" style="background-color: lightgrey;"
|
||||||
@@ -696,7 +723,7 @@
|
|||||||
appear as bold and is center aligned-->
|
appear as bold and is center aligned-->
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr id="calForm">
|
||||||
<!-- Here we have applied inline style
|
<!-- Here we have applied inline style
|
||||||
to make it more attractive-->
|
to make it more attractive-->
|
||||||
<th style="color: white; background: purple;">
|
<th style="color: white; background: purple;">
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Selmer Bot Web Dashboard</title>
|
<title>Selmer Bot Web Dashboard</title>
|
||||||
|
|
||||||
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico?raw=true" type="image/x-icon">
|
||||||
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
|||||||
@@ -185,6 +185,24 @@ app.get('/.well-known/apple-developer-merchantid-domain-association', async (req
|
|||||||
return res.sendFile('apple-developer-merchantid-domain-association', { root: '.' });
|
return res.sendFile('apple-developer-merchantid-domain-association', { root: '.' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.post('/verifypremium', async (req, res) => {
|
||||||
|
if (req.headers.userid) {
|
||||||
|
const id = req.headers.userid;
|
||||||
|
|
||||||
|
connection.then((client) => {
|
||||||
|
const dbo = client.db('main').collection('authorized');
|
||||||
|
dbo.findOne({id: id}).then((doc) => {
|
||||||
|
if (doc != undefined) {
|
||||||
|
res.sendStatus(200);
|
||||||
|
} else {
|
||||||
|
res.sendStatus(401);
|
||||||
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error(err); return res.sendStatus(500);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
app.post('/sendData', async (req, res) => {
|
app.post('/sendData', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<title>Selmer Bot Web Dashboard</title>
|
<title>Selmer Bot Web Dashboard</title>
|
||||||
|
|
||||||
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico?raw=true" type="image/x-icon">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
html { width:100%; height:100%; margin:0; padding:0; }
|
html { width:100%; height:100%; margin:0; padding:0; }
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico?raw=true" type="image/x-icon">
|
||||||
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
<title>Selmer Bot Web Dashboard</title>
|
<title>Selmer Bot Web Dashboard</title>
|
||||||
|
|
||||||
<span id="IMPORTS">
|
<span id="IMPORTS">
|
||||||
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico" type="image/x-icon">
|
<link rel="shortcut icon" href="https://github.com/ION606/selmer-bot-website/blob/main/assets/favicon.ico?raw=true" type="image/x-icon">
|
||||||
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
<script src="https://kit.fontawesome.com/728e740903.js" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|||||||
Reference in New Issue
Block a user