ZH
测试版翻译

@core / comments

1.0.1 ▾
已验证MIT
GitHub

任意实体的审核评论:访客或用户、回复、1–5 评分、封禁、GDPR 删除和安全 HTML

代码9 个文件上下文约 552 个 token扫描通过

应用 .genpmignore 后将被注入的确切目录树。固定于

src/lib/comments/adapters/next.ts只读 · abfbbe8
// Adaptador Next.js: `app/api/comments/[type]/[id]/route.ts` →
//   export const { GET, POST } = commentRoute({ currentUser: async () => getUser(await cookies()) });
import type { Moderation } from '../index.ts';
import { type CurrentUser, handleList, handlePost } from './http.ts';

type Ctx = { params: Promise<{ type: string; id: string }> };

export function commentRoute(opts: { currentUser: CurrentUser; moderation?: Moderation }) {
  return {
    GET: async (req: Request, ctx: Ctx) => {
      const { type, id } = await ctx.params;
      return handleList(req, type, id);
    },
    POST: async (req: Request, ctx: Ctx) => {
      const { type, id } = await ctx.params;
      return handlePost(req, type, id, opts);
    },
  };
}

举报 @core/comments

使用 GitHub 登录后才能举报包。