mirror of
https://github.com/mii443/vrchatapi-rust.git
synced 2025-08-22 15:45:35 +00:00
Add Wasm compatibility
This commit is contained in:
@ -24,7 +24,7 @@ find src -type f -exec sed -i '/The version of the OpenAPI document/d' {} \;
|
||||
find src -type f -exec sed -i '/^\s*\/\/\/\s*$/d' {} \;
|
||||
|
||||
# Cookie storage
|
||||
sed -i 's/Client::new()/Client::builder().cookie_store(true).build().unwrap()/g' src/apis/configuration.rs
|
||||
sed -i 's/reqwest::Client::new()/{#[cfg(target_family = "wasm")] {reqwest::Client::new()}\n #[cfg(not(target_family = "wasm"))] { reqwest::Client::builder().cookie_store(true).build().unwrap()}\n }/g' src/apis/configuration.rs
|
||||
sed -i 's/features = \["json", "multipart"\]/features = \["json", "cookies", "multipart"\]/g' Cargo.toml
|
||||
|
||||
#Fix example
|
||||
|
@ -40,7 +40,9 @@ impl Default for Configuration {
|
||||
Configuration {
|
||||
base_path: "https://vrchat.com/api/1".to_owned(),
|
||||
user_agent: Some("vrchatapi-rust".to_owned()),
|
||||
client: reqwest::Client::builder().cookie_store(true).build().unwrap(),
|
||||
client: {#[cfg(target_family = "wasm")] {reqwest::Client::new()}
|
||||
#[cfg(not(target_family = "wasm"))] { reqwest::Client::builder().cookie_store(true).build().unwrap()}
|
||||
},
|
||||
basic_auth: None,
|
||||
oauth_access_token: None,
|
||||
bearer_access_token: None,
|
||||
|
Reference in New Issue
Block a user