mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 12:42:44 +01:00
Redirect guild profile cdn stuff to normal avatar route while guild profiles are TODO
This commit is contained in:
parent
a1869d9723
commit
73af303bb4
@ -73,7 +73,7 @@ router.get("/:user_id", async (req: Request, res: Response) => {
|
||||
return res.send(file);
|
||||
});
|
||||
|
||||
router.get("/:user_id/:hash", async (req: Request, res: Response) => {
|
||||
export const getAvatar = async (req: Request, res: Response) => {
|
||||
var { user_id, hash } = req.params;
|
||||
hash = hash.split(".")[0]; // remove .file extension
|
||||
const path = `avatars/${user_id}/${hash}`;
|
||||
@ -86,7 +86,9 @@ router.get("/:user_id/:hash", async (req: Request, res: Response) => {
|
||||
res.set("Cache-Control", "public, max-age=31536000");
|
||||
|
||||
return res.send(file);
|
||||
});
|
||||
}
|
||||
|
||||
router.get("/:user_id/:hash", getAvatar);
|
||||
|
||||
router.delete("/:user_id/:id", async (req: Request, res: Response) => {
|
||||
if (req.headers.signature !== Config.get().security.requestSignature)
|
||||
|
10
cdn/src/routes/guilds.ts
Normal file
10
cdn/src/routes/guilds.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Router } from "express";
|
||||
import { getAvatar } from "./avatars";
|
||||
|
||||
const router = Router();
|
||||
|
||||
// TODO: handle guild profiles
|
||||
router.get("/:guild_id/users/:user_id/avatars/:hash", getAvatar);
|
||||
router.get("/:guild_id/users/:user_id/banners/:hash", getAvatar);
|
||||
|
||||
export default router;
|
Loading…
Reference in New Issue
Block a user