some backend updates

This commit is contained in:
rift 2024-08-22 16:23:13 -05:00
parent e0805868a6
commit c9a02c2351
5 changed files with 25 additions and 21 deletions

View file

@ -1,5 +1,5 @@
{ {
"marketplace_enabled": false, "marketplace_enabled": true,
"marketplace_psk": "CHANGE_THIS_THIS_IS_INSECURE", "marketplace_psk": "CHANGE_THIS_THIS_IS_INSECURE",
"marketplace_level": "1" "marketplace_level": "1"
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

View file

@ -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;
}

View file

@ -30,6 +30,7 @@ function auth_psk(req, res, next) {
if (req.headers.psk !== config.marketplace_psk) { if (req.headers.psk !== config.marketplace_psk) {
let err = "Bad PSK!"; let err = "Bad PSK!";
console.log("Bad psk");
return next(err); return next(err);
} }
@ -117,6 +118,8 @@ const catalog_assets = sequelize.define("catalog_assets", {
}, },
}); });
app.use(express.json());
app.get("/api", function (request, reply) { app.get("/api", function (request, reply) {
reply.send({ hello: "world" }); 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("/images/", express.static("./database_assets/image"));
app.use("/videos/", express.static("./database_assets/video")); app.use("/videos/", express.static("./database_assets/video"));
app.use("/styles/", express.static("./database_assets/styles")); app.use("/styles/", express.static("./database_assets/styles"));

View file

@ -10,7 +10,7 @@ const form = new FormData();
form.set("file", await fileFromPath("asgard.png")); form.set("file", await fileFromPath("asgard.png"));
console.log(config.marketplace_psk); console.log(config.marketplace_psk);
console.log(form);
await fetch("http://localhost:8080/api/upload-image", { await fetch("http://localhost:8080/api/upload-image", {
headers: { headers: {
PSK: config.marketplace_psk, PSK: config.marketplace_psk,