feat: 实现标签合并维护接口与n8n每日工作流
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user