From 6bcf1275fcd26d57ce55494e2d393d77636b0352 Mon Sep 17 00:00:00 2001 From: Taois Date: Fri, 17 Oct 2025 00:14:03 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E5=8F=91=E5=B8=83=E6=96=B0?= =?UTF-8?q?=E7=89=88drplayer=E5=A2=9E=E5=8A=A0=E6=82=AC=E6=B5=AE=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboard/docs/FASTIFY_DEPLOYMENT.md | 2 +- dashboard/package.json | 2 +- dashboard/src/App.vue | 10 + dashboard/src/components/FloatingIframe.vue | 619 ++++++++++++++++++++ dashboard/src/services/backupService.js | 54 +- dashboard/src/services/resetService.js | 30 +- dashboard/src/views/Settings.vue | 143 ++++- 7 files changed, 849 insertions(+), 11 deletions(-) create mode 100644 dashboard/src/components/FloatingIframe.vue diff --git a/dashboard/docs/FASTIFY_DEPLOYMENT.md b/dashboard/docs/FASTIFY_DEPLOYMENT.md index d6ced6f..efc7a71 100644 --- a/dashboard/docs/FASTIFY_DEPLOYMENT.md +++ b/dashboard/docs/FASTIFY_DEPLOYMENT.md @@ -129,7 +129,7 @@ fastify.get('/apps/drplayer/', async (request, reply) => { ## 测试验证 1. 启动Fastify服务器 -2. 访问 `http://localhost:3000/apps/drplayer/` +2. 访问 `http://localhost:5757/apps/drplayer/` 3. 导航到不同页面(如设置页面) 4. 刷新页面,确认不出现404错误 5. 检查浏览器开发者工具,确认静态资源正常加载 diff --git a/dashboard/package.json b/dashboard/package.json index de36d49..5151663 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -1,7 +1,7 @@ { "name": "drplayer", "private": true, - "version": "1.0.1 20251016", + "version": "1.0.2 20251017", "type": "module", "scripts": { "dev": "vite", diff --git a/dashboard/src/App.vue b/dashboard/src/App.vue index 30ab616..5dff0ab 100644 --- a/dashboard/src/App.vue +++ b/dashboard/src/App.vue @@ -5,12 +5,21 @@ + + + + \ No newline at end of file diff --git a/dashboard/src/services/backupService.js b/dashboard/src/services/backupService.js index b688b47..ab2d7f5 100644 --- a/dashboard/src/services/backupService.js +++ b/dashboard/src/services/backupService.js @@ -39,7 +39,15 @@ const BACKUP_KEYS = { PARSER_CONFIG: 'parserConfig', PARSERS: 'drplayer_parsers', // 解析器数据 SIDEBAR_COLLAPSED: 'sidebarCollapsed', - PAGE_STATE: 'pageState' + PAGE_STATE: 'pageState', + + // 开发者调试设置 + DEBUG_SETTINGS: 'debugSettings', + + // 悬浮组件相关 + FLOATING_BUTTON_POSITION: 'floating-iframe-button-position', + FLOATING_WINDOW_POSITION: 'floating-iframe-window-position', + FLOATING_WINDOW_SIZE: 'floating-iframe-window-size' } // 存储为字符串的键(不需要JSON解析) @@ -189,6 +197,19 @@ export const collectBackupData = () => { liveConfigUrl: getLocalStorageData(BACKUP_KEYS.LIVE_CONFIG_URL, ''), // 当前站点 currentSite: getLocalStorageData(BACKUP_KEYS.CURRENT_SITE, null) + }, + + // 开发者调试设置 + debugSettings: getLocalStorageData(BACKUP_KEYS.DEBUG_SETTINGS, {}), + + // 悬浮组件数据 + floatingData: { + // 悬浮按钮位置 + buttonPosition: getLocalStorageData(BACKUP_KEYS.FLOATING_BUTTON_POSITION, null), + // 悬浮窗口位置 + windowPosition: getLocalStorageData(BACKUP_KEYS.FLOATING_WINDOW_POSITION, null), + // 悬浮窗口尺寸 + windowSize: getLocalStorageData(BACKUP_KEYS.FLOATING_WINDOW_SIZE, null) } } @@ -406,6 +427,37 @@ export const restoreBackupData = (backupData) => { } } + // 还原开发者调试设置 + if (backupData.debugSettings) { + if (setLocalStorageData(BACKUP_KEYS.DEBUG_SETTINGS, backupData.debugSettings)) { + restoredCount++ + } else { + failedCount++ + errors.push('开发者调试设置') + } + } + + // 还原悬浮组件数据 + if (backupData.floatingData) { + const floatingDataMapping = { + buttonPosition: BACKUP_KEYS.FLOATING_BUTTON_POSITION, + windowPosition: BACKUP_KEYS.FLOATING_WINDOW_POSITION, + windowSize: BACKUP_KEYS.FLOATING_WINDOW_SIZE + } + + for (const [key, value] of Object.entries(backupData.floatingData)) { + const storageKey = floatingDataMapping[key] + if (storageKey && value !== null) { + if (setLocalStorageData(storageKey, value)) { + restoredCount++ + } else { + failedCount++ + errors.push(`悬浮组件数据 ${key}`) + } + } + } + } + // 显示还原结果 if (failedCount === 0) { Message.success(`数据还原成功!共还原 ${restoredCount} 项数据`) diff --git a/dashboard/src/services/resetService.js b/dashboard/src/services/resetService.js index 0d2d01b..8255d4f 100644 --- a/dashboard/src/services/resetService.js +++ b/dashboard/src/services/resetService.js @@ -55,9 +55,16 @@ const DEFAULT_CONFIGS = { searchAggregationSettings: { selectedSources: [] // 默认没有选中任何搜索源 }, + + // 侧边栏折叠状态默认值 + sidebarCollapsed: false, - // 侧边栏状态默认值 - sidebarCollapsed: false + // 开发者调试设置默认值 + debugSettings: { + enabled: false, + url: 'http://localhost:5757/apps/websocket', + resetting: false + } } // 需要完全清空的数据键 @@ -92,15 +99,23 @@ const CLEAR_DATA_KEYS = [ 'selectedParser', // 选中的解析器 'last-clicked-video', // 最后点击的视频 - // 界面状态 + // 其他设置和状态 'sidebar-collapsed', // 侧边栏折叠状态 - - // 地址配置历史 + + // 地址配置历史记录 'drplayer_vod_config_history', 'drplayer_live_config_history', 'drplayer_proxy_access_history', 'drplayer_proxy_play_history', - 'drplayer_proxy_sniff_history' + 'drplayer_proxy_sniff_history', + + // 开发者调试设置相关 + 'debugSettings', + + // 悬浮组件相关 + 'floating-iframe-button-position', + 'floating-iframe-window-position', + 'floating-iframe-window-size' ] /** @@ -206,5 +221,6 @@ export const factoryResetWithConfirmation = async () => { export default { showResetConfirmation, performFactoryReset, - factoryResetWithConfirmation + factoryResetWithConfirmation, + DEFAULT_CONFIGS } \ No newline at end of file diff --git a/dashboard/src/views/Settings.vue b/dashboard/src/views/Settings.vue index ff25942..fe2367a 100644 --- a/dashboard/src/views/Settings.vue +++ b/dashboard/src/views/Settings.vue @@ -800,6 +800,83 @@ + + + + +
+ +
+
+ +
+
允许调试
+
开启开发者调试功能
+
+
+
+ +
+
+ + +
+
+
+ +
+
调试地址
+
配置悬浮iframe的调试地址
+
+
+
+ + + +
+ + + 重置状态 + + + + 保存 + + +
+
+
+
+
+
+