feat: Adopt Edge runtime for API routes, add Cloudflare Pages build configuration, remove icon.png, and configure npm legacy peer dependencies.

This commit is contained in:
kuekhaoyang
2025-12-06 12:55:57 +08:00
parent f575e45a10
commit cd036e5059
10 changed files with 1034 additions and 7 deletions
+1
View File
@@ -0,0 +1 @@
legacy-peer-deps=true
+2
View File
@@ -1,4 +1,6 @@
import { NextResponse } from 'next/server';
export const runtime = 'edge';
import { ADULT_SOURCES } from '@/lib/api/adult-sources';
export async function GET(request: Request) {
+2
View File
@@ -7,6 +7,8 @@ import { NextRequest, NextResponse } from 'next/server';
import { getVideoDetail } from '@/lib/api/client';
import { getSourceById } from '@/lib/api/video-sources';
export const runtime = 'edge';
/**
* Shared handler for fetching video details
*/
+3 -1
View File
@@ -1,5 +1,7 @@
import { NextResponse } from 'next/server';
export const runtime = 'edge';
export async function GET(request: Request) {
const { searchParams } = new URL(request.url);
const tag = searchParams.get('tag') || '热门';
@@ -9,7 +11,7 @@ export async function GET(request: Request) {
try {
const url = `https://movie.douban.com/j/search_subjects?type=${type}&tag=${encodeURIComponent(tag)}&sort=recommend&page_limit=${pageLimit}&page_start=${pageStart}`;
const response = await fetch(url, {
headers: {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
+3 -2
View File
@@ -2,10 +2,11 @@ import { NextRequest, NextResponse } from 'next/server';
import { processM3u8Content } from '@/lib/utils/proxy-utils';
import { fetchWithRetry } from '@/lib/utils/fetch-with-retry';
export const runtime = 'nodejs';
export const runtime = 'edge';
// Disable SSL verification for video sources with invalid certificates
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
// Note: This is not supported in Cloudflare Workers/Edge Runtime.
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
export async function GET(request: NextRequest) {
const url = request.nextUrl.searchParams.get('url');
+2
View File
@@ -9,6 +9,8 @@ import { searchVideos } from '@/lib/api/client';
import { getSourceById } from '@/lib/api/video-sources';
import { getSourceName } from '@/lib/utils/source-names';
export const runtime = 'edge';
export async function POST(request: NextRequest) {
const encoder = new TextEncoder();
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 598 KiB

+3
View File
@@ -19,6 +19,9 @@ const geistMono = Geist_Mono({
export const metadata: Metadata = {
title: "KVideo - 视频聚合平台",
description: "Multi-source video aggregation platform with beautiful Liquid Glass UI",
icons: {
icon: '/icon.png',
},
};
export default function RootLayout({
+1014 -2
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -6,7 +6,8 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint"
"lint": "eslint",
"pages:build": "npx @cloudflare/next-on-pages@1"
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",
@@ -20,6 +21,7 @@
"zustand": "^5.0.8"
},
"devDependencies": {
"@cloudflare/next-on-pages": "^1.13.16",
"@tailwindcss/postcss": "^4",
"@types/node": "^24",
"@types/react": "^19",
@@ -30,4 +32,4 @@
"tailwindcss": "^4",
"typescript": "^5"
}
}
}