added hashing on api calls

This commit is contained in:
2022-07-12 12:49:26 +01:00
parent f23ad2a300
commit be9f86b6b2
13 changed files with 234 additions and 158 deletions
+10
View File
@@ -13,11 +13,18 @@ const ApiProxy = nextConnect();
ApiProxy.use(middleware);
ApiProxy.post(async (req, res) => {
var checkHash = req.query.hash;
console.log(JSON.parse(req.body.appealData));
console.log(req.files);
const appealData = JSON.parse(req.body.appealData);
// var checkquerypath = "/api/file/upload";
// console.log(hashAPIPath(checkquerypath), checkHash);
// console.log(hashAPIPath(checkquerypath) == "?hash=" + checkHash);
// if (hashAPIPath(checkquerypath) == "?hash=" + checkHash) {
createContainer(appealData.pinswg_name.trim()).then((containerName) => {
createBlob(appealData, containerName).then((data) => {
uploadFile(req.files, containerName, data);
@@ -25,6 +32,9 @@ ApiProxy.post(async (req, res) => {
});
return res.status(200).json({ data: "success" });
// } else {
// return res.status(400).json();
// }
});
export const config = {