wasm fixes
This commit is contained in:
		@@ -3,10 +3,7 @@ mod protected_store;
 | 
			
		||||
mod system;
 | 
			
		||||
mod table_store;
 | 
			
		||||
 | 
			
		||||
pub mod utils;
 | 
			
		||||
 | 
			
		||||
pub use block_store::*;
 | 
			
		||||
pub use protected_store::*;
 | 
			
		||||
pub use system::*;
 | 
			
		||||
pub use table_store::*;
 | 
			
		||||
use utils::*;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
use super::*;
 | 
			
		||||
use crate::*;
 | 
			
		||||
use data_encoding::BASE64URL_NOPAD;
 | 
			
		||||
use rkyv::{Archive as RkyvArchive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
use async_executors::{Bindgen, LocalSpawnHandleExt, SpawnHandleExt, Timer};
 | 
			
		||||
use futures_util::future::{select, Either};
 | 
			
		||||
use js_sys::*;
 | 
			
		||||
use crate::*;
 | 
			
		||||
 | 
			
		||||
//use js_sys::*;
 | 
			
		||||
 | 
			
		||||
pub async fn get_outbound_relay_peer() -> Option<crate::veilid_api::PeerInfo> {
 | 
			
		||||
    // unimplemented!
 | 
			
		||||
@@ -8,7 +8,7 @@ pub async fn get_outbound_relay_peer() -> Option<crate::veilid_api::PeerInfo> {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// pub async fn get_pwa_web_server_config() -> {
 | 
			
		||||
//     if utils::is_browser() {
 | 
			
		||||
//     if is_browser() {
 | 
			
		||||
 | 
			
		||||
//         let win = window().unwrap();
 | 
			
		||||
//         let doc = win.document().unwrap();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,3 @@
 | 
			
		||||
use super::*;
 | 
			
		||||
 | 
			
		||||
use crate::intf::table_db::*;
 | 
			
		||||
use crate::*;
 | 
			
		||||
use keyvaluedb_web::*;
 | 
			
		||||
@@ -135,7 +133,7 @@ impl TableStore {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if utils::is_browser() {
 | 
			
		||||
        if is_browser() {
 | 
			
		||||
            let out = match Database::delete(table_name.clone()).await {
 | 
			
		||||
                Ok(_) => true,
 | 
			
		||||
                Err(_) => false,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
#![deny(clippy::all)]
 | 
			
		||||
#![deny(unused_must_use)]
 | 
			
		||||
#![recursion_limit = "1024"]
 | 
			
		||||
 | 
			
		||||
cfg_if::cfg_if! {
 | 
			
		||||
    if #[cfg(target_arch = "wasm32")] {
 | 
			
		||||
 
 | 
			
		||||
@@ -192,7 +192,7 @@ impl RouteSpecDetail {
 | 
			
		||||
 | 
			
		||||
/// The core representation of the RouteSpecStore that can be serialized
 | 
			
		||||
#[derive(Debug, Clone, Default, RkyvArchive, RkyvSerialize, RkyvDeserialize)]
 | 
			
		||||
#[archive_attr(repr(C), derive(CheckBytes))]
 | 
			
		||||
#[archive_attr(repr(C, align(8)), derive(CheckBytes))]
 | 
			
		||||
pub struct RouteSpecStoreContent {
 | 
			
		||||
    /// All of the routes we have allocated so far
 | 
			
		||||
    details: HashMap<DHTKey, RouteSpecDetail>,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,14 @@
 | 
			
		||||
#[cfg(target_os = "android")]
 | 
			
		||||
mod android;
 | 
			
		||||
pub mod common;
 | 
			
		||||
#[cfg(target_os = "ios")]
 | 
			
		||||
mod ios;
 | 
			
		||||
#[cfg(not(target_arch = "wasm32"))]
 | 
			
		||||
mod native;
 | 
			
		||||
 | 
			
		||||
#[allow(unused_imports)]
 | 
			
		||||
use super::*;
 | 
			
		||||
 | 
			
		||||
pub use common::*;
 | 
			
		||||
pub use crypto::tests::*;
 | 
			
		||||
pub use network_manager::tests::*;
 | 
			
		||||
 
 | 
			
		||||
@@ -597,11 +597,13 @@ impl VeilidConfig {
 | 
			
		||||
        macro_rules! get_config {
 | 
			
		||||
            ($key:expr) => {
 | 
			
		||||
                let keyname = &stringify!($key)[6..];
 | 
			
		||||
                $key = *cb(keyname.to_owned())?.downcast().map_err(|_| {
 | 
			
		||||
                    let err = format!("incorrect type for key {}", keyname);
 | 
			
		||||
                    debug!("{}", err);
 | 
			
		||||
                    VeilidAPIError::generic(err)
 | 
			
		||||
                })?;
 | 
			
		||||
                let v = cb(keyname.to_owned())?;
 | 
			
		||||
                $key = match v.downcast() {
 | 
			
		||||
                    Ok(v) => *v,
 | 
			
		||||
                    Err(_) => {
 | 
			
		||||
                        apibail_generic!(format!("incorrect type for key {}", keyname))
 | 
			
		||||
                    }
 | 
			
		||||
                };
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user