chore(bump): bump to 0.1.2, fix get_localized_action and add weather

viewing
This commit is contained in:
Soph :3 2025-08-22 19:36:09 +03:00
parent 27d33973b8
commit 6c3f9c500d
4 changed files with 29 additions and 16 deletions

2
Cargo.lock generated
View file

@ -155,7 +155,7 @@ checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29"
[[package]] [[package]]
name = "blitzortung" name = "blitzortung"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"clap", "clap",
"futures-util", "futures-util",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "blitzortung" name = "blitzortung"
version = "0.1.1" version = "0.1.2"
edition = "2024" edition = "2024"
[dependencies] [dependencies]

View file

@ -22,7 +22,7 @@ This project connects to the Blitzortung lightning detection network and sends n
### Use ### Use
If you do not wish to compile `blitzortung`, feel free to download it from: If you do not wish to compile `blitzortung`, feel free to download it from:
- [Linux x64](https://files.sad.ovh/public/releases/blitzortung/0.1.1/release/blitzortung) - [Linux x64](https://files.sad.ovh/public/releases/blitzortung/0.1.2/release/blitzortung)
### Compile ### Compile
```sh ```sh

View file

@ -202,19 +202,32 @@ fn get_localized_message(
} }
} }
} }
fn get_localized_action(lang: &str, lon: f64, lat: f64) -> serde_json::Value { fn get_localized_action(lang: &str, lon: f64, lat: f64) -> serde_json::Value {
let label = match lang { let label_maps = match lang {
"lv" => "Skatīt Google Maps", "lv" => "Skatīt Google Maps (strādā!)",
"ru" => "Открыть в Google Maps", "ru" => "Открыть в Google Maps (работает!)",
_ => "View in Google Maps", _ => "View in Google Maps (works!)",
}; };
let label_weather = match lang {
"lv" => "Skatīt laikapstākļus šeit",
"ru" => "Посмотреть погоду здесь",
_ => "View weather here",
};
let actions = vec![
serde_json::json!({ serde_json::json!({
"action": "view", "action": "view",
"label": label, "label": label_maps,
"url": format!("geo:{:.5},{:.5}", lon, lat), "url": format!("geo:{:.5},{:.5}", lat, lon),
"clear": false "clear": false
}) }),
serde_json::json!({
"action": "view",
"label": label_weather,
"url": format!("https://www.windy.com/?{:.5},{:.5},10", lat, lon),
"clear": false
}),
];
serde_json::json!(actions)
} }
#[tokio::main] #[tokio::main]
@ -399,7 +412,7 @@ async fn main() {
args.detector_fetch, args.detector_fetch,
&location_name, &location_name,
); );
let action = get_localized_action(&lang, lon, lat); let actions = get_localized_action(&lang, lon, lat);
let topic = format!("{}-{}", args.ntfy_topic, lang); let topic = format!("{}-{}", args.ntfy_topic, lang);
@ -408,7 +421,7 @@ async fn main() {
"message": message, "message": message,
"title": title, "title": title,
"priority": args.priority, "priority": args.priority,
"actions": [action] "actions": actions
}); });
let client = reqwest::Client::new(); let client = reqwest::Client::new();