mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix: spotify authentication 429 errors
This commit is contained in:
parent
59f298a935
commit
1a32264bc7
@ -6,6 +6,7 @@ import 'package:collection/collection.dart';
|
|||||||
import 'package:desktop_webview_window/desktop_webview_window.dart';
|
import 'package:desktop_webview_window/desktop_webview_window.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:dio/io.dart';
|
import 'package:dio/io.dart';
|
||||||
|
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
|
||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart'
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart'
|
||||||
hide X509Certificate;
|
hide X509Certificate;
|
||||||
@ -34,13 +35,18 @@ extension ExpirationAuthenticationTableData on AuthenticationTableData {
|
|||||||
|
|
||||||
class AuthenticationNotifier extends AsyncNotifier<AuthenticationTableData?> {
|
class AuthenticationNotifier extends AsyncNotifier<AuthenticationTableData?> {
|
||||||
static final Dio dio = () {
|
static final Dio dio = () {
|
||||||
final dio = Dio();
|
final dio = Dio()
|
||||||
|
..httpClientAdapter = Http2Adapter(
|
||||||
|
ConnectionManager(
|
||||||
|
idleTimeout: const Duration(seconds: 10),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
(dio.httpClientAdapter as IOHttpClientAdapter)
|
// (dio.httpClientAdapter as IOHttpClientAdapter)
|
||||||
.createHttpClient = () => HttpClient()
|
// .createHttpClient = () => HttpClient()
|
||||||
..badCertificateCallback = (X509Certificate cert, String host, int port) {
|
// ..badCertificateCallback = (X509Certificate cert, String host, int port) {
|
||||||
return host.endsWith("spotify.com") && port == 443;
|
// return host.endsWith("spotify.com") && port == 443;
|
||||||
};
|
// };
|
||||||
|
|
||||||
return dio;
|
return dio;
|
||||||
}();
|
}();
|
||||||
|
16
pubspec.lock
16
pubspec.lock
@ -544,6 +544,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.7.0"
|
version: "5.7.0"
|
||||||
|
dio_http2_adapter:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dio_http2_adapter
|
||||||
|
sha256: b8bd5d587fd228a461711f8b82f378ccd4bf1fbf7802e7663ca60d7b5ce0e3aa
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.6.0"
|
||||||
dio_web_adapter:
|
dio_web_adapter:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -1186,6 +1194,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.2"
|
version: "1.2.2"
|
||||||
|
http2:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: http2
|
||||||
|
sha256: "382d3aefc5bd6dc68c6b892d7664f29b5beb3251611ae946a98d35158a82bbfa"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.1"
|
||||||
http_methods:
|
http_methods:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -141,6 +141,7 @@ dependencies:
|
|||||||
http_parser: ^4.1.2
|
http_parser: ^4.1.2
|
||||||
collection: any
|
collection: any
|
||||||
otp_util: ^1.0.2
|
otp_util: ^1.0.2
|
||||||
|
dio_http2_adapter: ^2.6.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
build_runner: ^2.4.13
|
build_runner: ^2.4.13
|
||||||
|
Loading…
Reference in New Issue
Block a user