Skip to content

Conversation

@LeeeSe
Copy link

@LeeeSe LeeeSe commented Aug 20, 2025

Add proxy support to Updater and UpdaterBuilder.

When a binary is packaged as an app and runs on Mac, cargo packager updater doesn't automatically use a proxy to check for and download updates. I've added a proxy configuration option to UpdaterBuilder to enable automatic use of system proxy (optional).

@denjell-crabnebula
Copy link
Contributor

Thanks for the proposal.

I feel at the very least, that this will absolutely need some kind of documentary support, ie. over at https://docs.crabnebula.dev/packager/

@LeeeSe
Copy link
Author

LeeeSe commented Aug 20, 2025

Sorry, my description was incorrect. Actually, I just added a proxy parameter for the updater, providing users with an option to set a proxy address for their own app. It's not that I set a switch for the updater that, when turned on, automatically uses the system proxy.

Its usage is as follows:

use cargo_packager_updater::{UpdaterBuilder, Config};
use semver::Version;

let config = Config {
  endpoints: vec!["http://myserver.com/updates".parse().unwrap()],
  pubkey: "<pubkey here>".into(),
  ..Default::default()
};

let current_version = Version::parse("0.1.0").unwrap();

let updater = UpdaterBuilder::new(current_version, config)
    .proxy("http://your-proxy-address:port") // set your proxy url
    .build()
    .unwrap();

if let Some(update) = updater.check().expect("failed while checking for update") {
    update.download_and_install().expect("failed to download and install update");
}

If you think this small change needs to be documented on the doc, I'm willing to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants