aboutsummaryrefslogtreecommitdiffstats
path: root/lib/upload.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/upload.js')
-rw-r--r--lib/upload.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/upload.js b/lib/upload.js
index cb14f459..d46c116c 100644
--- a/lib/upload.js
+++ b/lib/upload.js
@@ -10,7 +10,7 @@ import { g, s, db } from "$lib/db";
export default async (req, res) => {
let {
params: { type },
- user,
+ user
} = req;
if (!["banner", "profile"].includes(type)) throw new Error("invalid upload");
@@ -28,9 +28,12 @@ export default async (req, res) => {
let path = `/app/data/uploads/${name}`;
let size = type === "banner" ? 1920 : 240;
- let t = sharp().rotate().resize(size).webp();
+ let t = sharp()
+ .rotate()
+ .resize(size)
+ .webp();
- await new Promise((r) => pipeline(s2, t, fs.createWriteStream(path), r));
+ await new Promise(r => pipeline(s2, t, fs.createWriteStream(path), r));
user[type] = true;
await s(`user:${user.id}`, user);