Complete private authentication, server integrations and activity reporting
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.
This commit is contained in:
commit
a1f19e86c6
74 files changed
+2108
-95
No files matched your search
@@ -14,6 +14,11 @@ use tauri_plugin_opener::OpenerExt;
|
||||
/// Commands return `Err(String)`; the UI shows it as-is.
|
||||
type Res<T> = Result<T, String>;
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn record_activity(state: State<'_, AppState>, kind: String, instance_id: Option<String>) -> Res<()> {
|
||||
crate::telemetry::send(&state, &kind, instance_id.as_deref().unwrap_or("")).await.map_err(aerr)
|
||||
}
|
||||
|
||||
fn err(e: impl std::fmt::Display) -> String {
|
||||
e.to_string()
|
||||
}
|
||||
@@ -152,6 +157,7 @@ pub fn select_account(state: State<'_, AppState>, id: String) -> Res<()> {
|
||||
|
||||
#[tauri::command]
|
||||
pub fn remove_account(state: State<'_, AppState>, id: String) -> Res<()> {
|
||||
crate::telemetry::background(&state, "logout", "");
|
||||
let mut accounts = state.accounts.write().unwrap();
|
||||
accounts.accounts.retain(|a| a.id != id);
|
||||
if accounts.active.as_deref() == Some(id.as_str()) {
|
||||
@@ -216,6 +222,11 @@ pub async fn set_cape(state: State<'_, AppState>, cape_id: Option<i64>) -> Res<P
|
||||
|
||||
// ---- game ----
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn set_username(state: State<'_, AppState>, username: String, password: String) -> Res<accounts::Account> {
|
||||
accounts::rename_panel(&state, &username, &password).await.map_err(aerr)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn launch(app: AppHandle, state: State<'_, AppState>, instance_id: String) -> Res<()> {
|
||||
start_task(app, &state, instance_id, true, false)
|
||||
@@ -237,6 +248,7 @@ fn start_task(app: AppHandle, state: &AppState, instance_id: String, start: bool
|
||||
let app2 = app.clone();
|
||||
let handle = tauri::async_runtime::spawn(async move {
|
||||
if let Err(e) = game::run(app2.clone(), instance_id.clone(), start, deep).await {
|
||||
crate::telemetry::background(&app2.state::<AppState>(), "launch_failed", &instance_id);
|
||||
tracing::error!("launch failed: {e:#}");
|
||||
game::emit_state(&app2, &instance_id, "error", Some(format!("{e:#}")));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user