mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
Add ASIN support to file organization and metadata
This update enhances audiobook file organization by including the ASIN in folder names and embedding it as a custom metadata tag in audio files (M4B/M4A/MP3). Documentation is updated to reflect the new folder naming convention and metadata tagging. Additionally, local login and registration can now be disabled via an environment variable, and the interactive torrent search modal allows custom search titles for all modes.
This commit is contained in:
@@ -15,6 +15,14 @@ import { getEncryptionService } from '@/lib/services/encryption.service';
|
||||
*/
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
// Check if local login is disabled
|
||||
if (process.env.DISABLE_LOCAL_LOGIN === 'true') {
|
||||
return NextResponse.json(
|
||||
{ error: 'Local login is disabled' },
|
||||
{ status: 403 }
|
||||
);
|
||||
}
|
||||
|
||||
const { username, password } = await request.json();
|
||||
|
||||
if (!username || !password) {
|
||||
|
||||
@@ -8,6 +8,14 @@ import { LocalAuthProvider } from '@/lib/services/auth/LocalAuthProvider';
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
// Check if local login is disabled
|
||||
if (process.env.DISABLE_LOCAL_LOGIN === 'true') {
|
||||
return NextResponse.json(
|
||||
{ error: 'Local login is disabled' },
|
||||
{ status: 403 }
|
||||
);
|
||||
}
|
||||
|
||||
const { username, password } = await request.json();
|
||||
|
||||
if (!username || !password) {
|
||||
|
||||
@@ -12,6 +12,9 @@ export async function GET() {
|
||||
const configService = new ConfigurationService();
|
||||
const backendMode = await configService.get('system.backend_mode');
|
||||
|
||||
// Check if local login is disabled via environment variable
|
||||
const localLoginDisabled = process.env.DISABLE_LOCAL_LOGIN === 'true';
|
||||
|
||||
if (backendMode === 'audiobookshelf') {
|
||||
// Audiobookshelf mode - check which auth methods are enabled
|
||||
const oidcEnabled = (await configService.get('oidc.enabled')) === 'true';
|
||||
@@ -25,14 +28,16 @@ export async function GET() {
|
||||
|
||||
const providers: string[] = [];
|
||||
if (oidcEnabled) providers.push('oidc');
|
||||
if (hasLocalUsers) providers.push('local');
|
||||
// Only add 'local' provider if not disabled and users exist
|
||||
if (hasLocalUsers && !localLoginDisabled) providers.push('local');
|
||||
|
||||
return NextResponse.json({
|
||||
backendMode: 'audiobookshelf',
|
||||
providers,
|
||||
registrationEnabled,
|
||||
registrationEnabled: !localLoginDisabled && registrationEnabled,
|
||||
hasLocalUsers,
|
||||
oidcProviderName: oidcEnabled ? oidcProviderName : null,
|
||||
localLoginDisabled,
|
||||
});
|
||||
} else {
|
||||
// Plex mode - check if local admin exists (setup admin)
|
||||
@@ -49,17 +54,20 @@ export async function GET() {
|
||||
registrationEnabled: false,
|
||||
hasLocalUsers,
|
||||
oidcProviderName: null,
|
||||
localLoginDisabled,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[Auth] Failed to fetch auth providers:', error);
|
||||
// Default to Plex mode if config can't be read
|
||||
const localLoginDisabled = process.env.DISABLE_LOCAL_LOGIN === 'true';
|
||||
return NextResponse.json({
|
||||
backendMode: 'plex',
|
||||
providers: ['plex'],
|
||||
registrationEnabled: false,
|
||||
hasLocalUsers: false,
|
||||
oidcProviderName: null,
|
||||
localLoginDisabled,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,14 @@ function checkRateLimit(ip: string): boolean {
|
||||
}
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
// Check if local login is disabled
|
||||
if (process.env.DISABLE_LOCAL_LOGIN === 'true') {
|
||||
return NextResponse.json(
|
||||
{ error: 'Local registration is disabled' },
|
||||
{ status: 403 }
|
||||
);
|
||||
}
|
||||
|
||||
// Rate limiting
|
||||
const ip = request.headers.get('x-forwarded-for') || 'unknown';
|
||||
if (!checkRateLimit(ip)) {
|
||||
|
||||
Reference in New Issue
Block a user