A cross platform Audiobookshelf client for Android and iOS
Dart
Add web downloads, fix backup restore, and add author and podcast tools
Barnabasa859e60eb308
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arbindex a98e6b66..f34ae37a 100644--- a/lib/l10n/app_en.arb+++ b/lib/l10n/app_en.arb@@ -2605,6 +2605,10 @@"adminPodcastsAutoDownloadOnSubtitle": "Server downloads new episodes automatically","adminPodcastsAutoDownloadOffSubtitle": "New episodes are not auto-downloaded","adminPodcastsFailedAutoDownloadUpdate": "Failed to update auto-download setting",+ "adminPodcastsMaxEpisodesToKeep": "Max episodes to keep",+ "adminPodcastsMaxEpisodesToKeepHelp": "0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.",+ "adminPodcastsNoEpisodeLimit": "No limit",+ "adminPodcastsEpisodeLimitInvalid": "Enter 0 or a whole number","adminPodcastsCheckSchedule": "Check Schedule","adminPodcastsFrequency": "Frequency","adminPodcastsFreqHourly": "Hourly",diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dartindex f5f1b73e..9a5db205 100644--- a/lib/l10n/app_localizations.dart+++ b/lib/l10n/app_localizations.dart@@ -8486,6 +8486,30 @@ abstract class AppLocalizations {/// **'Failed to update auto-download setting'**String get adminPodcastsFailedAutoDownloadUpdate;+ /// No description provided for @adminPodcastsMaxEpisodesToKeep.+ ///+ /// In en, this message translates to:+ /// **'Max episodes to keep'**+ String get adminPodcastsMaxEpisodesToKeep;++ /// No description provided for @adminPodcastsMaxEpisodesToKeepHelp.+ ///+ /// In en, this message translates to:+ /// **'0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.'**+ String get adminPodcastsMaxEpisodesToKeepHelp;++ /// No description provided for @adminPodcastsNoEpisodeLimit.+ ///+ /// In en, this message translates to:+ /// **'No limit'**+ String get adminPodcastsNoEpisodeLimit;++ /// No description provided for @adminPodcastsEpisodeLimitInvalid.+ ///+ /// In en, this message translates to:+ /// **'Enter 0 or a whole number'**+ String get adminPodcastsEpisodeLimitInvalid;+/// No description provided for @adminPodcastsCheckSchedule.////// In en, this message translates to:diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dartindex 64a8d9e6..66dd8aa1 100644--- a/lib/l10n/app_localizations_de.dart+++ b/lib/l10n/app_localizations_de.dart@@ -4790,6 +4790,19 @@ class AppLocalizationsDe extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Auto-Download-Einstellung konnte nicht aktualisiert werden';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Prüfplan';diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dartindex 36401503..40e57df3 100644--- a/lib/l10n/app_localizations_el.dart+++ b/lib/l10n/app_localizations_el.dart@@ -4735,6 +4735,19 @@ class AppLocalizationsEl extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dartindex 8721a76d..cc8000d1 100644--- a/lib/l10n/app_localizations_en.dart+++ b/lib/l10n/app_localizations_en.dart@@ -4735,6 +4735,19 @@ class AppLocalizationsEn extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dartindex 639b0bcd..2b3204f5 100644--- a/lib/l10n/app_localizations_es.dart+++ b/lib/l10n/app_localizations_es.dart@@ -4737,6 +4737,19 @@ class AppLocalizationsEs extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dartindex c0ad0f7f..91f66158 100644--- a/lib/l10n/app_localizations_fr.dart+++ b/lib/l10n/app_localizations_fr.dart@@ -4755,6 +4755,19 @@ class AppLocalizationsFr extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dartindex 95d528a7..16f40786 100644--- a/lib/l10n/app_localizations_it.dart+++ b/lib/l10n/app_localizations_it.dart@@ -4735,6 +4735,19 @@ class AppLocalizationsIt extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dartindex 862cad64..c48b8029 100644--- a/lib/l10n/app_localizations_ja.dart+++ b/lib/l10n/app_localizations_ja.dart@@ -4735,6 +4735,19 @@ class AppLocalizationsJa extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dartindex 2fdfd2c9..75f87a04 100644--- a/lib/l10n/app_localizations_no.dart+++ b/lib/l10n/app_localizations_no.dart@@ -4735,6 +4735,19 @@ class AppLocalizationsNo extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dartindex 232955b3..2046ef00 100644--- a/lib/l10n/app_localizations_pt.dart+++ b/lib/l10n/app_localizations_pt.dart@@ -4735,6 +4735,19 @@ class AppLocalizationsPt extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dartindex 30ae2549..319b48df 100644--- a/lib/l10n/app_localizations_ro.dart+++ b/lib/l10n/app_localizations_ro.dart@@ -4735,6 +4735,19 @@ class AppLocalizationsRo extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dartindex 3baa45d8..b8c199df 100644--- a/lib/l10n/app_localizations_ru.dart+++ b/lib/l10n/app_localizations_ru.dart@@ -4739,6 +4739,19 @@ class AppLocalizationsRu extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dartindex 343a34fb..b18e1282 100644--- a/lib/l10n/app_localizations_zh.dart+++ b/lib/l10n/app_localizations_zh.dart@@ -4654,6 +4654,19 @@ class AppLocalizationsZh extends AppLocalizations {String get adminPodcastsFailedAutoDownloadUpdate =>'Failed to update auto-download setting';+ @override+ String get adminPodcastsMaxEpisodesToKeep => 'Max episodes to keep';++ @override+ String get adminPodcastsMaxEpisodesToKeepHelp =>+ '0 keeps every episode. After a new episode is auto-downloaded, Audiobookshelf removes the oldest episode when the show is over this limit.';++ @override+ String get adminPodcastsNoEpisodeLimit => 'No limit';++ @override+ String get adminPodcastsEpisodeLimitInvalid => 'Enter 0 or a whole number';+@overrideString get adminPodcastsCheckSchedule => 'Check Schedule';diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dartindex d224eadc..f8e59e24 100644--- a/lib/providers/auth_provider.dart+++ b/lib/providers/auth_provider.dart@@ -119,6 +119,12 @@ class AuthProvider extends ChangeNotifier {return perms?['delete'] == true;}+ /// True when the server allows this user to download library item files.+ bool get canDownload {+ final perms = _userJson?['permissions'] as Map<String, dynamic>?;+ return perms?['download'] == true;+ }+/// Replace the live app shell with the startup loading view while a saved/// account is being activated and its library is prepared.void beginAccountSwitch() {diff --git a/lib/screens/absorbing_screen.dart b/lib/screens/absorbing_screen.dartindex f042a439..bc65bec3 100644--- a/lib/screens/absorbing_screen.dart+++ b/lib/screens/absorbing_screen.dart@@ -41,12 +41,12 @@ double absorbingDesktopPlayerLayoutWidth(double paneWidth) =>.clamp(0.0, double.infinity).toDouble();-bool shouldOverlayAbsorbingSidePanel(double paneWidth) =>+bool shouldUseCompactAbsorbingSidePanel(double paneWidth) =>absorbingDesktopPlayerLayoutWidth(paneWidth) <kAbsorbingDesktopRowLayoutWidth;bool shouldOpenAbsorbingSidePanelByDefault(double paneWidth) =>- !shouldOverlayAbsorbingSidePanel(paneWidth);+ !shouldUseCompactAbsorbingSidePanel(paneWidth);enum DesktopAbsorbingPanelTab { chapters, queue }@@ -980,8 +980,8 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {absorbingDesktopPlayerLayoutWidth(constraints.maxWidth,);- final overlayPanel =- shouldOverlayAbsorbingSidePanel(+ final compactPanel =+ shouldUseCompactAbsorbingSidePanel(constraints.maxWidth,);final chapterData =@@ -1060,8 +1060,7 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {CrossAxisAlignment.stretch,children: [playerPane,- if (!overlayPanel)- SizedBox(width: visibleWidth),+ SizedBox(width: visibleWidth),const SizedBox(width:_kAbsorbingDesktopPanelDividerWidth,@@ -1100,7 +1099,7 @@ class _AbsorbingScreenState extends State<AbsorbingScreen> {},child: _buildDesktopSidePanel(context,- opaque: overlayPanel,+ opaque: compactPanel,chapterData: chapterData,queuePanel: _AbsorbingQueuePanel(embedded: true,diff --git a/lib/screens/admin_podcasts_screen.dart b/lib/screens/admin_podcasts_screen.dartindex d2208b94..ca9153b1 100644--- a/lib/screens/admin_podcasts_screen.dart+++ b/lib/screens/admin_podcasts_screen.dart@@ -1120,6 +1120,90 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT} catch (_) {}}+ Future<void> _editMaxEpisodesToKeep() async {+ final l = AppLocalizations.of(context)!;+ final rawCurrent = _media['maxEpisodesToKeep'];+ final current = rawCurrent is num && rawCurrent >= 0+ ? rawCurrent.toInt()+ : 0;+ final controller = TextEditingController(text: '$current');+ String? errorText;++ final value = await showDialog<int>(+ context: context,+ builder: (dialogContext) => StatefulBuilder(+ builder: (context, setDialogState) {+ void submit() {+ final parsed = int.tryParse(controller.text.trim());+ if (parsed == null || parsed < 0) {+ setDialogState(() => errorText = l.adminPodcastsEpisodeLimitInvalid);+ return;+ }+ Navigator.of(dialogContext).pop(parsed);+ }++ return AlertDialog(+ title: Text(l.adminPodcastsMaxEpisodesToKeep),+ content: SizedBox(+ width: 360,+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ l.adminPodcastsMaxEpisodesToKeepHelp,+ style: Theme.of(context).textTheme.bodyMedium,+ ),+ const SizedBox(height: 16),+ TextField(+ controller: controller,+ autofocus: true,+ keyboardType: TextInputType.number,+ textInputAction: TextInputAction.done,+ decoration: InputDecoration(+ labelText: l.adminPodcastsMaxEpisodesToKeep,+ errorText: errorText,+ border: const OutlineInputBorder(),+ ),+ onChanged: (_) {+ if (errorText != null) {+ setDialogState(() => errorText = null);+ }+ },+ onSubmitted: (_) => submit(),+ ),+ ],+ ),+ ),+ actions: [+ TextButton(+ onPressed: () => Navigator.of(dialogContext).pop(),+ child: Text(l.cancel),+ ),+ FilledButton(onPressed: submit, child: Text(l.save)),+ ],+ );+ },+ ),+ );+ controller.dispose();+ if (value == null || value == current || !mounted) return;++ final api = context.read<AuthProvider>().apiService;+ if (api == null) return;+ final ok = await api.updatePodcastMedia(+ _podcastId,+ {'maxEpisodesToKeep': value},+ );+ if (!mounted) return;+ if (ok) {+ setState(() => _media['maxEpisodesToKeep'] = value);+ widget.onChanged();+ } else {+ _msg(l.adminPodcastsFailedAutoDownloadUpdate);+ }+ }+Future<void> _loadFeed() async {if (_feedUrl.isEmpty) { _msg(AppLocalizations.of(context)!.adminPodcastsNoFeedAvailable); return; }final api = context.read<AuthProvider>().apiService; if (api == null) return;@@ -1939,6 +2023,11 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleTif (autoDownload)StatefulBuilder(builder: (ctx, setScheduleState) {final currentCron = _media['autoDownloadSchedule'] as String? ?? '0 * * * *';+ final rawMaxEpisodesToKeep = _media['maxEpisodesToKeep'];+ final maxEpisodesToKeep =+ rawMaxEpisodesToKeep is num && rawMaxEpisodesToKeep >= 0+ ? rawMaxEpisodesToKeep.toInt()+ : 0;final parsed = _parseCron(currentCron);final freq = parsed.$1; // 'hourly', 'daily', 'weekly'final hour = parsed.$2; // 0-23@@ -1999,6 +2088,39 @@ class _PodcastDetailScreenState extends State<_PodcastDetailScreen> with SingleT: l.podcastScheduleServerTime(serverTimeZone),style: tt.bodySmall?.copyWith(color: cs.onSurfaceVariant)),),+ const SizedBox(height: 14),+ Row(crossAxisAlignment: CrossAxisAlignment.center, children: [+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ l.adminPodcastsMaxEpisodesToKeep,+ style: tt.bodySmall?.copyWith(+ color: cs.onSurface,+ fontWeight: FontWeight.w600,+ ),+ ),+ const SizedBox(height: 2),+ Text(+ l.adminPodcastsMaxEpisodesToKeepHelp,+ style: tt.labelSmall?.copyWith(+ color: cs.onSurfaceVariant,+ ),+ ),+ ],+ ),+ ),+ const SizedBox(width: 12),+ OutlinedButton(+ onPressed: _editMaxEpisodesToKeep,+ child: Text(+ maxEpisodesToKeep == 0+ ? l.adminPodcastsNoEpisodeLimit+ : '$maxEpisodesToKeep',+ ),+ ),+ ]),const SizedBox(height: 10),// FrequencyText(l.adminPodcastsFrequency, style: tt.labelSmall?.copyWith(color: cs.onSurfaceVariant, fontSize: 10)),diff --git a/lib/screens/library_screen.dart b/lib/screens/library_screen.dartindex 9ad06de6..10c369f6 100644--- a/lib/screens/library_screen.dart+++ b/lib/screens/library_screen.dart@@ -32,6 +32,7 @@ import 'app_shell.dart';import 'upcoming_releases_screen.dart';import '../widgets/audible_series_sheet.dart' show showAudibleRegionPicker;import '../widgets/offline_status_icon.dart';+import '../widgets/overlay_toast.dart';import '../widgets/desktop_batch_actions.dart';import '../widgets/desktop_cover_size_control.dart';import '../widgets/rmab_config_sheet.dart'@@ -548,6 +549,10 @@ class LibraryScreenState extends State<LibraryScreen>bool _selectionMode = false;bool _batchActionBusy = false;+ bool _matchingAuthors = false;+ String? _matchingAuthorId;+ int _authorMatchPosition = 0;+ int _authorMatchTotal = 0;final Set<String> _selectedItemIds = {};int? _lastSelectedVisibleIndex;@@ -564,6 +569,11 @@ class LibraryScreenState extends State<LibraryScreen>}List<Map<String, dynamic>> _selectableVisibleItems() {+ if (_tabController != null && _currentTab == 2) {+ return _authors+ .where((author) => author['id'] is String)+ .toList(growable: false);+ }final lib = context.read<LibraryProvider>();return _visibleLibraryItems(lib).where(@@ -580,7 +590,7 @@ class LibraryScreenState extends State<LibraryScreen>setState(() {_selectionMode = true;if (shiftPressed && _lastSelectedVisibleIndex != null) {- final items = _visibleLibraryItems(context.read<LibraryProvider>());+ final items = _selectableVisibleItems();final start = min(_lastSelectedVisibleIndex!, visibleIndex);final end = max(_lastSelectedVisibleIndex!, visibleIndex);for (var index = start; index <= end && index < items.length; index++) {@@ -1731,6 +1741,125 @@ class LibraryScreenState extends State<LibraryScreen>});}+ String _authorQuickMatchRegion(LibraryProvider lib) {+ final provider =+ lib.selectedLibrary?['provider']?.toString().toLowerCase() ?? '';+ if (!provider.startsWith('audible.')) return 'us';+ final region = provider.split('.').last.trim();+ return region.isEmpty ? 'us' : region;+ }++ List<Map<String, dynamic>> _selectedAuthors() {+ return _authors+ .where((author) => _selectedItemIds.contains(author['id']))+ .toList(growable: false);+ }++ Future<bool> _quickMatchAuthors(+ List<Map<String, dynamic>> authors, {+ bool allAuthors = false,+ }) async {+ if (authors.isEmpty) return false;+ final auth = context.read<AuthProvider>();+ final lib = context.read<LibraryProvider>();+ final api = auth.apiService;+ final libraryId = lib.selectedLibraryId;+ if (api == null || libraryId == null || !auth.canUpdateMetadata) {+ return false;+ }++ final l = AppLocalizations.of(context)!;+ setState(() {+ _authorMatchPosition = 0;+ _authorMatchTotal = authors.length;+ _matchingAuthorId = null;+ });+ showOverlayToast(+ context,+ l.adminMatchingStarted(+ allAuthors+ ? l.libraryAuthorsCount(authors.length)+ : l.selectedCount(authors.length),+ ),+ icon: Icons.auto_fix_high_rounded,+ );++ final region = _authorQuickMatchRegion(lib);+ var found = 0;+ var updated = 0;+ var notFound = 0;+ var failed = 0;+ for (var index = 0; index < authors.length; index++) {+ final author = authors[index];+ final id = author['id']?.toString() ?? '';+ final name = author['name']?.toString().trim() ?? '';+ final asin = author['asin']?.toString().trim() ?? '';+ if (mounted) {+ setState(() {+ _matchingAuthorId = id.isEmpty ? null : id;+ _authorMatchPosition = index + 1;+ });+ }+ if (id.isEmpty || (asin.isEmpty && name.isEmpty)) {+ failed++;+ continue;+ }+ final result = await api.quickMatchAuthor(+ id,+ asin: asin.isEmpty ? null : asin,+ q: asin.isEmpty ? name : null,+ region: region,+ );+ if (result.found) {+ found++;+ if (result.updated) updated++;+ } else if (result.statusCode == 404) {+ notFound++;+ } else {+ failed++;+ }+ }++ if (!mounted) return failed < authors.length;+ setState(() => _matchingAuthorId = null);+ if (context.read<LibraryProvider>().selectedLibraryId == libraryId) {+ await _refreshAuthors();+ }+ if (!mounted) return failed < authors.length;++ final unchanged = found - updated;+ final summary = <String>[+ if (updated > 0) '${l.metadataUpdated} ($updated)',+ if (unchanged > 0) '${l.quickMatchNoUpdates} ($unchanged)',+ if (notFound > 0) '${l.authorNoMatchFound} ($notFound)',+ if (failed > 0) '${l.failedToUpdateMetadata} ($failed)',+ ];+ showOverlayToast(+ context,+ summary.join(' • '),+ icon: failed > 0+ ? Icons.error_outline_rounded+ : notFound > 0+ ? Icons.search_off_rounded+ : Icons.check_circle_outline_rounded,+ );+ return failed == 0 && notFound == 0;+ }++ Future<void> _quickMatchAllAuthors() async {+ if (_matchingAuthors || _batchActionBusy || _authors.isEmpty) return;+ final authors = List<Map<String, dynamic>>.from(_authors);+ setState(() => _matchingAuthors = true);+ await _quickMatchAuthors(authors, allAuthors: true);+ if (mounted) {+ setState(() {+ _matchingAuthors = false;+ _authorMatchPosition = 0;+ _authorMatchTotal = 0;+ });+ }+ }+Future<void> _loadNarrators() async {if (_isLoadingNarrators) return;setState(() => _isLoadingNarrators = true);@@ -2606,11 +2735,19 @@ class LibraryScreenState extends State<LibraryScreen>});}final hasTabs = _tabController != null && !_isInSearchMode;- final selectionAvailable =+ final selectingAuthors = hasTabs && _currentTab == 2;+ final authorSelectionAvailable =+ selectingAuthors &&+ !libWatch.isOffline &&+ auth.canUpdateMetadata &&+ !_matchingAuthors;+ final bookSelectionAvailable =desktopWorkspace &&!libWatch.isOffline &&!_isInSearchMode &&(hasTabs ? _currentTab == 0 : _podcastView == 0);+ final selectionAvailable =+ authorSelectionAvailable || bookSelectionAvailable;if (!selectionAvailable && _selectionMode) _resetSelectionState();final showCoverControl =desktopWorkspace &&@@ -2688,7 +2825,10 @@ class LibraryScreenState extends State<LibraryScreen>},),),- if (hasTabs && !_isInSearchMode && !desktopWorkspace)+ if (hasTabs &&+ !_isInSearchMode &&+ !desktopWorkspace &&+ !_selectionMode)Positioned(left: 0,right: 0,@@ -2749,9 +2889,28 @@ class LibraryScreenState extends State<LibraryScreen>),],),- floatingActionButton: !desktopWorkspace+ floatingActionButton: _selectionMode && authorSelectionAvailable+ ? DesktopBatchActionBar(+ selectedCount: _selectedItemIds.length,+ selectableCount: selectableCount,+ busy: _batchActionBusy,+ busyLabel: _authorMatchTotal > 0+ ? '$_authorMatchPosition/$_authorMatchTotal'+ : null,+ canQuickMatch: true,+ canMarkProgress: false,+ canDelete: false,+ onSelectAll: _toggleSelectAll,+ onClear: _clearSelection,+ onQuickMatch: () =>+ _runBatchAction(() => _quickMatchAuthors(_selectedAuthors())),+ onMarkFinished: () {},+ onMarkUnfinished: () {},+ onDelete: () {},+ )+ : !desktopWorkspace? null- : _selectionMode && selectionAvailable+ : _selectionMode && bookSelectionAvailable? DesktopBatchActionBar(selectedCount: _selectedItemIds.length,selectableCount: selectableCount,@@ -2795,7 +2954,10 @@ class LibraryScreenState extends State<LibraryScreen>onIncrease: () => _changeBookshelfCoverSize(1),): null,- floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,+ floatingActionButtonLocation:+ authorSelectionAvailable && !desktopWorkspace+ ? FloatingActionButtonLocation.centerFloat+ : FloatingActionButtonLocation.endFloat,);}@@ -2832,11 +2994,19 @@ class LibraryScreenState extends State<LibraryScreen>),);final desktop = isDesktopWorkspace(context);+ final canSelectAuthors =+ _tabController != null &&+ _currentTab == 2 &&+ context.read<AuthProvider>().canUpdateMetadata &&+ !_matchingAuthors;final canSelectItems =- desktop &&!lib.isOffline &&!_isInSearchMode &&- (_tabController == null ? _podcastView == 0 : _currentTab == 0);+ (canSelectAuthors ||+ (desktop &&+ (_tabController == null+ ? _podcastView == 0+ : _currentTab == 0)));return SliverAppBar(floating: !desktop,snap: !desktop,@@ -2941,9 +3111,11 @@ class LibraryScreenState extends State<LibraryScreen>Tooltip(message: _selectionMode? l.downloadsCancelSelection- : 'Select items',+ : l.downloadsSelect,child: IconButton(- onPressed: _selectionMode+ onPressed: _batchActionBusy+ ? null+ : _selectionMode? _clearSelection: () => setState(() => _selectionMode = true),icon: Icon(@@ -3392,6 +3564,29 @@ class LibraryScreenState extends State<LibraryScreen>),),],+ if (_currentTab == 2 &&+ !_selectionMode &&+ _authors.isNotEmpty &&+ context.read<AuthProvider>().canUpdateMetadata &&+ !context.read<LibraryProvider>().isOffline)+ TextButton.icon(+ onPressed: _matchingAuthors ? null : _quickMatchAllAuthors,+ icon: _matchingAuthors+ ? const SizedBox(+ width: 16,+ height: 16,+ child: CircularProgressIndicator(strokeWidth: 2),+ )+ : const Icon(Icons.auto_fix_high_rounded, size: 18),+ label: Text(+ _matchingAuthors && _authorMatchTotal > 0+ ? '${l.adminMatching} '+ '$_authorMatchPosition/$_authorMatchTotal'+ : _matchingAuthors+ ? l.adminMatching+ : l.adminMatchAll,+ ),+ ),const Spacer(),Text(countText,@@ -3568,6 +3763,16 @@ class LibraryScreenState extends State<LibraryScreen>onRefresh: _refreshAuthors,headerSliver: headerSliver,scrollController: _authorsScrollController,+ selectionMode: _selectionMode,+ selectedAuthorIds: _selectedItemIds,+ matchingAuthorId: _matchingAuthorId,+ onSelectionToggle:+ context.read<AuthProvider>().canUpdateMetadata &&+ !context.read<LibraryProvider>().isOffline &&+ !_matchingAuthors &&+ !_batchActionBusy+ ? _toggleSelection+ : null,);}diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dartindex a65d7829..89b397c3 100644--- a/lib/screens/login_screen.dart+++ b/lib/screens/login_screen.dart@@ -828,21 +828,20 @@ class _LoginScreenState extends State<LoginScreen>spacing: 8,runSpacing: 8,children: [- if (!AppPlatform.isWeb)- ActionChip(- avatar: Icon(Icons.restore_rounded, size: 16,- color: cs.onSurfaceVariant.withValues(alpha: 0.6)),- label: Text(l.loginRestoreFromBackup,- style: tt.labelSmall?.copyWith(- color: cs.onSurfaceVariant.withValues(alpha: 0.6),- )),- backgroundColor: cs.surfaceContainerHighest.withValues(alpha: 0.3),- side: BorderSide(color: cs.outlineVariant.withValues(alpha: 0.15)),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(20),- ),- onPressed: _restoreFromBackup,+ ActionChip(+ avatar: Icon(Icons.restore_rounded, size: 16,+ color: cs.onSurfaceVariant.withValues(alpha: 0.6)),+ label: Text(l.loginRestoreFromBackup,+ style: tt.labelSmall?.copyWith(+ color: cs.onSurfaceVariant.withValues(alpha: 0.6),+ )),+ backgroundColor: cs.surfaceContainerHighest.withValues(alpha: 0.3),+ side: BorderSide(color: cs.outlineVariant.withValues(alpha: 0.15)),+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(20),),+ onPressed: _restoreFromBackup,+ ),ActionChip(key: const Key('paste-login-link'),avatar: Icon(Icons.content_paste_rounded, size: 16,@@ -965,14 +964,28 @@ class _LoginScreenState extends State<LoginScreen>}Future<void> _restoreFromBackup() async {- if (AppPlatform.isWeb) return;-try {- final result = await FilePicker.platform.pickFiles(type: FileType.any);+ final result = await FilePicker.platform.pickFiles(+ type: FileType.any,+ withData: AppPlatform.isWeb,+ );if (result == null || result.files.isEmpty) return;- final file = File(result.files.single.path!);- final jsonStr = await file.readAsString();+ final pickedFile = result.files.single;+ final bytes = pickedFile.bytes;+ final jsonStr = bytes != null+ ? utf8.decode(bytes)+ : pickedFile.path != null+ ? await File(pickedFile.path!).readAsString()+ : null;+ if (jsonStr == null) {+ if (mounted) {+ final l = AppLocalizations.of(context)!;+ showOverlayToast(context, l.loginInvalidBackupFile,+ icon: Icons.error_outline_rounded);+ }+ return;+ }final data = jsonDecode(jsonStr) as Map<String, dynamic>;if (!data.containsKey('version')) {diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dartindex dfe86b73..ca2f5ae6 100644--- a/lib/screens/settings_screen.dart+++ b/lib/screens/settings_screen.dart@@ -4368,15 +4368,13 @@ class SettingsScreenState extends State<SettingsScreen> {onPressed: () => _backupSettings(context, cs, tt,),),),- if (!AppPlatform.isWeb) ...[- const SizedBox(width: 10),- Expanded(child: OutlinedButton.icon(- icon: const Icon(Icons.download_rounded, size: 18,),- label: Text(l.restore),- onPressed: () => _restoreSettings(context, cs, tt,- ),- ),),- ],+ const SizedBox(width: 10),+ Expanded(child: OutlinedButton.icon(+ icon: const Icon(Icons.download_rounded, size: 18,),+ label: Text(l.restore),+ onPressed: () => _restoreSettings(context, cs, tt,+ ),+ ),),],),],),@@ -4859,11 +4857,26 @@ class SettingsScreenState extends State<SettingsScreen> {void _restoreSettings(BuildContext context, ColorScheme cs, TextTheme tt,) async {final l = AppLocalizations.of(context)!;try {- final result = await FilePicker.platform.pickFiles(type: FileType.any);- if (result == null || result.files.single.path == null) return;-- final file = File(result.files.single.path!);- final jsonStr = await file.readAsString();+ final result = await FilePicker.platform.pickFiles(+ type: FileType.any,+ withData: AppPlatform.isWeb,+ );+ if (result == null || result.files.isEmpty) return;++ final pickedFile = result.files.single;+ final bytes = pickedFile.bytes;+ final jsonStr = bytes != null+ ? utf8.decode(bytes)+ : pickedFile.path != null+ ? await File(pickedFile.path!).readAsString()+ : null;+ if (jsonStr == null) {+ if (mounted) {+ showOverlayToast(context, l.invalidBackupFile,+ icon: Icons.error_outline_rounded,);+ }+ return;+ }final data = jsonDecode(jsonStr) as Map<String, dynamic>;if (data['version'] == null) {diff --git a/lib/services/api_service.dart b/lib/services/api_service.dartindex 1e8cd832..2c509ffc 100644--- a/lib/services/api_service.dart+++ b/lib/services/api_service.dart@@ -17,6 +17,20 @@ class LocalSessionResult {const LocalSessionResult({required this.ok, required this.serverTooOld});}+class AuthorQuickMatchResult {+ final int statusCode;+ final bool updated;+ final Map<String, dynamic>? author;++ const AuthorQuickMatchResult({+ required this.statusCode,+ this.updated = false,+ this.author,+ });++ bool get found => statusCode == 200;+}+class MediaUploadFile {final String name;final int size;@@ -1488,32 +1502,73 @@ class ApiService {/// Quick-match an author against the configured provider (Audible)./// Server fetches name/asin/description/image, updates the author server-side,- /// and returns the updated author. Returns null if no match or on error.+ /// and returns the author. Returns null if no match or on error. A successful+ /// match can return the unchanged author when its stored details are already+ /// current./// POST /api/authors/:id/match body: { q, region }- /// Response: { updated: true, author: {...} } on match, { updated: false } on no match.+ /// Response: { updated, author } on match; a missing provider match is 404.Future<Map<String, dynamic>?> matchAuthor(String authorId, {required String q,String region = 'us',}) async {+ final result = await quickMatchAuthor(authorId, q: q, region: region);+ if (!result.found) return null;+ return result.author;+ }++ /// Quick-match one author using the same ASIN-first request shape as the+ /// Audiobookshelf web client. The full response is retained so batch callers+ /// can distinguish a match with no changes from a missing author or a failed+ /// request.+ Future<AuthorQuickMatchResult> quickMatchAuthor(+ String authorId, {+ String? q,+ String? asin,+ String region = 'us',+ }) async {+ final trimmedAsin = asin?.trim() ?? '';+ final trimmedQuery = q?.trim() ?? '';+ if (trimmedAsin.isEmpty && trimmedQuery.isEmpty) {+ return const AuthorQuickMatchResult(statusCode: 0);+ }+try {+ final body = <String, dynamic>{'region': region};+ if (trimmedAsin.isNotEmpty) {+ body['asin'] = trimmedAsin;+ } else {+ body['q'] = trimmedQuery;+ }final r = await _authPost(Uri.parse('$_cleanBaseUrl/api/authors/$authorId/match'),- body: jsonEncode({'q': q, 'region': region}),+ body: jsonEncode(body),+ timeout: const Duration(seconds: 30),+ );+ debugPrint(+ '[API] quickMatchAuthor $authorId -> ${r.statusCode}: ${r.body}',);- debugPrint('[API] matchAuthor $authorId -> ${r.statusCode}: ${r.body}');if (r.statusCode == 200) {final data = jsonDecode(r.body) as Map<String, dynamic>;- // Server signals no match with { updated: false } and no author payload.- if (data['updated'] == false) return null;- if (data['author'] is Map)- return data['author'] as Map<String, dynamic>;- return data;+ final author = data['author'] is Map+ ? Map<String, dynamic>.from(data['author'] as Map)+ : null;+ // Current ABS returns 404 when the provider has no match. Older+ // servers returned 200 with {updated: false} and no author payload.+ if (author == null && data['updated'] == false) {+ return const AuthorQuickMatchResult(statusCode: 404);+ }+ return AuthorQuickMatchResult(+ statusCode: r.statusCode,+ updated: data['updated'] == true,+ author: author,+ );}+ return AuthorQuickMatchResult(statusCode: r.statusCode);} catch (e) {- debugPrint('matchAuthor error: $e');+ debugPrint('quickMatchAuthor error: $e');}- return null;+ return const AuthorQuickMatchResult(statusCode: 0);}/// Set the author image from a remote URL.diff --git a/lib/services/backup_service.dart b/lib/services/backup_service.dartindex cb713884..74170cb5 100644--- a/lib/services/backup_service.dart+++ b/lib/services/backup_service.dart@@ -408,7 +408,9 @@ class BackupService {// when we write settings below. saveAccount() sets the active scope key.final accounts = data['accounts'] as List<dynamic>?;if (accounts != null) {- for (final a in accounts) {+ // saveAccount inserts at the front. Restore in reverse so the backup's+ // first (active) account stays first and owns the scoped settings below.+ for (final a in accounts.reversed) {final map = a as Map<String, dynamic>;await UserAccountService().saveAccount(SavedAccount.fromJson(map,diff --git a/lib/utils/url_file_download.dart b/lib/utils/url_file_download.dartnew file mode 100644index 00000000..c8a5db0e--- /dev/null+++ b/lib/utils/url_file_download.dart@@ -0,0 +1,2 @@+export 'url_file_download_stub.dart'+ if (dart.library.js_interop) 'url_file_download_web.dart';diff --git a/lib/utils/url_file_download_stub.dart b/lib/utils/url_file_download_stub.dartnew file mode 100644index 00000000..659a82b6--- /dev/null+++ b/lib/utils/url_file_download_stub.dart@@ -0,0 +1 @@+Future<bool> downloadUrlFile(Uri uri) async => false;diff --git a/lib/utils/url_file_download_web.dart b/lib/utils/url_file_download_web.dartnew file mode 100644index 00000000..3c31289b--- /dev/null+++ b/lib/utils/url_file_download_web.dart@@ -0,0 +1,19 @@+import 'package:web/web.dart' as web;++Future<bool> downloadUrlFile(Uri uri) async {+ try {+ final body = web.document.body;+ if (body == null) return false;++ // Keep authenticated download URLs out of the visible tab and its+ // history. The server's Content-Disposition header still controls whether+ // this is the original file or a generated ZIP.+ final frame = web.HTMLIFrameElement()+ ..src = uri.toString()+ ..style.display = 'none';+ body.appendChild(frame);+ return true;+ } catch (_) {+ return false;+ }+}diff --git a/lib/widgets/author_books_sheet.dart b/lib/widgets/author_books_sheet.dartindex 42efc996..a64688f7 100644--- a/lib/widgets/author_books_sheet.dart+++ b/lib/widgets/author_books_sheet.dart@@ -128,7 +128,7 @@ class _AuthorBooksSheetState extends State<AuthorBooksSheet> {final lib = context.read<LibraryProvider>();final auth = context.watch<AuthProvider>();final headers = lib.mediaHeaders;- final canEdit = auth.isAdmin && !lib.isOffline;+ final canEdit = auth.canUpdateMetadata && !lib.isOffline;if (_isLoading) {return Column(diff --git a/lib/widgets/book_detail_sheet.dart b/lib/widgets/book_detail_sheet.dartindex 1244718d..01686f85 100644--- a/lib/widgets/book_detail_sheet.dart+++ b/lib/widgets/book_detail_sheet.dart@@ -52,6 +52,7 @@ import 'adaptive_modal.dart';import 'stackable_sheet.dart';import 'ebook_router.dart';import '../utils/duration_format.dart';+import '../utils/url_file_download.dart';// ─── BOOK DETAIL BOTTOM SHEET ───────────────────────────────@@ -757,6 +758,10 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {// Primary action row: Download | Fully Absorb | Read (when ebook)const SizedBox(height: 12),Row(children: [+ if (AppPlatform.isWeb && auth.canDownload) ...[+ Expanded(child: _webDownloadButton(context, cs, l, auth)),+ const SizedBox(width: 8),+ ],if (!isEbookOnly && !AppPlatform.isWeb) ...[Expanded(child: DownloadWideButton(itemId: widget.itemId, coverUrl: _coverUrl, title: title, author: authorName, accent: accent)),const SizedBox(width: 8),@@ -1005,6 +1010,66 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {]);}+ Widget _webDownloadButton(+ BuildContext context,+ ColorScheme cs,+ AppLocalizations l,+ AuthProvider auth,+ ) {+ return GestureDetector(+ onTap: () => _downloadToComputer(context, auth),+ child: Container(+ height: 36,+ decoration: BoxDecoration(+ color: cs.onSurface.withValues(alpha: 0.06),+ borderRadius: BorderRadius.circular(14),+ border: Border.all(+ color: cs.onSurface.withValues(alpha: 0.08),+ ),+ ),+ child: Row(+ mainAxisAlignment: MainAxisAlignment.center,+ children: [+ Icon(+ Icons.download_outlined,+ size: 16,+ color: cs.onSurfaceVariant,+ ),+ const SizedBox(width: 6),+ Text(+ l.download,+ style: TextStyle(+ color: cs.onSurfaceVariant,+ fontSize: 12,+ fontWeight: FontWeight.w500,+ ),+ ),+ ],+ ),+ ),+ );+ }++ Future<void> _downloadToComputer(+ BuildContext context,+ AuthProvider auth,+ ) async {+ final api = auth.apiService;+ if (api == null) return;++ final uri = Uri.parse(+ '${api.cleanBaseUrl}/api/items/${Uri.encodeComponent(widget.itemId)}/download',+ ).replace(queryParameters: {'token': api.token});+ final started = await downloadUrlFile(uri);+ if (!started && context.mounted) {+ showOverlayToast(+ context,+ AppLocalizations.of(context)!.downloadNotifFailedTitle,+ icon: Icons.error_outline_rounded,+ );+ }+ }+// ─── QUICK ACTIONS (long-press) ─────────────────────────────// Compact long-press layout: cover + title, an Absorb/Download grid, then// the same actions as the detail sheet's "more" menu rendered as pills.diff --git a/lib/widgets/desktop_batch_actions.dart b/lib/widgets/desktop_batch_actions.dartindex eb514082..97bcebf0 100644--- a/lib/widgets/desktop_batch_actions.dart+++ b/lib/widgets/desktop_batch_actions.dart@@ -234,6 +234,7 @@ class DesktopBatchActionBar extends StatelessWidget {final int selectedCount;final int selectableCount;final bool busy;+ final String? busyLabel;final bool canQuickMatch;final bool canMarkProgress;final bool canDelete;@@ -249,6 +250,7 @@ class DesktopBatchActionBar extends StatelessWidget {required this.selectedCount,required this.selectableCount,required this.busy,+ this.busyLabel,required this.canQuickMatch,this.canMarkProgress = true,required this.canDelete,@@ -280,7 +282,7 @@ class DesktopBatchActionBar extends StatelessWidget {child: Row(mainAxisSize: MainAxisSize.min,children: [- if (busy)+ if (busy) ...[const Padding(padding: EdgeInsets.all(10),child: SizedBox(@@ -288,8 +290,16 @@ class DesktopBatchActionBar extends StatelessWidget {height: 20,child: CircularProgressIndicator(strokeWidth: 2),),- )- else+ ),+ if (busyLabel != null && busyLabel!.isNotEmpty)+ Padding(+ padding: const EdgeInsets.only(right: 6),+ child: Text(+ busyLabel!,+ style: const TextStyle(fontWeight: FontWeight.w700),+ ),+ ),+ ] elsePadding(padding: const EdgeInsets.symmetric(horizontal: 10),child: Text(diff --git a/lib/widgets/edit_author_sheet.dart b/lib/widgets/edit_author_sheet.dartindex 19bbe124..6e2cfdf1 100644--- a/lib/widgets/edit_author_sheet.dart+++ b/lib/widgets/edit_author_sheet.dart@@ -128,13 +128,18 @@ class _EditAuthorContentState extends State<_EditAuthorContent>setState(() { _matching = true; _matchResult = null; _matchEmpty = false; });- final result = await api.matchAuthor(widget.authorId, q: q, region: _region);+ final match = await api.quickMatchAuthor(+ widget.authorId,+ q: q,+ region: _region,+ );+ final result = match.author;if (!mounted) return;setState(() {_matching = false;if (result == null || result.isEmpty) {- _matchEmpty = true;+ _matchEmpty = match.statusCode == 404;} else {_matchResult = result;// Sync the Custom tab fields with the matched values so editing@@ -148,12 +153,17 @@ class _EditAuthorContentState extends State<_EditAuthorContent>}});- if (result != null && result.isNotEmpty) {- // The match endpoint already updates the author server-side, so notify parent.- widget.onUpdated();- _showToast(AppLocalizations.of(context)!.authorMatched, icon: Icons.check_circle_rounded);+ final l = AppLocalizations.of(context)!;+ if (match.found) {+ if (match.updated) widget.onUpdated();+ _showToast(+ match.updated ? l.authorMatched : l.quickMatchNoUpdates,+ icon: Icons.check_circle_rounded,+ );+ } else if (match.statusCode == 404) {+ _showToast(l.authorNoMatchFound, icon: Icons.search_off_rounded);} else {- _showToast(AppLocalizations.of(context)!.authorNoMatchFound, icon: Icons.search_off_rounded);+ _showToast(l.failedToUpdateMetadata, icon: Icons.error_outline_rounded);}}diff --git a/lib/widgets/library_authors_tab.dart b/lib/widgets/library_authors_tab.dartindex 14af7ea0..bedd2a6f 100644--- a/lib/widgets/library_authors_tab.dart+++ b/lib/widgets/library_authors_tab.dart@@ -12,6 +12,11 @@ class LibraryAuthorsTab extends StatelessWidget {final Future<void> Function() onRefresh;final Widget? headerSliver;final ScrollController? scrollController;+ final bool selectionMode;+ final Set<String> selectedAuthorIds;+ final String? matchingAuthorId;+ final void Function(Map<String, dynamic> author, int index)?+ onSelectionToggle;const LibraryAuthorsTab({super.key,@@ -22,6 +27,10 @@ class LibraryAuthorsTab extends StatelessWidget {required this.onRefresh,this.headerSliver,this.scrollController,+ this.selectionMode = false,+ this.selectedAuthorIds = const {},+ this.matchingAuthorId,+ this.onSelectionToggle,});@override@@ -92,10 +101,19 @@ class LibraryAuthorsTab extends StatelessWidget {childAspectRatio: 0.68,desktopMaxCrossAxisExtent: desktopMaxCrossAxisExtent,),- delegate: SliverChildBuilderDelegate(- (context, index) => GridAuthorTile(author: authors[index]),- childCount: authors.length,- ),+ delegate: SliverChildBuilderDelegate((context, index) {+ final author = authors[index];+ final authorId = author['id'] as String? ?? '';+ return GridAuthorTile(+ author: author,+ selectionMode: selectionMode,+ isSelected: selectedAuthorIds.contains(authorId),+ isMatching: matchingAuthorId == authorId,+ onSelectionToggle: onSelectionToggle == null+ ? null+ : () => onSelectionToggle!(author, index),+ );+ }, childCount: authors.length),),),],diff --git a/lib/widgets/library_grid_tiles.dart b/lib/widgets/library_grid_tiles.dartindex 1907100a..f4c493f0 100644--- a/lib/widgets/library_grid_tiles.dart+++ b/lib/widgets/library_grid_tiles.dart@@ -880,7 +880,19 @@ class GridListTile extends StatelessWidget {// ═══════════════════════════════════════════════════════════════class GridAuthorTile extends StatelessWidget {final Map<String, dynamic> author;- const GridAuthorTile({super.key, required this.author});+ final bool selectionMode;+ final bool isSelected;+ final bool isMatching;+ final VoidCallback? onSelectionToggle;++ const GridAuthorTile({+ super.key,+ required this.author,+ this.selectionMode = false,+ this.isSelected = false,+ this.isMatching = false,+ this.onSelectionToggle,+ });@overrideWidget build(BuildContext context) {@@ -902,88 +914,154 @@ class GridAuthorTile extends StatelessWidget {final headers = lib.mediaHeaders;- return GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () {- if (authorId.isNotEmpty) {- showAuthorDetailSheet(context, authorId: authorId, authorName: name);- }- },- child: Column(- children: [- // Circular avatar- AspectRatio(- aspectRatio: 1,- child: Stack(- fit: StackFit.expand,- clipBehavior: Clip.none,- children: [- Container(- decoration: BoxDecoration(- shape: BoxShape.circle,- color: cs.secondaryContainer,+ return Semantics(+ selected: selectionMode ? isSelected : null,+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () {+ if (selectionMode) {+ onSelectionToggle?.call();+ return;+ }+ if (authorId.isNotEmpty) {+ showAuthorDetailSheet(+ context,+ authorId: authorId,+ authorName: name,+ );+ }+ },+ onLongPress: onSelectionToggle,+ child: Column(+ children: [+ // Circular avatar+ AspectRatio(+ aspectRatio: 1,+ child: Stack(+ fit: StackFit.expand,+ clipBehavior: Clip.none,+ children: [+ Container(+ decoration: BoxDecoration(+ shape: BoxShape.circle,+ color: cs.secondaryContainer,+ border: selectionMode && isSelected+ ? Border.all(color: cs.primary, width: 3)+ : null,+ ),+ padding: selectionMode && isSelected+ ? const EdgeInsets.all(3)+ : EdgeInsets.zero,+ clipBehavior: Clip.antiAlias,+ child: imageUrl != null+ ? ClipOval(+ child: CachedNetworkImage(+ imageUrl: imageUrl,+ fit: BoxFit.cover,+ httpHeaders: headers,+ placeholder: (_, __) => _placeholder(cs),+ errorWidget: (_, __, ___) => _placeholder(cs),+ ),+ )+ : ClipOval(child: _placeholder(cs)),),- clipBehavior: Clip.antiAlias,- child: imageUrl != null- ? CachedNetworkImage(- imageUrl: imageUrl,- fit: BoxFit.cover,- httpHeaders: headers,- placeholder: (_, __) => _placeholder(cs),- errorWidget: (_, __, ___) => _placeholder(cs),- )- : _placeholder(cs),- ),- if (numBooks > 0)- Positioned(- top: 0,- right: 0,- child: Container(- padding: const EdgeInsets.symmetric(- horizontal: 7,- vertical: 3,- ),- decoration: BoxDecoration(- color: cs.primaryContainer,- borderRadius: BorderRadius.circular(10),- ),- child: Row(- mainAxisSize: MainAxisSize.min,- children: [- Icon(- Icons.auto_stories_rounded,- size: 11,- color: cs.onPrimaryContainer,+ if (selectionMode)+ Positioned(+ top: 0,+ left: 0,+ child: Container(+ width: 28,+ height: 28,+ decoration: BoxDecoration(+ shape: BoxShape.circle,+ color: isSelected+ ? cs.primary+ : cs.surfaceContainerHighest,+ border: Border.all(+ color: isSelected ? cs.primary : cs.outlineVariant,),- const SizedBox(width: 3),- Text(- '$numBooks',- style: TextStyle(- fontSize: 10,- fontWeight: FontWeight.w700,+ ),+ child: Icon(+ isSelected+ ? Icons.check_rounded+ : Icons.circle_outlined,+ size: 18,+ color: isSelected+ ? cs.onPrimary+ : cs.onSurfaceVariant,+ ),+ ),+ ),+ if (numBooks > 0)+ Positioned(+ top: 0,+ right: 0,+ child: Container(+ padding: const EdgeInsets.symmetric(+ horizontal: 7,+ vertical: 3,+ ),+ decoration: BoxDecoration(+ color: cs.primaryContainer,+ borderRadius: BorderRadius.circular(10),+ ),+ child: Row(+ mainAxisSize: MainAxisSize.min,+ children: [+ Icon(+ Icons.auto_stories_rounded,+ size: 11,color: cs.onPrimaryContainer,),+ const SizedBox(width: 3),+ Text(+ '$numBooks',+ style: TextStyle(+ fontSize: 10,+ fontWeight: FontWeight.w700,+ color: cs.onPrimaryContainer,+ ),+ ),+ ],+ ),+ ),+ ),+ if (isMatching)+ Positioned.fill(+ child: DecoratedBox(+ decoration: BoxDecoration(+ shape: BoxShape.circle,+ color: Colors.black.withValues(alpha: 0.55),+ ),+ child: const Center(+ child: SizedBox(+ width: 30,+ height: 30,+ child: CircularProgressIndicator(+ strokeWidth: 3,+ color: Colors.white,+ ),),- ],+ ),),),- ),- ],+ ],+ ),),- ),- const SizedBox(height: 5),- Text(- name,- textAlign: TextAlign.center,- maxLines: 2,- overflow: TextOverflow.ellipsis,- style: tt.labelSmall?.copyWith(- fontWeight: FontWeight.w600,- color: cs.onSurface,- fontSize: 11,+ const SizedBox(height: 5),+ Text(+ name,+ textAlign: TextAlign.center,+ maxLines: 2,+ overflow: TextOverflow.ellipsis,+ style: tt.labelSmall?.copyWith(+ fontWeight: FontWeight.w600,+ color: cs.onSurface,+ fontSize: 11,+ ),),- ),- ],+ ],+ ),),);}