import { createSidecarProxy } from '@@/sidecar/create-proxy'; import { mountPrefix } from '@@/plugins/manifest'; import { manifest } from '../manifest'; // Auth, then forward to officer-slskd. No routes of its own and no slskd knowledge: this file must never // grow app logic. // // Covers both slskd's own API (`/api/v0/searches`, `/api/v0/transfers`, …) and the sidecar's // Officer-owned routes (`/_officer/*` — favourites and the browse tree, features slskd has no concept // of). Both are opaque from here; the sidecar injects the slskd API key. // // The prefix is DERIVED, never written out. `mountPrefix` returns `/soulseek` for a first-party plugin // and `/p//soulseek` for anyone else's, so a literal would be right by coincidence today and // silently wrong the moment this is published by someone other than officerdev. `createSidecarProxy` // also calls `registerProxiedPrefix` with it, which is what stops `bodyParser` consuming the streams // this router only forwards. const proxy = createSidecarProxy({ name: 'slskd', prefix: `/api${mountPrefix({ appName: 'soulseek', manifest })}`, }); export const router = proxy.router; /** Base URL of the sidecar's HTTP server, or null if it has not reported in yet. */ export const getSlskdServerUrl = proxy.getHttpUrl;