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:
Wyatt Verchere
2023-03-31 18:44:26 -07:00
committed by GitHub
parent f48959a816
commit 6a05276a21
14 changed files with 447 additions and 46 deletions

View File

@@ -25,6 +25,9 @@ pub use self::users::*;
mod children;
pub use self::children::*;
mod auth_task;
pub use self::auth_task::*;
// Global state
static LAUNCHER_STATE: OnceCell<Arc<State>> = OnceCell::const_new();
pub struct State {
@@ -39,8 +42,10 @@ pub struct State {
// TODO: settings API
/// Launcher configuration
pub settings: RwLock<Settings>,
/// Reference to process children
/// Reference to minecraft process children
pub children: RwLock<Children>,
/// Authentication flow
pub auth_flow: RwLock<AuthTask>,
/// Launcher profile metadata
pub(crate) profiles: RwLock<Profiles>,
/// Launcher user account info
@@ -80,6 +85,8 @@ impl State {
let children = Children::new();
let auth_flow = AuthTask::new();
Ok(Arc::new(Self {
database,
directories,
@@ -89,6 +96,7 @@ impl State {
profiles: RwLock::new(profiles),
users: RwLock::new(users),
children: RwLock::new(children),
auth_flow: RwLock::new(auth_flow),
}))
}
})