用户组增加权限控制

This commit is contained in:
mtvpls
2026-04-22 16:22:17 +08:00
parent 2734de0c85
commit 0916e4ff08
61 changed files with 617 additions and 165 deletions
+7 -1
View File
@@ -5,6 +5,7 @@ import { NextRequest, NextResponse } from 'next/server';
import { getAvailableApiSites, getConfig } from '@/lib/config';
import { db } from '@/lib/db';
import { getCachedLiveChannels } from '@/lib/live';
import { hasFeaturePermission } from '@/lib/permissions';
export const runtime = 'nodejs';
@@ -76,7 +77,12 @@ export async function GET(request: NextRequest) {
const apiSites = await getAvailableApiSites(username);
// 获取直播源
const liveConfig = config.LiveConfig?.filter(live => !live.disabled) || [];
const canAccessLive = isGlobalToken || !username
? true
: await hasFeaturePermission(username, 'live');
const liveConfig = canAccessLive
? config.LiveConfig?.filter(live => !live.disabled) || []
: [];
// 获取当前请求的 origin,用于构建代理链接
// 优先级:SITE_BASE 环境变量 > origin 参数 > 从请求头构建