refactor: update MITM bypass logic and enhance combo name validation

This commit is contained in:
decolua committed 2026-03-19 22:47:32 +07:00
1 parent a0500dfc85
commit f1c53a319e
6 files changed
+54 -62

No files matched your search

+2 -2
View File
@@ -2,7 +2,7 @@ import { NextResponse } from "next/server";
import { getComboById, updateCombo, deleteCombo, getComboByName } from "@/lib/localDb";
// Validate combo name: only a-z, A-Z, 0-9, -, _
const VALID_NAME_REGEX = /^[a-zA-Z0-9_-]+$/;
const VALID_NAME_REGEX = /^[a-zA-Z0-9_.\-]+$/;
// GET /api/combos/[id] - Get combo by ID
export async function GET(request, { params }) {
@@ -30,7 +30,7 @@ export async function PUT(request, { params }) {
// Validate name format if provided
if (body.name) {
if (!VALID_NAME_REGEX.test(body.name)) {
return NextResponse.json({ error: "Name can only contain letters, numbers, - and _" }, { status: 400 });
return NextResponse.json({ error: "Name can only contain letters, numbers, -, _ and ." }, { status: 400 });
}
// Check if name already exists (exclude current combo)