diff --git a/config.json b/config.json index d5058a9..7533dce 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,5 @@ { - "marketplace_enabled": false, + "marketplace_enabled": true, "marketplace_psk": "CHANGE_THIS_THIS_IS_INSECURE", "marketplace_level": "1" } \ No newline at end of file diff --git a/database_assets/image/asgard.png b/database_assets/image/asgard.png deleted file mode 100644 index 2dc065e..0000000 Binary files a/database_assets/image/asgard.png and /dev/null differ diff --git a/database_assets/styles/neptune.css b/database_assets/styles/neptune.css deleted file mode 100644 index e5cfaa4..0000000 --- a/database_assets/styles/neptune.css +++ /dev/null @@ -1,19 +0,0 @@ -:root { - --background-primary: rgba(0, 0, 0, 0); - --background-lighter: #04ff00; - --navbar-color: #ffffff; - --navbar-height: 60px; - --navbar-text-color: #ff7300; - --navbar-link-color: #16dcff; - --navbar-link-hover-color: gray; - --navbar-font: "Roboto"; - --input-text-color: #e0def4; - --input-placeholder-color: white; - --input-background-color: #ffb9d5; - --input-border-color: #eb6f92; - --input-border-size: 1.3px; - --navbar-logo-filter: none; - --dropdown-option-hover-color: #a891f4; - --tab-color: var(--black); - --border-color: #ff009d; -} diff --git a/server.js b/server.js index d070a2c..5f885aa 100644 --- a/server.js +++ b/server.js @@ -30,6 +30,7 @@ function auth_psk(req, res, next) { if (req.headers.psk !== config.marketplace_psk) { let err = "Bad PSK!"; + console.log("Bad psk"); return next(err); } @@ -117,6 +118,8 @@ const catalog_assets = sequelize.define("catalog_assets", { }, }); +app.use(express.json()); + app.get("/api", function (request, reply) { reply.send({ hello: "world" }); }); @@ -270,6 +273,26 @@ app.post( } ); +// This API is responsible for creating packages in the database. +// PSK authentication required. +app.post("/api/create-package", auth_psk, async function (req, res) { + console.log(req.body); + await catalog_assets.create({ + package_name: req.body.uuid, + title: req.body.title, + image: req.body.image_path, + author: req.body.author, + version: req.body.version, + description: req.body.description, + tags: ["Hacking", "Animated", "Funny"], + payload: req.body.payload, + background_video: req.body.background_video, + background_image: req.body.background_image_path, + type: req.body.type, + }); + res.send({ hello: "world" }); +}); + app.use("/images/", express.static("./database_assets/image")); app.use("/videos/", express.static("./database_assets/video")); app.use("/styles/", express.static("./database_assets/styles")); diff --git a/test_upload.js b/test_upload.js index cb36245..b8e9e10 100644 --- a/test_upload.js +++ b/test_upload.js @@ -10,7 +10,7 @@ const form = new FormData(); form.set("file", await fileFromPath("asgard.png")); console.log(config.marketplace_psk); - +console.log(form); await fetch("http://localhost:8080/api/upload-image", { headers: { PSK: config.marketplace_psk,