reply.send

This commit is contained in:
tamaina 2023-02-06 15:38:33 +00:00
parent 15983012fd
commit 39908281a1
3 changed files with 4 additions and 4 deletions

View File

@ -166,7 +166,7 @@ async function proxyHandler(request, reply) {
} }
reply.header('Content-Type', image.type); reply.header('Content-Type', image.type);
reply.header('Cache-Control', 'max-age=31536000, immutable'); reply.header('Cache-Control', 'max-age=31536000, immutable');
return image.data; return reply.send(image.data);
} }
catch (e) { catch (e) {
if ('cleanup' in file) if ('cleanup' in file)

View File

@ -1,6 +1,6 @@
{ {
"name": "misskey-media-proxy", "name": "misskey-media-proxy",
"version": "0.0.2", "version": "0.0.3",
"description": "The Media Proxy for Misskey", "description": "The Media Proxy for Misskey",
"main": "built/index.js", "main": "built/index.js",
"packageManager": "pnpm@7.26.0", "packageManager": "pnpm@7.26.0",
@ -12,7 +12,7 @@
], ],
"scripts": { "scripts": {
"build": "tsc -p tsconfig.json", "build": "tsc -p tsconfig.json",
"watch": "swc src -d built -D -w & fastify start -w -l info -P ./built/index.js", "dev": "swc src -d built -D -w & fastify start -w -l info -P ./built/index.js",
"start": "fastify start ./server.js" "start": "fastify start ./server.js"
}, },
"repository": { "repository": {

View File

@ -207,7 +207,7 @@ async function proxyHandler(request: FastifyRequest<{ Params: { url: string; };
reply.header('Content-Type', image.type); reply.header('Content-Type', image.type);
reply.header('Cache-Control', 'max-age=31536000, immutable'); reply.header('Cache-Control', 'max-age=31536000, immutable');
return image.data; return reply.send(image.data);
} catch (e) { } catch (e) {
if ('cleanup' in file) file.cleanup(); if ('cleanup' in file) file.cleanup();
throw e; throw e;