@@ -365,18 +365,6 @@ pub struct Updater {
365
365
}
366
366
367
367
impl Updater {
368
- fn get_updater_installer ( & self ) -> Option < Installer > {
369
- match bundle_type ( ) ? {
370
- BundleType :: Deb => Some ( Installer :: Deb ) ,
371
- BundleType :: Rpm => Some ( Installer :: Rpm ) ,
372
- BundleType :: AppImage => Some ( Installer :: AppImage ) ,
373
- BundleType :: Msi => Some ( Installer :: Msi ) ,
374
- BundleType :: Nsis => Some ( Installer :: Nsis ) ,
375
- BundleType :: App => Some ( Installer :: App ) ,
376
- BundleType :: Dmg => None ,
377
- }
378
- }
379
-
380
368
pub async fn check ( & self ) -> Result < Option < Update > > {
381
369
// we want JSON only
382
370
let mut headers = self . headers . clone ( ) ;
@@ -506,7 +494,7 @@ impl Updater {
506
494
None => release. version > self . current_version ,
507
495
} ;
508
496
509
- let installer = self . get_updater_installer ( ) ;
497
+ let installer = installer_for_bundle_type ( bundle_type ( ) ) ;
510
498
let ( download_url, signature) = self . get_urls ( & release, & installer) ?;
511
499
512
500
let update = if should_update {
@@ -523,7 +511,6 @@ impl Updater {
523
511
download_url : download_url. clone ( ) ,
524
512
signature : signature. to_owned ( ) ,
525
513
body : release. notes ,
526
- installer,
527
514
raw_json : raw_json. unwrap ( ) ,
528
515
timeout : None ,
529
516
proxy : self . proxy . clone ( ) ,
@@ -590,8 +577,6 @@ pub struct Update {
590
577
/// The `{{target}}` variable we replace in the endpoint and search for in the JSON,
591
578
/// this is either the user provided target or the current operating system by default
592
579
pub target : String ,
593
- /// Current installer type
594
- pub installer : Option < Installer > ,
595
580
/// Download URL announced
596
581
pub download_url : Url ,
597
582
/// Signature announced
@@ -931,7 +916,7 @@ impl Update {
931
916
/// └── ...
932
917
///
933
918
fn install_inner ( & self , bytes : & [ u8 ] ) -> Result < ( ) > {
934
- match self . installer {
919
+ match installer_for_bundle_type ( bundle_type ( ) ) {
935
920
Some ( Installer :: Deb ) => self . install_deb ( bytes) ,
936
921
Some ( Installer :: Rpm ) => self . install_rpm ( bytes) ,
937
922
_ => self . install_appimage ( bytes) ,
@@ -1389,6 +1374,18 @@ impl<'de> Deserialize<'de> for RemoteRelease {
1389
1374
}
1390
1375
}
1391
1376
1377
+ fn installer_for_bundle_type ( bundle : Option < BundleType > ) -> Option < Installer > {
1378
+ match bundle? {
1379
+ BundleType :: Deb => Some ( Installer :: Deb ) ,
1380
+ BundleType :: Rpm => Some ( Installer :: Rpm ) ,
1381
+ BundleType :: AppImage => Some ( Installer :: AppImage ) ,
1382
+ BundleType :: Msi => Some ( Installer :: Msi ) ,
1383
+ BundleType :: Nsis => Some ( Installer :: Nsis ) ,
1384
+ BundleType :: App => Some ( Installer :: App ) ,
1385
+ _ => None ,
1386
+ }
1387
+ }
1388
+
1392
1389
fn parse_version < ' de , D > ( deserializer : D ) -> std:: result:: Result < Version , D :: Error >
1393
1390
where
1394
1391
D : serde:: Deserializer < ' de > ,
0 commit comments