mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-13 13:37:31 -07:00
[mastodon-client] Set correct access-control-expose-headers response header
This commit is contained in:
parent
081b836e92
commit
3bc4afec77
2 changed files with 12 additions and 0 deletions
|
@ -17,6 +17,7 @@ import { CacheMiddleware } from "@/server/api/mastodon/middleware/cache.js";
|
|||
import { KoaBodyMiddleware } from "@/server/api/mastodon/middleware/koa-body.js";
|
||||
import { NormalizeQueryMiddleware } from "@/server/api/mastodon/middleware/normalize-query.js";
|
||||
import { PaginationMiddleware } from "@/server/api/mastodon/middleware/pagination.js";
|
||||
import { SetHeadersMiddleware } from "@/server/api/mastodon/middleware/set-headers.js";
|
||||
|
||||
export const logger = apiLogger.createSubLogger("mastodon");
|
||||
export type MastoContext = RouterContext & DefaultContext;
|
||||
|
@ -37,6 +38,7 @@ export function setupMastodonApi(router: Router): void {
|
|||
|
||||
function setupMiddleware(router: Router): void {
|
||||
router.use(KoaBodyMiddleware());
|
||||
router.use(SetHeadersMiddleware);
|
||||
router.use(CatchErrorsMiddleware);
|
||||
router.use(NormalizeQueryMiddleware);
|
||||
router.use(PaginationMiddleware);
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { MastoContext } from "@/server/api/mastodon/index.js";
|
||||
|
||||
const headers = {
|
||||
"Access-Control-Expose-Headers": "Link,Connection,Sec-Websocket-Accept,Upgrade"
|
||||
};
|
||||
|
||||
export async function SetHeadersMiddleware(ctx: MastoContext, next: () => Promise<any>) {
|
||||
ctx.set(headers);
|
||||
await next();
|
||||
}
|
Loading…
Reference in a new issue