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,17 @@
|
||||
[package]
|
||||
name = "tessera-desktop"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "tessera_desktop_lib"
|
||||
crate-type = ["cdylib", "staticlib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = ["tray-icon"] }
|
||||
tauri-plugin-store = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Tessera desktop capabilities",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"store:default"
|
||||
]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 361 B |
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 105 B |
@@ -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");
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
tessera_desktop_lib::run()
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/tauri-apps/tauri/dev/crates/tauri-config-schema/schema.json",
|
||||
"productName": "Tessera",
|
||||
"version": "0.0.1",
|
||||
"identifier": "de.ctl.tessera.desktop",
|
||||
"build": {
|
||||
"frontendDist": "../src",
|
||||
"devUrl": "http://localhost:1420"
|
||||
},
|
||||
"app": {
|
||||
"withGlobalTauri": true,
|
||||
"windows": [
|
||||
{
|
||||
"label": "main",
|
||||
"title": "Tessera",
|
||||
"width": 1280,
|
||||
"height": 800,
|
||||
"center": true,
|
||||
"decorations": true,
|
||||
"resizable": true
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": "default-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src *; img-src * data:; font-src * data:; style-src 'self' 'unsafe-inline' *; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://unpkg.com"
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": ["appimage", "nsis"],
|
||||
"icon": ["icons/icon.png", "icons/icon.ico"]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user