@@ -371,11 +371,14 @@ impl Updater {
371
371
. replace ( "{{arch}}" , self . arch )
372
372
. parse ( ) ?;
373
373
374
+ log:: debug!( "checking for updates {url}" ) ;
375
+
374
376
let mut request = ClientBuilder :: new ( ) . user_agent ( UPDATER_USER_AGENT ) ;
375
377
if let Some ( timeout) = self . timeout {
376
378
request = request. timeout ( timeout) ;
377
379
}
378
380
if let Some ( ref proxy) = self . proxy {
381
+ log:: debug!( "using proxy {proxy}" ) ;
379
382
let proxy = reqwest:: Proxy :: all ( proxy. as_str ( ) ) ?;
380
383
request = request. proxy ( proxy) ;
381
384
}
@@ -391,24 +394,38 @@ impl Updater {
391
394
if res. status ( ) . is_success ( ) {
392
395
// no updates found!
393
396
if StatusCode :: NO_CONTENT == res. status ( ) {
397
+ log:: debug!( "update endpoint returned 204 No Content" ) ;
394
398
return Ok ( None ) ;
395
399
} ;
396
400
397
- raw_json = Some ( res. json ( ) . await ?) ;
398
- match serde_json:: from_value :: < RemoteRelease > ( raw_json. clone ( ) . unwrap ( ) )
401
+ let update_response: serde_json:: Value = res. json ( ) . await ?;
402
+ log:: debug!( "update response: {update_response:?}" ) ;
403
+ raw_json = Some ( update_response. clone ( ) ) ;
404
+ match serde_json:: from_value :: < RemoteRelease > ( update_response)
399
405
. map_err ( Into :: into)
400
406
{
401
407
Ok ( release) => {
408
+ println ! ( "parsed release response {release:?}" ) ;
402
409
last_error = None ;
403
410
remote_release = Some ( release) ;
404
- // we found a relase , break the loop
411
+ // we found a release , break the loop
405
412
break ;
406
413
}
407
- Err ( err) => last_error = Some ( err) ,
414
+ Err ( err) => {
415
+ log:: error!( "failed to deserialize update response: {err}" ) ;
416
+ last_error = Some ( err)
417
+ }
408
418
}
419
+ } else {
420
+ log:: error!(
421
+ "update endpoint did not respond with a successful status code"
422
+ ) ;
409
423
}
410
424
}
411
- Err ( err) => last_error = Some ( err. into ( ) ) ,
425
+ Err ( err) => {
426
+ log:: error!( "failed to check for updates: {err}" ) ;
427
+ last_error = Some ( err. into ( ) )
428
+ }
412
429
}
413
430
}
414
431
@@ -670,6 +687,7 @@ impl Update {
670
687
} ;
671
688
672
689
if let Some ( on_before_exit) = self . on_before_exit . as_ref ( ) {
690
+ log:: debug!( "running on_before_exit hook" ) ;
673
691
on_before_exit ( ) ;
674
692
}
675
693
@@ -838,6 +856,7 @@ impl Update {
838
856
839
857
#[ cfg( feature = "zip" ) ]
840
858
if infer:: archive:: is_gz ( bytes) {
859
+ log:: debug!( "extracting AppImage" ) ;
841
860
// extract the buffer to the tmp_dir
842
861
// we extract our signed archive into our final directory without any temp file
843
862
let archive = Cursor :: new ( bytes) ;
@@ -861,6 +880,7 @@ impl Update {
861
880
return Err ( Error :: BinaryNotFoundInArchive ) ;
862
881
}
863
882
883
+ log:: debug!( "rewriting AppImage" ) ;
864
884
return match std:: fs:: write ( & self . extract_path , bytes)
865
885
. and_then ( |_| std:: fs:: set_permissions ( & self . extract_path , permissions) )
866
886
{
@@ -914,6 +934,7 @@ impl Update {
914
934
fn install_deb ( & self , bytes : & [ u8 ] ) -> Result < ( ) > {
915
935
// First verify the bytes are actually a .deb package
916
936
if !infer:: archive:: is_deb ( bytes) {
937
+ log:: warn!( "update is not a valid deb package" ) ;
917
938
return Err ( Error :: InvalidUpdaterFormat ) ;
918
939
}
919
940
@@ -956,13 +977,15 @@ impl Update {
956
977
. status ( )
957
978
{
958
979
if status. success ( ) {
980
+ log:: debug!( "installed deb with pkexec" ) ;
959
981
return Ok ( ( ) ) ;
960
982
}
961
983
}
962
984
963
985
// 2. Try zenity or kdialog for a graphical sudo experience
964
986
if let Ok ( password) = self . get_password_graphically ( ) {
965
987
if self . install_with_sudo ( deb_path, & password) ? {
988
+ log:: debug!( "installed deb with GUI sudo" ) ;
966
989
return Ok ( ( ) ) ;
967
990
}
968
991
}
@@ -975,6 +998,7 @@ impl Update {
975
998
. status ( ) ?;
976
999
977
1000
if status. success ( ) {
1001
+ log:: debug!( "installed deb with sudo" ) ;
978
1002
Ok ( ( ) )
979
1003
} else {
980
1004
Err ( Error :: DebInstallFailed )
@@ -1098,6 +1122,7 @@ impl Update {
1098
1122
} ;
1099
1123
1100
1124
if need_authorization {
1125
+ log:: debug!( "app installation needs admin privileges" ) ;
1101
1126
// Use AppleScript to perform moves with admin privileges
1102
1127
let apple_script = format ! (
1103
1128
"do shell script \" rm -rf '{src}' && mv -f '{new}' '{src}'\" with administrator privileges" ,
0 commit comments