@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 15 lines 547 Bytes
Raw
1 interface Fetcher {
2 fetch(request: Request): Promise<Response>;
3 }
4
5 /**
6 * The app's Worker: the client build, plus `/api` forwarded to the bank over
7 * a service binding. One origin for both, so the session cookie is
8 * first-party and reaches every call and every live read's WebSocket.
9 */
10 export default {
11 fetch(request: Request, env: { readonly ASSETS: Fetcher; readonly BANK: Fetcher }) {
12 const { pathname } = new URL(request.url);
13 return pathname.startsWith("/api") ? env.BANK.fetch(request) : env.ASSETS.fetch(request);
14 },
15 };