stuff uwu
This commit is contained in:
+32
-6
@@ -6,8 +6,6 @@ const morgan = require('morgan');
|
||||
const fetch = require('node-fetch');
|
||||
const http = require('http').Server(app);
|
||||
const io = require('socket.io')(http);
|
||||
const puppeteer = require('puppeteer');
|
||||
const dom = require('jsdom');
|
||||
const NodeCache = require('node-cache');
|
||||
const math = require('mathjs')
|
||||
require('dotenv').config();
|
||||
@@ -110,7 +108,7 @@ app.post(`/tools/mcw/clip`, async (req, res) => {
|
||||
})
|
||||
|
||||
app.get('/browser/medal', (req, res) => {
|
||||
return res.sendFile(__dirname + '/public/index.html')
|
||||
return res.sendFile(__dirname + '/public/browser.html')
|
||||
})
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
@@ -161,12 +159,13 @@ app.post(`/browser/medal/alert`, async (req, res) => {
|
||||
}
|
||||
})
|
||||
|
||||
app.get(`/browser/medal/test`, (req, res) => {
|
||||
app.get(`/browser/medal/test`, async (req, res) => {
|
||||
var header = req.query.secret
|
||||
|
||||
if(header === `${process.env.access}`) {
|
||||
const follower = `poggers`
|
||||
io.emit('event', follower);
|
||||
const follower = `215577`
|
||||
await getFollowerInfo(follower)
|
||||
io.emit('event', global.follower);
|
||||
|
||||
return res.send({ "status": 200, "message": "Event successfully emitted" })
|
||||
} else {
|
||||
@@ -192,6 +191,33 @@ app.get('/browser/medal/activity', (req, res) => {
|
||||
}
|
||||
})
|
||||
|
||||
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}`, {
|
||||
|
||||
Generated
-1943
File diff suppressed because it is too large
Load Diff
@@ -9,12 +9,10 @@
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
"http": "^0.0.1-security",
|
||||
"jsdom": "^17.0.0",
|
||||
"mathjs": "^9.4.4",
|
||||
"morgan": "^1.10.0",
|
||||
"node-cache": "^5.1.2",
|
||||
"node-fetch": "^2.6.1",
|
||||
"puppeteer": "^10.2.0",
|
||||
"socket.io": "^4.1.3"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
async function recievedAlert(follower) {
|
||||
var audio = document.getElementById('audio');
|
||||
|
||||
// Play the Medal intro audio & gif
|
||||
setTimeout(function() {
|
||||
var gif = document.getElementById(`gif`)
|
||||
var img = document.getElementById(`img`)
|
||||
img.style.display = `block`;
|
||||
gif.setAttribute(`width`, `350`)
|
||||
gif.setAttribute(`src`, `assets/img/medal-gif.gif`)
|
||||
var text = document.getElementById(`text`);
|
||||
text.innerText = `CloakyBrokey was followed by ${follower} on Medal.tv!`
|
||||
audio.play();
|
||||
}, 1000);
|
||||
|
||||
setTimeout(function() {
|
||||
document.getElementById(`img`).innerHTML = ``;
|
||||
}, 15000)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
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}`)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
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)
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
@@ -6,6 +6,11 @@
|
||||
<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">
|
||||
@@ -16,24 +21,6 @@
|
||||
<audio src="/assets/img/medal-novideo.mp3" id="audio"></audio>
|
||||
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script>
|
||||
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(msg)
|
||||
audio.play();
|
||||
}, 1000);
|
||||
|
||||
setTimeout(function() {
|
||||
document.getElementById(`container`).style.display = `none`;
|
||||
}, 9000)
|
||||
});
|
||||
</script>
|
||||
<script src="/assets/javascript/socket.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,28 @@
|
||||
.container {
|
||||
position: absolute;
|
||||
padding-top:40px;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
/* width: 600px; */
|
||||
height: 100px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.jumbotron {
|
||||
background-color:#4a4a4a;
|
||||
}
|
||||
|
||||
.jumbotron img {
|
||||
max-width:75%;
|
||||
}
|
||||
|
||||
.jumbotron h3 {
|
||||
color:white;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color:#b3b3b3;
|
||||
text-align:center;
|
||||
}
|
||||
Reference in New Issue
Block a user