From 51d8d2abbfe8fc9cef42b5ef6598243c5e7c5926 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 31 Dec 2022 09:12:42 +0900 Subject: [PATCH] cache emoji response --- .../backend/src/server/web/ClientServerService.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts index 02b779d74..7206653a4 100644 --- a/packages/backend/src/server/web/ClientServerService.ts +++ b/packages/backend/src/server/web/ClientServerService.ts @@ -228,6 +228,8 @@ export class ClientServerService { return; } + reply.header('Cache-Control', 'public, max-age=3600'); + const name = path.split('@')[0].replace('.webp', ''); const host = path.split('@')[1]?.replace('.webp', ''); @@ -244,7 +246,7 @@ export class ClientServerService { reply.header('Content-Security-Policy', 'default-src \'none\'; style-src \'unsafe-inline\''); - const url = new URL("/proxy/emoji.webp", this.config.url); + const url = new URL('/proxy/emoji.webp', this.config.url); // || emoji.originalUrl してるのは後方互換性のため(publicUrlはstringなので??はだめ) url.searchParams.set('url', emoji.publicUrl || emoji.originalUrl); url.searchParams.set('emoji', '1'); @@ -347,15 +349,15 @@ export class ClientServerService { fastify.get('/opensearch.xml', async (request, reply) => { const meta = await this.metaService.fetch(); - const name = meta.name || "Misskey"; - let content = ""; - content += ``; + const name = meta.name || 'Misskey'; + let content = ''; + content += ''; content += `${name} Search`; content += `${name} Search`; - content += `UTF-8`; + content += 'UTF-8'; content += `${this.config.url}/favicon.ico`; content += ``; - content += ``; + content += ''; reply.header('Content-Type', 'application/opensearchdescription+xml'); return await reply.send(content);