updated splitstat privacy policy
This commit is contained in:
@@ -1 +0,0 @@
|
||||
.env
|
||||
-233
@@ -1,233 +0,0 @@
|
||||
const app = require('express')();
|
||||
const { static } = require('express');
|
||||
const bodyParser = require('body-parser');
|
||||
const cors = require('cors');
|
||||
const morgan = require('morgan');
|
||||
const fetch = require('node-fetch');
|
||||
const http = require('http').Server(app);
|
||||
const io = require('socket.io')(http);
|
||||
const NodeCache = require('node-cache');
|
||||
const math = require('mathjs')
|
||||
require('dotenv').config();
|
||||
|
||||
const cache = new NodeCache();
|
||||
app.use(cors());
|
||||
app.use(morgan('dev'));
|
||||
app.use(bodyParser.json());
|
||||
app.use(static(__dirname + '/public'));
|
||||
app.use(bodyParser.urlencoded({
|
||||
extended: true
|
||||
}));
|
||||
|
||||
timer = false;
|
||||
global = {}
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send({ "status": 200 })
|
||||
})
|
||||
|
||||
app.get('/demi', (req, res) => {
|
||||
res.send(`go away`)
|
||||
})
|
||||
|
||||
app.get(`/tools/discord`, (req, res) => {
|
||||
res.send({ "status": "404", "message": "not a get endpoint. shoo."})
|
||||
})
|
||||
|
||||
app.post(`/tools/discord`, (req, res) => {
|
||||
try {
|
||||
const data = {
|
||||
username: `${req.body.disuser}`,
|
||||
avatar_url: `${req.body.avimage}`,
|
||||
embeds: [
|
||||
{
|
||||
color: `${req.body.color}`,
|
||||
title: `${req.body.title}`,
|
||||
description: `${req.body.description}`,
|
||||
image: {
|
||||
url: `${req.body.image}`
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
fetch(req.body.url, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
|
||||
res.redirect(`https://awexxx.xyz/tools/discord?callback=success`)
|
||||
}
|
||||
catch(err) {
|
||||
res.redirect(`https://awexxx.xyz/tools/discord?callback=fail`)
|
||||
}
|
||||
})
|
||||
|
||||
app.get(`/mcw`, (req, res) => {
|
||||
res.redirect(`https://mcw.awexxx.xyz/`)
|
||||
})
|
||||
|
||||
app.post(`/tools/mcw/clip`, async (req, res) => {
|
||||
var clipLink = req.body.clipLink || 'none';
|
||||
var user = req.body.medalUsername || 'none';
|
||||
var webhook = req.body.webhook || 'none';
|
||||
var caption = req.body.caption || 'none';
|
||||
|
||||
if(clipLink && user && webhook && caption === 'none') {
|
||||
console.log(`something wasn't supplied uh oh uwu :3`)
|
||||
return res.status(500).send({ "status": 500, "message": 'Your request was invalid! Please make sure all values were filled in!' })
|
||||
}
|
||||
|
||||
const data = {
|
||||
"username": 'Medal Clip Webhook by Awex',
|
||||
"avatar_url": 'https://avatars.githubusercontent.com/u/68027680?v=4',
|
||||
"content": `${user} shared via Medal Clip Webhook by Awex!`,
|
||||
"embeds": [
|
||||
{
|
||||
"author": {
|
||||
"name": `Credits to ${user} (https://medal.tv/${user})`,
|
||||
"url": `https://medal.tv/${user}`
|
||||
},
|
||||
"title": `${caption}`,
|
||||
"url": `${clipLink}`,
|
||||
"description": "This clip was shared via the [Medal Clip Webhook](https://mcw.awexxx.xyz)",
|
||||
"color": "15258703"
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
var resp = await fetch(`${webhook}`, {
|
||||
method: `POST`,
|
||||
headers: { 'Content-type': `application/json` },
|
||||
body: JSON.stringify(data)
|
||||
}).then(response => response.json)
|
||||
|
||||
res.status(200).send({ "status": 200, "message": "Clip successfully sent!" })
|
||||
|
||||
})
|
||||
|
||||
app.get('/browser/medal', (req, res) => {
|
||||
return res.sendFile(__dirname + '/public/browser.html')
|
||||
})
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
socket.on('event', msg => {
|
||||
io.emit('event', msg);
|
||||
});
|
||||
});
|
||||
|
||||
app.post(`/browser/medal/alert`, async (req, res) => {
|
||||
const header = req.header(`secret`)
|
||||
|
||||
if(header === `${process.env.access}`) {
|
||||
timer = true;
|
||||
res.send({ "status": 200, "message": "Started listening to Medal's API." })
|
||||
|
||||
interval = setInterval(async function() {
|
||||
var medalApiData = await fetch(`${process.env.medalapi}/24378`, {
|
||||
method: 'GET',
|
||||
headers: { 'x-authentication': `${process.env.medalauth}` }
|
||||
}).then(response => response.json());
|
||||
|
||||
try {
|
||||
if(cache.has('uniqueKey')) {
|
||||
if (medalApiData.followers === cache.get('uniqueKey')) {
|
||||
return console.log(`User hasn't gained followers, not firing.` + `\nCache: ${cache.get('uniqueKey')} & Medal API: ${medalApiData.followers}.`);
|
||||
} else if (medalApiData.followers > cache.get('uniqueKey')) {
|
||||
console.log(`More followers than before`, `${medalApiData.followers} vs ${cache.get('uniqueKey')}`)
|
||||
var arrayNum = math.subtract(medalApiData.followers, 13)
|
||||
obj = Object.keys(medalApiData.userFollowers)[arrayNum]
|
||||
await getFollowerInfo(obj)
|
||||
io.emit('event', global.follower);
|
||||
return cache.set('uniqueKey', medalApiData.followers)
|
||||
} else if (medalApiData.followers < cache.get('uniqueKey')) {
|
||||
console.log(`User lost followers.`, `Cache: ${cache.get('uniqueKey')} & Medal API: ${medalApiData.followers}.`)
|
||||
return cache.set('uniqueKey', medalApiData.followers)
|
||||
}
|
||||
} else {
|
||||
console.log(`User wasn't cached at all.`)
|
||||
return cache.set(`uniqueKey`, medalApiData.followers)
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
console.log(err)
|
||||
}
|
||||
}, 10*60000)
|
||||
} else {
|
||||
return res.status(401).send({ "status": 401, "message": "401 Not Authorized. Access Token Header missing" })
|
||||
}
|
||||
})
|
||||
|
||||
app.get(`/browser/medal/test`, async (req, res) => {
|
||||
var header = req.query.secret
|
||||
|
||||
if(header === `${process.env.access}`) {
|
||||
const follower = `215577`
|
||||
await getFollowerInfo(follower)
|
||||
io.emit('event', global.follower);
|
||||
|
||||
return res.send({ "status": 200, "message": "Event successfully emitted" })
|
||||
} else {
|
||||
return res.status(401).send({ "status": 401, "message": "401 Not Authorized. Access Token Header missing" })
|
||||
}
|
||||
})
|
||||
|
||||
app.get(`/browser/medal/stop`, (req, res) => {
|
||||
var header = req.header(`secret`)
|
||||
if(header === `${process.env.access}`) {
|
||||
clearInterval(interval)
|
||||
return res.send({ "status": 200, "message": "Interval successfully cleared" })
|
||||
} else {
|
||||
return res.status(401).send({ "status": 401, "message": "401 Not Authorized. Access Token Header missing" })
|
||||
}
|
||||
})
|
||||
|
||||
app.get('/browser/medal/activity', (req, res) => {
|
||||
if (timer === true) {
|
||||
return res.status(200).send({ "status": 200, "active": true, "message": "The Medal API Check Timer is ACTIVE." })
|
||||
} else if (timer === false) {
|
||||
return res.status(200).send({ "status": 200, "active": false, "message": "The Medal API Check Timer is NOT ACTIVE."})
|
||||
}
|
||||
})
|
||||
|
||||
app.post('/browser/medal/update-alert', (req, res) => {
|
||||
var header = req.header(`secret`)
|
||||
|
||||
if (header) {
|
||||
if (header === `${process.env.access}`) {
|
||||
var sampleObject = {
|
||||
"user": 'CloakyBrokey',
|
||||
"gif": req.body.gifurl,
|
||||
"sound": req.body.sound
|
||||
};
|
||||
|
||||
fs.writeFile("public/storage.json", JSON.stringify(sampleObject, null, 4), (err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
return res.status(500).send({ "status": 500, "message": "Something went wrong trying to store that info" })
|
||||
};
|
||||
console.log("File has been created");
|
||||
return res.status(200).send({ "status": 200, "message": "Successfully stored and set GIF and Alert Sound" })
|
||||
});
|
||||
} else {
|
||||
return res.status(401).send({ "status": 401, "message": "401 Not Authorized. Access Token Header incorrect"})
|
||||
}
|
||||
} else {
|
||||
return res.status(401).send({ "status": 401, "message": "401 Not Authorized. Access Token Header missing"})
|
||||
}
|
||||
})
|
||||
|
||||
async function getFollowerInfo(follower) {
|
||||
|
||||
var follower = await fetch(`${process.env.medalapi}/${follower}`, {
|
||||
method: 'GET',
|
||||
headers: { 'x-authentication': `${process.env.medalauth}` }
|
||||
}).then(response => response.json());
|
||||
|
||||
global.follower = follower.userName
|
||||
}
|
||||
|
||||
http.listen(process.env.PORT, () => {
|
||||
console.log(`Socket.IO server running at https://api.awexxx.xyz`);
|
||||
});
|
||||
|
||||
Generated
-1548
File diff suppressed because it is too large
Load Diff
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "api",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
"http": "^0.0.1-security",
|
||||
"mathjs": "^9.4.4",
|
||||
"morgan": "^1.10.0",
|
||||
"node-cache": "^5.1.2",
|
||||
"node-fetch": "^2.6.1",
|
||||
"socket.io": "^4.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
body {
|
||||
font-family: 'Teko', sans-serif;
|
||||
}
|
||||
|
||||
h3{
|
||||
color:gray;
|
||||
}
|
||||
|
||||
.center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
#container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#img {
|
||||
padding-top:20px;
|
||||
animation: fadeIn 1s;
|
||||
-webkit-animation: fadeIn 1s;
|
||||
-moz-animation: fadeIn 1s;
|
||||
-o-animation: fadeIn 1s;
|
||||
-ms-animation: fadeIn 1s;
|
||||
}
|
||||
@keyframes fadeIn {
|
||||
0% {opacity:0;}
|
||||
100% {opacity:1;}
|
||||
}
|
||||
|
||||
@-moz-keyframes fadeIn {
|
||||
0% {opacity:0;}
|
||||
100% {opacity:1;}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeIn {
|
||||
0% {opacity:0;}
|
||||
100% {opacity:1;}
|
||||
}
|
||||
|
||||
@-o-keyframes fadeIn {
|
||||
0% {opacity:0;}
|
||||
100% {opacity:1;}
|
||||
}
|
||||
|
||||
@-ms-keyframes fadeIn {
|
||||
0% {opacity:0;}
|
||||
100% {opacity:1;}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.2 MiB |
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
async function setSrc() {
|
||||
const json = await fetch(`https://api.awexxx.xyz/assets/json/storage.json`).then(response => response.json());
|
||||
|
||||
const audio = document.getElementById(`audio`);
|
||||
const gif = document.getElementById('gif');
|
||||
audio.setAttribute(`src`, `${json.sound}`)
|
||||
gif.setAttribute(`src`, `${json.gif}`)
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
var socket = io();
|
||||
|
||||
socket.on('event', function(msg) {
|
||||
var audio = document.getElementById('audio');
|
||||
|
||||
// Play the Medal intro audio & gif
|
||||
setTimeout(function() {
|
||||
document.getElementById(`container`).style.display = `block`;
|
||||
text.innerText = `CloakyBrokey was followed by ${msg} on Medal.tv!`
|
||||
console.log(`User that followed:`, msg)
|
||||
audio.play();
|
||||
}, 1000);
|
||||
|
||||
setTimeout(function() {
|
||||
document.getElementById(`container`).style.display = `none`;
|
||||
audio.pause();
|
||||
}, 9000)
|
||||
});
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"user": "CloakyBrokey",
|
||||
"gif": "https://media.giphy.com/media/c5skRQb3BXp8RwKGKW/giphy.gif?cid=ecf05e477jeehu9k7a3bvl9ni0u3gedimlcl1zgmedn8kgk1&rid=giphy.gif&ct=g",
|
||||
"sound": "http://localhost:7204/assets/img/medal-novideo.mp3"
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="/assets/css/main.css">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Teko:wght@500&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<script src="/assets/javascript/data.js"></script>
|
||||
<script>
|
||||
window.onload = setSrc
|
||||
</script>
|
||||
|
||||
|
||||
<div id="container" style="text-align:center;">
|
||||
<div id="img">
|
||||
<img class="center" width="350" id="gif" src="/assets/img/medal-gif.gif">
|
||||
<h3 id="text" style="font-size:50px;"></h3>
|
||||
</div>
|
||||
</div>
|
||||
<audio src="/assets/img/medal-novideo.mp3" id="audio"></audio>
|
||||
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script src="/assets/javascript/socket.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user