mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
Use rhttp to make webdav requests.
This commit is contained in:
@@ -257,18 +257,7 @@ class RHttpAdapter implements HttpClientAdapter {
|
|||||||
Future<void>? cancelFuture,
|
Future<void>? cancelFuture,
|
||||||
) async {
|
) async {
|
||||||
var res = await rhttp.Rhttp.request(
|
var res = await rhttp.Rhttp.request(
|
||||||
method: switch (options.method) {
|
method: rhttp.HttpMethod(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}'),
|
|
||||||
},
|
|
||||||
url: options.uri.toString(),
|
url: options.uri.toString(),
|
||||||
settings: settings,
|
settings: settings,
|
||||||
expectBody: rhttp.HttpExpectBody.stream,
|
expectBody: rhttp.HttpExpectBody.stream,
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import 'package:dio/io.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:venera/foundation/app.dart';
|
import 'package:venera/foundation/app.dart';
|
||||||
import 'package:venera/foundation/appdata.dart';
|
import 'package:venera/foundation/appdata.dart';
|
||||||
@@ -90,18 +89,11 @@ class DataSync with ChangeNotifier {
|
|||||||
String user = config[1];
|
String user = config[1];
|
||||||
String pass = config[2];
|
String pass = config[2];
|
||||||
|
|
||||||
var proxy = await AppDio.getProxy();
|
|
||||||
|
|
||||||
var client = newClient(
|
var client = newClient(
|
||||||
url,
|
url,
|
||||||
user: user,
|
user: user,
|
||||||
password: pass,
|
password: pass,
|
||||||
adapter: IOHttpClientAdapter(
|
adapter: RHttpAdapter(),
|
||||||
createHttpClient: () {
|
|
||||||
return HttpClient()
|
|
||||||
..findProxy = (uri) => proxy == null ? "DIRECT" : "PROXY $proxy";
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -162,18 +154,11 @@ class DataSync with ChangeNotifier {
|
|||||||
String user = config[1];
|
String user = config[1];
|
||||||
String pass = config[2];
|
String pass = config[2];
|
||||||
|
|
||||||
var proxy = await AppDio.getProxy();
|
|
||||||
|
|
||||||
var client = newClient(
|
var client = newClient(
|
||||||
url,
|
url,
|
||||||
user: user,
|
user: user,
|
||||||
password: pass,
|
password: pass,
|
||||||
adapter: IOHttpClientAdapter(
|
adapter: RHttpAdapter(),
|
||||||
createHttpClient: () {
|
|
||||||
return HttpClient()
|
|
||||||
..findProxy = (uri) => proxy == null ? "DIRECT" : "PROXY $proxy";
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@@ -757,10 +757,11 @@ packages:
|
|||||||
rhttp:
|
rhttp:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: rhttp
|
path: rhttp
|
||||||
sha256: "3deabc6c3384b4efa252dfb4a5059acc6530117fdc1b10f5f67ff9768c9af75a"
|
ref: HEAD
|
||||||
url: "https://pub.dev"
|
resolved-ref: "18d430cc45fd4f0114885c5235090abf65106257"
|
||||||
source: hosted
|
url: "https://github.com/wgh136/rhttp"
|
||||||
|
source: git
|
||||||
version: "0.10.0"
|
version: "0.10.0"
|
||||||
screen_retriever:
|
screen_retriever:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
|
@@ -57,7 +57,10 @@ dependencies:
|
|||||||
git:
|
git:
|
||||||
url: https://github.com/venera-app/lodepng_flutter
|
url: https://github.com/venera-app/lodepng_flutter
|
||||||
ref: 9a784b193af5d55b2a35e58fa390bda3e4f35d00
|
ref: 9a784b193af5d55b2a35e58fa390bda3e4f35d00
|
||||||
rhttp: 0.10.0
|
rhttp:
|
||||||
|
git:
|
||||||
|
url: https://github.com/wgh136/rhttp
|
||||||
|
path: rhttp
|
||||||
webdav_client:
|
webdav_client:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/wgh136/webdav_client
|
url: https://github.com/wgh136/webdav_client
|
||||||
|
Reference in New Issue
Block a user