createSidecarProxy arrived with the wallet but nothing else moved onto it, so five sidecars still carried their own copy of the same two files: a sidecar-server.ts that remembered a port announced as `<name>:server`, and a router.ts that forwarded the subpath. Byte for byte identical once the app name was normalised away — which is exactly what the factory's own header said it existed to end. headscale, transmission, invoiceshelf, slskd and music are now wallet-shaped: create the proxy, export the router and the URL getter. 386 lines deleted against 163 added, and the five feature directories go from ~70 lines each to ~18. Two deviations were real and moved INTO the factory rather than being dropped, because both are HTTP concerns rather than app knowledge: - Range and If-None-Match are now forwarded for every sidecar. music needed both (seeking, and ETag revalidation returning a cheap 304 instead of a cover image) and slskd needed Range. Forwarding them everywhere costs nothing and removes the reason to hand-roll. - timeoutSeconds, used only by music at 1800. A from-scratch reindex holds the proxied connection open for minutes with no bytes flowing, which the 60s idle timeout would drop. It applies to the whole prefix — the proxy must not know which of a sidecar's routes are slow. The five side-effect imports in hono.ts are gone with them: the port listener now registers when createSidecarProxy runs inside the router this file already imports. Vault keeps its hand-rolled pair and its side-effect import — it is off-limits by standing instruction, and is the one sidecar this commit deliberately does not touch. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
18 lines
667 B
TypeScript
18 lines
667 B
TypeScript
import { createSidecarProxy } from '../../sidecar/create-proxy';
|
|
|
|
// /api/transmission/* — auth, then forward to officer-transmission. No routes of its own and no transmission knowledge:
|
|
// this file must never grow app logic.
|
|
//
|
|
// The sidecar owns the Transmission RPC contract, including its session-id handshake, and holds the
|
|
// credentials. The platform knows none of it.
|
|
|
|
const proxy = createSidecarProxy({
|
|
name: 'transmission',
|
|
prefix: '/api/transmission',
|
|
});
|
|
|
|
export const transmissionRouter = proxy.router;
|
|
|
|
/** Base URL of the sidecar's HTTP server, or null if it hasn't reported in yet. */
|
|
export const getTransmissionServerUrl = proxy.getHttpUrl;
|