Nice and stable before liveview
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// app/api/events/cars/route.ts
|
||||
// API endpoint to get available cars from server config
|
||||
|
||||
import { NextResponse } from 'next/server';
|
||||
import { getAvailableCars } from '@/lib/serverConfig';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const cars = await getAvailableCars();
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
data: cars,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error fetching cars:', error);
|
||||
return NextResponse.json(
|
||||
{ success: false, error: 'Failed to load available cars' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -20,16 +20,15 @@ export async function POST(request: Request) {
|
||||
}
|
||||
|
||||
// Validate steamId format to prevent SQL injection
|
||||
const steamId = inputSteamId.trim(); // just in case
|
||||
const driverGuid = steamId.trim(); // just in case
|
||||
|
||||
if (!/^[0-9]{15,20}$/.test(steamId)) {
|
||||
if (!/^[0-9]{15,20}$/.test(driverGuid)) {
|
||||
return NextResponse.json(
|
||||
{ success: false, error: "Invalid Steam ID format" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const driverGuid = steamId;
|
||||
console.log('Parsed driver GUID:', driverGuid);
|
||||
if (isNaN(driverGuid)) {
|
||||
return NextResponse.json(
|
||||
|
||||
Reference in New Issue
Block a user