Skip to content

Commit ab91dc1

Browse files
committed
Location fixes
1 parent d5202e0 commit ab91dc1

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎src/api/map.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn generate_url(is_dark: bool) -> String {
1919
.replace("\\n", "\n"); // fixes newlines in docker compose file env section.
2020

2121
if let Some(loc) = LOCATION_STATE.lock().unwrap().as_ref() {
22-
let center = format!("{}, {}, {}", loc.city, loc.state, loc.country);
22+
let center = format!("{},{}", loc.lat, loc.lng);
2323
eprintln!("[map] center={center:?}, lat={}, lng={}", loc.lat, loc.lng);
2424
url.query_pairs_mut().append_pair("center", &center);
2525
}

‎src/api/mod.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn handle_location(request: Request) {
7878
};
7979
let mut city = query_pairs.get("city").cloned().unwrap_or_default();
8080
let mut state_name = query_pairs.get("state").cloned().unwrap_or_default();
81-
let country = query_pairs.get("country").cloned().unwrap_or_default();
81+
let mut country = query_pairs.get("country").cloned().unwrap_or_default();
8282

8383
match env::var("LOCATION_HIDDEN_CITY") {
8484
Ok(hidden_city) => {
@@ -88,10 +88,11 @@ fn handle_location(request: Request) {
8888
city,
8989
city.eq_ignore_ascii_case(&hidden_city)
9090
);
91-
if city.eq_ignore_ascii_case(&hidden_city) {
91+
if city.trim().eq_ignore_ascii_case(&hidden_city.trim()) {
9292
eprintln!("[location] Hiding location: overriding to London");
9393
city = "London".to_string();
9494
state_name = "England".to_string();
95+
country = "United Kingdom".to_string();
9596
lat = 51.5074;
9697
lng = -0.1278;
9798
}

0 commit comments

Comments
 (0)