summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-06-09 18:58:46 -0400
committerLLLL Colonq <llll@colonq>2025-06-09 18:58:46 -0400
commite97c890fb61cf2951231f6fd2f6f49911cdb8837 (patch)
treef81f0213eb40380c2420f88265c1047dd7ebaf44
parent4ccaa3c849070379f52e6b306811ca33305d0694 (diff)
Add bundt_api_server
-rw-r--r--crates/teleia/src/context.rs25
-rw-r--r--crates/teleia/src/helpers.js8
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";
+}