diff --git a/lib/network/app_dio.dart b/lib/network/app_dio.dart index 816b226..7689410 100644 --- a/lib/network/app_dio.dart +++ b/lib/network/app_dio.dart @@ -257,18 +257,7 @@ class RHttpAdapter implements HttpClientAdapter { Future? cancelFuture, ) async { var res = await rhttp.Rhttp.request( - method: switch (options.method) { - 'GET' => rhttp.HttpMethod.get, - 'POST' => rhttp.HttpMethod.post, - 'PUT' => rhttp.HttpMethod.put, - 'PATCH' => rhttp.HttpMethod.patch, - 'DELETE' => rhttp.HttpMethod.delete, - 'HEAD' => rhttp.HttpMethod.head, - 'OPTIONS' => rhttp.HttpMethod.options, - 'TRACE' => rhttp.HttpMethod.trace, - 'CONNECT' => rhttp.HttpMethod.connect, - _ => throw ArgumentError('Unsupported method: ${options.method}'), - }, + method: rhttp.HttpMethod(options.method), url: options.uri.toString(), settings: settings, expectBody: rhttp.HttpExpectBody.stream, diff --git a/lib/utils/data_sync.dart b/lib/utils/data_sync.dart index 721ddf6..763685e 100644 --- a/lib/utils/data_sync.dart +++ b/lib/utils/data_sync.dart @@ -1,4 +1,3 @@ -import 'package:dio/io.dart'; import 'package:flutter/foundation.dart'; import 'package:venera/foundation/app.dart'; import 'package:venera/foundation/appdata.dart'; @@ -90,18 +89,11 @@ class DataSync with ChangeNotifier { String user = config[1]; String pass = config[2]; - var proxy = await AppDio.getProxy(); - var client = newClient( url, user: user, password: pass, - adapter: IOHttpClientAdapter( - createHttpClient: () { - return HttpClient() - ..findProxy = (uri) => proxy == null ? "DIRECT" : "PROXY $proxy"; - }, - ), + adapter: RHttpAdapter(), ); try { @@ -162,18 +154,11 @@ class DataSync with ChangeNotifier { String user = config[1]; String pass = config[2]; - var proxy = await AppDio.getProxy(); - var client = newClient( url, user: user, password: pass, - adapter: IOHttpClientAdapter( - createHttpClient: () { - return HttpClient() - ..findProxy = (uri) => proxy == null ? "DIRECT" : "PROXY $proxy"; - }, - ), + adapter: RHttpAdapter(), ); try { diff --git a/pubspec.lock b/pubspec.lock index 3a12883..84c2b4b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -757,10 +757,11 @@ packages: rhttp: dependency: "direct main" description: - name: rhttp - sha256: "3deabc6c3384b4efa252dfb4a5059acc6530117fdc1b10f5f67ff9768c9af75a" - url: "https://pub.dev" - source: hosted + path: rhttp + ref: HEAD + resolved-ref: "18d430cc45fd4f0114885c5235090abf65106257" + url: "https://github.com/wgh136/rhttp" + source: git version: "0.10.0" screen_retriever: dependency: transitive diff --git a/pubspec.yaml b/pubspec.yaml index e57c064..37a2bad 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -57,7 +57,10 @@ dependencies: git: url: https://github.com/venera-app/lodepng_flutter ref: 9a784b193af5d55b2a35e58fa390bda3e4f35d00 - rhttp: 0.10.0 + rhttp: + git: + url: https://github.com/wgh136/rhttp + path: rhttp webdav_client: git: url: https://github.com/wgh136/webdav_client