set connect-src for sw.js

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
ゆめ 2024-11-22 09:37:41 -06:00
parent eec5ce1a99
commit d7a8660952
No known key found for this signature in database

View file

@ -503,6 +503,7 @@ export class ClientServerService {
// ServiceWorker // ServiceWorker
fastify.get('/sw.js', async (request, reply) => { fastify.get('/sw.js', async (request, reply) => {
reply.header('content-security-policy', `default-src \'self'; connect-src \'self\'${ this.config.mediaProxy ? ` ${new URL(this.config.mediaProxy).origin}` : '' }`);
return await reply.sendFile('/sw.js', swAssets, { return await reply.sendFile('/sw.js', swAssets, {
maxAge: ms('10 minutes'), maxAge: ms('10 minutes'),
}); });