feat: 实现标签合并维护接口与n8n每日工作流

This commit is contained in:
2026-02-21 09:52:51 +08:00
parent 6cb4545a17
commit 220e9f8b71
12 changed files with 829 additions and 241 deletions
+8 -4
View File
@@ -7,11 +7,15 @@ export async function POST(request: NextRequest) {
// 1. API Key 验证
const apiKey = request.headers.get('X-API-Key');
const expectedKey = process.env.WEBHOOK_API_KEY;
const providedBuf = Buffer.from(apiKey || '');
const expectedBuf = Buffer.from(expectedKey || '');
if (!apiKey || !expectedKey || !crypto.timingSafeEqual(
Buffer.from(apiKey),
Buffer.from(expectedKey)
)) {
if (
!apiKey ||
!expectedKey ||
providedBuf.length !== expectedBuf.length ||
!crypto.timingSafeEqual(providedBuf, expectedBuf)
) {
return NextResponse.json(
{ error: 'Unauthorized' },
{ status: 401 }