feat: unsupport edgeless

This commit is contained in:
shinya
2025-08-18 23:04:27 +08:00
parent ed3c4239dc
commit 4df244d3a3
28 changed files with 27 additions and 32 deletions

View File

@@ -23,14 +23,8 @@ COPY --from=deps /app/node_modules ./node_modules
COPY . . COPY . .
# 在构建阶段也显式设置 DOCKER_ENV # 在构建阶段也显式设置 DOCKER_ENV
# 确保 Next.js 在编译时即选择 Node Runtime 而不是 Edge Runtime
RUN find ./src -type f -name "route.ts" -print0 \
| xargs -0 sed -i "s/export const runtime = 'edge';/export const runtime = 'nodejs';/g"
ENV DOCKER_ENV=true ENV DOCKER_ENV=true
# For Docker builds, force dynamic rendering to read runtime environment variables.
RUN sed -i "/const inter = Inter({ subsets: \['latin'] });/a export const dynamic = 'force-dynamic';" src/app/layout.tsx
# 生成生产构建 # 生成生产构建
RUN pnpm run build RUN pnpm run build

View File

@@ -6,7 +6,7 @@ import { getAuthInfoFromCookie } from '@/lib/auth';
import { getConfig } from '@/lib/config'; import { getConfig } from '@/lib/config';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
export const runtime = 'edge'; export const runtime = 'nodejs';
// 支持的操作类型 // 支持的操作类型
type Action = 'add' | 'disable' | 'enable' | 'delete' | 'sort'; type Action = 'add' | 'disable' | 'enable' | 'delete' | 'sort';

View File

@@ -6,7 +6,7 @@ import { AdminConfigResult } from '@/lib/admin.types';
import { getAuthInfoFromCookie } from '@/lib/auth'; import { getAuthInfoFromCookie } from '@/lib/auth';
import { getConfig } from '@/lib/config'; import { getConfig } from '@/lib/config';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage'; const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage';

View File

@@ -5,7 +5,7 @@ import { NextRequest, NextResponse } from 'next/server';
import { getAuthInfoFromCookie } from '@/lib/auth'; import { getAuthInfoFromCookie } from '@/lib/auth';
import { resetConfig } from '@/lib/config'; import { resetConfig } from '@/lib/config';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage'; const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage';

View File

