diff --git a/Audio-Transcription/background.js b/Audio-Transcription/background.js index 0869ed7..25ea75c 100644 --- a/Audio-Transcription/background.js +++ b/Audio-Transcription/background.js @@ -170,7 +170,8 @@ async function stopCapture() { if (optionTabId) { res = await sendMessageToTab(currentTabId, { - type: "STOP" + type: "STOP", + data: { currentTabId: currentTabId }, }); await removeChromeTab(optionTabId); } @@ -188,3 +189,15 @@ chrome.runtime.onMessage.addListener((message) => { stopCapture(); } }); + + +/** + * Listens for if the tab is reloaded. + * @param {Object} message - The message received from the runtime. + */ +chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => { + if (changeInfo.status === 'complete') { + await executeScriptInTab(tabId, "content.js"); + await delayExecution(500); + } +}); diff --git a/Audio-Transcription/manifest.json b/Audio-Transcription/manifest.json index cd9aaf7..858f813 100644 --- a/Audio-Transcription/manifest.json +++ b/Audio-Transcription/manifest.json @@ -4,7 +4,9 @@ "name": "Audio Transcription", "version": "1.0.0", "description": "This extension captures the audio on the current tab, sends it to a server for transcription and shows the transcription in Real-time.", - + "content_security_policy": { + "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self';" + }, "options_page": "options.html", "background": { "service_worker": "background.js" diff --git a/Audio-Transcription/options.html b/Audio-Transcription/options.html index e0223c9..51ab923 100644 --- a/Audio-Transcription/options.html +++ b/Audio-Transcription/options.html @@ -4,15 +4,14 @@