4 Commits

Author SHA1 Message Date
69f67d303e Merge branch 'master' of http://git.dormedas.com/dormedas/town-of-us-updater 2022-09-26 19:08:26 -07:00
6d05440d98 Merge branch 'hotfix-2.0.0' 2022-09-26 19:07:54 -07:00
972c310673 Update 'README.md' 2022-09-26 14:47:01 -07:00
90b703ee30 Bump to 3.0.0 2022-09-26 08:15:17 -07:00
4 changed files with 19 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "town-of-us-updater" name = "town-of-us-updater"
version = "2.3.0" version = "3.0.0"
edition = "2021" edition = "2021"
build = "src/build.rs" build = "src/build.rs"

View File

@@ -7,6 +7,7 @@ A tool to automatically install the **Town of Us R** mod for **Among Us**.
- Caches old builds to allow you to continue playing the mod in case of a breaking Among Us update - Caches old builds to allow you to continue playing the mod in case of a breaking Among Us update
- GUI to select which build to play - GUI to select which build to play
- Auto-detection of Among Us install directory - Auto-detection of Among Us install directory
- Auto-launch of BetterCrewLink if installed
# Contributing # Contributing

View File

@@ -1,4 +1,3 @@
use crate::AmongUsVersion;
use crate::AppData; use crate::AppData;
use druid::{ use druid::{
widget::*, BoxConstraints, Env, Event, EventCtx, FileDialogOptions, LayoutCtx, LifeCycle, widget::*, BoxConstraints, Env, Event, EventCtx, FileDialogOptions, LayoutCtx, LifeCycle,
@@ -45,42 +44,36 @@ impl AmongUsLauncherWidget {
// Iterate first to find labels: // Iterate first to find labels:
let mut flexbox_array: Vec<druid::widget::Flex<AppData>> = Vec::new(); let mut flexbox_array: Vec<druid::widget::Flex<AppData>> = Vec::new();
let mut auv_array: Vec<AmongUsVersion> = Vec::new(); let mut auv_array: Vec<String> = Vec::new();
for i in &collection { for i in &collection {
let existing_ver_smash = i.as_ref().unwrap().file_name(); let existing_ver_smash = i.as_ref().unwrap().file_name();
let mut ver_smash_split = existing_ver_smash.to_str().unwrap().split('-'); let mut ver_smash_split = existing_ver_smash.to_str().unwrap().split('-');
let among_us_version = AmongUsVersion::from(ver_smash_split.next().unwrap()); let auv = ver_smash_split.next().unwrap();
if !auv_array.contains(&among_us_version) { if !auv_array.contains(&auv.to_string()) {
auv_array.push(among_us_version); let label_text = format!("Among Us {}", auv);
let flex: druid::widget::Flex<AppData> = druid::widget::Flex::column()
.with_flex_child(
druid::widget::Label::new(label_text.as_str()).with_text_size(24.0),
1.0,
)
.with_default_spacer();
flexbox_array.push(flex);
auv_array.push(auv.to_string());
} }
} }
auv_array.sort();
for among_us_version in &auv_array {
println!("{}", among_us_version);
let label_text = format!("Among Us {}", among_us_version);
let flex: druid::widget::Flex<AppData> = druid::widget::Flex::column()
.with_flex_child(
druid::widget::Label::new(label_text.as_str()).with_text_size(24.0),
1.0,
)
.with_default_spacer();
flexbox_array.push(flex);
}
println!("Installs list:"); println!("Installs list:");
for i in collection { for i in collection {
let existing_ver_smash = i.unwrap().file_name(); let existing_ver_smash = i.unwrap().file_name();
let mut ver_smash_split = existing_ver_smash.to_str().unwrap().split('-'); let mut ver_smash_split = existing_ver_smash.to_str().unwrap().split('-');
let among_us_version = AmongUsVersion::from(ver_smash_split.next().unwrap()); let auv = ver_smash_split.next().unwrap();
let button_string: String = let button_string: String =
format!("Town of Us {}", ver_smash_split.next().unwrap()); format!("Town of Us {}", ver_smash_split.next().unwrap());
for (index, j) in auv_array.iter().enumerate() { for (index, j) in auv_array.iter().enumerate() {
if j == &among_us_version { if j == auv {
let mut clone: PathBuf = PathBuf::from(data.installs_path.clone()); let mut clone: PathBuf = PathBuf::from(data.installs_path.clone());
clone.push(existing_ver_smash.clone()); clone.push(existing_ver_smash.clone());
@@ -113,8 +106,6 @@ impl AmongUsLauncherWidget {
} }
} }
flexbox_array.reverse();
for i in flexbox_array { for i in flexbox_array {
flex.add_flex_child(i, 1.0); flex.add_flex_child(i, 1.0);
} }

View File

@@ -201,12 +201,10 @@ 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 client = reqwest::blocking::Client::builder() let zip = reqwest::blocking::get(ver_url.1.clone())
.timeout(None) .unwrap()
.build() .bytes()
.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();
} }