diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 22:29:30 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 22:41:21 +1000 |
commit | 99ee7e9400f06e8718612d8b52d15215dc620774 (patch) | |
tree | 08de8c5d3985b9c2eaa419f5198f891ecd82d012 /src/cdn/routes | |
parent | Remove the cdn storage location log (diff) | |
download | server-99ee7e9400f06e8718612d8b52d15215dc620774.tar.xz |
Prettier
Diffstat (limited to 'src/cdn/routes')
-rw-r--r-- | src/cdn/routes/attachments.ts | 8 | ||||
-rw-r--r-- | src/cdn/routes/avatars.ts | 4 | ||||
-rw-r--r-- | src/cdn/routes/external.ts | 11 | ||||
-rw-r--r-- | src/cdn/routes/guilds.ts | 2 | ||||
-rw-r--r-- | src/cdn/routes/role-icons.ts | 2 |
5 files changed, 15 insertions, 12 deletions
diff --git a/src/cdn/routes/attachments.ts b/src/cdn/routes/attachments.ts index ae50bc48..2a1b6f09 100644 --- a/src/cdn/routes/attachments.ts +++ b/src/cdn/routes/attachments.ts @@ -56,7 +56,7 @@ router.post( }; return res.json(file); - } + }, ); router.get( @@ -65,7 +65,7 @@ router.get( const { channel_id, id, filename } = req.params; const file = await storage.get( - `attachments/${channel_id}/${id}/${filename}` + `attachments/${channel_id}/${id}/${filename}`, ); if (!file) throw new HTTPError("File not found"); const type = await FileType.fromBuffer(file); @@ -79,7 +79,7 @@ router.get( res.set("Cache-Control", "public, max-age=31536000"); return res.send(file); - } + }, ); router.delete( @@ -94,7 +94,7 @@ router.delete( await storage.delete(path); return res.send({ success: true }); - } + }, ); export default router; diff --git a/src/cdn/routes/avatars.ts b/src/cdn/routes/avatars.ts index e5e25a4c..50a76d4b 100644 --- a/src/cdn/routes/avatars.ts +++ b/src/cdn/routes/avatars.ts @@ -55,7 +55,7 @@ router.post( size, url: `${endpoint}${req.baseUrl}/${user_id}/${hash}`, }); - } + }, ); router.get("/:user_id", async (req: Request, res: Response) => { @@ -86,7 +86,7 @@ export const getAvatar = async (req: Request, res: Response) => { res.set("Cache-Control", "public, max-age=31536000"); return res.send(file); -} +}; router.get("/:user_id/:hash", getAvatar); diff --git a/src/cdn/routes/external.ts b/src/cdn/routes/external.ts index cb17ff9b..405e665e 100644 --- a/src/cdn/routes/external.ts +++ b/src/cdn/routes/external.ts @@ -66,14 +66,14 @@ router.get("/resize/:url", async (req: Request, res: Response) => { const { resizeHeightMax, resizeWidthMax } = Config.get().cdn; const w = Math.min(parseInt(width as string), resizeWidthMax ?? 100); const h = Math.min(parseInt(height as string), resizeHeightMax ?? 100); - if (w < 1 || h < 1) throw new HTTPError("Width and height must be greater than 0"); + if (w < 1 || h < 1) + throw new HTTPError("Width and height must be greater than 0"); let buffer, response; try { response = await fetch(url, DEFAULT_FETCH_OPTIONS); buffer = await response.buffer(); - } - catch (e) { + } catch (e) { throw new HTTPError("Couldn't fetch website"); } @@ -84,7 +84,10 @@ router.get("/resize/:url", async (req: Request, res: Response) => { .toBuffer(); res.setHeader("Content-Disposition", "attachment"); - res.setHeader("Content-Type", response.headers.get("content-type") ?? "image/png"); + res.setHeader( + "Content-Type", + response.headers.get("content-type") ?? "image/png", + ); return res.end(resizedBuffer); }); diff --git a/src/cdn/routes/guilds.ts b/src/cdn/routes/guilds.ts index 3c4b646c..6f0719b6 100644 --- a/src/cdn/routes/guilds.ts +++ b/src/cdn/routes/guilds.ts @@ -7,4 +7,4 @@ const router = Router(); router.get("/:guild_id/users/:user_id/avatars/:hash", getAvatar); router.get("/:guild_id/users/:user_id/banners/:hash", getAvatar); -export default router; \ No newline at end of file +export default router; diff --git a/src/cdn/routes/role-icons.ts b/src/cdn/routes/role-icons.ts index 12aae8a4..bdfa0355 100644 --- a/src/cdn/routes/role-icons.ts +++ b/src/cdn/routes/role-icons.ts @@ -54,7 +54,7 @@ router.post( size, url: `${endpoint}${req.baseUrl}/${role_id}/${hash}`, }); - } + }, ); router.get("/:role_id", async (req: Request, res: Response) => { |