feat: add cf pages support

This commit is contained in:
shinya
2025-06-28 23:38:02 +08:00
parent a9010bf6b5
commit 57ed0f1e20
11 changed files with 2671 additions and 10 deletions

View File

@@ -185,6 +185,8 @@ async function getVideoDetail(
return getDetailFromApi(apiSite, id);
}
export const runtime = 'edge';
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const id = searchParams.get('id');

View File

@@ -54,6 +54,8 @@ async function fetchDoubanData(url: string): Promise<DoubanApiResponse> {
}
}
export const runtime = 'edge';
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);

View File

@@ -1,5 +1,7 @@
import { NextRequest, NextResponse } from 'next/server';
export const runtime = 'edge';
export async function POST(req: NextRequest) {
try {
const result = process.env.PASSWORD;

View File

@@ -5,6 +5,8 @@ import { NextRequest, NextResponse } from 'next/server';
import { db } from '@/lib/db';
import { PlayRecord } from '@/lib/db';
export const runtime = 'edge';
export async function GET() {
try {
const records = await db.getAllPlayRecords();

View File

@@ -3,6 +3,8 @@ import { NextResponse } from 'next/server';
import { API_CONFIG, ApiSite, getApiSites, getCacheTime } from '@/lib/config';
import { cleanHtmlTags } from '@/lib/utils';
export const runtime = 'edge';
// 根据环境变量决定最大搜索页数,默认 5
const MAX_SEARCH_PAGES: number =
Number(process.env.NEXT_PUBLIC_SEARCH_MAX_PAGE) || 5;