diff --git a/dist-js/index.d.ts b/dist-js/index.d.ts index e560083..912e49a 100644 --- a/dist-js/index.d.ts +++ b/dist-js/index.d.ts @@ -17,6 +17,10 @@ interface CheckOptions { * Target identifier for the running application. This is sent to the backend. */ target?: string; + /** + * Allow downgrades to previous versions by not checking if the current version is greater than the available version. + */ + allowDowngrades?: boolean; } /** Options used when downloading an update */ interface DownloadOptions { diff --git a/guest-js/index.ts b/guest-js/index.ts index 87f7929..c33033e 100644 --- a/guest-js/index.ts +++ b/guest-js/index.ts @@ -22,6 +22,10 @@ interface CheckOptions { * Target identifier for the running application. This is sent to the backend. */ target?: string + /** + * Allow downgrades to previous versions by not checking if the current version is greater than the available version. + */ + allowDowngrades?: boolean } /** Options used when downloading an update */ diff --git a/src/commands.rs b/src/commands.rs index ae84294..129c413 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -46,6 +46,7 @@ pub(crate) async fn check( timeout: Option, proxy: Option, target: Option, + allow_downgrades: Option, ) -> Result> { let mut builder = webview.updater_builder(); if let Some(headers) = headers { @@ -63,6 +64,9 @@ pub(crate) async fn check( if let Some(target) = target { builder = builder.target(target); } + if allow_downgrades.unwrap_or(false) { + builder = builder.version_comparator(|current, update| update.version != current); + } let updater = builder.build()?; let update = updater.check().await?;