feat: 首页支持宣传语
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
incrementHourlyActivity,
|
||||
publishEvent,
|
||||
} from "@/lib/redis";
|
||||
import { validateApiKey } from "@/lib/auth/api-key";
|
||||
import { authenticateRequest } from "@/lib/auth/request";
|
||||
import { getGeoLocation } from "@/lib/geo/ip-location";
|
||||
import { heartbeatSchema } from "@/lib/validators/schemas";
|
||||
|
||||
@@ -22,19 +22,11 @@ function getClientIp(req: NextRequest): string {
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const authHeader = req.headers.get("authorization");
|
||||
if (!authHeader?.startsWith("Bearer ")) {
|
||||
return NextResponse.json(
|
||||
{ error: "Missing or invalid authorization header" },
|
||||
{ status: 401 }
|
||||
);
|
||||
}
|
||||
|
||||
const apiKey = authHeader.slice(7);
|
||||
const claw = await validateApiKey(apiKey);
|
||||
if (!claw) {
|
||||
return NextResponse.json({ error: "Invalid API key" }, { status: 401 });
|
||||
const auth = await authenticateRequest(req);
|
||||
if (auth instanceof NextResponse) {
|
||||
return auth;
|
||||
}
|
||||
const { claw } = auth;
|
||||
|
||||
let bodyData = {};
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user