Security: Cloud-Auth auf Bearer-JWT umgestellt (IDOR-Luecke geschlossen)
- cloud_service: echter Login gegen baka-auth, Token statt X-API-Key/X-User - app_config: hartcodierten API-Key-Default entfernt - download_service + melo_logger: Bearer-Token statt X-API-Key - navidrome: Passwort in flutter_secure_storage (Keychain/Keystore) - song: token-haltige stream_url wird nicht mehr in SQLite persistiert - cloud_screen: Pfad-Traversal beim Download-Dateinamen gefixt (p.basename) - home_screen: Login-Dialog mit Passwort-Feld, Auto-Sync nutzt restoreLogin
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:path_provider/path_provider.dart';
|
||||
import '../models/song.dart';
|
||||
import '../database/db_helper.dart';
|
||||
import 'melo_logger.dart';
|
||||
import 'cloud_service.dart';
|
||||
|
||||
/// Download-Service: Lädt YouTube-Audio über den yt-proxy herunter.
|
||||
/// Nutzt ChangeNotifier für UI-Updates via ListenableBuilder.
|
||||
@@ -16,8 +17,10 @@ class DownloadService extends ChangeNotifier {
|
||||
DownloadService._();
|
||||
|
||||
static const String _proxyBasisUrl = 'https://yt.baka-net.de';
|
||||
static const String _apiKey = 'melo-yT9xK7pQ3nR5vW2b';
|
||||
static const Map<String, String> _authHeader = {'X-API-Key': _apiKey};
|
||||
static Map<String, String> get _authHeader {
|
||||
final t = CloudService().token;
|
||||
return {if (t.isNotEmpty) 'Authorization': 'Bearer $t'};
|
||||
}
|
||||
|
||||
final DbHelper _db = DbHelper();
|
||||
|
||||
@@ -146,6 +149,14 @@ class DownloadService extends ChangeNotifier {
|
||||
String? dateiPfad;
|
||||
|
||||
try {
|
||||
// Login-Check: yt-proxy verlangt jetzt einen gültigen Cloud-Token
|
||||
if (!CloudService().istAngemeldet) {
|
||||
_fehler = 'Bitte zuerst in der Cloud anmelden (Cloud-Tab)';
|
||||
_ladt = false;
|
||||
notifyListeners();
|
||||
return null;
|
||||
}
|
||||
|
||||
// URL-Validierung
|
||||
if (!url.contains('youtube.com') && !url.contains('youtu.be')) {
|
||||
_fehler = 'Keine gültige YouTube-URL';
|
||||
|
||||
Reference in New Issue
Block a user