chore(bump): bump to 0.1.2, fix get_localized_action and add weather
viewing
This commit is contained in:
parent
27d33973b8
commit
6c3f9c500d
4 changed files with 29 additions and 16 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -155,7 +155,7 @@ checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29"
|
|||
|
||||
[[package]]
|
||||
name = "blitzortung"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"futures-util",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "blitzortung"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ This project connects to the Blitzortung lightning detection network and sends n
|
|||
|
||||
### Use
|
||||
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
|
||||
```sh
|
||||
|
|
|
|||
39
src/main.rs
39
src/main.rs
|
|
@ -202,19 +202,32 @@ fn get_localized_message(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_localized_action(lang: &str, lon: f64, lat: f64) -> serde_json::Value {
|
||||
let label = match lang {
|
||||
"lv" => "Skatīt Google Maps",
|
||||
"ru" => "Открыть в Google Maps",
|
||||
_ => "View in Google Maps",
|
||||
let label_maps = match lang {
|
||||
"lv" => "Skatīt Google Maps (strādā!)",
|
||||
"ru" => "Открыть в Google Maps (работает!)",
|
||||
_ => "View in Google Maps (works!)",
|
||||
};
|
||||
serde_json::json!({
|
||||
"action": "view",
|
||||
"label": label,
|
||||
"url": format!("geo:{:.5},{:.5}", lon, lat),
|
||||
"clear": false
|
||||
})
|
||||
let label_weather = match lang {
|
||||
"lv" => "Skatīt laikapstākļus šeit",
|
||||
"ru" => "Посмотреть погоду здесь",
|
||||
_ => "View weather here",
|
||||
};
|
||||
let actions = vec![
|
||||
serde_json::json!({
|
||||
"action": "view",
|
||||
"label": label_maps,
|
||||
"url": format!("geo:{:.5},{:.5}", lat, lon),
|
||||
"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]
|
||||
|
|
@ -399,7 +412,7 @@ async fn main() {
|
|||
args.detector_fetch,
|
||||
&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);
|
||||
|
||||
|
|
@ -408,7 +421,7 @@ async fn main() {
|
|||
"message": message,
|
||||
"title": title,
|
||||
"priority": args.priority,
|
||||
"actions": [action]
|
||||
"actions": actions
|
||||
});
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue