fix ngaccount, reintroduce reqwest for wasm32 only

Niko PLP 1 year ago
parent 08791bea10
commit d46733d6eb
  1. 83
      Cargo.lock
  2. 2
      ng-app/src/routes/WalletCreate.svelte
  3. 7
      ng-sdk-js/src/lib.rs
  4. 2
      ngaccount/web/src/routes/Create.svelte
  5. 5
      p2p-net/Cargo.toml
  6. 13
      p2p-net/src/utils.rs

83
Cargo.lock generated

@ -2206,6 +2206,19 @@ dependencies = [
"want",
]
[[package]]
name = "hyper-tls"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [
"bytes",
"hyper",
"native-tls",
"tokio",
"tokio-native-tls",
]
[[package]]
name = "iana-time-zone"
version = "0.1.57"
@ -2742,6 +2755,24 @@ dependencies = [
"getrandom 0.2.10",
]
[[package]]
name = "native-tls"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
dependencies = [
"lazy_static",
"libc",
"log",
"openssl",
"openssl-probe",
"openssl-sys",
"schannel",
"security-framework",
"security-framework-sys",
"tempfile",
]
[[package]]
name = "ndk"
version = "0.6.0"
@ -3168,6 +3199,12 @@ dependencies = [
"syn 2.0.18",
]
[[package]]
name = "openssl-probe"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
version = "111.26.0+1.1.1u"
@ -3275,6 +3312,7 @@ dependencies = [
"num_enum",
"once_cell",
"p2p-repo",
"reqwest",
"serde",
"serde_bare",
"serde_bytes",
@ -3961,10 +3999,12 @@ dependencies = [
"http",
"http-body",
"hyper",
"hyper-tls",
"ipnet",
"js-sys",
"log",
"mime",
"native-tls",
"once_cell",
"percent-encoding",
"pin-project-lite",
@ -3972,6 +4012,7 @@ dependencies = [
"serde_json",
"serde_urlencoded",
"tokio",
"tokio-native-tls",
"tokio-util",
"tower-service",
"url",
@ -4138,6 +4179,15 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "schannel"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88"
dependencies = [
"windows-sys",
]
[[package]]
name = "scoped-tls"
version = "1.0.1"
@ -4150,6 +4200,29 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "security-framework"
version = "2.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
dependencies = [
"bitflags",
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "selectors"
version = "0.22.0"
@ -5078,6 +5151,16 @@ dependencies = [
"syn 2.0.18",
]
[[package]]
name = "tokio-native-tls"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
dependencies = [
"native-tls",
"tokio",
]
[[package]]
name = "tokio-stream"
version = "0.1.14"

@ -292,7 +292,7 @@
} else {
local_url = await ng.get_local_url(location.href);
}
redirect_url = local_url + APP_WALLET_CREATE_SUFFIX;
if (local_url) redirect_url = local_url + APP_WALLET_CREATE_SUFFIX;
}
let create = {

@ -25,10 +25,13 @@ use p2p_net::types::{
BootstrapContent, BootstrapContentV0, ClientId, ClientInfo, ClientInfoV0, ClientType,
CreateAccountBSP, DirectPeerId, UserId, IP,
};
#[cfg(target_arch = "wasm32")]
use p2p_net::utils::retrieve_local_url;
use p2p_net::utils::{
decode_invitation_string, retrieve_local_bootstrap, retrieve_local_url, spawn_and_log_error,
Receiver, ResultSend, Sender,
decode_invitation_string, retrieve_local_bootstrap, spawn_and_log_error, Receiver, ResultSend,
Sender,
};
use p2p_net::WS_PORT;
use p2p_repo::log::*;
use p2p_repo::types::*;

@ -276,7 +276,7 @@
link <a target="_blank" href="https://account.{domain}/#/delete"
>https://account.{domain}/#/delete</a
> or by entering in your NextGraph application and selecting the menu,
then Account, then delete</span
then Accounts, then under broker "delete registration"</span
>
</li>
<li class="flex space-x-3">

@ -25,12 +25,13 @@ noise-protocol = "0.2.0-rc1"
noise-rust-crypto = "0.6.0-rc.1"
ed25519-dalek = "1.0.1"
either = "1.8.1"
# reqwest = { version = "0.11.18", features = ["json"] }
#,"native-tls-vendored"
url = "2.4.0"
base64-url = "2.0.0"
web-time = "0.2.0"
[target.'cfg(target_arch = "wasm32")'.dependencies]
reqwest = { version = "0.11.18", features = ["json"] }
#,"native-tls-vendored"
[target.'cfg(target_arch = "wasm32")'.dependencies.getrandom]
version = "0.2.7"

@ -114,15 +114,16 @@ pub fn check_is_local_url(bootstrap: &BrokerServerV0, location: &String) -> Opti
None
}
#[cfg(target_arch = "wasm32")]
pub async fn retrieve_local_url(location: String) -> Option<String> {
let bootstraps: BootstrapContent = {
// let resp = reqwest::get(format!("{}{}", APP_PREFIX, NG_BOOTSTRAP_LOCAL_PATH)).await;
// if resp.is_ok() {
// let resp = resp.unwrap().json::<BootstrapContent>().await;
// resp.unwrap()
// } else {
let resp = reqwest::get(format!("{}{}", APP_PREFIX, NG_BOOTSTRAP_LOCAL_PATH)).await;
if resp.is_ok() {
let resp = resp.unwrap().json::<BootstrapContent>().await;
resp.unwrap()
} else {
return None;
// }
}
};
for bootstrap in bootstraps.servers() {
let res = check_is_local_url(bootstrap, &location);

Loading…
Cancel
Save