feat: add home feed provider setting, fix Qobuz cover URL propagation

- Add homeFeedProvider field to AppSettings with picker UI in extensions page
- Update explore_provider to respect user's home feed provider preference
- Add normalizeCoverReference() and normalizeRemoteHttpUrl() to filter
  invalid cover URLs (no scheme, no host, protocol-relative)
- Apply cover URL normalization across all screens and providers to
  prevent 'no host specified in URI' errors from Qobuz
- Propagate CoverURL from QobuzDownloadResult through Go backend so
  cover art is available even when request metadata is incomplete
This commit is contained in:
zarzet
2026-03-25 15:46:22 +07:00
parent c91154ea3e
commit 3a73aee1b7
16 changed files with 252 additions and 95 deletions
+35
View File
@@ -6,6 +6,41 @@ String? normalizeOptionalString(String? value) {
return trimmed;
}
final RegExp _windowsAbsolutePathPattern = RegExp(r'^[A-Za-z]:[\\/]');
bool _looksLikeLocalReference(String value) {
return value.startsWith('/') ||
value.startsWith('content://') ||
value.startsWith('file://') ||
_windowsAbsolutePathPattern.hasMatch(value);
}
String? normalizeCoverReference(String? value) {
final normalized = normalizeOptionalString(value);
if (normalized == null) return null;
if (normalized.startsWith('//')) {
return 'https:$normalized';
}
if (normalized.startsWith('http://') ||
normalized.startsWith('https://') ||
_looksLikeLocalReference(normalized)) {
return normalized;
}
return null;
}
String? normalizeRemoteHttpUrl(String? value) {
final normalized = normalizeCoverReference(value);
if (normalized == null) return null;
if (normalized.startsWith('http://') || normalized.startsWith('https://')) {
return normalized;
}
return null;
}
String formatSampleRateKHz(int sampleRate) {
final khz = sampleRate / 1000;
final precision = sampleRate % 1000 == 0 ? 0 : 1;