ZH
测试版翻译

@core / jobs

1.1.0 ▾
已验证MIT
GitHub

基于 Postgres 的后台任务:持久队列、退避重试、cron 计划和无服务器 cron 端点

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

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

src/lib/jobs/cron-auth.ts只读 · eef017d
// Protección del endpoint de cron: `Authorization: Bearer <CRON_SECRET>` comparado en tiempo constante.

export function isAuthorizedCron(authorization: string | null | undefined, secret = process.env.CRON_SECRET): boolean {
  if (!secret || secret.length < 32) throw new Error('CRON_SECRET must be set (>= 32 chars)');
  const given = new TextEncoder().encode(authorization ?? '');
  const expected = new TextEncoder().encode(`Bearer ${secret}`);
  let diff = given.length ^ expected.length;
  for (let i = 0; i < expected.length; i++) diff |= (given[i] ?? 0) ^ expected[i]!;
  return diff === 0;
}

举报 @core/jobs

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