emby增加自定义ua和图片代理

This commit is contained in:
mtvpls
2026-03-03 11:23:25 +08:00
parent fe1f79b273
commit 4f87e99f52
13 changed files with 246 additions and 15 deletions
+5 -1
View File
@@ -4,6 +4,7 @@ import { NextRequest, NextResponse } from 'next/server';
import { getCachedEmbyList, setCachedEmbyList } from '@/lib/emby-cache';
import { embyManager } from '@/lib/emby-manager';
import { getProxyToken } from '@/lib/emby-token';
export const runtime = 'nodejs';
@@ -31,6 +32,9 @@ export async function GET(request: NextRequest) {
// 获取Emby客户端
const client = await embyManager.getClient(embyKey);
// 获取代理 token(如果启用了代理)
const proxyToken = client.isProxyEnabled() ? await getProxyToken(request) : null;
// 获取媒体列表
const result = await client.getItems({
ParentId: parentId,
@@ -46,7 +50,7 @@ export async function GET(request: NextRequest) {
const list = result.Items.map((item) => ({
id: item.Id,
title: item.Name,
poster: client.getImageUrl(item.Id, 'Primary'),
poster: client.getImageUrl(item.Id, 'Primary', undefined, proxyToken || undefined),
year: item.ProductionYear?.toString() || '',
rating: item.CommunityRating || 0,
mediaType: item.Type === 'Movie' ? 'movie' : 'tv',