Self-hosted, federated location sharing app and server that prioritizes user privacy and security
end-to-end-encryption location-sharing privacy self-hosted federated
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

handle initial route selection fully in rust

azomDev 01598257 a7a0ec13

+44 -30
+1
app/README.md
··· 1 + - in src-tauri/src/lib.rs, we directly create the webpage with home-page as it's starting point so that "logging in" (seeing if the user id is set) is checked before the webview window is even created. This is fine since we are only checking a single value
-14
app/index.html
··· 1 - <script type="module"> 2 - import { Store } from "/src/utils/store.ts"; 3 - 4 - // For testing (to easily go to home or signup page). You only need to uncomment the right line, run it once, and comment it out again right after 5 - await Store.reset(); 6 - // await Store.set("user_id", "adummyuserid"); 7 - 8 - // await alert(appLocalDataDirPath); // ~/.local/share/dev.azom.privacypin 9 - if (await Store.isLoggedIn()) { 10 - window.location.href = "/src/home-page/home.html"; 11 - } else { 12 - window.location.href = "/src/signup-page/signup.html"; 13 - } 14 - </script>
+26 -1
app/src-tauri/src/lib.rs
··· 1 + use std::path::PathBuf; 2 + use tauri::{WebviewUrl, WebviewWindowBuilder}; 3 + use tauri_plugin_store::StoreBuilder; 4 + 1 5 // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ 2 6 #[tauri::command] 3 7 fn greet(name: &str) -> String { ··· 7 11 #[cfg_attr(mobile, tauri::mobile_entry_point)] 8 12 pub fn run() { 9 13 tauri::Builder::default() 10 - .plugin(tauri_plugin_opener::init()) 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 + }) 11 36 .plugin(tauri_plugin_store::Builder::default().build()) 12 37 .invoke_handler(tauri::generate_handler![greet]) 13 38 .run(tauri::generate_context!())
+2 -15
app/src-tauri/tauri.conf.json
··· 11 11 }, 12 12 "app": { 13 13 "withGlobalTauri": true, 14 - "windows": [ 15 - { 16 - "title": "privacypin", 17 - "width": 412, 18 - "height": 715, 19 - "resizable": false 20 - } 21 - ], 14 + "windows": [], 22 15 "security": { 23 16 "csp": null 24 17 } ··· 26 19 "bundle": { 27 20 "active": true, 28 21 "targets": "all", 29 - "icon": [ 30 - "icons/32x32.png", 31 - "icons/128x128.png", 32 - "icons/128x128@2x.png", 33 - "icons/icon.icns", 34 - "icons/icon.ico" 35 - ] 22 + "icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"] 36 23 } 37 24 }
+15
app/src/add-friend-page/add-friend.ts
··· 1 + // we need 2 paths for the users to take or we could add a bit of complexity code wise and make both the same... 2 + // 3 + // later it will be qr codes, but for now: 4 + // for a given user: 5 + // - show their own user id 6 + // - show a cryptographically random number 7 + // - have a text input to enter the friend's user id 8 + // - have a text input to enter the friend's cryprgraphic number 9 + // 10 + // we thus need the random numbers to have a symmetric operation that gives something we can use to generate a base friend key 11 + // xor works probably very well here actually 12 + // 13 + // to start, we'll have a static AES-GCM friend key that never rotates 14 + 15 + // we first need to merge ui with auth tho