diff --git a/spot/entrypoints/background.ts b/spot/entrypoints/background.ts index aed9610ef..4eb397d0c 100644 --- a/spot/entrypoints/background.ts +++ b/spot/entrypoints/background.ts @@ -350,7 +350,6 @@ export default defineBackground(() => { void attachDebuggerToTab(recordingState.activeTabId) }) } else { - console.log(settings.useDebugger, 'tab', recordingState.activeTabId) startTrackingNetwork(); } } @@ -360,6 +359,7 @@ export default defineBackground(() => { activeTabId: recordingState.activeTabId, area: "tab", recording: REC_STATE.recording, + audioPerm: recordingState.audioPerm, }; const microphone = request.mic; micStatus = microphone ? "on" : "off"; @@ -401,6 +401,7 @@ export default defineBackground(() => { activeTabId: null, area: "desktop", recording: REC_STATE.recording, + audioPerm: recordingState.audioPerm }; startRecording( recArea, @@ -588,6 +589,7 @@ export default defineBackground(() => { activeTabId: null, area: null, recording: REC_STATE.stopped, + audioPerm: recordingState.audioPerm }; } if (request.type === messages.content.from.restart) { @@ -849,6 +851,7 @@ export default defineBackground(() => { activeTabId: null, area: null, recording: REC_STATE.stopped, + audioPerm: recordingState.audioPerm }; // id of spot, mobURL - for events, videoURL - for video if (!resp || !resp.id) { @@ -934,14 +937,16 @@ export default defineBackground(() => { active: true, }); } - // in future: - // const tabs = await browser.tabs.query({}) as chrome.tabs.Tab[] - // for (const tab of tabs) { - // if (tab.id) { - // this will require more permissions, do we even want this? - // void chrome.tabs.executeScript(tab.id, {file: "content"}); - // } - // } + for (const tab of await chrome.tabs.query({})) { + if (tab.url?.match(/(chrome|chrome-extension):\/\//gi)) { + continue; + } + const res = await browser.scripting.executeScript({ + target: { tabId: tab.id }, + files: ["/content-scripts/content.js"], + }); + console.log('restoring content at', res) + } await checkTokenValidity(); await initializeOffscreenDocument(); }); @@ -1073,6 +1078,7 @@ export default defineBackground(() => { activeTabId: null, area: null, recording: REC_STATE.stopped, + audioPerm: recordingState.audioPerm }; void sendToActiveTab({ type: messages.content.to.unmount, @@ -1084,7 +1090,7 @@ export default defineBackground(() => { return; } const mountMsg = { - type: "content:start", + type: messages.content.to.start, microphone, time: 0, slackChannels, @@ -1119,6 +1125,7 @@ export default defineBackground(() => { state: getRecState(), activeTabId: null, }; + console.log(tabId, 'activation for new') attachDebuggerToTab(tabId) void sendToActiveTab(msg); }); @@ -1190,6 +1197,7 @@ export default defineBackground(() => { activeTabId: null, area: null, recording: REC_STATE.stopped, + audioPerm: recordingState.audioPerm }; } } diff --git a/spot/entrypoints/content/index.tsx b/spot/entrypoints/content/index.tsx index e847fe2a5..602446818 100644 --- a/spot/entrypoints/content/index.tsx +++ b/spot/entrypoints/content/index.tsx @@ -16,6 +16,10 @@ export default defineContentScript({ cssInjectionMode: "ui", async main(ctx) { + if (!ctx.isValid) { + console.error("Spot: context is invalidated on mount") + return; + } const ui = await createShadowRootUi(ctx, { name: "spot-ui", position: "inline", diff --git a/spot/package.json b/spot/package.json index ed74ba501..9d682d582 100644 --- a/spot/package.json +++ b/spot/package.json @@ -2,7 +2,7 @@ "name": "spot", "description": "manifest.json description", "private": true, - "version": "1.0.15", + "version": "1.0.16", "type": "module", "scripts": { "dev": "wxt", diff --git a/spot/utils/networkTracking.ts b/spot/utils/networkTracking.ts index b9853810d..10dc7caac 100644 --- a/spot/utils/networkTracking.ts +++ b/spot/utils/networkTracking.ts @@ -105,6 +105,7 @@ function createSpotNetworkRequest( responseBody: "", requestHeaders, responseHeaders, + time: trackedRequest.timeStamp, timestamp: trackedRequest.timeStamp, statusCode: status, error: trackedRequest.error, diff --git a/spot/wxt.config.ts b/spot/wxt.config.ts index 7698adba7..650d00e48 100644 --- a/spot/wxt.config.ts +++ b/spot/wxt.config.ts @@ -16,7 +16,7 @@ export default defineConfig({ }, web_accessible_resources: [ { - resources: ["injected.js", "notifications.js"], + resources: ["injected.js", "notifications.js", "/content-scripts/content.css"], matches: [""], }, ], @@ -31,4 +31,7 @@ export default defineConfig({ "debugger", ], }, + runner: { + chromiumArgs: ['--user-data-dir=./.wxt/chrome-data'], + } });