Self-hosted, federated location sharing app and server that prioritizes user privacy and security
end-to-end-encryption location-sharing privacy self-hosted federated
at auth 1.4 kB view raw
1use std::path::PathBuf; 2use tauri::{WebviewUrl, WebviewWindowBuilder}; 3use tauri_plugin_store::StoreBuilder; 4 5// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ 6#[tauri::command] 7fn greet(name: &str) -> String { 8 format!("Hello, {}! You've been greeted from Rust!", name) 9} 10 11#[cfg_attr(mobile, tauri::mobile_entry_point)] 12pub fn run() { 13 tauri::Builder::default() 14 .setup(|app| { 15 let app_handle = app.handle(); 16 let store_path = PathBuf::from("settings.json"); 17 let store = StoreBuilder::new(app_handle, store_path).build()?; 18 19 let user_id = store.get("user_id"); 20 21 let page = if user_id.is_some() { 22 "/src/home-page/home.html" 23 } else { 24 "/src/signup-page/signup.html" 25 }; 26 27 // create and open window directly at the correct page 28 WebviewWindowBuilder::new(app_handle, "main", WebviewUrl::App(page.into())) 29 .title("privacypin") 30 .inner_size(412.0, 715.0) 31 .resizable(false) 32 .build()?; 33 34 Ok(()) 35 }) 36 .plugin(tauri_plugin_store::Builder::default().build()) 37 .invoke_handler(tauri::generate_handler![greet]) 38 .run(tauri::generate_context!()) 39 .expect("error while running tauri application"); 40}