Skip to content

Commit dd17c13

Browse files
authored
Merge branch 'hjdhnx:main' into main
2 parents 20c55d2 + 1c7a78d commit dd17c13

21 files changed

+5486
-96
lines changed

dashboard/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<meta name="referrer" content="no-referrer" />
78
<title>DrPlayer</title>
89
</head>
910
<body>

dashboard/src/api/services/live.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,8 @@ class LiveService {
7373

7474
// 获取直播文件内容
7575
const response = await axios.get(liveConfig.url, {
76-
timeout: 15000,
77-
headers: {
78-
'User-Agent': liveConfig.ua || 'Mozilla/5.0'
79-
}
76+
timeout: 15000
77+
// 注意:浏览器环境下不能设置 User-Agent 头,浏览器会自动处理
8078
})
8179

8280
if (!response.data) {

dashboard/src/components/actions/InputAction.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -824,12 +824,19 @@ export default {
824824
825825
imageCoords.value = { x, y }
826826
827-
// 将坐标填入输入框
828-
const coordsText = `${x},${y}`
829-
inputValue.value = coordsText
827+
// 将坐标累积到输入框中,多个坐标用-符号分隔
828+
const newCoordsText = `${x},${y}`
829+
830+
if (inputValue.value.trim()) {
831+
// 如果输入框已有内容,用-符号分隔追加新坐标
832+
inputValue.value = `${inputValue.value}-${newCoordsText}`
833+
} else {
834+
// 如果输入框为空,直接设置新坐标
835+
inputValue.value = newCoordsText
836+
}
830837
831838
// 触发输入验证
832-
validateInput(coordsText)
839+
validateInput(inputValue.value)
833840
834841
// 不自动提交,让用户可以看到坐标并手动确认
835842
}

dashboard/src/components/players/ArtVideoPlayer.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Artplayer.PLAYBACK_RATE = [0.5, 0.75, 1, 1.25, 1.5, 2, 2.5, 3, 4, 5]
6666
import PlayerHeader from './PlayerHeader.vue'
6767
import SkipSettingsDialog from './SkipSettingsDialog.vue'
6868
import { useSkipSettings } from '@/composables/useSkipSettings'
69+
import { applyCSPBypass, setVideoReferrerPolicy, REFERRER_POLICIES } from '@/utils/csp'
6970
7071
// Props - 已添加 HLS 支持、动态高度自适应和自动下一集功能
7172
const props = defineProps({
@@ -210,6 +211,14 @@ const initArtPlayer = async (url) => {
210211
211212
console.log('初始化 ArtPlayer:', url)
212213
214+
// 应用CSP绕过策略
215+
try {
216+
const appliedPolicy = applyCSPBypass(url)
217+
console.log(`已为ArtPlayer应用CSP策略: ${appliedPolicy}`)
218+
} catch (error) {
219+
console.warn('应用CSP策略失败:', error)
220+
}
221+
213222
// 重置重连状态
214223
resetRetryState()
215224

dashboard/src/components/players/VideoPlayer.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import Hls from 'hls.js'
8989
import PlayerHeader from './PlayerHeader.vue'
9090
import SkipSettingsDialog from './SkipSettingsDialog.vue'
9191
import { useSkipSettings } from '@/composables/useSkipSettings'
92+
import { applyCSPBypass, setVideoReferrerPolicy, REFERRER_POLICIES } from '@/utils/csp'
9293
9394
// Props
9495
const props = defineProps({
@@ -309,6 +310,16 @@ const initVideoPlayer = (url) => {
309310
310311
const video = videoPlayer.value
311312
313+
// 应用CSP绕过策略
314+
try {
315+
const appliedPolicy = applyCSPBypass(url, video)
316+
console.log(`已为视频播放应用CSP策略: ${appliedPolicy}`)
317+
} catch (error) {
318+
console.warn('应用CSP策略失败:', error)
319+
// 降级到基本的no-referrer策略
320+
setVideoReferrerPolicy(video, REFERRER_POLICIES.NO_REFERRER)
321+
}
322+
312323
// 视频结束事件处理函数
313324
const handleVideoEnded = () => {
314325
// 防抖:如果正在处理自动连播,则忽略

0 commit comments

Comments
 (0)