Compare commits
3 Commits
972c310673
...
2.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f1a6c6bc1 | |||
| 856cffd740 | |||
| 686d24f7b5 |
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "town-of-us-updater"
|
name = "town-of-us-updater"
|
||||||
version = "2.0.0"
|
version = "2.2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
build = "src/build.rs"
|
build = "src/build.rs"
|
||||||
|
|
||||||
|
|||||||
@@ -128,6 +128,11 @@ impl Widget<AppData> for AmongUsLauncherWidget {
|
|||||||
self.build_widget(data);
|
self.build_widget(data);
|
||||||
ctx.children_changed();
|
ctx.children_changed();
|
||||||
}
|
}
|
||||||
|
Event::KeyDown(evt) => {
|
||||||
|
if evt.code == druid::Code::F5 {
|
||||||
|
ctx.submit_command(ATTEMPT_INSTALL);
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
self.root.event(ctx, event, data, env);
|
self.root.event(ctx, event, data, env);
|
||||||
}
|
}
|
||||||
@@ -141,7 +146,7 @@ impl Widget<AppData> for AmongUsLauncherWidget {
|
|||||||
self.root.update(ctx, data, env);
|
self.root.update(ctx, data, env);
|
||||||
if old_data.among_us_path.is_empty() && !data.among_us_path.is_empty() {
|
if old_data.among_us_path.is_empty() && !data.among_us_path.is_empty() {
|
||||||
ctx.submit_command(ATTEMPT_INSTALL);
|
ctx.submit_command(ATTEMPT_INSTALL);
|
||||||
println!("Detect Stuff");
|
// println!("Detect Stuff");
|
||||||
}
|
}
|
||||||
// println!("Update!");
|
// println!("Update!");
|
||||||
self.build_widget(data);
|
self.build_widget(data);
|
||||||
|
|||||||
16
src/main.rs
16
src/main.rs
@@ -121,10 +121,13 @@ impl AppDelegate<AppData> for Delegate {
|
|||||||
fn window_added(
|
fn window_added(
|
||||||
&mut self,
|
&mut self,
|
||||||
_id: WindowId,
|
_id: WindowId,
|
||||||
_data: &mut AppData,
|
data: &mut AppData,
|
||||||
_env: &Env,
|
_env: &Env,
|
||||||
_ctx: &mut DelegateCtx,
|
ctx: &mut DelegateCtx,
|
||||||
) {
|
) {
|
||||||
|
if !data.among_us_path.is_empty() {
|
||||||
|
ctx.submit_command(ATTEMPT_INSTALL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fn command(
|
fn command(
|
||||||
&mut self,
|
&mut self,
|
||||||
@@ -198,10 +201,12 @@ impl AppDelegate<AppData> for Delegate {
|
|||||||
"Downloading Town of Us... Please be patient! [{}]",
|
"Downloading Town of Us... Please be patient! [{}]",
|
||||||
ver_url.1.clone()
|
ver_url.1.clone()
|
||||||
);
|
);
|
||||||
let zip = reqwest::blocking::get(ver_url.1.clone())
|
let client = reqwest::blocking::Client::builder()
|
||||||
.unwrap()
|
.timeout(None)
|
||||||
.bytes()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
let zip_request = client.get(ver_url.1.clone()).build().unwrap();
|
||||||
|
let zip = client.execute(zip_request).unwrap().bytes().unwrap();
|
||||||
fs::write(download_path.clone(), zip).unwrap();
|
fs::write(download_path.clone(), zip).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,6 +233,7 @@ impl AppDelegate<AppData> for Delegate {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data.initialized = !data.initialized;
|
||||||
|
|
||||||
return Handled::Yes;
|
return Handled::Yes;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user