From af8caa23be1c776ba3a2ecea8188a07281f23c13 Mon Sep 17 00:00:00 2001 From: shinya Date: Sun, 15 Mar 2026 23:05:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=B1=E6=95=88=E8=B1=86?= =?UTF-8?q?=E7=93=A3=E5=9B=BE=E7=89=87=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG | 6 ++++++ VERSION.txt | 2 +- src/app/admin/page.tsx | 6 +++--- src/components/UserMenu.tsx | 14 +++++++++----- src/lib/changelog.ts | 13 +++++++++++++ src/lib/utils.ts | 13 ++++++------- src/lib/version.ts | 2 +- 7 files changed, 39 insertions(+), 17 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ac6b914..0379c4f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +## [100.1.2] - 2026-03-15 + +### Changed + +- 移除豆瓣图片代理中的「直连」和「豆瓣官方精品 CDN」选项,历史数据自动兼容为服务器代理 + ## [100.1.1] - 2026-02-27 ### Changed diff --git a/VERSION.txt b/VERSION.txt index f890b16..840071c 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -100.1.1 \ No newline at end of file +100.1.2 \ No newline at end of file diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 49958b2..830fffe 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -3416,9 +3416,7 @@ const SiteConfigComponent = ({ config, refreshConfig }: { config: AdminConfig | // 豆瓣图片代理选项 const doubanImageProxyTypeOptions = [ - { value: 'direct', label: '直连(浏览器直接请求豆瓣)' }, { value: 'server', label: '服务器代理(由服务器代理请求豆瓣)' }, - { value: 'img3', label: '豆瓣官方精品 CDN(阿里云)' }, { value: 'cmliussss-cdn-tencent', label: '豆瓣 CDN By CMLiussss(腾讯云)', @@ -3453,7 +3451,9 @@ const SiteConfigComponent = ({ config, refreshConfig }: { config: AdminConfig | DoubanProxyType: config.SiteConfig.DoubanProxyType || 'cmliussss-cdn-tencent', DoubanProxy: config.SiteConfig.DoubanProxy || '', DoubanImageProxyType: - config.SiteConfig.DoubanImageProxyType || 'cmliussss-cdn-tencent', + (config.SiteConfig.DoubanImageProxyType === 'direct' || config.SiteConfig.DoubanImageProxyType === 'img3') + ? 'server' + : (config.SiteConfig.DoubanImageProxyType || 'cmliussss-cdn-tencent'), DoubanImageProxy: config.SiteConfig.DoubanImageProxy || '', DisableYellowFilter: config.SiteConfig.DisableYellowFilter || false, FluidSearch: config.SiteConfig.FluidSearch || true, diff --git a/src/components/UserMenu.tsx b/src/components/UserMenu.tsx index 2d55278..8889562 100644 --- a/src/components/UserMenu.tsx +++ b/src/components/UserMenu.tsx @@ -88,9 +88,7 @@ export const UserMenu: React.FC = () => { // 豆瓣图片代理选项 const doubanImageProxyTypeOptions = [ - { value: 'direct', label: '直连(浏览器直接请求豆瓣)' }, { value: 'server', label: '服务器代理(由服务器代理请求豆瓣)' }, - { value: 'img3', label: '豆瓣官方精品 CDN(阿里云)' }, { value: 'cmliussss-cdn-tencent', label: '豆瓣 CDN By CMLiussss(腾讯云)', @@ -159,10 +157,13 @@ export const UserMenu: React.FC = () => { ); const defaultDoubanImageProxyType = (window as any).RUNTIME_CONFIG?.DOUBAN_IMAGE_PROXY_TYPE || 'cmliussss-cdn-tencent'; + // 兼容历史数据:直连和豆瓣官方精品 CDN 统一使用服务器代理 + const normalizeImageProxyType = (type: string) => + type === 'direct' || type === 'img3' ? 'server' : type; if (savedDoubanImageProxyType !== null) { - setDoubanImageProxyType(savedDoubanImageProxyType); + setDoubanImageProxyType(normalizeImageProxyType(savedDoubanImageProxyType)); } else if (defaultDoubanImageProxyType) { - setDoubanImageProxyType(defaultDoubanImageProxyType); + setDoubanImageProxyType(normalizeImageProxyType(defaultDoubanImageProxyType)); } const savedDoubanImageProxyUrl = localStorage.getItem( @@ -422,8 +423,11 @@ export const UserMenu: React.FC = () => { (window as any).RUNTIME_CONFIG?.DOUBAN_PROXY_TYPE || 'cmliussss-cdn-tencent'; const defaultDoubanProxy = (window as any).RUNTIME_CONFIG?.DOUBAN_PROXY || ''; - const defaultDoubanImageProxyType = + let defaultDoubanImageProxyType = (window as any).RUNTIME_CONFIG?.DOUBAN_IMAGE_PROXY_TYPE || 'cmliussss-cdn-tencent'; + if (defaultDoubanImageProxyType === 'direct' || defaultDoubanImageProxyType === 'img3') { + defaultDoubanImageProxyType = 'server'; + } const defaultDoubanImageProxyUrl = (window as any).RUNTIME_CONFIG?.DOUBAN_IMAGE_PROXY || ''; const defaultFluidSearch = diff --git a/src/lib/changelog.ts b/src/lib/changelog.ts index f22f9b9..7a55b57 100644 --- a/src/lib/changelog.ts +++ b/src/lib/changelog.ts @@ -10,6 +10,19 @@ export interface ChangelogEntry { } export const changelog: ChangelogEntry[] = [ + { + version: "100.1.2", + date: "2026-03-15", + added: [ + // 无新增内容 + ], + changed: [ + "移除豆瓣图片代理中的「直连」和「豆瓣官方精品 CDN」选项,历史数据自动兼容为服务器代理" + ], + fixed: [ + // 无修复内容 + ] + }, { version: "100.1.1", date: "2026-02-27", diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 3c287b5..fa04425 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -4,18 +4,20 @@ import Hls from 'hls.js'; function getDoubanImageProxyConfig(): { proxyType: - | 'direct' | 'server' - | 'img3' | 'cmliussss-cdn-tencent' | 'cmliussss-cdn-ali' | 'custom'; proxyUrl: string; } { - const doubanImageProxyType = + let doubanImageProxyType = localStorage.getItem('doubanImageProxyType') || (window as any).RUNTIME_CONFIG?.DOUBAN_IMAGE_PROXY_TYPE || 'cmliussss-cdn-tencent'; + // 兼容历史数据:直连和豆瓣官方精品 CDN 统一使用服务器代理 + if (doubanImageProxyType === 'direct' || doubanImageProxyType === 'img3') { + doubanImageProxyType = 'server'; + } const doubanImageProxy = localStorage.getItem('doubanImageProxyUrl') || (window as any).RUNTIME_CONFIG?.DOUBAN_IMAGE_PROXY || @@ -41,8 +43,6 @@ export function processImageUrl(originalUrl: string): string { switch (proxyType) { case 'server': return `/api/image-proxy?url=${encodeURIComponent(originalUrl)}`; - case 'img3': - return originalUrl.replace(/img\d+\.doubanio\.com/g, 'img3.doubanio.com'); case 'cmliussss-cdn-tencent': return originalUrl.replace( /img\d+\.doubanio\.com/g, @@ -55,9 +55,8 @@ export function processImageUrl(originalUrl: string): string { ); case 'custom': return `${proxyUrl}${encodeURIComponent(originalUrl)}`; - case 'direct': default: - return originalUrl; + return `/api/image-proxy?url=${encodeURIComponent(originalUrl)}`; } } diff --git a/src/lib/version.ts b/src/lib/version.ts index 84ea0ea..b4962f9 100644 --- a/src/lib/version.ts +++ b/src/lib/version.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ -const CURRENT_VERSION = '100.1.1'; +const CURRENT_VERSION = '100.1.2'; // 导出当前版本号供其他地方使用 export { CURRENT_VERSION };