Various final backend fixes (#117)

* Various final backend fixes

* Add FS watching

* run lint

* Autodetect installed jars
This commit is contained in:
Geometrically
2023-05-16 15:30:04 -07:00
committed by GitHub
parent 5cb54b44be
commit 3fa0e99de2
26 changed files with 941 additions and 529 deletions

View File

@@ -7,8 +7,7 @@ use dunce::canonicalize;
use theseus::jre::autodetect_java_globals;
use theseus::prelude::*;
use theseus::profile_create::profile_create;
use tokio::time::{sleep, Duration};
use tracing_error::ErrorLayer;
use tracing_subscriber::layer::SubscriberExt;
@@ -51,6 +50,8 @@ async fn main() -> theseus::Result<()> {
let st = State::get().await?;
//State::update();
// let path = jre::auto_install_java(8).await.unwrap();
st.settings.write().await.java_globals = autodetect_java_globals().await?;
st.settings.write().await.max_concurrent_downloads = 50;
st.settings.write().await.hooks.post_exit =
@@ -58,6 +59,12 @@ async fn main() -> theseus::Result<()> {
// Changed the settings, so need to reset the semaphore
st.reset_fetch_semaphore().await;
//
// st.settings
// .write()
// .await
// .java_globals
// .insert(JAVA_8_KEY.to_string(), check_jre(path).await?.unwrap());
// Clear profiles
println!("Clearing profiles.");
{
@@ -69,52 +76,53 @@ async fn main() -> theseus::Result<()> {
println!("Creating/adding profile.");
// let name = "Example".to_string();
// let game_version = "1.19.2".to_string();
// let modloader = ModLoader::Vanilla;
// let loader_version = "stable".to_string();
//
// let profile_path = profile_create(
// name.clone(),
// game_version,
// modloader,
// Some(loader_version),
// None,
// None,
// None,
// None,
// )
// .await?;
let name = "Example".to_string();
let game_version = "1.19.2".to_string();
let modloader = ModLoader::Vanilla;
let loader_version = "stable".to_string();
let profile_path = profile_create(
name.clone(),
game_version,
modloader,
Some(loader_version),
None,
None,
None,
None,
)
.await?;
//
// install(&profile_path).await.unwrap();
// let mut value = list().await?;
// let profile_path = value.iter().next().map(|x| x.0).unwrap();
// println!("Adding sodium");
// let sodium_path = profile::add_project_from_version(
// &profile_path,
// "rAfhHfow".to_string(),
// )
// .await?;
//
// let mod_menu_path = profile::add_project_from_version(
// &profile_path,
// "gSoPJyVn".to_string(),
// )
// .await?;
//
// println!("Disabling sodium");
// profile::toggle_disable_project(&profile_path, &sodium_path).await?;
// profile::remove_project(&profile_path, &mod_menu_path).await?;
let profile_path = pack::install_pack_from_version_id(
"CeeCkHke".to_string(),
"Technical Electrical".to_string(),
None,
println!("Adding sodium");
let sodium_path = profile::add_project_from_version(
&profile_path,
"rAfhHfow".to_string(),
)
.await
.unwrap();
.await?;
let mod_menu_path = profile::add_project_from_version(
&profile_path,
"gSoPJyVn".to_string(),
)
.await?;
println!("Disabling sodium");
profile::toggle_disable_project(&profile_path, &sodium_path).await?;
profile::remove_project(&profile_path, &mod_menu_path).await?;
// let profile_path = pack::install_pack_from_version_id(
// "CeeCkHke".to_string(),
// "Technical Electrical".to_string(),
// None,
// )
// .await
// .unwrap();
// async closure for testing any desired edits
// (ie: changing the java runtime of an added profile)
@@ -147,8 +155,8 @@ async fn main() -> theseus::Result<()> {
println!("Minecraft PID: {:?}", pid);
// Wait 5 seconds
println!("Waiting 20 seconds to gather logs...");
sleep(Duration::from_secs(20)).await;
println!("Waiting 5 seconds to gather logs...");
sleep(Duration::from_secs(5)).await;
let stdout = process::get_stdout_by_uuid(&uuid).await?;
let stderr = process::get_stderr_by_uuid(&uuid).await?;
println!("Logs after 5sec <<< {stdout} >>> end stdout");