安全性提升:TID动态生成+Streamlit页面排除+工作记忆修复

This commit is contained in:
Liang Jiaqing
2026-03-06 18:54:09 +08:00
parent c6af92e612
commit 524944dfc8
7 changed files with 22 additions and 15 deletions

View File

@@ -46,12 +46,14 @@ fetch('PDF_URL').then(r=>r.blob()).then(b=>{
## CDP桥(tmwd_cdp_bridge扩展) ⭐首选
扩展路径:`assets/tmwd_cdp_bridge/`(需安装含debugger权限)
调用MutationObserver监听addedNodes(id=`__ljq_ctrl`)⚠每次必须remove旧→createElement新→设textContent JSON→appendChild
⚠TID密钥首次运行自动生成到`assets/tmwd_cdp_bridge/config.js`(已gitignore)扩展通过manifest引用
调用MutationObserver监听addedNodes(id=TID)⚠每次必须remove旧→createElement新→设textContent JSON→appendChild
```js
const old = document.getElementById('__ljq_ctrl');
// TID从assets/tmwd_cdp_bridge/config.js读取示例用'__ljq_ctrl'占位
const old = document.getElementById(TID);
if (old) old.remove();
const el = document.createElement('div');
el.id = '__ljq_ctrl'; el.style.display = 'none';
el.id = TID; el.style.display = 'none';
el.textContent = JSON.stringify({cmd:'...', ...});
document.body.appendChild(el); // 响应写回el.textContent
```