Add Fabric/Forge version builds and Paper integration, preserve permanent player identities across renames, harden session authorization, and surface privacy-conscious launcher/server activity in the panel.
84 lines
2.8 KiB
Rust
84 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 telemetry;
|
|
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::record_activity,
|
|
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::set_username,
|
|
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");
|
|
}
|