diff options
| author | LLLL Colonq <llll@colonq> | 2025-06-09 18:58:46 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-06-09 18:58:46 -0400 |
| commit | e97c890fb61cf2951231f6fd2f6f49911cdb8837 (patch) | |
| tree | f81f0213eb40380c2420f88265c1047dd7ebaf44 /crates | |
| parent | 4ccaa3c849070379f52e6b306811ca33305d0694 (diff) | |
Add bundt_api_server
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/teleia/src/context.rs | 25 | ||||
| -rw-r--r-- | crates/teleia/src/helpers.js | 8 |
2 files changed, 26 insertions, 7 deletions
diff --git a/crates/teleia/src/context.rs b/crates/teleia/src/context.rs index 89592be..c633da9 100644 --- a/crates/teleia/src/context.rs +++ b/crates/teleia/src/context.rs @@ -13,6 +13,8 @@ use winit::platform::web::WindowExtWebSys; extern { fn js_track_resized_setup(); fn js_poll_resized() -> bool; + fn js_bundt_api_server() -> String; + fn js_bundt_secure_api_server() -> String; } #[cfg(not(target_arch = "wasm32"))] @@ -136,14 +138,23 @@ impl Context { } #[cfg(target_arch = "wasm32")] - pub fn resize_necessary(&self) -> bool { - js_poll_resized() - } - + pub fn resize_necessary(&self) -> bool { js_poll_resized() } #[cfg(not(target_arch = "wasm32"))] - pub fn resize_necessary(&self) -> bool { - false - } + pub fn resize_necessary(&self) -> bool { false } + + #[cfg(target_arch = "wasm32")] + pub fn bundt_api_server(&self) -> String { js_bundt_api_server() } + #[cfg(all(not(target_arch = "wasm32"), debug_assertions))] + pub fn bundt_api_server(&self) -> String { "http://localhost:8080/api".to_owned() } + #[cfg(all(not(target_arch = "wasm32"), not(debug_assertions)))] + pub fn bundt_api_server(&self) -> String { "http://api.colonq.computer/api".to_owned() } + + #[cfg(target_arch = "wasm32")] + pub fn bundt_secure_api_server(&self) -> String { js_bundt_secure_api_server() } + #[cfg(all(not(target_arch = "wasm32"), debug_assertions))] + pub fn bundt_secure_api_server(&self) -> String { "http://localhost:8080/api".to_owned() } + #[cfg(all(not(target_arch = "wasm32"), not(debug_assertions)))] + pub fn bundt_secure_api_server(&self) -> String { "http://secure.colonq.computer/api".to_owned() } pub fn clear_color(&self, color: glam::Vec4) { unsafe { diff --git a/crates/teleia/src/helpers.js b/crates/teleia/src/helpers.js index aaaafa1..881064b 100644 --- a/crates/teleia/src/helpers.js +++ b/crates/teleia/src/helpers.js @@ -11,3 +11,11 @@ export function js_poll_resized() { resized = false; return ret; } + +export function js_bundt_api_server() { + return globalThis.apiServer || "http://localhost:8080/api"; +} + +export function js_bundt_secure_api_server() { + return globalThis.secureApiServer || "http://localhost:8080/api"; +} |
