mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 20:52:42 +01:00
🐛 message attachment url
This commit is contained in:
parent
46b7f44bf0
commit
202a8bd187
@ -3,6 +3,7 @@ import {
|
||||
Attachment,
|
||||
Channel,
|
||||
ChannelType,
|
||||
Config,
|
||||
DmChannelDTO,
|
||||
Embed,
|
||||
emitEvent,
|
||||
@ -15,6 +16,7 @@ import { HTTPError } from "lambert-server";
|
||||
import { handleMessage, postHandleMessage, route } from "@fosscord/api";
|
||||
import multer from "multer";
|
||||
import { FindManyOptions, LessThan, MoreThan } from "typeorm";
|
||||
import { URL } from "url";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@ -111,6 +113,9 @@ router.get("/", async (req: Request, res: Response) => {
|
||||
});
|
||||
// @ts-ignore
|
||||
if (!x.author) x.author = { discriminator: "0000", username: "Deleted User", public_flags: "0", avatar: null };
|
||||
x.attachments?.forEach((x) => {
|
||||
x.proxy_url = `${Config.get().cdn.endpointPublic || "http://localhost:3003"}${new URL(x.proxy_url).pathname}`;
|
||||
});
|
||||
|
||||
return x;
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user