fix(audio): remove speed from TTS/cache/MinIO keys; fix presigned URL host rewrite

- Speed is no longer part of Kokoro generation, in-memory cache keys, or
  MinIO object keys — audio is always generated at 1.0 and playback speed
  is applied client-side via audioEl.playbackRate
- presignAudio() now calls rewriteHost() so chapter audio URLs use the
  public MinIO endpoint (same as presignVoiceSample already did)
- docker-compose.yml: rename MINIO_PUBLIC_ENDPOINT → PUBLIC_MINIO_PUBLIC_URL
  for the ui service so SvelteKit's $env/dynamic/public picks it up
This commit is contained in:
Admin
2026-03-04 19:30:46 +05:00
parent c8e0cf2813
commit acbfafb8cd
9 changed files with 45 additions and 72 deletions

View File

@@ -98,14 +98,12 @@ export async function presignVoiceSample(voice: string): Promise<string> {
export async function presignAudio(
slug: string,
n: number,
voice?: string,
speed?: number
voice?: string
): Promise<string> {
const params = new URLSearchParams();
if (voice) params.set('voice', voice);
if (speed) params.set('speed', String(speed));
const qs = params.toString() ? `?${params.toString()}` : '';
log.debug('minio', 'presigning audio', { slug, n, voice, speed });
log.debug('minio', 'presigning audio', { slug, n, voice });
let res: Response;
try {
res = await fetch(`${SCRAPER_URL}/api/presign/audio/${slug}/${n}${qs}`);
@@ -126,7 +124,5 @@ export async function presignAudio(
}
const data = (await res.json()) as { url: string };
log.debug('minio', 'presign audio ok', { slug, n });
// The scraper now signs audio URLs with the public endpoint directly,
// so no host rewrite is needed here.
return data.url;
return rewriteHost(data.url);
}