add cors header to ActivityPubServerService.ts (#9888)
* add cors header to ActivityPubServerService.ts * Update CHANGELOG.md
This commit is contained in:
parent
1ac7c154d7
commit
f28aea9e30
|
@ -12,6 +12,7 @@ You should also include the user name that made the change.
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
- アニメーションを少なくする設定の時、MkPageHeaderのタブアニメーションを無効化
|
- アニメーションを少なくする設定の時、MkPageHeaderのタブアニメーションを無効化
|
||||||
|
- Backend: activitypub情報がcorsでブロックされないようヘッダーを追加
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
- Client: ユーザーページでアクティビティを見ることができない問題を修正
|
- Client: ユーザーページでアクティビティを見ることができない問題を修正
|
||||||
|
|
|
@ -441,6 +441,14 @@ export class ActivityPubServerService {
|
||||||
fastify.addContentTypeParser('application/activity+json', { parseAs: 'string' }, fastify.getDefaultJsonParser('ignore', 'ignore'));
|
fastify.addContentTypeParser('application/activity+json', { parseAs: 'string' }, fastify.getDefaultJsonParser('ignore', 'ignore'));
|
||||||
fastify.addContentTypeParser('application/ld+json', { parseAs: 'string' }, fastify.getDefaultJsonParser('ignore', 'ignore'));
|
fastify.addContentTypeParser('application/ld+json', { parseAs: 'string' }, fastify.getDefaultJsonParser('ignore', 'ignore'));
|
||||||
|
|
||||||
|
fastify.addHook('onRequest', (request, reply, done) => {
|
||||||
|
reply.header('Access-Control-Allow-Headers', 'Accept');
|
||||||
|
reply.header('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
||||||
|
reply.header('Access-Control-Allow-Origin', '*');
|
||||||
|
reply.header('Access-Control-Expose-Headers', 'Vary');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
//#region Routing
|
//#region Routing
|
||||||
// inbox (limit: 64kb)
|
// inbox (limit: 64kb)
|
||||||
fastify.post('/inbox', { bodyLimit: 1024 * 64 }, async (request, reply) => await this.inbox(request, reply));
|
fastify.post('/inbox', { bodyLimit: 1024 * 64 }, async (request, reply) => await this.inbox(request, reply));
|
||||||
|
|
Loading…
Reference in a new issue