smart truncation, iframe preservation, streamlit filter

- simphtml: truncate_biggest replaces naive string cut, targets fattest content block via 70% drill-down
- simphtml: iframe children preserved through div proxy (bypass BS4 limitation)
- background/content.js: filter streamlit tabs and skip content script injection
- ga.py: file_content tag regex allows attributes; maxchars 38k->35k
This commit is contained in:
Liang Jiaqing
2026-04-06 12:19:20 +08:00
parent aae6d810cd
commit 8e829730a9
4 changed files with 39 additions and 8 deletions

View File

@@ -341,7 +341,7 @@ chrome.runtime.onInstalled.addListener(() => connectWS());
// Sync tab list on changes
async function sendTabsUpdate() {
if (!ws || ws.readyState !== WebSocket.OPEN) return;
const tabs = (await chrome.tabs.query({})).filter(t => isScriptable(t.url));
const tabs = (await chrome.tabs.query({})).filter(t => isScriptable(t.url) && !/streamlit/i.test(t.title));
ws.send(JSON.stringify({
type: 'tabs_update',
tabs: tabs.map(t => ({ id: t.id, url: t.url, title: t.title }))

View File

@@ -1,3 +1,4 @@
;(function(){ if (/streamlit/i.test(document.title)) return;
// Remove meta CSP tags
document.querySelectorAll('meta[http-equiv="Content-Security-Policy"]').forEach(e => e.remove());
@@ -42,4 +43,5 @@ async function handle(el) {
} catch (e) {
el.textContent = JSON.stringify({ ok: false, error: e.message });
}
}
}
})();