Some checks are pending
Release Multiplatform Binaries / build (deb,appimage, linux-x86_64, ubuntu-22.04, x86_64-unknown-linux-gnu) (push) Waiting to run
Release Multiplatform Binaries / build (dmg,app, macos-arm64, macos-14, aarch64-apple-darwin) (push) Waiting to run
Release Multiplatform Binaries / build (dmg,app, macos-x86_64, macos-14, x86_64-apple-darwin) (push) Waiting to run
Release Multiplatform Binaries / build (nsis, windows-x86_64, windows-latest, x86_64-pc-windows-msvc) (push) Waiting to run
Release Multiplatform Binaries / create-release (push) Blocked by required conditions
- Rebased onto official Polyfrost OneLauncher v2.3.1 (commit 0e49c691)
- Preserved 100% offline authentication without requiring Microsoft accounts
- Integrated custom 3D offline skin changer with UUID character slot targeting
- Maintained CustomSkinLoader auto-configuration for Ely.by and SkinRestorer
- Maintained direct GitHub Releases auto-updater pointing to oiupoyt/OneLauncher-Cracked
- Maintained mods filter popover fix eliminating text ghosting/duplication
- Configured dev profile to prevent debug symbol bloat
48 lines
1.4 KiB
Rust
48 lines
1.4 KiB
Rust
|
|
use std::process::Command;
|
|
|
|
use oneclient_core::{dev, logger, LauncherResult};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> LauncherResult<()> {
|
|
logger::init_debug()?;
|
|
let state = dev::initialize().await?;
|
|
|
|
let session = state.auth.begin_microsoft_login().await?;
|
|
|
|
println!("Sign in with EITHER method:\n");
|
|
println!(" Browser: opening {}", session.browser.auth_url);
|
|
try_open_browser(&session.browser.auth_url);
|
|
println!(
|
|
" Device code: go to {} and enter {}\n",
|
|
session.device.verification_uri, session.device.user_code
|
|
);
|
|
|
|
println!("Waiting for you to sign in...");
|
|
let account = state.auth.finish_microsoft_login(session).await?;
|
|
|
|
println!(
|
|
"Signed in as {} ({})\n token expires: {}",
|
|
account.username, account.id, account.expires
|
|
);
|
|
println!("Account saved to {}", oneclient_common::paths::auth_file()?.display());
|
|
|
|
Ok(())
|
|
}
|
|
|
|
fn try_open_browser(url: &str) {
|
|
let result = if cfg!(target_os = "windows") {
|
|
Command::new("cmd").args(["/C", "start", "", url]).spawn()
|
|
} else if cfg!(target_os = "macos") {
|
|
Command::new("open").arg(url).spawn()
|
|
} else {
|
|
Command::new("xdg-open").arg(url).spawn()
|
|
};
|
|
|
|
match result {
|
|
Ok(_) => println!("Opened verification page in your default browser.\n"),
|
|
Err(err) => {
|
|
println!("Could not open browser automatically ({err}). Open the URL above manually.\n");
|
|
}
|
|
}
|
|
}
|