feat(metadata): add configurable enabled fields for metadata editor and picker + UI tweaks (#2299)

Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
ACX
2026-01-16 19:13:17 -07:00
committed by GitHub
co-authored by acx10
parent 3a41e25aeb
commit 4dc5c0008c
49 changed files with 2631 additions and 1833 deletions
@@ -105,7 +105,25 @@ describe('AppSettingsService', () => {
smartCroppingEnabled: false
},
metadataDownloadOnBookdrop: false,
telemetryEnabled: false
telemetryEnabled: false,
metadataProviderSpecificFields: {
asin: false,
amazonRating: false,
amazonReviewCount: false,
googleId: false,
goodreadsId: false,
goodreadsRating: false,
goodreadsReviewCount: false,
hardcoverId: false,
hardcoverBookId: false,
hardcoverRating: false,
hardcoverReviewCount: false,
comicvineId: false,
lubimyczytacId: false,
lubimyczytacRating: false,
ranobedbId: false,
ranobedbRating: false
}
};
const mockPublicSettings: PublicAppSettings = {
@@ -457,7 +475,25 @@ describe('AppSettingsService - API Contract Tests', () => {
smartCroppingEnabled: false
},
metadataDownloadOnBookdrop: false,
telemetryEnabled: false
telemetryEnabled: false,
metadataProviderSpecificFields: {
asin: false,
amazonRating: false,
amazonReviewCount: false,
googleId: false,
goodreadsId: false,
goodreadsRating: false,
goodreadsReviewCount: false,
hardcoverId: false,
hardcoverBookId: false,
hardcoverRating: false,
hardcoverReviewCount: false,
comicvineId: false,
lubimyczytacId: false,
lubimyczytacRating: false,
ranobedbId: false,
ranobedbRating: false
}
};
httpClientMock.get.mockReturnValue(of(mockSettings));
service['fetchAppSettings']().subscribe(settings => {
@@ -1,7 +1,7 @@
import {inject, Injectable, Injector} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {BehaviorSubject, Observable, of} from 'rxjs';
import {catchError, finalize, shareReplay, tap} from 'rxjs/operators';
import {catchError, finalize, map, shareReplay, switchMap, tap} from 'rxjs/operators';
import {API_CONFIG} from '../../core/config/api-config';
import {AppSettings, OidcProviderDetails} from '../model/app-settings.model';
import {AuthService} from './auth.service';
@@ -99,20 +99,8 @@ export class AppSettingsService {
}));
return this.http.put<void>(this.apiUrl, payload).pipe(
tap(() => {
const current = this.appSettingsSubject.value;
if (current) {
settings.forEach(s => (current as any)[s.key] = s.newValue);
this.appSettingsSubject.next({...current});
this.syncPublicSettings(current);
} else {
this.loading$ = this.fetchAppSettings().pipe(
shareReplay(1),
finalize(() => (this.loading$ = null))
);
this.loading$.subscribe();
}
}),
switchMap(() => this.fetchAppSettings()),
map(() => void 0),
catchError(err => {
console.error('Error saving settings:', err);
return of();