✨ update to use new Lambert-server
This commit is contained in:
@@ -15,7 +15,7 @@ type Attachment = {
|
||||
router.post("/:filename", multer_.single("attachment"), async (req, res) => {
|
||||
const { buffer, mimetype } = req.file;
|
||||
const { filename } = req.params;
|
||||
const { db } = req.server;
|
||||
const { db } = req.cdn;
|
||||
|
||||
const File: Attachment = {
|
||||
filename,
|
||||
@@ -30,7 +30,7 @@ router.post("/:filename", multer_.single("attachment"), async (req, res) => {
|
||||
});
|
||||
|
||||
router.get("/:hash/:filename", async (req, res) => {
|
||||
const { db } = req.server;
|
||||
const { db } = req.cdn;
|
||||
const { hash, filename } = req.params;
|
||||
|
||||
const File: Attachment = await db.data.attachments({ id: hash, filename: filename }).get();
|
||||
@@ -41,7 +41,7 @@ router.get("/:hash/:filename", async (req, res) => {
|
||||
|
||||
router.delete("/:hash/:filename", async (req, res) => {
|
||||
const { hash, filename } = req.params;
|
||||
const { db } = req.server;
|
||||
const { db } = req.cdn;
|
||||
|
||||
await db.data.attachments({ id: hash, filename: filename }).delete();
|
||||
return res.send({ success: true, message: "attachment deleted" });
|
||||
|
||||
@@ -30,7 +30,7 @@ const DEFAULT_FETCH_OPTIONS: any = {
|
||||
router.post("/", bodyParser.json(), async (req, res) => {
|
||||
if (!req.body) throw new Error("Invalid Body (url missing) \nExample: url:https://discord.com");
|
||||
|
||||
const { db } = req.server;
|
||||
const { db } = req.cdn;
|
||||
const { url } = req.body;
|
||||
|
||||
const ID = btoa(url);
|
||||
@@ -72,7 +72,7 @@ router.post("/", bodyParser.json(), async (req, res) => {
|
||||
});
|
||||
|
||||
router.get("/:id/:filename", async (req, res) => {
|
||||
const { db } = req.server;
|
||||
const { db } = req.cdn;
|
||||
const { id, filename } = req.params;
|
||||
const { image, type } = await db.data.externals({ id: id }).get();
|
||||
const imageBuffer = Buffer.from(image, "base64");
|
||||
|
||||
Reference in New Issue
Block a user