File tree Expand file tree Collapse file tree
app/browser/window/tab/item/page/navigation/request/info Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ impl Dialog for PreferencesDialog {
121121 /// Lookup [MaxMind](https://www.maxmind.com) database
122122 fn l ( profile : & Profile , socket_address : & SocketAddress ) -> Option < String > {
123123 use maxminddb:: {
124- MaxMindDbError , Reader ,
124+ Reader ,
125125 geoip2:: { /*City,*/ Country } ,
126126 } ;
127127 if !matches ! (
@@ -136,26 +136,16 @@ impl Dialog for PreferencesDialog {
136136 Reader :: open_readfile ( c)
137137 }
138138 . ok ( ) ?;
139- let lookup = {
140- let a : std :: net :: SocketAddr = socket_address . to_string ( ) . parse ( ) . unwrap ( ) ;
141- let lookup : std :: result :: Result < Option < Country > , MaxMindDbError > =
142- db . lookup ( a . ip ( ) ) ;
143- lookup
139+ let a : std :: net :: SocketAddr = socket_address . to_string ( ) . parse ( ) . unwrap ( ) ;
140+ let c : Country = db . lookup ( a . ip ( ) ) . ok ( ) ? . decode ( ) . ok ( ) ?? ;
141+ let mut b = Vec :: new ( ) ;
142+ if let Some ( iso_code ) = c . country . iso_code {
143+ b . push ( iso_code ) ;
144144 }
145- . ok ( ) ??;
146- lookup. country . map ( |c| {
147- let mut b = Vec :: new ( ) ;
148- if let Some ( iso_code) = c. iso_code {
149- b. push ( iso_code)
150- }
151- if let Some ( n) = c. names
152- && let Some ( s) = n. get ( "en" )
153- {
154- b. push ( s)
155- } // @TODO multi-lang
156- // @TODO city DB
157- b. join ( ", " )
158- } )
145+ if let Some ( name_en) = c. country . names . english {
146+ b. push ( name_en) ;
147+ }
148+ b. join ( ", " ) . into ( )
159149 }
160150 p. add ( & {
161151 let g = PreferencesGroup :: builder ( ) . title ( "Remote" ) . build ( ) ;
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ pub fn select(
151151 //profile_id: row.get(1)?,
152152 opened : Event {
153153 time : DateTime :: from_unix_local ( row. get ( 2 ) ?) . unwrap ( ) ,
154- count : row. get ( 3 ) ?,
154+ count : row. get :: < _ , i64 > ( 3 ) ? as usize ,
155155 } ,
156156 closed : closed ( row. get ( 4 ) ?, row. get ( 5 ) ?) ,
157157 request : row. get :: < _ , String > ( 6 ) ?. into ( ) ,
You can’t perform that action at this time.
0 commit comments