mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-13 05:37:21 -05:00
feat: add signed Windows launcher self-updates with SHA-256 verification
This commit is contained in:
@@ -733,6 +733,8 @@ fn main() {
|
||||
.current_dir(&root_dir)
|
||||
.env("APPDATA_PATH", &vyla_files_str)
|
||||
.env("NODE_EXE", &node_bin)
|
||||
.env("VYLA_APP_VERSION", env!("CARGO_PKG_VERSION"))
|
||||
.env("VYLA_DEV", if cfg!(debug_assertions) { "1" } else { "0" })
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped());
|
||||
@@ -796,6 +798,40 @@ fn main() {
|
||||
};
|
||||
|
||||
match msg.event.as_str() {
|
||||
"self-update" => {
|
||||
let target = msg
|
||||
.data
|
||||
.get("path")
|
||||
.and_then(|p| p.as_str())
|
||||
.map(PathBuf::from);
|
||||
if let Some(p) = target {
|
||||
let name = p
|
||||
.file_name()
|
||||
.and_then(|n| n.to_str())
|
||||
.unwrap_or("")
|
||||
.to_string();
|
||||
if name.starts_with("vyla-installer-")
|
||||
&& name.ends_with(".exe")
|
||||
&& p.exists()
|
||||
{
|
||||
let state: State<NodeServices> = w.state();
|
||||
if let Ok(mut lock) = state.0.lock() {
|
||||
if let Some(mut child) = lock.take() {
|
||||
kill_child_process(&mut child);
|
||||
}
|
||||
};
|
||||
let mut installer = Command::new(&p);
|
||||
installer.args(["/S", "/UPDATE"]);
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::process::CommandExt;
|
||||
installer.creation_flags(0x00000008 | 0x00000200);
|
||||
}
|
||||
let _ = installer.spawn();
|
||||
w.app_handle().exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
"ready" => {
|
||||
if let Some(u) = msg.data.get("url").and_then(|u| u.as_str()) {
|
||||
if let Ok(mut g) = READY_URL.lock() {
|
||||
|
||||
Reference in New Issue
Block a user