Skip to content

Commit 8815e13

Browse files
committed
/api/search/resources add user check
1 parent a12e4a5 commit 8815e13

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [100.0.2] - 2025-10-23
2+
3+
### Fixed
4+
5+
- 修复 /api/search/resources 接口越权问题
6+
17
## [100.0.1] - 2025-09-25
28

39
### Fixed

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
100.0.1
1+
100.0.2

src/app/api/search/resources/route.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
/* eslint-disable no-console */
22

33
import { NextRequest, NextResponse } from 'next/server';
4-
4+
import { getAuthInfoFromCookie } from '@/lib/auth';
55
import { getAvailableApiSites } from '@/lib/config';
66

77
export const runtime = 'nodejs';
88

99
// OrionTV 兼容接口
1010
export async function GET(request: NextRequest) {
11-
console.log('request', request.url);
11+
const authInfo = getAuthInfoFromCookie(request);
12+
if (!authInfo || !authInfo.username) {
13+
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
14+
}
1215
try {
13-
const apiSites = await getAvailableApiSites();
16+
const apiSites = await getAvailableApiSites(authInfo.username);
1417

1518
return NextResponse.json(apiSites);
1619
} catch (error) {

src/lib/changelog.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ export interface ChangelogEntry {
1010
}
1111

1212
export const changelog: ChangelogEntry[] = [
13+
{
14+
version: "100.0.2",
15+
date: "2025-10-23",
16+
added: [
17+
// 无新增内容
18+
],
19+
changed: [
20+
// 无变更内容
21+
],
22+
fixed: [
23+
"修复 /api/search/resources 接口越权问题"
24+
]
25+
},
1326
{
1427
version: "100.0.1",
1528
date: "2025-09-25",
@@ -19,7 +32,7 @@ export const changelog: ChangelogEntry[] = [
1932
changed: [
2033
// 无变更内容
2134
],
22-
fixed: [
35+
fixed: [
2336
"修复错误的环境变量 ADMIN_USERNAME",
2437
"修复 bangumi 数据中没有图片导致首页崩溃问题"
2538
]

src/lib/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-console */
22

3-
const CURRENT_VERSION = '100.0.1';
3+
const CURRENT_VERSION = '100.0.2';
44

55
// 导出当前版本号供其他地方使用
66
export { CURRENT_VERSION };

0 commit comments

Comments
 (0)