mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
Add indexer flag bonuses and SSL verify toggle
Implements configurable indexer flag bonuses/penalties for torrent ranking, including UI for admin settings and support in ranking-algorithm. Adds an option to disable SSL certificate verification for qBittorrent connections (for self-signed certs), with UI in both setup and admin settings, and persists the setting. Updates documentation, API routes, and ranking logic to support these features. Also includes minor UI improvements and bug fixes.
This commit is contained in:
@@ -17,6 +17,7 @@ export async function PUT(request: NextRequest) {
|
||||
url,
|
||||
username,
|
||||
password,
|
||||
disableSSLVerify,
|
||||
remotePathMappingEnabled,
|
||||
remotePath,
|
||||
localPath,
|
||||
@@ -92,6 +93,16 @@ export async function PUT(request: NextRequest) {
|
||||
});
|
||||
}
|
||||
|
||||
// Save SSL verification setting
|
||||
await prisma.configuration.upsert({
|
||||
where: { key: 'download_client_disable_ssl_verify' },
|
||||
update: { value: disableSSLVerify ? 'true' : 'false' },
|
||||
create: {
|
||||
key: 'download_client_disable_ssl_verify',
|
||||
value: disableSSLVerify ? 'true' : 'false',
|
||||
},
|
||||
});
|
||||
|
||||
// Save remote path mapping configuration
|
||||
await prisma.configuration.upsert({
|
||||
where: { key: 'download_client_remote_path_mapping_enabled' },
|
||||
|
||||
@@ -34,6 +34,10 @@ export async function GET(request: NextRequest) {
|
||||
const savedConfigStr = await configService.get('prowlarr_indexers');
|
||||
const savedIndexers: SavedIndexerConfig[] = savedConfigStr ? JSON.parse(savedConfigStr) : [];
|
||||
|
||||
// Get saved flag configuration
|
||||
const flagConfigStr = await configService.get('indexer_flag_config');
|
||||
const flagConfigs = flagConfigStr ? JSON.parse(flagConfigStr) : [];
|
||||
|
||||
// Merge with defaults (wizard format: array of {id, name, priority, seedingTimeMinutes})
|
||||
const savedIndexersMap = new Map<number, SavedIndexerConfig>(
|
||||
savedIndexers.map((idx) => [idx.id, idx])
|
||||
@@ -58,6 +62,7 @@ export async function GET(request: NextRequest) {
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
indexers: indexersWithConfig,
|
||||
flagConfigs,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('[Prowlarr] Failed to fetch indexers:', error);
|
||||
@@ -76,13 +81,13 @@ export async function GET(request: NextRequest) {
|
||||
|
||||
/**
|
||||
* PUT /api/admin/settings/prowlarr/indexers
|
||||
* Save indexer configuration
|
||||
* Save indexer configuration and flag configs
|
||||
*/
|
||||
export async function PUT(request: NextRequest) {
|
||||
return requireAuth(request, async (req: AuthenticatedRequest) => {
|
||||
return requireAdmin(req, async () => {
|
||||
try {
|
||||
const { indexers } = await req.json();
|
||||
const { indexers, flagConfigs } = await req.json();
|
||||
|
||||
// Filter to only enabled indexers and convert to wizard format
|
||||
const enabledIndexers = indexers
|
||||
@@ -97,14 +102,26 @@ export async function PUT(request: NextRequest) {
|
||||
|
||||
// Save to configuration (matches wizard format)
|
||||
const configService = getConfigService();
|
||||
await configService.setMany([
|
||||
const configUpdates = [
|
||||
{
|
||||
key: 'prowlarr_indexers',
|
||||
value: JSON.stringify(enabledIndexers),
|
||||
category: 'indexer',
|
||||
description: 'Prowlarr indexer settings (enabled, priority, seeding time)',
|
||||
},
|
||||
]);
|
||||
];
|
||||
|
||||
// Save flag configs if provided
|
||||
if (flagConfigs !== undefined) {
|
||||
configUpdates.push({
|
||||
key: 'indexer_flag_config',
|
||||
value: JSON.stringify(flagConfigs),
|
||||
category: 'indexer',
|
||||
description: 'Indexer flag bonus/penalty configuration',
|
||||
});
|
||||
}
|
||||
|
||||
await configService.setMany(configUpdates);
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
|
||||
@@ -71,6 +71,7 @@ export async function GET(request: NextRequest) {
|
||||
url: configMap.get('download_client_url') || '',
|
||||
username: configMap.get('download_client_username') || '',
|
||||
password: maskValue('password', configMap.get('download_client_password')),
|
||||
disableSSLVerify: configMap.get('download_client_disable_ssl_verify') === 'true',
|
||||
seedingTimeMinutes: parseInt(configMap.get('seeding_time_minutes') || '0'),
|
||||
remotePathMappingEnabled: configMap.get('download_client_remote_path_mapping_enabled') === 'true',
|
||||
remotePath: configMap.get('download_client_remote_path') || '',
|
||||
|
||||
@@ -17,6 +17,7 @@ export async function POST(request: NextRequest) {
|
||||
url,
|
||||
username,
|
||||
password,
|
||||
disableSSLVerify,
|
||||
remotePathMappingEnabled,
|
||||
remotePath,
|
||||
localPath,
|
||||
@@ -57,7 +58,8 @@ export async function POST(request: NextRequest) {
|
||||
const version = await QBittorrentService.testConnectionWithCredentials(
|
||||
url,
|
||||
username,
|
||||
actualPassword
|
||||
actualPassword,
|
||||
disableSSLVerify || false
|
||||
);
|
||||
|
||||
// If path mapping enabled, validate local path exists
|
||||
|
||||
Reference in New Issue
Block a user