this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: get server_url at compile time from env var cuz lazy

dusk 651f0bad aad23617

+27 -4
+17 -1
build.nu
··· 1 - def main [feat: string, --run (-r)] { 1 + $env.SERVER_URL = "ws://localhost:3111" 2 + 3 + def build-web [run: bool] { 4 + mut cmd = ["cargo" "run-wasm" "--package" "annoyance" "--features" "client" "--release"] 5 + if not $run { $cmd = $cmd ++ ["--build-only"] } 6 + run-external $cmd 7 + } 8 + 9 + def build-native [feat: string, run: bool] { 2 10 let dir = pwd | path join $"($feat)-build" 3 11 cargo b --release --features $feat --artifact-dir $dir -Z unstable-options 4 12 if $run { 5 13 exec ($dir | path join "annoyance.exe") 6 14 } 7 15 } 16 + 17 + def main [feat: string = "server", --run (-r), --web (-w)] { 18 + if $web { 19 + build-web $run 20 + } else { 21 + build-native $feat $run 22 + } 23 + }
+10 -3
src/main.rs
··· 213 213 if should_cleanup { 214 214 self.last_cleanup = self.clock.now(); 215 215 216 - for (_, points) in self.laser_points.iter_mut() { 216 + let mut ids_to_remove = Vec::new(); 217 + for (id, points) in self.laser_points.iter_mut() { 217 218 let points_len = points.len(); 218 219 if points_len == 0 { 219 220 continue; ··· 232 233 } 233 234 *points = new_points; 234 235 235 - if !points.is_empty() { 236 + if points.is_empty() { 237 + ids_to_remove.push(*id); 238 + } else { 236 239 has_any_points = true; 237 240 } 241 + } 242 + 243 + for id in ids_to_remove { 244 + self.laser_points.remove(&id); 238 245 } 239 246 } else { 240 247 has_any_points = self.laser_points.values().any(|points| !points.is_empty()); ··· 473 480 { 474 481 let client_id = app.client_id; 475 482 let fut = async move { 476 - ws::client::connect("ws://localhost:3111", window, _rx, _tx, client_id) 483 + ws::client::connect(env!("SERVER_URL"), window, _rx, _tx, client_id) 477 484 .await 478 485 .unwrap() 479 486 };