fix: Fix web platform issues

This commit is contained in:
yuluo
2024-04-24 01:42:14 +08:00
Unverified
parent 38a33ea9b0
commit 0496adf6cf
4 changed files with 24 additions and 9 deletions

View File

@@ -14,10 +14,7 @@ class HttpService {
dynamic body,
}) async {
headers ??= {'Content-Type': 'application/json'};
// For web platforms
if (kIsWeb) {
return await _pollFultterHttp(url, method, headers: headers, body: body);
}
// Determine if there is currently a proxy setting, and if so, use FFI to call the Rust HTTP method.
final isProxy = await bind.mainGetProxyStatus();

View File

@@ -770,6 +770,24 @@ class RustdeskImpl {
throw UnimplementedError();
}
Future<bool> mainGetProxyStatus({dynamic hint}) {
return Future(() => false);
}
Future<void> mainHttpRequest({
required String url,
required String method,
String? body,
required String header,
dynamic hint,
}) {
throw UnimplementedError();
}
Future<String?> mainGetHttpStatus({required String url, dynamic hint}){
throw UnimplementedError();
}
String mainGetLocalOption({required String key, dynamic hint}) {
return js.context.callMethod('getByName', ['option:local', key]);
}

View File

@@ -921,10 +921,10 @@ packages:
dependency: "direct main"
description:
name: path
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
version: "1.8.3"
path_parsing:
dependency: transitive
description:
@@ -1526,10 +1526,10 @@ packages:
dependency: transitive
description:
name: web
sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05"
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.4.2"
version: "0.3.0"
web_socket_channel:
dependency: transitive
description:

View File

@@ -31,7 +31,7 @@ use hbb_common::tokio::sync::mpsc::UnboundedSender;
use hbb_common::tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver};
use hbb_common::{
allow_err,
anyhow::Context,
anyhow::{anyhow, Context},
bail,
config::{
self, Config, LocalConfig, PeerConfig, PeerInfoSerde, Resolution, CONNECT_TIMEOUT,