Update app to incorporate sigcrafting inventory endpoints

master
sigonasr2 2 years ago
parent 8eabca4138
commit 09c327ec69
  1. 28
      server/app.js
  2. 2
      server/files/leaderboardinfo

@ -6,12 +6,13 @@ const app = express();
const port = 4501; const port = 4501;
const { json, urlencoded } = require("body-parser"); const { json, urlencoded } = require("body-parser");
const Pool = require("pg").Pool; const Pool = require("pg").Pool;
app.use(json()); app.use(json({limit:"300kb"}));
app.use( app.use(
urlencoded({ urlencoded({
extended: true, extended: true,
}) })
); );
app.use(express.json({limit:"300kb"}))
const nodemailer = require("nodemailer"); const nodemailer = require("nodemailer");
const fileUpload = require("express-fileupload"); const fileUpload = require("express-fileupload");
const unzipper = require("unzipper"); const unzipper = require("unzipper");
@ -2730,6 +2731,31 @@ app.post("/cans", function (req, res) {
} }
}); });
inventoryData=[]
inventoryLastUpdate = new Date().getTime();
app.post("/inventoryData",(req,res)=>{
if (req.body){
inventoryData=req.body
inventoryLastUpdate=new Date().getTime();
res.status(200).send("Done!");
} else {
res.status(400).send("Invalid credentials!");
}
});
app.get("/inventoryData",(req,res)=>{
if (req.query.lastUpdate){
if (req.query.lastUpdate>inventoryLastUpdate){
res.status(200).send("")
} else {
res.status(200).json(inventoryData)
}
} else {
res.status(200).json(inventoryData)
}
})
app.post("/streamkill/:id", function (req, res) { app.post("/streamkill/:id", function (req, res) {
if (req.body && req.body.username && req.body.authentication_token) { if (req.body && req.body.username && req.body.authentication_token) {
GetUserLoginAllowed( GetUserLoginAllowed(

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save