mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-22 01:05:40 +02:00
26
packages/backend/src/server/proxy/index.ts
Normal file
26
packages/backend/src/server/proxy/index.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Media Proxy
|
||||
*/
|
||||
|
||||
import * as Koa from 'koa';
|
||||
import * as cors from '@koa/cors';
|
||||
import * as Router from '@koa/router';
|
||||
import { proxyMedia } from './proxy-media';
|
||||
|
||||
// Init app
|
||||
const app = new Koa();
|
||||
app.use(cors());
|
||||
app.use(async (ctx, next) => {
|
||||
ctx.set('Content-Security-Policy', `default-src 'none'; style-src 'unsafe-inline'`);
|
||||
await next();
|
||||
});
|
||||
|
||||
// Init router
|
||||
const router = new Router();
|
||||
|
||||
router.get('/:url*', proxyMedia);
|
||||
|
||||
// Register router
|
||||
app.use(router.routes());
|
||||
|
||||
module.exports = app;
|
||||
Reference in New Issue
Block a user