From d3f065b01c9b7ca2102435b8ea9fc4edb1113bec Mon Sep 17 00:00:00 2001 From: Cris Stringfellow <22254235+crislin2046@users.noreply.github.com> Date: Wed, 15 Dec 2021 22:30:22 +0800 Subject: [PATCH] "Issues" --- archivist.js | 22 ++++++++++------------ common.js | 2 +- todo | 3 ++- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/archivist.js b/archivist.js index 0759747..25460b0 100644 --- a/archivist.js +++ b/archivist.js @@ -282,8 +282,6 @@ async function collect({chrome_port:port, mode} = {}) { if ( State.Indexing.has(info.targetId) ) return; State.Indexing.add(info.targetId); - State.Index.set(info.url, info.title); - if ( ! sessionId ) { sessionId = await untilHas(Sessions, info.targetId); } @@ -292,6 +290,9 @@ async function collect({chrome_port:port, mode} = {}) { await untilHas(Installations, sessionId); } + const {title:latestTitle} = Targets.get(sessionId); + State.Index.set(info.url, latestTitle); + send("DOMSnapshot.enable", {}, sessionId); await sleep(500); @@ -396,16 +397,13 @@ async function collect({chrome_port:port, mode} = {}) { async function attachToTarget(targetInfo) { if ( dontInstall(targetInfo) ) return; const {url} = targetInfo; - if ( !!url && url != "about:blank" && !url.startsWith('chrome') ) { - - if ( targetInfo.type == 'page' ) { - if ( ! targetInfo.attached ) { - const {sessionId} = await send("Target.attachToTarget", { - targetId: targetInfo.targetId, - flatten: true - }); - Sessions.set(targetInfo.targetId, sessionId); - } + if ( url && targetInfo.type == 'page' ) { + if ( ! targetInfo.attached ) { + const {sessionId} = await send("Target.attachToTarget", { + targetId: targetInfo.targetId, + flatten: true + }); + Sessions.set(targetInfo.targetId, sessionId); } } } diff --git a/common.js b/common.js index 219202a..7f2f4ac 100644 --- a/common.js +++ b/common.js @@ -21,7 +21,7 @@ import {fileURLToPath} from 'url'; export const context = Context; -export const DEBUG = process.env.DEBUG_22120 || false; +export const DEBUG = process.env.DEBUG_22120 || true; export const CHECK_INTERVAL = 400; export const TEXT_NODE = 3; diff --git a/todo b/todo index 831f7d5..5adab9e 100644 --- a/todo +++ b/todo @@ -1,5 +1,6 @@ - ensure we are correctly indexing / saving the page title when the page title updates. - - issues. Title still out of date. We are incorrectly connecting to newtab, etc. + - issues. Title still out of date. +- We need to reload on localhost 22120 if we open with that - ensure we are getting the page text to index once it is actually loaded (we should call again later, or add mutation observer and update on mutate) - add export and import of the FTS index - link up to search input and provide results page