@@ -6,7 +6,7 @@ import { getAuthInfoFromCookie } from '@/lib/auth';
import { getConfig } from '@/lib/config'; import { getConfig } from '@/lib/config';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function POST(request: NextRequest) { export async function POST(request: NextRequest) {
const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage'; const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage';

View File

@@ -6,7 +6,7 @@ import { getAuthInfoFromCookie } from '@/lib/auth';
import { getConfig } from '@/lib/config'; import { getConfig } from '@/lib/config';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
export const runtime = 'edge'; export const runtime = 'nodejs';
// 支持的操作类型 // 支持的操作类型
type Action = 'add' | 'disable' | 'enable' | 'delete' | 'sort'; type Action = 'add' | 'disable' | 'enable' | 'delete' | 'sort';

View File

@@ -6,7 +6,7 @@ import { getAuthInfoFromCookie } from '@/lib/auth';
import { getConfig } from '@/lib/config'; import { getConfig } from '@/lib/config';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
export const runtime = 'edge'; export const runtime = 'nodejs';
// 支持的操作类型 // 支持的操作类型
const ACTIONS = [ const ACTIONS = [

View File

@@ -5,7 +5,7 @@ import { NextRequest, NextResponse } from 'next/server';
import { getAuthInfoFromCookie } from '@/lib/auth'; import { getAuthInfoFromCookie } from '@/lib/auth';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function POST(request: NextRequest) { export async function POST(request: NextRequest) {
const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage'; const storageType = process.env.NEXT_PUBLIC_STORAGE_TYPE || 'localstorage';

View File

@@ -7,7 +7,7 @@ import { db } from '@/lib/db';
import { fetchVideoDetail } from '@/lib/fetchVideoDetail'; import { fetchVideoDetail } from '@/lib/fetchVideoDetail';
import { SearchResult } from '@/lib/types'; import { SearchResult } from '@/lib/types';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
console.log(request.url); console.log(request.url);

View File

@@ -3,7 +3,7 @@ import { NextResponse } from 'next/server';
import { getAvailableApiSites, getCacheTime } from '@/lib/config'; import { getAvailableApiSites, getCacheTime } from '@/lib/config';
import { getDetailFromApi } from '@/lib/downstream'; import { getDetailFromApi } from '@/lib/downstream';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: Request) { export async function GET(request: Request) {
const { searchParams } = new URL(request.url); const { searchParams } = new URL(request.url);

View File

@@ -20,7 +20,7 @@ interface DoubanCategoryApiResponse {
}>; }>;
} }
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: Request) { export async function GET(request: Request) {
const { searchParams } = new URL(request.url); const { searchParams } = new URL(request.url);

View File

@@ -23,7 +23,7 @@ interface DoubanRecommendApiResponse {
}>; }>;
} }
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url); const { searchParams } = new URL(request.url);

View File

@@ -13,7 +13,7 @@ interface DoubanApiResponse {
}>; }>;
} }
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: Request) { export async function GET(request: Request) {
const { searchParams } = new URL(request.url); const { searchParams } = new URL(request.url);

View File

@@ -7,7 +7,7 @@ import { getConfig } from '@/lib/config';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
import { Favorite } from '@/lib/types'; import { Favorite } from '@/lib/types';
export const runtime = 'edge'; export const runtime = 'nodejs';
/** /**
* GET /api/favorites * GET /api/favorites

View File

@@ -1,6 +1,6 @@
import { NextResponse } from 'next/server'; import { NextResponse } from 'next/server';
export const runtime = 'edge'; export const runtime = 'nodejs';
// OrionTV 兼容接口 // OrionTV 兼容接口
export async function GET(request: Request) { export async function GET(request: Request) {

View File

@@ -4,7 +4,7 @@ import { NextRequest, NextResponse } from 'next/server';
import { getConfig } from '@/lib/config'; import { getConfig } from '@/lib/config';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
export const runtime = 'edge'; export const runtime = 'nodejs';
// 读取存储类型环境变量,默认 localstorage // 读取存储类型环境变量,默认 localstorage
const STORAGE_TYPE = const STORAGE_TYPE =

View File

@@ -1,6 +1,6 @@
import { NextResponse } from 'next/server'; import { NextResponse } from 'next/server';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function POST() { export async function POST() {
const response = NextResponse.json({ ok: true }); const response = NextResponse.json({ ok: true });

View File

@@ -7,7 +7,7 @@ import { getConfig } from '@/lib/config';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
import { PlayRecord } from '@/lib/types'; import { PlayRecord } from '@/lib/types';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
try { try {

View File

@@ -4,7 +4,7 @@ import { NextRequest, NextResponse } from 'next/server';
import { getConfig } from '@/lib/config'; import { getConfig } from '@/lib/config';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
export const runtime = 'edge'; export const runtime = 'nodejs';
// 读取存储类型环境变量,默认 localstorage // 读取存储类型环境变量,默认 localstorage
const STORAGE_TYPE = const STORAGE_TYPE =

View File

@@ -4,7 +4,7 @@ import { getCacheTime, getConfig } from '@/lib/config';
import { searchFromApi } from '@/lib/downstream'; import { searchFromApi } from '@/lib/downstream';
import { yellowWords } from '@/lib/yellow'; import { yellowWords } from '@/lib/yellow';
export const runtime = 'edge'; export const runtime = 'nodejs';
// OrionTV 兼容接口 // OrionTV 兼容接口
export async function GET(request: Request) { export async function GET(request: Request) {

View File

@@ -4,7 +4,7 @@ import { NextRequest, NextResponse } from 'next/server';
import { getAvailableApiSites } from '@/lib/config'; import { getAvailableApiSites } from '@/lib/config';
export const runtime = 'edge'; export const runtime = 'nodejs';
// OrionTV 兼容接口 // OrionTV 兼容接口
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {

View File

@@ -6,7 +6,7 @@ import { getCacheTime, getConfig } from '@/lib/config';
import { searchFromApi } from '@/lib/downstream'; import { searchFromApi } from '@/lib/downstream';
import { yellowWords } from '@/lib/yellow'; import { yellowWords } from '@/lib/yellow';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: Request) { export async function GET(request: Request) {
const { searchParams } = new URL(request.url); const { searchParams } = new URL(request.url);

View File

@@ -6,7 +6,7 @@ import { getAuthInfoFromCookie } from '@/lib/auth';
import { getConfig } from '@/lib/config'; import { getConfig } from '@/lib/config';
import { searchFromApi } from '@/lib/downstream'; import { searchFromApi } from '@/lib/downstream';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
try { try {

View File

@@ -6,7 +6,7 @@ import { getConfig } from '@/lib/config';
import { searchFromApi } from '@/lib/downstream'; import { searchFromApi } from '@/lib/downstream';
import { yellowWords } from '@/lib/yellow'; import { yellowWords } from '@/lib/yellow';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url); const { searchParams } = new URL(request.url);

View File

@@ -6,7 +6,7 @@ import { getAuthInfoFromCookie } from '@/lib/auth';
import { getConfig } from '@/lib/config'; import { getConfig } from '@/lib/config';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
export const runtime = 'edge'; export const runtime = 'nodejs';
// 最大保存条数(与客户端保持一致) // 最大保存条数(与客户端保持一致)
const HISTORY_LIMIT = 20; const HISTORY_LIMIT = 20;

View File

@@ -5,7 +5,7 @@ import { NextRequest, NextResponse } from 'next/server';
import { getConfig } from '@/lib/config'; import { getConfig } from '@/lib/config';
import { CURRENT_VERSION } from '@/lib/version' import { CURRENT_VERSION } from '@/lib/version'
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
console.log('server-config called: ', request.url); console.log('server-config called: ', request.url);

View File

@@ -7,7 +7,7 @@ import { getConfig } from '@/lib/config';
import { db } from '@/lib/db'; import { db } from '@/lib/db';
import { SkipConfig } from '@/lib/types'; import { SkipConfig } from '@/lib/types';
export const runtime = 'edge'; export const runtime = 'nodejs';
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
try { try {

View File

@@ -13,6 +13,7 @@ import { SiteProvider } from '../components/SiteProvider';
import { ThemeProvider } from '../components/ThemeProvider'; import { ThemeProvider } from '../components/ThemeProvider';
const inter = Inter({ subsets: ['latin'] }); const inter = Inter({ subsets: ['latin'] });
export const dynamic = 'force-dynamic';
// 动态生成 metadata支持配置更新后的标题变化 // 动态生成 metadata支持配置更新后的标题变化
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {