mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
Audible regions: isEnglish flag + UI warnings
Add an isEnglish flag to AUDIBLE_REGIONS and update region handling across the app. UI: populate Audible region selects from AUDIBLE_REGIONS and mark non-English regions with a '*' and an amber warning explaining limited feature support. Service: set axios default param language=english on Audible requests (simplifies/fixes locale handling) and remove the previous locale-correction flow. API: validate regions dynamically from AUDIBLE_REGIONS. Also bump package version to 1.0.2. These changes make region metadata explicit and inform users about limited support for non-English regions while forcing English content where supported.
This commit is contained in:
@@ -8,11 +8,12 @@ import { requireAuth, requireAdmin, AuthenticatedRequest } from '@/lib/middlewar
|
||||
import { getConfigService } from '@/lib/services/config.service';
|
||||
import { getAudibleService } from '@/lib/integrations/audible.service';
|
||||
import { getJobQueueService } from '@/lib/services/job-queue.service';
|
||||
import { AUDIBLE_REGIONS } from '@/lib/types/audible';
|
||||
import { RMABLogger } from '@/lib/utils/logger';
|
||||
|
||||
const logger = RMABLogger.create('API.Admin.Settings.Audible');
|
||||
|
||||
const VALID_REGIONS = ['us', 'ca', 'uk', 'au', 'in', 'de'];
|
||||
const VALID_REGIONS = Object.keys(AUDIBLE_REGIONS);
|
||||
|
||||
export async function PUT(request: NextRequest) {
|
||||
return requireAuth(request, async (req: AuthenticatedRequest) => {
|
||||
@@ -24,7 +25,7 @@ export async function PUT(request: NextRequest) {
|
||||
if (!region || !VALID_REGIONS.includes(region)) {
|
||||
logger.warn('Invalid region provided', { region });
|
||||
return NextResponse.json(
|
||||
{ success: false, error: 'Invalid Audible region. Must be one of: us, ca, uk, au, in, de' },
|
||||
{ success: false, error: `Invalid Audible region. Must be one of: ${VALID_REGIONS.join(', ')}` },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user