Peach: Local-first video metadata scraper and media manager.
fix: complete immersive playback controls
longmeidao937f3607d206
diff --git a/docs/STATUS.md b/docs/STATUS.mdindex 500a0a345..f4456c4f3 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -49,6 +49,7 @@- 沉浸模式按用户提供的 YouTube Shorts 桌面截图重排:竖屏使用居中的 9:16 播放舞台,横屏使用在整个视口视觉居中的 16:9 大舞台;48 px 圆形操作按钮与文字分离,作者头像、身份和标题留在页面左下;390×844 手机继续使用全视口播放器。保留 Peach 的三项本地反馈、混合横竖屏队列和完整画面优先,不复制评论、分享、Remix 或订阅。- 用户生产截图确认上一版横屏舞台贴右导致视觉失衡;同一截图还显示 HTTPS 服务 PID 47788 同时预读三部已切走的视频,子进程 PID 43080 正在转码 `IDBD-446_C.mkv`。根因是沉浸模式没有复用详情播放器已有的可取消 `session` 契约。本批为每个沉浸视频分配独立会话,并在切片、关闭、失败和页面离开时通知服务端取消。取证后 PID 43080 已自行退出;PID 47788 是正常 HTTPS 服务,不是下载器,3 秒复核读写增量均为 0,未强行终止任何进程。- 正式 Windows 全量测试 1123 项通过、13 项按平台跳过。临时静态页面在 1440×900 下实测横屏舞台 922×518、中心偏差 0 px、无横向溢出;390×844 下舞台为完整视口且无横向溢出。浏览器控制台无错误;尚未重启生产服务。+- 沉浸模式补齐画面点击播放/暂停,桌面左右键按设置步长快退/快进;手机单击切换播放状态,同侧双击左右半区快退/快进,并保留横划进度与竖划切片。详情播放器错误文案改为画面中央:390×844 临时账本实测错误文字框与左上加载速度徽标不重合,普通点击可暂停/恢复;内置浏览器不支持注入原生 touch 事件,手机同侧双击的真机触控证据记为未取得。- `5926ff4` 已合入 `master`:关注页改用与首页一致的作者头像和标签胶囊,压缩顶部间距;管理页不再残留目录标题;`深喉咙` 统一为 `深喉`;非视频主附件也会从同一发布的图片附件取预览图。- Fiu758 只登记为厂牌 Logo 候选发现来源,不作真相源。17 个已安装横条 Logo 已原样备份并无损补成正方形;5 个损坏图片保持不动并进入错误报告。- 正式 Windows 测试入口跑完 1040 项,全部通过,13 项按平台跳过。桌面浏览器确认关注页顶部为 88px、无旧筛选控件、无横向溢出且目录标题隐藏;手机视口覆盖连续超时,截图验收为未取得,响应式源码契约测试已通过。diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 5e673c075..f688fc964 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -380,7 +380,23 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("stage&&!stage.hidden?stage.querySelector('video'):null")self.assertPageLacks("return stage&&!stage.hidden?$('#vid'):null")self.assertPageContains("seekVideoBy(video,appSettings.seekSeconds*(e.key==='ArrowRight'?1:-1))")- self.assertPageContains("if(video.paused)video.play().catch(()=>{});else video.pause()")+ self.assertPageContains("toggleVideoPlayback(video)")++ def test_immerse_click_toggles_playback_and_mobile_double_tap_seeks(self):+ self.assertPageContains("function toggleVideoPlayback(video)")+ self.assertPageContains("$('#tokTrack').onclick=()=>{")+ self.assertPageContains("if(Date.now()<tokIgnoreClickUntil)return")+ self.assertPageContains("const TOK_DOUBLE_TAP_MS=280")+ self.assertPageContains("const side=clientX<window.innerWidth/2?-1:1")+ self.assertPageContains("seekVideoBy(video,appSettings.seekSeconds*side)")+ self.assertPageContains("handleTokTap(end.clientX)")+ self.assertPageContains("touch-action:manipulation;cursor:pointer")++ def test_mobile_player_error_is_centred_away_from_the_network_badge(self):+ self.assertPageContains(+ ".vwrap .video-js.vjs-error .vjs-error-display .vjs-modal-dialog-content{")+ self.assertPageContains(+ "display:flex;align-items:center;justify-content:center;padding:56px 24px;text-align:center")def test_space_does_not_also_scroll_the_page(self):self.assertPageContains("if(e.key===' '){\n e.preventDefault();")diff --git a/web/app.css b/web/app.cssindex 7d6d2c75a..19c913382 100644--- a/web/app.css+++ b/web/app.css@@ -800,6 +800,8 @@ body.index-open #tiers,body.index-open #tagbar{display:none}.vwrap .video-js .vjs-tech{object-fit:contain}.vwrap .video-js .vjs-control-bar{height:3.4em;background:linear-gradient(transparent,rgba(0,0,0,.82))}.vwrap .video-js .vjs-progress-control{min-width:0}.vwrap .video-js .vjs-time-control{font-size:var(--fs-xs)}+.vwrap .video-js.vjs-error .vjs-error-display .vjs-modal-dialog-content{+ display:flex;align-items:center;justify-content:center;padding:56px 24px;text-align:center;overflow-wrap:anywhere}.vwrap>.video-js.vjs-fullscreen,.video-js.vjs-fullscreen{width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;aspect-ratio:auto!important}.vwrap>.video-js.vjs-fullscreen .vjs-tech,.video-js.vjs-fullscreen .vjs-tech{@@ -1030,7 +1032,7 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位transform:translate(-50%,-50%)}.tokstage.wide{left:50%;right:auto;width:min(64vw,177.778vh);aspect-ratio:16/9;transform:translate(-50%,-50%)}.toktrack{position:absolute;inset:0;overflow:hidden;border-radius:12px;background:#000;- box-shadow:0 0 64px rgba(0,0,0,.34)}.toktrack video{position:absolute;inset:0;max-height:none;max-width:none;+ box-shadow:0 0 64px rgba(0,0,0,.34);touch-action:manipulation;cursor:pointer}.toktrack video{position:absolute;inset:0;max-height:none;max-width:none;width:100%;height:100%;left:50%;transform:translateX(-50%);object-fit:cover;background:#000;will-change:transform;transition:transform .2s cubic-bezier(.2,.2,.4,.9)}/* 片源与视口比例差得多时按原始比例完整显示(留黑边),不裁掉画面。diff --git a/web/app.js b/web/app.jsindex 3db911872..409f15874 100644--- a/web/app.js+++ b/web/app.js@@ -4178,7 +4178,7 @@ $('#q').addEventListener('blur',()=>setTimeout(()=>{if(!$('#q').value&&!$('#sear$('#brandHome').onclick=e=>{e.preventDefault();state={loc:state.loc,creator:'',studio:'',tag:'',len:'',dur_min:'',dur_max:'',orient:'',state:'',sort:appSettings.defaultSort,seed:persistedSeed(),q:'',thumb:'1'};route('/');$('#q').value='';disposeStage(false);buildBars();load(true);window.scrollTo({top:0,behavior:'smooth'})};-$('#tokClose').onclick=()=>{setTokLoading(false);route('/');$('#tok').hidden=true;$('#tokTrack').querySelectorAll('video').forEach(v=>{+$('#tokClose').onclick=()=>{setTokLoading(false);clearTokTap();route('/');$('#tok').hidden=true;$('#tokTrack').querySelectorAll('video').forEach(v=>{disposeTokVideo(v,v.id!=='tokVid')});const v=$('#tokVid');if(v){v.style.transform='translateX(-50%)'}$('#tok').classList.remove('tok-wide');$('#tok .tokstage').classList.remove('wide');tokSwitching=false;document.body.style.overflow='';showHomeSurfaces();load(true)};@@ -4191,9 +4191,40 @@ $('#tok').addEventListener('wheel',e=>{const n=Date.now();if(n-wl<260)return;wl=/* 手机上竖划切片、横划拖进度。横划在哪儿起手都行——屏幕最下沿那条进度条在手机上几乎摸不到。方向一旦定下就不再改,否则斜着划会又切片又跳进度。位移按屏宽换算成时长的相对量,所以从任何位置起手都是「往右 = 往后」。 */-let tokTouch=null;+const TOK_DOUBLE_TAP_MS=280;+let tokTouch=null,tokTapTimer=null,tokLastTap=null,tokIgnoreClickUntil=0;+function clearTokTap(){+ if(tokTapTimer)clearTimeout(tokTapTimer);+ tokTapTimer=null;tokLastTap=null;+}+function toggleVideoPlayback(video){+ if(!video)return;+ if(video.paused)video.play().catch(()=>{});else video.pause();+}+function handleTokTap(clientX){+ const video=$('#tokVid');if(!video)return;+ const side=clientX<window.innerWidth/2?-1:1;+ const now=Date.now();+ if(tokLastTap&&tokLastTap.side===side&&now-tokLastTap.at<=TOK_DOUBLE_TAP_MS){+ clearTokTap();+ seekVideoBy(video,appSettings.seekSeconds*side);+ return;+ }+ // 两次点在不同半区时,第一下仍是一次完整的单击;立即兑现后再等当前点击。+ if(tokTapTimer){clearTimeout(tokTapTimer);tokTapTimer=null;toggleVideoPlayback(video)}+ tokLastTap={side,at:now};+ tokTapTimer=setTimeout(()=>{+ tokTapTimer=null;tokLastTap=null;+ if(!$('#tok').hidden)toggleVideoPlayback($('#tokVid'));+ },TOK_DOUBLE_TAP_MS);+}+$('#tokTrack').onclick=()=>{+ // 触屏的合成 click 会紧跟 touchend;那一下已经由单击/双击判定接管,不能再切一次。+ if(Date.now()<tokIgnoreClickUntil)return;+ toggleVideoPlayback($('#tokVid'));+};$('#tok').addEventListener('touchstart',e=>{- if(e.touches.length!==1){tokTouch=null;return}+ if(e.touches.length!==1||!e.target.closest('.toktrack')){tokTouch=null;return}const v=$('#tokVid');tokTouch={x:e.touches[0].clientX,y:e.touches[0].clientY,axis:'',from:v?v.currentTime||0:0};@@ -4216,14 +4247,22 @@ $('#tok').addEventListener('touchmove',e=>{$('#tok').addEventListener('touchend',e=>{if(!tokTouch)return;const touch=tokTouch;tokTouch=null;+ tokIgnoreClickUntil=Date.now()+700;$('#tokBar').classList.remove('scrubbing');if(touch.axis==='x'){const v=$('#tokVid');if(v&&touch.to!=null)v.currentTime=touch.to;return;}- const dy=touch.y-e.changedTouches[0].clientY;- if(Math.abs(dy)>60)tokNext(dy>0?1:-1);+ const end=e.changedTouches[0],dx=end.clientX-touch.x,dy=touch.y-end.clientY;+ if(Math.abs(dy)>60){clearTokTap();tokNext(dy>0?1:-1);return}+ if(Math.abs(dx)<=14&&Math.abs(dy)<=14){+ e.preventDefault();+ handleTokTap(end.clientX);+ }+},{passive:false});+$('#tok').addEventListener('touchcancel',()=>{+ tokTouch=null;$('#tokBar').classList.remove('scrubbing');},{passive:true});[['#tokDislike','dislike'],['#tokSeen','seen'],['#tokO','o']].forEach(([s,kind])=>{$(s).onclick=async()=>{const it=tokList[tokIdx];@@ -4282,7 +4321,7 @@ document.addEventListener('keydown',e=>{}if(e.key===' '){e.preventDefault(); // 不加这句空格会把页面滚下去- if(video.paused)video.play().catch(()=>{});else video.pause();+ toggleVideoPlayback(video);return;}}