add auth server with hardcoded pass!

This commit is contained in:
deflax 2021-10-10 15:35:17 +00:00
parent e7ceb9684b
commit c0dbc48562
4 changed files with 1273 additions and 0 deletions

6
auth/Dockerfile Normal file
View file

@ -0,0 +1,6 @@
FROM node:12
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY server.js ./
CMD ["npm", "start"]

1229
auth/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

16
auth/package.json Normal file
View file

@ -0,0 +1,16 @@
{
"name": "auth",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"nodemon": "^2.0.7"
}
}

22
auth/server.js Normal file
View file

@ -0,0 +1,22 @@
const express = require('express');
const app = express();
app.use(express.urlencoded());
app.post("/auth", function (req, res) {
/* This server is only available to nginx */
const streamkey = req.body.key;
/* You can make a database of users instead :) */
if (streamkey === "supersecret23") {
res.status(200).send();
return;
}
/* Reject the stream */
res.status(403).send();
});
app.listen(8000, function () {
console.log("Listening on port 8000!");
});