gui-web: Use the document url as the the API url
This commit is contained in:
1 parent
66d768c1ff
commit
3d49e4d88c
1 file changed
+9
-3
+9
-3
@@ -96,12 +96,18 @@ pub fn run() -> Result<(), anyhow::Error> {
|
||||
.inspect_err(|err| eprintln!("{err:?}"))
|
||||
.unwrap_or_default();
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let conf = Config::default();
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
let conf = Config::default();
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
let mut conf = Config::default();
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
web_sys::window()
|
||||
.and_then(|window| window.document())
|
||||
.and_then(|document| document.url().ok())
|
||||
.map(|url| conf.address = url);
|
||||
|
||||
state.set_server_address(conf.address.to_shared_string());
|
||||
let conf_shared = Arc::new(Mutex::new(conf));
|
||||
|
||||
|
||||
Reference in new issue
Block a user