Implement basic stream monitoring

pull/5/head
sigonasr2 4 years ago
parent ea5add10f9
commit f9852b8ef1
  1. 1
      .gitignore
  2. 2
      divabotguardian/.gitignore
  3. BIN
      divabotguardian/cropped.png
  4. BIN
      divabotguardian/lib/httpclient-4.5.12.jar
  5. BIN
      divabotguardian/lib/httpcore-4.4.13.jar
  6. 2
      divabotguardian/processes/3.divabotguardian
  7. 2
      divabotguardian/processes/3.ffmpeg
  8. 7
      frontend/src/setupProxy.js
  9. 17
      server/app.js
  10. 1
      server/invalidSongs

1
.gitignore vendored

@ -0,0 +1 @@
postgres-data

@ -1 +1,3 @@
.guardian_env
streams
processes

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

@ -1,6 +1,13 @@
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
"/passImageData",
createProxyMiddleware({
target: 'http://server:4501',
changeOrigin: true,
})
);
app.use(
"/getUserAuthData",
createProxyMiddleware({

@ -991,10 +991,11 @@ app.post('/updateuser', function(req, res) {
app.post('/getUserAuthData', function(req, res) {
if (req.body&&req.body.password&&req.body.userId) {
if (req.body.password===process.env.GUARDIANPASSWORD) {
db.query("select username,authentication_token from users where id=$1",[req.body.userId])
db.query("select uploads,username,authentication_token from users where id=$1",[req.body.userId])
.then((data)=>{
if (data.rows.length>0) {
res.status(400).json(data.rows[0])
db.query("update users set uploads=$1 where id=$2",[data.rows[0].uploads+1,req.body.userId])
} else {
res.status(400).send("No user found!")
}
@ -1011,6 +1012,20 @@ app.post('/getUserAuthData', function(req, res) {
}
})
app.post('/passImageData',function(req,res) {
if (req.body&&req.body.user&&req.body.auth&&req.body.url) {
axios.post("http://projectdivar.com/image",{user:req.body.user,auth:req.body.auth,url:req.body.url})
.then((data)=>{
res.status(200).json(data.data)
})
.catch((err)=>{
res.status(500).send(err.message)
})
} else {
res.status(400).send("Invalid credentials!")
}
})
app.get('/streamdata/:id',function (req,res){
db.query("select twitch_name from users where id=$1",[req.params.id])
.then((data)=>{

@ -80,3 +80,4 @@
{"song":"深海シティアンダーグラウンド","username":"sigonasr2","authentication_token":"sig","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"-1.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"http://pbs.twimg.com/media/EiK0POLVkAIFpho.jpg"}
{"song":"深海シティアンダーグラウンド","username":"sigonasr2","authentication_token":"sig","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"-1.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"http://pbs.twimg.com/media/EiK0POLVkAIFpho.jpg"}
{"song":"深海シティアンダーグラウンド","username":"sigonasr2","authentication_token":"sig","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"-1.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"http://pbs.twimg.com/media/EiK0POLVkAIFpho.jpg"}
{"song":"スノーマン","username":"sigonasr2","authentication_token":"sig","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"-1.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"http://projectdivar.com/files/plays/3/690"}

Loading…
Cancel
Save