From 020197201aca25ef726c8473954f57528bc0526b Mon Sep 17 00:00:00 2001 From: mtvpls Date: Wed, 17 Dec 2025 22:09:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99v203=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG | 17 ++++ VERSION.txt | 2 +- src/app/page.tsx | 7 ++ src/components/HttpWarningDialog.tsx | 122 +++++++++++++++++++++++++++ src/lib/changelog.ts | 19 +++++ src/lib/version.ts | 2 +- 6 files changed, 167 insertions(+), 2 deletions(-) create mode 100644 src/components/HttpWarningDialog.tsx diff --git a/CHANGELOG b/CHANGELOG index 314e29c..de68bf9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,20 @@ +## [203.0.0] - 2025-12-17 + +### Added +- 首页新增即将上映模块 +- 新增剧集屏蔽功能 +- 换源增加重新测试和质量排序 + +### Changed +- IOS全屏体验优化 +- 站点配置中的注册相关配置移动到了新的注册配置大项中 +- 默认站名从MoonTV改为MoonTVPlus +- 用户管理现在会给oidc注册的用户显示oidc标识 + +### Fixed +- 修复压缩节目单无法加载 +- 修复Docker环境下离线下载无法开启 + ## [202.0.0] - 2025-12-14 ### Added diff --git a/VERSION.txt b/VERSION.txt index d48b7a6..e334ab9 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -202.0.0 \ No newline at end of file +203.0.0 \ No newline at end of file diff --git a/src/app/page.tsx b/src/app/page.tsx index 16d9641..b9adb09 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -27,6 +27,7 @@ import PageLayout from '@/components/PageLayout'; import ScrollableRow from '@/components/ScrollableRow'; import { useSite } from '@/components/SiteProvider'; import VideoCard from '@/components/VideoCard'; +import HttpWarningDialog from '@/components/HttpWarningDialog'; function HomeClient() { const [activeTab, setActiveTab] = useState<'home' | 'favorites'>('home'); @@ -41,6 +42,7 @@ function HomeClient() { const { announcement } = useSite(); const [showAnnouncement, setShowAnnouncement] = useState(false); + const [showHttpWarning, setShowHttpWarning] = useState(true); // 检查公告弹窗状态 useEffect(() => { @@ -507,6 +509,11 @@ function HomeClient() { + {/* HTTP 环境警告弹窗 */} + {showHttpWarning && ( + setShowHttpWarning(false)} /> + )} + {/* 公告弹窗 */} {showAnnouncement && (
diff --git a/src/components/HttpWarningDialog.tsx b/src/components/HttpWarningDialog.tsx new file mode 100644 index 0000000..af26c8d --- /dev/null +++ b/src/components/HttpWarningDialog.tsx @@ -0,0 +1,122 @@ +'use client'; + +import { AlertTriangle } from 'lucide-react'; +import { useEffect, useState } from 'react'; +import { createPortal } from 'react-dom'; +import { getAuthInfoFromBrowserCookie } from '@/lib/auth'; + +interface HttpWarningDialogProps { + onClose: () => void; +} + +export default function HttpWarningDialog({ onClose }: HttpWarningDialogProps) { + const [isVisible, setIsVisible] = useState(false); + const [shouldShow, setShouldShow] = useState(false); + + useEffect(() => { + // 检查是否应该显示弹窗 + const checkShouldShow = () => { + // 只在客户端执行 + if (typeof window === 'undefined') return false; + + // 检查是否已经选择不再提示 + const dontShowAgain = localStorage.getItem('httpWarningDismissed'); + if (dontShowAgain === 'true') return false; + + // 检查是否是站长 + const authInfo = getAuthInfoFromBrowserCookie(); + if (!authInfo || authInfo.role !== 'owner') return false; + + // 检查是否是 HTTP 环境(非 localhost 和 127.0.0.1) + const { protocol, hostname } = window.location; + const isHttp = protocol === 'http:'; + const isLocalhost = hostname === 'localhost' || hostname === '127.0.0.1'; + + // 只在 HTTP 且非本地环境下显示 + return isHttp && !isLocalhost; + }; + + const shouldDisplay = checkShouldShow(); + setShouldShow(shouldDisplay); + + if (shouldDisplay) { + // 延迟显示动画 + setTimeout(() => setIsVisible(true), 100); + } + }, []); + + const handleDontShowAgain = () => { + localStorage.setItem('httpWarningDismissed', 'true'); + handleClose(); + }; + + const handleClose = () => { + setIsVisible(false); + setTimeout(() => { + onClose(); + }, 300); + }; + + // 如果不需要显示,直接返回 null + if (!shouldShow) return null; + + return createPortal( +
+
e.stopPropagation()} + > +
+ {/* 图标和标题 */} +
+
+ +
+
+

+ HTTP 环境功能限制提示 +

+
+

+ 检测到您正在使用 HTTP 协议访问本站。由于浏览器安全策略限制,以下功能将无法正常使用: +

+
    +
  • 视频超分(AI 画质增强)
  • +
  • 麦克风语音功能
  • +
  • 其他需要安全上下文的高级功能
  • +
+

+ 建议配置 HTTPS 证书以获得完整功能体验。 +

+
+
+
+ + {/* 按钮组 */} +
+ + +
+
+
+
, + document.body + ); +} diff --git a/src/lib/changelog.ts b/src/lib/changelog.ts index 7388fba..8837147 100644 --- a/src/lib/changelog.ts +++ b/src/lib/changelog.ts @@ -11,6 +11,25 @@ export interface ChangelogEntry { export const changelog: ChangelogEntry[] = [ { + version: '203.0.0', + date: '2025-12-17', + added: [ + '首页新增即将上映模块', + '新增剧集屏蔽功能', + '换源增加重新测试和质量排序' + ], + changed: [ + 'IOS全屏体验优化', + '站点配置中的注册相关配置移动到了新的注册配置大项中', + '默认站名从MoonTV改为MoonTVPlus', + '用户管理现在会给oidc注册的用户显示oidc标识', + ], + fixed: [ + '修复压缩节目单无法加载', + '修复Docker环境下离线下载无法开启' + ] + }, + { version: '202.0.0', date: '2025-12-14', added: [ diff --git a/src/lib/version.ts b/src/lib/version.ts index 37cfa01..839d944 100644 --- a/src/lib/version.ts +++ b/src/lib/version.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ -const CURRENT_VERSION = '202.0.0'; +const CURRENT_VERSION = '203.0.0'; // 导出当前版本号供其他地方使用 export { CURRENT_VERSION };