13 lines
423 B
TypeScript
13 lines
423 B
TypeScript
|
|
import { NextRequest, NextResponse } from "next/server";
|
||
|
|
import { pollFtp } from "@/lib/ftp-watcher";
|
||
|
|
|
||
|
|
export async function GET(request: NextRequest) {
|
||
|
|
const authHeader = request.headers.get("authorization");
|
||
|
|
if (authHeader !== `Bearer ${process.env.CRON_SECRET}`) {
|
||
|
|
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
||
|
|
}
|
||
|
|
|
||
|
|
const result = await pollFtp();
|
||
|
|
return NextResponse.json(result);
|
||
|
|
}
|