feat: 完善项目架构和功能
- 修复路由配置,实现根路径自动重定向到/project - 新增Gitea OAuth认证系统和相关组件 - 完善日志系统实现,包含pino日志工具和中间件 - 重构页面结构,分离项目管理和环境管理页面 - 新增CORS、Session等关键中间件 - 优化前端请求封装和类型定义 - 修复TypeScript类型错误和参数传递问题
This commit is contained in:
24
apps/server/middlewares/session.ts
Normal file
24
apps/server/middlewares/session.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import session from 'koa-session';
|
||||
import type Koa from 'koa';
|
||||
import type { Middleware } from './types.ts';
|
||||
|
||||
export class Session implements Middleware {
|
||||
apply(app: Koa): void {
|
||||
app.keys = ['foka-ci'];
|
||||
app.use(
|
||||
session(
|
||||
{
|
||||
key: 'foka.sid',
|
||||
maxAge: 86400000,
|
||||
autoCommit: true /** (boolean) automatically commit headers (default true) */,
|
||||
overwrite: true /** (boolean) can overwrite or not (default true) */,
|
||||
httpOnly: true /** (boolean) httpOnly or not (default true) */,
|
||||
signed: true /** (boolean) signed or not (default true) */,
|
||||
rolling: false /** (boolean) Force a session identifier cookie to be set on every response. The expiration is reset to the original maxAge, resetting the expiration countdown. (default is false) */,
|
||||
renew: false /** (boolean) renew session when session is nearly expired, so we can always keep user logged in. (default is false)*/,
|
||||
},
|
||||
app,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user