refactor(api): force dynamic rendering for API routes
Add 'force-dynamic' export to audiobook and documents API routes to ensure dynamic rendering. Remove 'nodejs' runtime export from TTS route for consistency.
This commit is contained in:
parent
9c56914542
commit
57ac17fb34
5 changed files with 8 additions and 2 deletions
|
|
@ -5,6 +5,8 @@ import { join } from 'path';
|
|||
import { AUDIOBOOKS_V1_DIR, isAudiobooksV1Ready } from '@/lib/server/docstore';
|
||||
import { findStoredChapterByIndex } from '@/lib/server/audiobook';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
function getAudiobooksRootDir(request: NextRequest): string {
|
||||
const raw = request.headers.get('x-openreader-test-namespace')?.trim();
|
||||
if (!raw) return AUDIOBOOKS_V1_DIR;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import { encodeChapterFileName, encodeChapterTitleTag, listStoredChapters, ffpro
|
|||
import type { TTSAudioBytes, TTSAudiobookFormat } from '@/types/tts';
|
||||
import type { AudiobookGenerationSettings } from '@/types/client';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
function getAudiobooksRootDir(request: NextRequest): string {
|
||||
const raw = request.headers.get('x-openreader-test-namespace')?.trim();
|
||||
if (!raw) return AUDIOBOOKS_V1_DIR;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import type { AudiobookGenerationSettings } from '@/types/client';
|
|||
import type { TTSAudiobookFormat, TTSAudiobookChapter } from '@/types/tts';
|
||||
import { readFile } from 'fs/promises';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
function getAudiobooksRootDir(request: NextRequest): string {
|
||||
const raw = request.headers.get('x-openreader-test-namespace')?.trim();
|
||||
if (!raw) return AUDIOBOOKS_V1_DIR;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import path from 'path';
|
|||
import { DOCUMENTS_V1_DIR, isDocumentsV1Ready } from '@/lib/server/docstore';
|
||||
import type { BaseDocument, DocumentType, SyncedDocument } from '@/types/documents';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
const SYNC_DIR = DOCUMENTS_V1_DIR;
|
||||
|
||||
async function trySetFileMtime(filePath: string, lastModifiedMs: number): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import { createHash } from 'crypto';
|
|||
import type { TTSRequestPayload } from '@/types/client';
|
||||
import type { TTSError, TTSAudioBuffer } from '@/types/tts';
|
||||
|
||||
export const runtime = 'nodejs';
|
||||
|
||||
type CustomVoice = string;
|
||||
type ExtendedSpeechParams = Omit<SpeechCreateParams, 'voice'> & {
|
||||
voice: SpeechCreateParams['voice'] | CustomVoice;
|
||||
|
|
|
|||
Loading…
Reference in a new issue