Skip to content

Commit 30300e7

Browse files
committed
feat: Adopt Edge runtime for API routes, delete icon.png, and update tsconfig.json jsx option.
1 parent ea3c466 commit 30300e7

7 files changed

Lines changed: 22 additions & 8 deletions

File tree

app/api/adult/category/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NextResponse } from 'next/server';
22
import { ADULT_SOURCES } from '@/lib/api/adult-sources';
33

4+
export const runtime = 'edge';
45
export async function GET(request: Request) {
56
const { searchParams } = new URL(request.url);
67
const categoryParam = searchParams.get('category') || ''; // Format: "sourceId:typeId" or just "typeId" or empty

app/api/detail/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { NextRequest, NextResponse } from 'next/server';
77
import { getVideoDetail } from '@/lib/api/client';
88
import { getSourceById } from '@/lib/api/video-sources';
99

10+
export const runtime = 'edge';
11+
1012
/**
1113
* Shared handler for fetching video details
1214
*/

app/api/douban/recommend/route.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { NextResponse } from 'next/server';
22

3+
export const runtime = 'edge';
4+
35
export async function GET(request: Request) {
46
const { searchParams } = new URL(request.url);
57
const tag = searchParams.get('tag') || '热门';
@@ -9,7 +11,7 @@ export async function GET(request: Request) {
911

1012
try {
1113
const url = `https://movie.douban.com/j/search_subjects?type=${type}&tag=${encodeURIComponent(tag)}&sort=recommend&page_limit=${pageLimit}&page_start=${pageStart}`;
12-
14+
1315
const response = await fetch(url, {
1416
headers: {
1517
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',

app/api/proxy/route.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import { NextRequest, NextResponse } from 'next/server';
22
import { processM3u8Content } from '@/lib/utils/proxy-utils';
33
import { fetchWithRetry } from '@/lib/utils/fetch-with-retry';
44

5-
export const runtime = 'nodejs';
5+
export const runtime = 'edge';
66

7-
// Disable SSL verification for video sources with invalid certificates
8-
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
7+
// NOTE: process.env.NODE_TLS_REJECT_UNAUTHORIZED is not supported in Edge Runtime
98

109
export async function GET(request: NextRequest) {
1110
const url = request.nextUrl.searchParams.get('url');

app/api/search-parallel/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { searchVideos } from '@/lib/api/client';
99
import { getSourceById } from '@/lib/api/video-sources';
1010
import { getSourceName } from '@/lib/utils/source-names';
1111

12+
export const runtime = 'edge';
13+
1214
export async function POST(request: NextRequest) {
1315
const encoder = new TextEncoder();
1416

app/icon.png

-598 KB
Binary file not shown.

tsconfig.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"compilerOptions": {
33
"target": "ES2017",
4-
"lib": ["dom", "dom.iterable", "esnext"],
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
59
"allowJs": true,
610
"skipLibCheck": true,
711
"strict": true,
@@ -11,15 +15,17 @@
1115
"moduleResolution": "bundler",
1216
"resolveJsonModule": true,
1317
"isolatedModules": true,
14-
"jsx": "react-jsx",
18+
"jsx": "preserve",
1519
"incremental": true,
1620
"plugins": [
1721
{
1822
"name": "next"
1923
}
2024
],
2125
"paths": {
22-
"@/*": ["./*"]
26+
"@/*": [
27+
"./*"
28+
]
2329
}
2430
},
2531
"include": [
@@ -30,5 +36,7 @@
3036
".next/dev/types/**/*.ts",
3137
"**/*.mts"
3238
],
33-
"exclude": ["node_modules"]
39+
"exclude": [
40+
"node_modules"
41+
]
3442
}

0 commit comments

Comments
 (0)