chore: update live chat and work server changes

This commit is contained in:
2026-04-26 16:37:06 +09:00
parent 63e5d263a7
commit 20a6333ed2
38 changed files with 2078 additions and 2281 deletions

View File

@@ -148,7 +148,22 @@ function canViewAllConversations(request: { headers: Record<string, unknown> })
return hasErrorLogViewAccessToken(request.headers['x-access-token'] as string | string[] | undefined);
}
function applyChatApiNoStoreHeaders(reply: FastifyReply) {
reply.header('Cache-Control', 'no-store, no-cache, max-age=0, must-revalidate');
reply.header('Pragma', 'no-cache');
reply.header('Expires', '0');
reply.header('Surrogate-Control', 'no-store');
}
export async function registerChatRoutes(app: FastifyInstance) {
app.addHook('onSend', async (request, reply, payload) => {
if (request.method.toUpperCase() === 'GET' && request.url.startsWith('/api/chat')) {
applyChatApiNoStoreHeaders(reply);
}
return payload;
});
app.get(`${CHAT_PUBLIC_ROUTE_PREFIX}*`, async (request, reply) => {
const wildcard = String((request.params as { '*': string | undefined })['*'] ?? '').trim();
return serveChatPublicResource(resolveChatAttachmentRepoPath(), wildcard, reply);