Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugins/updater/guest-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 4 additions & 0 deletions plugins/updater/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub(crate) async fn check<R: Runtime>(
timeout: Option<u64>,
proxy: Option<String>,
target: Option<String>,
allow_downgrades: Option<bool>,
) -> Result<Option<Metadata>> {
let mut builder = webview.updater_builder();
if let Some(headers) = headers {
Expand All @@ -63,6 +64,9 @@ pub(crate) async fn check<R: Runtime>(
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?;
Expand Down
Loading