You've already forked AstralRinth
forked from didirus/AstralRinth
Auth bindings (#58)
* basic framework. still has errors * added functionality for main endpoints + some structuring * formatting * unused code * mimicked CLI function with wait_for process * added basic auth bindings * made PR changes, added playground * cargo fmt * removed missed println * misc tests fixes * cargo fmt * added windows support * cargo fmt * all OS use dunce * restructured profile slightly; fixed mac bug * profile changes, new main.rs * fixed requested pr + canonicaliation bug * fixed regressed bug in ui * fixed regressed bugs * fixed git error * typo * ran prettier * clippy * playground clippy * ported profile loading fix * profile change for real, url println and clippy * PR changes * auth bindings + semisynch flow * fixed dropping task error * prettier, eslint, clippy * removed debugging modifications * removed unused function that eslinter missed :( * fixed settings not being released --------- Co-authored-by: Wyatt <wyatt@modrinth.com>
This commit is contained in:
@@ -6,27 +6,27 @@ use theseus::prelude::*;
|
||||
// invoke('profile_add',profile)
|
||||
#[tauri::command]
|
||||
pub async fn profile_add(profile: Profile) -> Result<()> {
|
||||
let res = profile::add(profile).await?;
|
||||
profile::add(profile).await?;
|
||||
State::sync().await?;
|
||||
Ok(res)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Add a path as a profile in-memory
|
||||
// invoke('profile_add_path',path)
|
||||
#[tauri::command]
|
||||
pub async fn profile_add_path(path: &Path) -> Result<()> {
|
||||
let res = profile::add_path(path).await?;
|
||||
profile::add_path(path).await?;
|
||||
State::sync().await?;
|
||||
Ok(res)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Remove a profile
|
||||
// invoke('profile_add_path',path)
|
||||
#[tauri::command]
|
||||
pub async fn profile_remove(path: &Path) -> Result<()> {
|
||||
let res = profile::remove(path).await?;
|
||||
profile::remove(path).await?;
|
||||
State::sync().await?;
|
||||
Ok(res)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Get a profile by path
|
||||
@@ -77,15 +77,15 @@ pub async fn profile_run(
|
||||
) -> Result<u32> {
|
||||
let proc_lock = profile::run(path, &credentials).await?;
|
||||
let pid = proc_lock.read().await.id().ok_or_else(|| {
|
||||
theseus::Error::from(theseus::ErrorKind::LauncherError(format!(
|
||||
"Process failed to stay open."
|
||||
)))
|
||||
theseus::Error::from(theseus::ErrorKind::LauncherError(
|
||||
"Process failed to stay open.".to_string(),
|
||||
))
|
||||
})?;
|
||||
Ok(pid)
|
||||
}
|
||||
|
||||
// Run Minecraft using a profile, and wait for the result
|
||||
// invoke('profile_wait_for', path, credentials)
|
||||
// invoke('profile_run_wait', path, credentials)
|
||||
#[tauri::command]
|
||||
pub async fn profile_run_wait(
|
||||
path: &Path,
|
||||
@@ -101,7 +101,7 @@ pub async fn profile_run_wait(
|
||||
#[tauri::command]
|
||||
pub async fn profile_wait_for(pid: u32) -> Result<()> {
|
||||
let st = State::get().await?;
|
||||
if let Some(proc_lock) = st.children.blocking_read().get(&pid) {
|
||||
if let Some(proc_lock) = st.children.read().await.get(&pid) {
|
||||
let mut proc = proc_lock.write().await;
|
||||
return Ok(profile::wait_for(&mut proc).await?);
|
||||
}
|
||||
@@ -114,8 +114,7 @@ pub async fn profile_wait_for(pid: u32) -> Result<()> {
|
||||
#[tauri::command]
|
||||
pub async fn profile_kill(pid: u32) -> Result<()> {
|
||||
let st = State::get().await?;
|
||||
let st = State::get().await?;
|
||||
if let Some(proc_lock) = st.children.blocking_read().get(&pid) {
|
||||
if let Some(proc_lock) = st.children.read().await.get(&pid) {
|
||||
let mut proc = proc_lock.write().await;
|
||||
return Ok(profile::kill(&mut proc).await?);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user