Skip to content

F2F-1528 rtcv scraper protocol routes proxyen via app#1

Merged
mjarkk merged 12 commits into
mainfrom
F2F-1528-rtcv-scraper-protocol-routes-proxyen-via-app
Apr 15, 2026
Merged

F2F-1528 rtcv scraper protocol routes proxyen via app#1
mjarkk merged 12 commits into
mainfrom
F2F-1528-rtcv-scraper-protocol-routes-proxyen-via-app

Conversation

@JanR2024
Copy link
Copy Markdown
Contributor

@JanR2024 JanR2024 commented Apr 14, 2026

F2F_APP modus voor scraper-protocol

Voegt een nieuwe modus toe waarmee scrapers via de f2f-app communiceren met RT-CV in plaats van rechtstreeks.
Wijzigingen

  • F2F_APP env var — zelfde URL-formaat als RTCV_SERVER (https://keyId:keySecret@host). Wanneer ingesteld worden uitgaande requests via de app geproxied. RTCV_SERVER blijft voorlopig vereist voor inkomende callback-authenticatie.
  • Challenge-response auth (lib/app_auth.ts) — vraagt een challenge op, berekent SHA-512 proof, wisselt in voor een Bearer token (8 min cache, 10 min TTL).
  • Route paden — elke call site gebruikt een ternary om het juiste pad te kiezen (/api/private/scraper/... vs /api/v1/...).
  • X-Scraper-Slug header — automatisch meegezonden in app-modus.
  • F2F_ALTERNATIVE_APP — ondersteuning voor alternatieve server in app-modus. Mixen met RTCV_ALTERNATIVE_SERVER is niet toegestaan.

Zonder F2F_APP werkt alles identiek als voorheen.

JanR2024 and others added 4 commits April 13, 2026 17:33
Delete app_routes.ts and use `this.isAppMode ? appPath : rtcvPath`
at each call site. Simpler, explicit, and easier to clean up when
RT-CV is fully integrated (just remove the ternary branches).

Also makes isAppMode public readonly so slack.ts can access it.
Collapse F2F_APP_URL + F2F_APP_KEY_ID + F2F_APP_KEY_SECRET into
F2F_APP=https://keyId:keySecret@host — same format as RTCV_SERVER,
parsed with new URL(). Same for F2F_ALTERNATIVE_APP.
Check res.ok before parsing JSON on both challenge and exchange
requests. Without this, a failed challenge silently produces a
wrong proof, leading to confusing "invalid proof" errors.
@JanR2024 JanR2024 requested a review from mjarkk April 14, 2026 09:40
JanR added 2 commits April 14, 2026 11:48
Use this.alternativeServer.isAppMode instead of this.isAppMode
for consistency with how other methods delegate to the alternative
server. Not a bug — both always share the same mode — but removes
an implicit coupling.
Comment thread lib/app_auth.ts
Comment thread lib/server.ts Outdated
Comment thread lib/server.ts Outdated
Comment thread lib/server.ts Outdated
Comment thread lib/server.ts
@mjarkk mjarkk requested a review from script-jerem April 14, 2026 09:55
No need to conditionally add it — RT-CV ignores unknown headers,
the app requires it.
Distinguishes app credentials from RTCV_SERVER basic auth.
f2f://keyId:keySecret@host maps to http://host for requests.
No protocol enforcement — just documented convention.
f2f:// maps to http (local dev), f2fs:// maps to https (production).
Mirrors the ws:// vs wss:// convention.
Reject other protocols with a clear error message pointing to
the correct format.
@JanR2024 JanR2024 requested a review from mjarkk April 14, 2026 10:59
@mjarkk mjarkk merged commit 27a558f into main Apr 15, 2026
2 checks passed
@mjarkk mjarkk deleted the F2F-1528-rtcv-scraper-protocol-routes-proxyen-via-app branch April 15, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants