Files
foka-ci/apps/server/middlewares/cors.ts
hurole ef473d6084 feat: 完善项目架构和功能
- 修复路由配置,实现根路径自动重定向到/project
- 新增Gitea OAuth认证系统和相关组件
- 完善日志系统实现,包含pino日志工具和中间件
- 重构页面结构,分离项目管理和环境管理页面
- 新增CORS、Session等关键中间件
- 优化前端请求封装和类型定义
- 修复TypeScript类型错误和参数传递问题
2025-09-04 23:19:52 +08:00

18 lines
359 B
TypeScript

import cors from '@koa/cors';
import type Koa from 'koa';
import type { Middleware } from './types.ts';
export class CORS implements Middleware {
apply(app: Koa) {
app.use(
cors({
credentials: true,
allowHeaders: ['Content-Type'],
origin(ctx) {
return ctx.get('Origin') || '*';
},
}),
);
}
}