Merge branch 'bugfix/csrf_refresh' of kilowatt36/freezer into master
This commit is contained in:
commit
c8a1bc7221
|
@ -35,6 +35,7 @@ android/local.properties
|
||||||
.pub-cache/
|
.pub-cache/
|
||||||
.pub/
|
.pub/
|
||||||
/build/
|
/build/
|
||||||
|
.gradle
|
||||||
|
|
||||||
# Web related
|
# Web related
|
||||||
lib/generated_plugin_registrant.dart
|
lib/generated_plugin_registrant.dart
|
||||||
|
|
|
@ -47,6 +47,7 @@ class DeezerAPI {
|
||||||
});
|
});
|
||||||
//Post
|
//Post
|
||||||
http.Response res = await http.post(uri, headers: headers, body: jsonEncode(params));
|
http.Response res = await http.post(uri, headers: headers, body: jsonEncode(params));
|
||||||
|
dynamic body = jsonDecode(res.body);
|
||||||
//Grab SID
|
//Grab SID
|
||||||
if (method == 'deezer.getUserData') {
|
if (method == 'deezer.getUserData') {
|
||||||
for (String cookieHeader in res.headers['set-cookie'].split(';')) {
|
for (String cookieHeader in res.headers['set-cookie'].split(';')) {
|
||||||
|
@ -55,8 +56,11 @@ class DeezerAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// In case of error "Invalid CSRF token" retrieve new one and retry the same call
|
||||||
return jsonDecode(res.body);
|
if (body['error'].isNotEmpty && body['error'].containsKey('VALID_TOKEN_REQUIRED') && await rawAuthorize()) {
|
||||||
|
return callApi(method, params: params, gatewayInput: gatewayInput);
|
||||||
|
}
|
||||||
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<dynamic, dynamic>> callPublicApi(String path) async {
|
Future<Map<dynamic, dynamic>> callPublicApi(String path) async {
|
||||||
|
|
|
@ -750,14 +750,15 @@ class _PlaylistDetailsState extends State<PlaylistDetails> {
|
||||||
if (playlist.tracks.length == 0) {
|
if (playlist.tracks.length == 0) {
|
||||||
//Get correct metadata
|
//Get correct metadata
|
||||||
deezerAPI.playlist(playlist.id)
|
deezerAPI.playlist(playlist.id)
|
||||||
.catchError((e) => setState(() => _error = true))
|
|
||||||
.then((Playlist p) {
|
.then((Playlist p) {
|
||||||
if (p == null) return;
|
|
||||||
setState(() {
|
setState(() {
|
||||||
playlist = p;
|
playlist = p;
|
||||||
});
|
});
|
||||||
//Load tracks
|
//Load tracks
|
||||||
_load();
|
_load();
|
||||||
|
})
|
||||||
|
.catchError((e) {
|
||||||
|
setState(() => _error = true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,7 +804,7 @@ class _PlaylistDetailsState extends State<PlaylistDetails> {
|
||||||
),
|
),
|
||||||
Container(height: 4.0),
|
Container(height: 4.0),
|
||||||
Text(
|
Text(
|
||||||
playlist.user.name,
|
playlist.user.name??'',
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
|
Loading…
Reference in New Issue