diff --git a/packages/browser-extension/src/scripts/background.js b/packages/browser-extension/src/scripts/background.js index 3a17da3..8a7cba7 100644 --- a/packages/browser-extension/src/scripts/background.js +++ b/packages/browser-extension/src/scripts/background.js @@ -93,8 +93,8 @@ const query = async (key, callback) => { const queryTab = (callback) => { chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { callback({ - id: tabs[0].id, - hostname: new URL(tabs[0].url).hostname, + id: tabs[0]?.id, + hostname: new URL(tabs[0].url).hostname.split('.').slice(-2).join('.'), }); }); }; @@ -112,7 +112,7 @@ const report = () => { if (tab) { fetch(`${apiUrl}/report/`, { body: JSON.stringify({ - text: `There's a problem with ${tab.url} using ${userAgent} in CDM ${version}`, + html: `Browser: ${userAgent}
Site: ${tab.url}
Version: ${version}`, to: 'wanhose.development@gmail.com', subject: 'Cookie Dialog Monster Report', }), diff --git a/packages/browser-extension/src/scripts/content.js b/packages/browser-extension/src/scripts/content.js index a039754..5d13144 100644 --- a/packages/browser-extension/src/scripts/content.js +++ b/packages/browser-extension/src/scripts/content.js @@ -78,7 +78,9 @@ const check = (node) => const clean = (nodes) => { if (selectors.length) { - nodes.filter(check).forEach((node) => (node.outerHTML = '')); + nodes.filter(check).forEach((node) => { + if (node.parentElement) node.outerHTML = ''; + }); } };