/api/search/resources add user check

This commit is contained in:
shinya
2025-10-23 13:02:02 +08:00
parent a12e4a5986
commit 8815e138e5
5 changed files with 28 additions and 6 deletions

View File

@@ -1,3 +1,9 @@
## [100.0.2] - 2025-10-23
### Fixed
- 修复 /api/search/resources 接口越权问题
## [100.0.1] - 2025-09-25 ## [100.0.1] - 2025-09-25
### Fixed ### Fixed

View File

@@ -1 +1 @@
100.0.1 100.0.2

View File

@@ -1,16 +1,19 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
import { NextRequest, NextResponse } from 'next/server'; import { NextRequest, NextResponse } from 'next/server';
import { getAuthInfoFromCookie } from '@/lib/auth';
import { getAvailableApiSites } from '@/lib/config'; import { getAvailableApiSites } from '@/lib/config';
export const runtime = 'nodejs'; export const runtime = 'nodejs';
// OrionTV 兼容接口 // OrionTV 兼容接口
export async function GET(request: NextRequest) { export async function GET(request: NextRequest) {
console.log('request', request.url); const authInfo = getAuthInfoFromCookie(request);
if (!authInfo || !authInfo.username) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
try { try {
const apiSites = await getAvailableApiSites(); const apiSites = await getAvailableApiSites(authInfo.username);
return NextResponse.json(apiSites); return NextResponse.json(apiSites);
} catch (error) { } catch (error) {

View File

@@ -10,6 +10,19 @@ export interface ChangelogEntry {
} }
export const changelog: ChangelogEntry[] = [ export const changelog: ChangelogEntry[] = [
{
version: "100.0.2",
date: "2025-10-23",
added: [
// 无新增内容
],
changed: [
// 无变更内容
],
fixed: [
"修复 /api/search/resources 接口越权问题"
]
},
{ {
version: "100.0.1", version: "100.0.1",
date: "2025-09-25", date: "2025-09-25",

View File

@@ -1,6 +1,6 @@
/* eslint-disable no-console */ /* eslint-disable no-console */
const CURRENT_VERSION = '100.0.1'; const CURRENT_VERSION = '100.0.2';
// 导出当前版本号供其他地方使用 // 导出当前版本号供其他地方使用
export { CURRENT_VERSION }; export { CURRENT_VERSION };