From 3a36dae5d0ceed8ebcaf5c331c9d3656f7990e05 Mon Sep 17 00:00:00 2001 From: "planetrenox@protonmail.com" Date: Tue, 20 Oct 2026 17:55:25 +0000 Subject: [PATCH] Feat: Name the search provider (Brave or Firecrawl) in the New Search alert Co-Authored-By: Claude Opus 5.5 --- functions/[[path]].js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/functions/[[path]].js b/functions/[[path]].js index 0701ee6..b4f93db 100644 --- a/functions/[[path]].js +++ b/functions/[[path]].js @@ -177,7 +177,11 @@ COMMIT TRANSACTION;`; return asset("limit.webp"); } - note({ title: `New ${label}Search`, message: `Query: ${query} (${list ? "from cached results, not counted," : `Search #${count} for`} ${ip})`, tags: list ? "mag,zap" : "mag", priority: 2 }); + // Whether a fresh main-site search goes to Firecrawl first (see FIRECRAWL_SHARE). If it fails, the fallback's own note + // says the other provider was tried. + const firecrawl = !list && !site && parseInt((await sha256(query)).slice(0, 8), 16) < FIRECRAWL_SHARE * 2 ** 32; + const via = !list && !site ? `, via ${firecrawl ? "Firecrawl" : "Brave"}` : ""; + note({ title: `New ${label}Search`, message: `Query: ${query} (${list ? "from cached results, not counted," : `Search #${count} for`} ${ip}${via})`, tags: list ? "mag,zap" : "mag", priority: 2 }); // Called once the result (image or error) is stored, so waiters serve it right away instead of at lock expiry const release = () => locked && context.waitUntil(db(`DELETE lock:\`${keyHash}\`;`).catch(() => {})); @@ -214,7 +218,6 @@ COMMIT TRANSACTION;`; } // A Firecrawl query's search returns only FIRECRAWL_RESULTS, so a higher ?i= skips it (and its credits) for AI - const firecrawl = !list && !free && parseInt((await sha256(query)).slice(0, 8), 16) < FIRECRAWL_SHARE * 2 ** 32; if (firecrawl && i > FIRECRAWL_RESULTS) return await fail("Past Firecrawl Results", `?i= past ${FIRECRAWL_RESULTS} on a Firecrawl query: ${cacheKey}`, "robot", 2); // The query's cached results, or a fresh search. pos holds the indexes of the working images found so far and next