| Crates.io | lighty-tauri |
| lib.rs | lighty-tauri |
| version | 0.8.6 |
| created_at | 2025-12-02 11:29:16.242453+00 |
| updated_at | 2025-12-14 07:29:52.224056+00 |
| description | Tauri integration for Lighty Launcher |
| homepage | https://github.com/Lighty-Launcher/LightyLauncherLib |
| repository | https://github.com/Lighty-Launcher/LightyLauncherLib |
| max_upload_size | |
| id | 1961644 |
| size | 164,466 |
Tauri integration for LightyLauncher.
This is an internal crate for the LightyLauncher ecosystem. Most users should use the main lighty-launcher crate with the tauri-commands feature instead.
lighty-tauri/
└── src/
├── lib.rs # Module declarations and re-exports
├── core.rs # Core types (re-exports AppState from lighty-core)
├── tauri_commands.rs # Main command exports
└── commands/ # Command implementations
├── mod.rs
├── auth/ # Authentication commands
│ └── mod.rs # Offline, Microsoft, Azuriom
├── core/ # Core commands
│ └── mod.rs # AppState init, path utilities
├── java/ # Java distribution commands
│ └── mod.rs
├── launch/ # Launch command
│ └── mod.rs
├── loaders/ # Loader enumeration
│ └── mod.rs
├── version/ # Version checking
│ └── mod.rs
└── utils/ # Utilities
├── mod.rs
└── parse.rs # Configuration parsing
Add to your Cargo.toml:
[dependencies]
lighty-launcher = { version = "0.8.2", features = ["tauri-commands", "all-loaders"] }
tauri = { version = "2", features = [] }
The easiest way to integrate LightyLauncher with Tauri is to use the plugin:
use lighty_launcher::tauri::lighty_plugin;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(lighty_plugin())
.run(tauri::generate_context!())
.expect("error running tauri application");
}
That's it! All commands are automatically registered and ready to use from your frontend.
The plugin approach is recommended because:
import { invoke } from '@tauri-apps/api/tauri';
// Initialize app state (REQUIRED - call first!)
await invoke('init_app_state', {
qualifier: 'com',
organization: 'example',
application: 'MyLauncher'
});
// Authenticate (Offline)
const profile = await invoke('authenticate_offline', {
username: 'PlayerName'
});
console.log(profile); // { username: 'PlayerName', uuid: '...', accessToken: null }
// Authenticate (Microsoft)
const msProfile = await invoke('authenticate_microsoft', {
clientId: 'your-azure-client-id'
});
// Authenticate (Azuriom)
const azProfile = await invoke('authenticate_azuriom', {
url: 'https://your-server.com',
username: 'player',
password: 'password123'
});
// Launch a Minecraft version
await invoke('launch', {
versionConfig: {
name: 'fabric-1.21',
loader: 'fabric',
loaderVersion: '0.16.9',
minecraftVersion: '1.21',
},
launchConfig: {
username: profile.username,
uuid: profile.uuid,
javaDistribution: 'temurin',
},
});
// Get available loaders
const loaders = await invoke('get_loaders');
console.log(loaders);
// [
// { name: 'vanilla', displayName: 'Vanilla' },
// { name: 'fabric', displayName: 'Fabric' },
// ...
// ]
// Get Java distributions
const javaDistributions = await invoke('get_java_distributions');
console.log(javaDistributions);
// [
// { name: 'temurin', displayName: 'Eclipse Temurin' },
// { name: 'graalvm', displayName: 'GraalVM' }
// ]
// Get launcher directory path
const launcherPath = await invoke('get_launcher_path');
console.log(launcherPath); // "/home/user/.local/share/MyLauncher"
// Check if version exists
const exists = await invoke('check_version_exists', {
versionName: 'fabric-1.21'
});
console.log(exists); // true or false
With the events feature enabled, you can subscribe to real-time events from the launcher:
[dependencies]
lighty-launcher = { version = "0.8.2", features = ["tauri-commands", "all-loaders", "events"] }
use lighty_launcher::tauri::lighty_plugin;
use lighty_event::EventBus;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(lighty_plugin())
.setup(|app| {
// Create event bus
let event_bus = EventBus::new(100);
// Subscribe to events (will emit to frontend)
subscribe_to_events(app.handle(), event_bus.clone());
// Store event_bus in state for use in commands
app.manage(event_bus);
Ok(())
})
.run(tauri::generate_context!())
.expect("error running tauri application");
}
import { listen } from '@tauri-apps/api/event';
// Listen to all launcher events
await listen('lighty-event', (event) => {
const { eventType, data } = event.payload;
switch(eventType) {
case 'auth':
console.log('Auth event:', data);
break;
case 'java':
console.log('Java event:', data);
// e.g., { type: 'DownloadProgress', current: 50, total: 100 }
break;
case 'launch':
console.log('Launch event:', data);
break;
case 'loader':
console.log('Loader event:', data);
break;
case 'core':
console.log('Core event:', data);
// e.g., { type: 'DownloadStarted', url: '...', file: '...' }
break;
}
});
Initialize the application state. Must be called first before any other command!
Parameters:
qualifier: Qualifier (e.g., "com")organization: Organization nameapplication: Application nameReturns: Result<(), String>
Get the launcher data directory path.
Returns: String
Authenticate in offline mode (no network required).
Parameters:
username: Player usernameReturns: AuthResult { username: String, uuid: String, accessToken: Option<String> }
Authenticate using Microsoft OAuth 2.0.
Parameters:
client_id: Azure AD application client IDReturns: AuthResult
Authenticate using Azuriom CMS.
Parameters:
url: Azuriom instance base URLusername: Usernamepassword: PasswordReturns: AuthResult
Launch a Minecraft version.
Parameters:
version_config: Version configuration (name, loader, loader_version, minecraft_version)launch_config: Launch configuration (username, uuid, java_distribution)Returns: LaunchResult { success: bool, message: String }
Get list of available Java distributions.
Returns: Vec<JavaDistInfo { name: String, display_name: String }>
Get list of available mod loaders.
Returns: Vec<LoaderInfo { name: String, display_name: String }>
Check if a version directory exists.
Parameters:
version_name: Name of the versionReturns: bool
Delete a version directory.
Parameters:
version_name: Name of the version to deleteReturns: Result<(), String>
All commands properly handle errors and return them to the frontend:
try {
await invoke('launch', { ... });
} catch (error) {
console.error('Launch failed:', error);
}
For complete integration guide, see TAURI_USAGE.md in the main repository.
MIT