High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
chore: align entrypoints, use stdlib, document profile lock
Bosch7b8519072918
diff --git a/docker-entrypoint.sh b/docker-entrypoint.shindex 80c6897c..705ba9bd 100644--- a/docker-entrypoint.sh+++ b/docker-entrypoint.sh@@ -22,4 +22,13 @@ if [ -z "${PINCHTAB_CONFIG:-}" ] && [ -z "${PINCHTAB_BIND:-}" ]; thenexport PINCHTAB_BIND=0.0.0.0fi+# Chrome requires --no-sandbox inside containers (no user namespace available).+# Backfill the flag into managed config if not already set.+if [ -z "${PINCHTAB_CONFIG:-}" ] && [ -f "$default_config_path" ]; then+ current_flags="$(/usr/local/bin/pinchtab config get browser.extraFlags 2>/dev/null || true)"+ if [ -z "$current_flags" ]; then+ /usr/local/bin/pinchtab config set browser.extraFlags "--no-sandbox --disable-gpu" >/dev/null+ fi+fi+exec "$@"diff --git a/internal/bridge/init.go b/internal/bridge/init.goindex 55cdc9c3..6e8b1b9c 100644--- a/internal/bridge/init.go+++ b/internal/bridge/init.go@@ -1,6 +1,7 @@package bridgeimport (+ "bytes""context""encoding/json""errors"@@ -548,7 +549,7 @@ func newPrefixedLogWriter(dst io.Writer, prefix string) *prefixedLogWriter {func (w *prefixedLogWriter) Write(p []byte) (int, error) {w.buf = append(w.buf, p...)for {- idx := bytesIndexByte(w.buf, '\n')+ idx := bytes.IndexByte(w.buf, '\n')if idx < 0 {break}@@ -569,12 +570,3 @@ func (w *prefixedLogWriter) writeLine(line []byte) error {_, err := fmt.Fprintf(w.dst, "%s: %s\n", w.prefix, text)return err}--func bytesIndexByte(b []byte, c byte) int {- for i, v := range b {- if v == c {- return i- }- }- return -1-}diff --git a/internal/bridge/profile_lock.go b/internal/bridge/profile_lock.goindex 6da6085d..ecc30dbb 100644--- a/internal/bridge/profile_lock.go+++ b/internal/bridge/profile_lock.go@@ -1,3 +1,15 @@+// profile_lock.go handles stale Chrome profile lock recovery.+//+// When a container restarts (or Chrome crashes), Chrome's SingletonLock,+// SingletonSocket, and SingletonCookie files may be left behind in the profile+// directory. On next startup Chrome sees these and refuses to launch with+// "The profile appears to be in use by another Chromium process".+//+// This code detects that error, checks whether the owning process is actually+// still running (via PID probe and process listing), and removes the stale+// lock files if it's safe to do so. It retries Chrome startup once after+// clearing the locks.+package bridgeimport (diff --git a/tests/e2e/docker-compose.yml b/tests/e2e/docker-compose.ymlindex 5cf0b6fb..16f08faa 100644--- a/tests/e2e/docker-compose.yml+++ b/tests/e2e/docker-compose.yml@@ -7,7 +7,6 @@ services:environment:PINCHTAB_CONFIG: /config/pinchtab.jsonPINCHTAB_PORT: "9999"- CHROME_BIN: /usr/bin/chromiumvolumes:- ./config/pinchtab.json:/config/pinchtab.json:roports:@@ -29,7 +28,6 @@ services:environment:PINCHTAB_CONFIG: /config/pinchtab-secure.jsonPINCHTAB_PORT: "9999"- CHROME_BIN: /usr/bin/chromiumvolumes:- ./config/pinchtab-secure.json:/config/pinchtab-secure.json:roports: