feat(06-01): scaffold apps/desktop as @tessera/desktop Tauri 2.x project
- Create Tauri project structure with Cargo.toml, tauri.conf.json, build.rs - Implement lib.rs with store plugin and server URL navigation on startup - Configure capabilities with core:default and store:default permissions - Set frontendDist to ../src for local setup page (no bundled frontend) - Add placeholder icons for build compatibility (to be replaced in 06-02) - Add Cargo target/ to .gitignore - Window config: 1280x800, centered, native decorations, resizable Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_store::StoreExt;
|
||||
|
||||
/// Main entry point for the Tessera desktop application.
|
||||
///
|
||||
/// Registers plugins, checks for a stored server URL on startup,
|
||||
/// and either navigates to the configured server or shows the
|
||||
/// bundled setup page for first-run configuration.
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_store::Builder::new().build())
|
||||
.setup(|app| {
|
||||
// Attempt to read a previously stored server URL
|
||||
let store = app.store("config.json")?;
|
||||
let server_url = store.get("server_url");
|
||||
|
||||
if let Some(url_value) = server_url {
|
||||
if let Some(url_str) = url_value.as_str() {
|
||||
if !url_str.is_empty() {
|
||||
// Navigate the main window to the configured server URL
|
||||
if let Some(window) = app.get_webview_window("main") {
|
||||
if let Ok(parsed) = url_str.parse::<tauri::Url>() {
|
||||
let _ = window.navigate(parsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// If no server_url is stored, the WebView remains on the
|
||||
// bundled setup page (frontendDist = ../src/setup.html)
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running Tessera desktop application");
|
||||
}
|
||||
Reference in New Issue
Block a user