THIBITISHA BRIDGE - macOS / Apple Silicon (no install required)
====================================================

This folder is self-contained. Node.js, ADB, and Cloudflare Tunnel are
all bundled inside it - you do not need to install anything. This
build is for Apple Silicon Macs (M1/M2/M3/M4). If your Mac has an
Intel chip, use the Intel download instead.

To check which chip your Mac has: Apple menu -> About This Mac. It
will say "Chip: Apple M1/M2/M3/M4..." (this build) or "Processor:
Intel ..." (use the Intel build instead).

HOW TO RUN
----------
1. Copy this whole folder anywhere on the Mac (Desktop, USB drive, etc).
2. Plug in the Android phone (or pair it over Wireless Debugging - see
   BRIDGE_SETUP.md in the main project for phone-side setup steps).
3. The first time only: macOS blocks unsigned downloaded files by
   default (Gatekeeper). Open Terminal, then run:
       xattr -dr com.apple.quarantine "<path to this folder>"
   (Drag the folder into the Terminal window after typing the command
   to fill in the path automatically.) You only need to do this once.
4. Double-click "Start Bridge.command". If macOS still warns that it's
   from an unidentified developer, right-click (or Control-click) the
   file and choose "Open" instead of double-clicking.
5. Wait for the green "TUNNEL URL" box to appear in the window - it
   looks like:
       https://random-words-here.trycloudflare.com
6. Open the dashboard:
       https://thibitisha-verify.onrender.com/dashboard.html
7. Paste that tunnel URL into the "Bridge URL" field and Save.
   The bridge status indicator should turn green.
8. Upload your CSV and click RUN VERIFICATION.

Keep the "Start Bridge.command" Terminal window open the whole time
you're running verifications. Closing it stops the bridge and the
tunnel.

NOTE: the tunnel URL changes every time you restart the bridge - paste
the new one into the dashboard each time you start a fresh session.

WHAT'S IN THIS FOLDER
----------------------
  Start Bridge.command   <- double-click this to start everything
  node/node               Bundled Node.js runtime (Apple Silicon build)
  app/bridge.js           The bridge server
  app/batch.js            Per-device verification worker (spawned by bridge.js)
  app/adb                 Bundled ADB (talks to the Android phone)
  app/cloudflared         Bundled Cloudflare Tunnel client (Apple Silicon build)

TROUBLESHOOTING
----------------
'"Start Bridge.command" cannot be opened because it is from an
unidentified developer'
  - Right-click (Control-click) the file and choose "Open", then
    confirm in the dialog. Or run the `xattr -dr com.apple.quarantine`
    command from step 3 above.

"No ADB devices connected" on the dashboard
  - Open Terminal in the app/ folder and try: ./adb devices
  - If it says "unauthorized", check the phone screen for a popup and
    tap Allow.

No TUNNEL URL appears
  - Check your internet connection - the bundled cloudflared needs
    outbound internet access to open the tunnel.

Bridge shows "Cannot GET /health" or similar when you open the tunnel
URL directly in a browser
  - Some other app on the Mac is using the same local port. Open
    Terminal and run: lsof -i :47235
    That tells you which other app is conflicting so you can close it,
    or change PORT in "Start Bridge.command" to a different number.
