feat: authorise server

master
Paul Makles 2023-12-12 20:00:19 +00:00
parent a39052baf9
commit a79de56d32
2 changed files with 6 additions and 1 deletions

View File

@ -1,2 +1,3 @@
MONGODB=
JWT_SECRET=
SERVER_TOKEN=

View File

@ -47,6 +47,10 @@ app.get("/jwt", async (req, res) => {
});
app.post("/info", async (req, res) => {
if (req.headers["x-server"] !== process.env.SERVER_TOKEN) {
return res.status(403).send("Not server.");
}
const token = req.headers["x-jwt"];
if (token) {
try {