Files
SCOPENET-MC/launcher/src-tauri/src/lib.rs
T
Claude 77a15cab8b Launcher: panel accounts via authlib-injector, skin & cape editor
Microsoft sign-in is gone. Server accounts now receive Yggdrasil tokens
from the panel and launch with authlib-injector pointed at the panel's
auth server, so online-mode servers verify players against it.

- Download authlib-injector from the panel mirror (fallback: official),
  SHA-256 verified and cached, with prefetched metadata
- New Skin & cape settings tab: upload, arm style, reset, cape picker
  with front/back previews
- Avatars render from the panel's head endpoint

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011ARcGWxLx21FwXJ3yfGriS
2026-09-28 08:58:27 +00:00

81 lines
2.8 KiB
Rust

//! SCOPENET launcher (Tauri shell). The heavy lifting lives in
//! `scopenet-core`; this crate wires it to the UI.
mod accounts;
mod commands;
mod game;
mod secrets;
mod settings;
mod state;
mod updater;
use tauri::Manager;
pub fn run() {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into()))
.init();
tauri::Builder::default()
// A second launch just focuses the existing window.
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
if let Some(w) = app.get_webview_window("main") {
w.show().ok();
w.unminimize().ok();
w.set_focus().ok();
}
}))
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_opener::init())
.setup(|app| {
let data_dir = app.path().app_data_dir()?;
app.manage(state::AppState::new(data_dir));
// The window starts hidden and the UI reveals it once painted (no
// white flash). If the UI never does, show it anyway.
let handle = app.handle().clone();
std::thread::spawn(move || {
std::thread::sleep(std::time::Duration::from_secs(4));
if let Some(w) = handle.get_webview_window("main") {
if !w.is_visible().unwrap_or(true) {
tracing::warn!("UI didn't signal ready; showing window");
w.show().ok();
}
}
});
Ok(())
})
.invoke_handler(tauri::generate_handler![
commands::bootstrap,
commands::refresh_manifest,
commands::set_panel_url,
commands::save_settings,
commands::login_panel,
commands::register_panel,
commands::add_offline,
commands::account_profile,
commands::upload_skin,
commands::set_skin_model,
commands::delete_skin,
commands::set_cape,
commands::select_account,
commands::remove_account,
commands::launch,
commands::repair_instance,
commands::cancel_launch,
commands::kill_game,
commands::instance_local,
commands::ping_server,
commands::open_folder,
commands::open_file,
commands::storage_info,
commands::delete_instance_data,
commands::clear_cache,
commands::detect_java,
commands::check_update,
commands::install_update,
commands::show_window,
])
.run(tauri::generate_context!())
.expect("error while running the launcher");
}