Skip to content

Commit af8caa2

Browse files
committed
移除失效豆瓣图片来源
1 parent 31653c1 commit af8caa2

7 files changed

Lines changed: 39 additions & 17 deletions

File tree

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [100.1.2] - 2026-03-15
2+
3+
### Changed
4+
5+
- 移除豆瓣图片代理中的「直连」和「豆瓣官方精品 CDN」选项,历史数据自动兼容为服务器代理
6+
17
## [100.1.1] - 2026-02-27
28

39
### Changed

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
100.1.1
1+
100.1.2

src/app/admin/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3416,9 +3416,7 @@ const SiteConfigComponent = ({ config, refreshConfig }: { config: AdminConfig |
34163416

34173417
// 豆瓣图片代理选项
34183418
const doubanImageProxyTypeOptions = [
3419-
{ value: 'direct', label: '直连(浏览器直接请求豆瓣)' },
34203419
{ value: 'server', label: '服务器代理(由服务器代理请求豆瓣)' },
3421-
{ value: 'img3', label: '豆瓣官方精品 CDN(阿里云)' },
34223420
{
34233421
value: 'cmliussss-cdn-tencent',
34243422
label: '豆瓣 CDN By CMLiussss(腾讯云)',
@@ -3453,7 +3451,9 @@ const SiteConfigComponent = ({ config, refreshConfig }: { config: AdminConfig |
34533451
DoubanProxyType: config.SiteConfig.DoubanProxyType || 'cmliussss-cdn-tencent',
34543452
DoubanProxy: config.SiteConfig.DoubanProxy || '',
34553453
DoubanImageProxyType:
3456-
config.SiteConfig.DoubanImageProxyType || 'cmliussss-cdn-tencent',
3454+
(config.SiteConfig.DoubanImageProxyType === 'direct' || config.SiteConfig.DoubanImageProxyType === 'img3')
3455+
? 'server'
3456+
: (config.SiteConfig.DoubanImageProxyType || 'cmliussss-cdn-tencent'),
34573457
DoubanImageProxy: config.SiteConfig.DoubanImageProxy || '',
34583458
DisableYellowFilter: config.SiteConfig.DisableYellowFilter || false,
34593459
FluidSearch: config.SiteConfig.FluidSearch || true,

src/components/UserMenu.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ export const UserMenu: React.FC = () => {
8888

8989
// 豆瓣图片代理选项
9090
const doubanImageProxyTypeOptions = [
91-
{ value: 'direct', label: '直连(浏览器直接请求豆瓣)' },
9291
{ value: 'server', label: '服务器代理(由服务器代理请求豆瓣)' },
93-
{ value: 'img3', label: '豆瓣官方精品 CDN(阿里云)' },
9492
{
9593
value: 'cmliussss-cdn-tencent',
9694
label: '豆瓣 CDN By CMLiussss(腾讯云)',
@@ -159,10 +157,13 @@ export const UserMenu: React.FC = () => {
159157
);
160158
const defaultDoubanImageProxyType =
161159
(window as any).RUNTIME_CONFIG?.DOUBAN_IMAGE_PROXY_TYPE || 'cmliussss-cdn-tencent';
160+
// 兼容历史数据:直连和豆瓣官方精品 CDN 统一使用服务器代理
161+
const normalizeImageProxyType = (type: string) =>
162+
type === 'direct' || type === 'img3' ? 'server' : type;
162163
if (savedDoubanImageProxyType !== null) {
163-
setDoubanImageProxyType(savedDoubanImageProxyType);
164+
setDoubanImageProxyType(normalizeImageProxyType(savedDoubanImageProxyType));
164165
} else if (defaultDoubanImageProxyType) {
165-
setDoubanImageProxyType(defaultDoubanImageProxyType);
166+
setDoubanImageProxyType(normalizeImageProxyType(defaultDoubanImageProxyType));
166167
}
167168

168169
const savedDoubanImageProxyUrl = localStorage.getItem(
@@ -422,8 +423,11 @@ export const UserMenu: React.FC = () => {
422423
(window as any).RUNTIME_CONFIG?.DOUBAN_PROXY_TYPE || 'cmliussss-cdn-tencent';
423424
const defaultDoubanProxy =
424425
(window as any).RUNTIME_CONFIG?.DOUBAN_PROXY || '';
425-
const defaultDoubanImageProxyType =
426+
let defaultDoubanImageProxyType =
426427
(window as any).RUNTIME_CONFIG?.DOUBAN_IMAGE_PROXY_TYPE || 'cmliussss-cdn-tencent';
428+
if (defaultDoubanImageProxyType === 'direct' || defaultDoubanImageProxyType === 'img3') {
429+
defaultDoubanImageProxyType = 'server';
430+
}
427431
const defaultDoubanImageProxyUrl =
428432
(window as any).RUNTIME_CONFIG?.DOUBAN_IMAGE_PROXY || '';
429433
const defaultFluidSearch =

src/lib/changelog.ts

Lines changed: 13 additions & 0 deletions
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.1.2",
15+
date: "2026-03-15",
16+
added: [
17+
// 无新增内容
18+
],
19+
changed: [
20+
"移除豆瓣图片代理中的「直连」和「豆瓣官方精品 CDN」选项,历史数据自动兼容为服务器代理"
21+
],
22+
fixed: [
23+
// 无修复内容
24+
]
25+
},
1326
{
1427
version: "100.1.1",
1528
date: "2026-02-27",

src/lib/utils.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ import Hls from 'hls.js';
44

55
function getDoubanImageProxyConfig(): {
66
proxyType:
7-
| 'direct'
87
| 'server'
9-
| 'img3'
108
| 'cmliussss-cdn-tencent'
119
| 'cmliussss-cdn-ali'
1210
| 'custom';
1311
proxyUrl: string;
1412
} {
15-
const doubanImageProxyType =
13+
let doubanImageProxyType =
1614
localStorage.getItem('doubanImageProxyType') ||
1715
(window as any).RUNTIME_CONFIG?.DOUBAN_IMAGE_PROXY_TYPE ||
1816
'cmliussss-cdn-tencent';
17+
// 兼容历史数据:直连和豆瓣官方精品 CDN 统一使用服务器代理
18+
if (doubanImageProxyType === 'direct' || doubanImageProxyType === 'img3') {
19+
doubanImageProxyType = 'server';
20+
}
1921
const doubanImageProxy =
2022
localStorage.getItem('doubanImageProxyUrl') ||
2123
(window as any).RUNTIME_CONFIG?.DOUBAN_IMAGE_PROXY ||
@@ -41,8 +43,6 @@ export function processImageUrl(originalUrl: string): string {
4143
switch (proxyType) {
4244
case 'server':
4345
return `/api/image-proxy?url=${encodeURIComponent(originalUrl)}`;
44-
case 'img3':
45-
return originalUrl.replace(/img\d+\.doubanio\.com/g, 'img3.doubanio.com');
4646
case 'cmliussss-cdn-tencent':
4747
return originalUrl.replace(
4848
/img\d+\.doubanio\.com/g,
@@ -55,9 +55,8 @@ export function processImageUrl(originalUrl: string): string {
5555
);
5656
case 'custom':
5757
return `${proxyUrl}${encodeURIComponent(originalUrl)}`;
58-
case 'direct':
5958
default:
60-
return originalUrl;
59+
return `/api/image-proxy?url=${encodeURIComponent(originalUrl)}`;
6160
}
6261
}
6362

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.1.1';
3+
const CURRENT_VERSION = '100.1.2';
44

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

0 commit comments

Comments
 (0)