mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-23 02:42:28 +01:00
Redirect guild profile cdn stuff to normal avatar route while guild profiles are TODO
This commit is contained in:
parent
b19d9fe294
commit
e891ddb412
@ -5,7 +5,7 @@ import avatarsRoute from "./routes/avatars";
|
||||
import iconsRoute from "./routes/role-icons";
|
||||
import bodyParser from "body-parser";
|
||||
|
||||
export interface CDNServerOptions extends ServerOptions {}
|
||||
export interface CDNServerOptions extends ServerOptions { }
|
||||
|
||||
export class CDNServer extends Server {
|
||||
public declare options: CDNServerOptions;
|
||||
|
@ -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