Sync/dashboard, sanitize content, update config

Add local Claude permissions file; make background.js call syncToDashboard() after each run when config.syncToDashboard is enabled; improve content extraction in content.js by cloning link nodes, removing svg/style elements and stripping review-related text/counts before trimming; update config.py defaults to enable target and gamestop (remove bestbuy), set HEADLESS=True and STEALTH_HEADLESS=True to favor headless environments.
This commit is contained in:
2026-03-28 10:24:25 -04:00
parent 8d382e723f
commit 297cb9b146
4 changed files with 33 additions and 4 deletions
+5
View File
@@ -268,6 +268,11 @@ async function runStockCheck() {
}
await saveProducts();
// Sync to dashboard after every run
if (config.syncToDashboard) {
await syncToDashboard();
}
}
// Fetch and parse products from a URL using content script
+5 -1
View File
@@ -60,7 +60,9 @@
let isSoldOut = false;
for (const link of links) {
const text = link.textContent.trim();
const clone = link.cloneNode(true);
clone.querySelectorAll('svg, style').forEach(el => el.remove());
const text = clone.textContent.trim();
// Check if any link says "SOLD OUT"
if (text.toUpperCase().includes("SOLD OUT")) {
@@ -82,6 +84,8 @@
bestName = bestName.replace(/\$[\d,.]+/g, "").trim();
// Remove "Add to Cart" etc
bestName = bestName.replace(/Add to Cart/gi, "").trim();
// Remove review star CSS/SVG junk and plain review counts
bestName = bestName.replace(/\s*(review-|\d*\s*reviews?).*$/i, "").trim();
// Clean whitespace
bestName = bestName.replace(/\s+/g, " ").trim();