Added webapp

This commit is contained in:
2023-05-02 13:29:51 +00:00
parent 0f4cecf9b0
commit 1a2a90d09e
12 changed files with 1705 additions and 25 deletions

BIN
views/images/wolf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

133
views/index.ejs Normal file
View File

@ -0,0 +1,133 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" sizes="192x192" href="/wolf.png">
<title><%= basecount %> Wolfs</title>
<style>
body {
background-color: #c2c2c2 !important;
margin: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Courier New', Courier, monospace;
}
.wolf {
width: 2em;
height: 2em;
vertical-align: middle;
}
h1 {
background-image: linear-gradient(to right, #c2c2c2, #6b6a6a);
animation: wiggle 4s linear infinite;
}
/* Keyframes */
@keyframes wiggle {
0%, 7% {
transform: rotateZ(0);
}
15% {
transform: rotateZ(-25deg);
}
20% {
transform: rotateZ(20deg);
}
25% {
transform: rotateZ(-20deg);
}
30% {
transform: rotateZ(10deg);
}
35% {
transform: rotateZ(-10deg);
}
40% {
transform: rotateZ(6deg);
}
45% {
transform: rotateZ(-4deg);
}
50%,100% {
transform: rotateZ(0deg);
}
}
.wolfcounting {
padding: 20% 0;
}
@media screen and (max-width: 1024px) {
.wolfcounting {
padding: 30% 0;
}
}
@media screen and (max-width: 768px) {
.wolfcounting {
padding: 38% 0;
}
}
@media screen and (max-width: 717px) {
.wolfcounting {
padding: 25% 0;
}
}
@media screen and (max-width: 425px) {
.wolfcounting {
padding: 72% 0;
}
}
</style>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
</head>
<body>
<!-- <h1><span>${basecount} wolfs</span><img class="wolf" src="images/wolf.png"></h1> -->
<div class="wolfcounting"><h1 style="box-shadow: 4px 6px; border: 3px solid grey; padding: 0.2vh 5px;"><span style="text-shadow: 2px 1px grey;"><%= basecount %> wolfs</span><img class="wolf" src="/wolf.png"></h1></div>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script>
</body>
</html>
<!-- <head>
<title>${basecount} Wolfs</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#c16a4f">
<link rel="icon" sizes="192x192" href="../site/assets/wolf.png">
<style>
body {
margin: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Courier New', Courier, monospace;
}
.wolf {
width: 2em;
height: 2em;
vertical-align: middle;
}
</style>
</head>
<body>
<h1><span>${basecount} wolfs</span><img class="wolf" src="../site/assets/wolf.png"></h1>
</body> -->

43
views/info.ejs Normal file
View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" sizes="192x192" href="/wolf.png">
<title>Wolfcount info</title>
<style>
body {
background-color: #c2c2c2 !important;
margin: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Courier New', Courier, monospace;
}
</style>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
</head>
<body>
<div class="container" style="padding: 10px">
<h1>Some information about this bot.</h1>
<p>The bot counts how many times the set letters are found, this will be once per message. So if someone says in this case wolf bla wolf the bot only counts one (the first one). Data refreshes every 2 minutes based on cron time (so 02, 04, 06, etc...).</p>
<p>You can add this bot by going to <a href="/invite">this page</a>. It will ofcourse ask you to go through some steps set by Discord to safely add it to the wanted server (Only 100 guilds possible, it may not be verified for more).</p>
<br><br>
<a href="/">Back to count</a><br>
<a href="/privacy">Privacy policy</a><br>
<a href="/tos">Terms of Service</a>
</div>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script>
</body>
</html>

49
views/privacy.ejs Normal file
View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" sizes="192x192" href="/wolf.png">
<title>Wolfcount privacy information</title>
<style>
body {
background-color: #c2c2c2 !important;
margin: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Courier New', Courier, monospace;
}
</style>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
</head>
<body>
<div class="container" style="padding: 10px">
<h1>Privacy statement</h1>
<h2>Data we collect</h2>
<p>The following data will get collected by using this bot.
<ul><li>Messages containing the letters set. In this case mainly messages containing "w", "o", "l" and "f".</li></ul>
</p>
<h2>Why we collect it?</h2>
<p>It will only get used for counting the number of messages.</p>
<h2>Does the data get shared?</h2>
<p>The message data is not shared to public, only the count is given on the page and the /wolfcount command.</p>
<br><br>
<a href="/">Back to count</a><br>
<a href="/info">Some more information</a><br>
<a href="/tos">Terms of Service</a>
</div>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script>
</body>
</html>

33
views/script.js--- Normal file
View File

@ -0,0 +1,33 @@
require("dotenv").config();
const mongoose = require('mongoose');
const wolfcount = require('../models/wolfcount');
const moment = require('moment');
const uri = `mongodb+srv://${process.env.MONGODBUSER}:${process.env.MONGODBPASS}@${process.env.MONGODBCLUSTER}/${process.env.DATABASE}?retryWrites=true&w=majority`
mongoose.connect(uri, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => {
console.log('');
console.log(`Connected to the database`);
}).catch((error) => {
console.log(`Failed to connect to the database`);
console.log(error);
});
console.log(`${moment(Date.now()).format('DD/MM/YY H:mm:ss')} Starting count refresh...`);
// Find a document by validation
wolfcount.findOne({ validation: 'wolfcount' }).then((countdocument) => {
console.log('');
//console.log(countdocument);
console.log(`Refreshed count`)
const basecount = countdocument.count
console.log('');
}).catch((error) => {
console.error(error);
});
console.log(`${moment(Date.now()).format('DD/MM/YY H:mm:ss')} Refreshed wolfcount on cron`);

43
views/tos.ejs Normal file
View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" sizes="192x192" href="/wolf.png">
<title>Wolfcount Terms of Service</title>
<style>
body {
background-color: #c2c2c2 !important;
margin: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Courier New', Courier, monospace;
}
</style>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
</head>
<body>
<div class="container" style="padding: 10px">
<h1>Terms of Service</h1>
<p>This bot kinda collects messages of Discord servers, so please mind the <a href="https://discord.com/terms">Terms of Service</a> and <a href="Community Guidelines">https://discord.com/guidelines</a> of Discord.
(The bot does not store the messages like Discord does, but it is better to follow the TOS and of Discord to avoid termination)</p>
<br><br>
<a href="/">Back to count</a><br>
<a href="/info">Some more information</a><br>
<a href="/privacy">Privacy policy</a>
</div>
<!-- Bootstrap JS -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script>
</body>
</html>