Fix splash page loop when scraper service is unavailable
Build & Auto-Repair / build (push) Has been cancelled
Build & Auto-Repair / build (push) Has been cancelled
Skip browser/Facebook detection in /setup/status when port 3008 is not reachable, so first_run only depends on env + Ollama. This prevents the setup wizard from showing endlessly when browser-use service is not running.
This commit is contained in:
+4
-2
@@ -367,9 +367,11 @@ const server = http.createServer(async (req, res) => {
|
|||||||
let browsers = { firefox: { path: null }, opera: { path: null }, chrome: { path: null }, edge: { path: null } }
|
let browsers = { firefox: { path: null }, opera: { path: null }, chrome: { path: null }, edge: { path: null } }
|
||||||
let facebookLoggedIn = false
|
let facebookLoggedIn = false
|
||||||
let selectedBrowser = process.env.SELECTED_BROWSER || ""
|
let selectedBrowser = process.env.SELECTED_BROWSER || ""
|
||||||
|
let scraperAvailable = false
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await fetch("http://127.0.0.1:3008/health", { signal: AbortSignal.timeout(2000) })
|
await fetch("http://127.0.0.1:3008/health", { signal: AbortSignal.timeout(2000) })
|
||||||
|
scraperAvailable = true
|
||||||
const profiles = await (await fetch("http://127.0.0.1:3008/setup/profile", { signal: AbortSignal.timeout(5000) })).json()
|
const profiles = await (await fetch("http://127.0.0.1:3008/setup/profile", { signal: AbortSignal.timeout(5000) })).json()
|
||||||
for (const [b, p] of Object.entries(profiles)) {
|
for (const [b, p] of Object.entries(profiles)) {
|
||||||
if (p) browsers[b] = { path: p }
|
if (p) browsers[b] = { path: p }
|
||||||
@@ -396,8 +398,8 @@ const server = http.createServer(async (req, res) => {
|
|||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
const anyDetected = Object.values(browsers).some(v => v.path)
|
const anyDetected = Object.values(browsers).some(v => v.path)
|
||||||
// first_run = any setup step is incomplete
|
// first_run = env or Ollama incomplete, or scraper is available but detection incomplete
|
||||||
const firstRun = !envExists || !ollamaRunning || !anyDetected || !facebookLoggedIn || !modelAvailable
|
const firstRun = !envExists || !ollamaRunning || (scraperAvailable && (!anyDetected || !facebookLoggedIn))
|
||||||
|
|
||||||
return sendJSON(res, 200, {
|
return sendJSON(res, 200, {
|
||||||
first_run: firstRun,
|
first_run: firstRun,
|
||||||
|
|||||||
Reference in New Issue
Block a user