From 40cc8e0caed38f1beb8f65cbb8f1386cccd5750e Mon Sep 17 00:00:00 2001 From: Jonatan Nilsson Date: Sat, 20 Aug 2022 00:46:19 +0000 Subject: [PATCH] config: Make avif images smaller. server: Update logging for aborted connections --- base/config.mjs | 8 ++++---- base/server.mjs | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/base/config.mjs b/base/config.mjs index b54f089..22de5ce 100644 --- a/base/config.mjs +++ b/base/config.mjs @@ -59,15 +59,15 @@ nconf.defaults({ "format": "avif", "blur": 10, "resize": { - "width": 300, - "height": 300, + "width": 200, + "height": 200, "fit": "inside", "withoutEnlargement": true, "kernel": "lanczos3" }, "avif": { - "quality": 50, - "effort": 4 + "quality": 30, + "effort": 9 } }, "small": { diff --git a/base/server.mjs b/base/server.mjs index f8f691e..dd94ae2 100644 --- a/base/server.mjs +++ b/base/server.mjs @@ -56,6 +56,9 @@ export default class Server { this.flaska.before(QueryHandler()) this.flaska.after(function(ctx) { + if (ctx.aborted && ctx.status === 200) { + ctx.status = 299 + } let ended = new Date().getTime() var requestTime = ended - ctx.state.started @@ -72,7 +75,7 @@ export default class Server { ctx.log[level]({ duration: requestTime, status: ctx.status, - }, `<-- ${status}${ctx.method} ${ctx.url}`) + }, (ctx.aborted ? '[ABORT]' : '<--') + ` ${status}${ctx.method} ${ctx.url}`) }) }