Skip to content

Commit 58afdb3

Browse files
committed
Log location info
1 parent 39dd844 commit 58afdb3

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

‎src/api/map.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub fn generate_url(isDark: bool) -> String {
2020

2121
if let Some(loc) = LOCATION_STATE.lock().unwrap().as_ref() {
2222
let center = format!("{}, {}, {}", loc.city, loc.state, loc.country);
23+
eprintln!("[map] center={center:?}, lat={}, lng={}", loc.lat, loc.lng);
2324
url.query_pairs_mut().append_pair("center", &center);
2425
}
2526

‎src/api/mod.rs‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,24 @@ fn handle_location(request: Request) {
8080
let mut state_name = query_pairs.get("state").cloned().unwrap_or_default();
8181
let country = query_pairs.get("country").cloned().unwrap_or_default();
8282

83-
if let Ok(hidden_city) = env::var("LOCATION_HIDDEN_CITY") {
84-
if city.eq_ignore_ascii_case(&hidden_city) {
85-
city = "London".to_string();
86-
state_name = "England".to_string();
87-
lat = 51.5074;
88-
lng = -0.1278;
83+
match env::var("LOCATION_HIDDEN_CITY") {
84+
Ok(hidden_city) => {
85+
eprintln!("[location] LOCATION_HIDDEN_CITY={:?}, incoming city={:?}, match={}", hidden_city, city, city.eq_ignore_ascii_case(&hidden_city));
86+
if city.eq_ignore_ascii_case(&hidden_city) {
87+
eprintln!("[location] Hiding location: overriding to London");
88+
city = "London".to_string();
89+
state_name = "England".to_string();
90+
lat = 51.5074;
91+
lng = -0.1278;
92+
}
93+
}
94+
Err(e) => {
95+
eprintln!("[location] LOCATION_HIDDEN_CITY not set: {e}");
8996
}
9097
}
9198

99+
eprintln!("[location] Saving: lat={lat}, lng={lng}, city={city:?}, state={state_name:?}, country={country:?}");
100+
92101
{
93102
let mut state = LOCATION_STATE.lock().unwrap();
94103
*state = Some(LocationInfo {

0 commit comments

Comments
 (0)