mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-29 19:36:36 +08:00
支持按用户保存播放器与弹幕偏好
在 user 记录上新增播放器音量、弹幕开关、透明度、字号、显示区域、合并偏好、自定义弹幕源以及 dandanplay 应用凭据字段,并提供 PUT /danmaku/settings 局部更新接口,带取值校验。 返回脱敏后的完整渲染配置,绝不回传应用密钥,仅在响应中标记密钥是否已配置。 结果缓存键加入用户 ID 与凭据指纹,避免不同用户或凭据串用缓存;旧版实例级设置仅作为未登录与迁移期的回退。
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { runWithoutGlobalVideoFrame } from './withoutVideoFrame.ts'
|
||||
|
||||
function check(name: string, cond: boolean) {
|
||||
if (!cond) throw new Error(`runWithoutGlobalVideoFrame: ${name}`)
|
||||
}
|
||||
|
||||
const FakeVideoFrame = function VideoFrame() {
|
||||
return undefined
|
||||
}
|
||||
|
||||
Object.defineProperty(globalThis, 'VideoFrame', {
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: FakeVideoFrame,
|
||||
})
|
||||
|
||||
let seenInside = typeof (globalThis as { VideoFrame?: unknown }).VideoFrame
|
||||
const result = runWithoutGlobalVideoFrame(() => {
|
||||
seenInside = typeof (globalThis as { VideoFrame?: unknown }).VideoFrame
|
||||
return 7
|
||||
})
|
||||
|
||||
check('hides VideoFrame inside the callback', seenInside === 'undefined')
|
||||
check('returns the callback result', result === 7)
|
||||
check(
|
||||
'restores VideoFrame afterwards',
|
||||
(globalThis as { VideoFrame?: unknown }).VideoFrame === FakeVideoFrame,
|
||||
)
|
||||
|
||||
console.log('withoutVideoFrame.test.ts ok')
|
||||
Reference in New Issue
Block a user