windows: updates from the app, and a dark theme
The service looks at the project's releases (windows-v* tags; pre-releases for a pre-release), fetches the newer setup program, checks its SHA-256 against the one published beside it, and runs it silently, detached, out of any job: the setup stops the service, replaces it, and starts it again. Run by the service (session 0), the setup's install starts the app in each signed-in user's session with their token rather than through Explorer. A failed copy during an upgrade starts the old service and app again. Request::UpdateCheck (anyone), UpdateInstall (services scope); proxy-ctl update [check|install]; the app's Overview card. The app's own preferences (%APPDATA%\ProxySuite\app.json): the theme (light, dark, or as Windows, followed as it changes; the title bar too) and whether to look for updates at start and daily. Settings > This app, and a sun/moon toggle in the sidebar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ed9275250b
commit
5bd47f7676
32 files changed
+911
-26
No files matched your search
@@ -69,6 +69,20 @@ enum Cmd {
|
||||
#[command(subcommand)]
|
||||
verb: Option<ComponentsVerb>,
|
||||
},
|
||||
/// Proxy Suite itself: whether a newer release is out, and installing it.
|
||||
Update {
|
||||
#[command(subcommand)]
|
||||
verb: Option<UpdateVerb>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum UpdateVerb {
|
||||
/// This version, and a newer release if there is one.
|
||||
Check,
|
||||
/// Fetch the newest release's setup program, check it and run it: the service and the app
|
||||
/// stop for a moment and start again, new.
|
||||
Install,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
@@ -702,6 +716,31 @@ async fn zapret(ctl: &Ctl, verb: Option<ZapretVerb>) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn update(ctl: &Ctl, verb: Option<UpdateVerb>) -> Result<()> {
|
||||
match verb.unwrap_or(UpdateVerb::Check) {
|
||||
UpdateVerb::Check => {
|
||||
let r = ctl.call(Request::UpdateCheck).await?;
|
||||
if ctl.json {
|
||||
ctl.print(&r);
|
||||
return Ok(());
|
||||
}
|
||||
let current = r["current"].as_str().unwrap_or("?");
|
||||
match r["available"].as_object() {
|
||||
Some(a) => {
|
||||
println!("Proxy Suite {current}; {} is out: {}", a["version"].as_str().unwrap_or("?"), a["page"].as_str().unwrap_or(""));
|
||||
println!("Install it with: proxy-ctl update install");
|
||||
}
|
||||
None => println!("Proxy Suite {current} is the newest release."),
|
||||
}
|
||||
}
|
||||
UpdateVerb::Install => {
|
||||
let r = ctl.call(Request::UpdateInstall).await?;
|
||||
println!("Installing Proxy Suite {}: the service stops for a moment and starts again.", r["version"].as_str().unwrap_or("?"));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn awg(ctl: &Ctl, verb: Option<AwgVerb>) -> Result<()> {
|
||||
match verb.unwrap_or(AwgVerb::List) {
|
||||
AwgVerb::List => {
|
||||
@@ -901,6 +940,7 @@ async fn real_main() -> Result<()> {
|
||||
Cmd::Components { verb } => components(&ctl, verb).await?,
|
||||
Cmd::Wl { verb } => wl(&ctl, verb).await?,
|
||||
Cmd::Awg { verb } => awg(&ctl, verb).await?,
|
||||
Cmd::Update { verb } => update(&ctl, verb).await?,
|
||||
Cmd::Tg { verb: TgVerb::Link } => {
|
||||
let r = ctl.call(Request::TgLinks).await?;
|
||||
for l in r["links"].as_array().into_iter().flatten().filter_map(Value::as_str) {
|
||||
|
||||
Reference in new issue
Block a user