mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update crates api
This commit is contained in:
parent
f4416c7af9
commit
d512e94db1
2 changed files with 11 additions and 21 deletions
|
|
@ -121,7 +121,7 @@ impl Dialog for PreferencesDialog {
|
||||||
/// Lookup [MaxMind](https://www.maxmind.com) database
|
/// Lookup [MaxMind](https://www.maxmind.com) database
|
||||||
fn l(profile: &Profile, socket_address: &SocketAddress) -> Option<String> {
|
fn l(profile: &Profile, socket_address: &SocketAddress) -> Option<String> {
|
||||||
use maxminddb::{
|
use maxminddb::{
|
||||||
MaxMindDbError, Reader,
|
Reader,
|
||||||
geoip2::{/*City,*/ Country},
|
geoip2::{/*City,*/ Country},
|
||||||
};
|
};
|
||||||
if !matches!(
|
if !matches!(
|
||||||
|
|
@ -136,26 +136,16 @@ impl Dialog for PreferencesDialog {
|
||||||
Reader::open_readfile(c)
|
Reader::open_readfile(c)
|
||||||
}
|
}
|
||||||
.ok()?;
|
.ok()?;
|
||||||
let lookup = {
|
let a: std::net::SocketAddr = socket_address.to_string().parse().unwrap();
|
||||||
let a: std::net::SocketAddr = socket_address.to_string().parse().unwrap();
|
let c: Country = db.lookup(a.ip()).ok()?.decode().ok()??;
|
||||||
let lookup: std::result::Result<Option<Country>, MaxMindDbError> =
|
let mut b = Vec::new();
|
||||||
db.lookup(a.ip());
|
if let Some(iso_code) = c.country.iso_code {
|
||||||
lookup
|
b.push(iso_code);
|
||||||
}
|
}
|
||||||
.ok()??;
|
if let Some(name_en) = c.country.names.english {
|
||||||
lookup.country.map(|c| {
|
b.push(name_en);
|
||||||
let mut b = Vec::new();
|
}
|
||||||
if let Some(iso_code) = c.iso_code {
|
b.join(", ").into()
|
||||||
b.push(iso_code)
|
|
||||||
}
|
|
||||||
if let Some(n) = c.names
|
|
||||||
&& let Some(s) = n.get("en")
|
|
||||||
{
|
|
||||||
b.push(s)
|
|
||||||
} // @TODO multi-lang
|
|
||||||
// @TODO city DB
|
|
||||||
b.join(", ")
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
p.add(&{
|
p.add(&{
|
||||||
let g = PreferencesGroup::builder().title("Remote").build();
|
let g = PreferencesGroup::builder().title("Remote").build();
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ pub fn select(
|
||||||
//profile_id: row.get(1)?,
|
//profile_id: row.get(1)?,
|
||||||
opened: Event {
|
opened: Event {
|
||||||
time: DateTime::from_unix_local(row.get(2)?).unwrap(),
|
time: DateTime::from_unix_local(row.get(2)?).unwrap(),
|
||||||
count: row.get(3)?,
|
count: row.get::<_, i64>(3)? as usize,
|
||||||
},
|
},
|
||||||
closed: closed(row.get(4)?, row.get(5)?),
|
closed: closed(row.get(4)?, row.get(5)?),
|
||||||
request: row.get::<_, String>(6)?.into(),
|
request: row.get::<_, String>(6)?.into(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue