Squashed commit of the following:

commit 3b09dcfb73
Author: quexeky <git@quexeky.dev>
Date:   Mon Oct 13 08:10:52 2025 +1100

    fix: #159

    Signed-off-by: quexeky <git@quexeky.dev>

commit 2859a59622
Author: quexeky <git@quexeky.dev>
Date:   Mon Oct 13 08:03:49 2025 +1100

    Squashed commit of the following:

    commit 0f48f3fb44
    Author: quexeky <git@quexeky.dev>
    Date:   Sun Oct 12 19:35:04 2025 +1100

        chore: Run cargo clippy && cargo fmt

        Signed-off-by: quexeky <git@quexeky.dev>

    commit 974666efe2
    Author: quexeky <git@quexeky.dev>
    Date:   Sun Oct 12 19:17:40 2025 +1100

        refactor: Finish refactor

        Signed-off-by: quexeky <git@quexeky.dev>

    commit 9e1bf9852f
    Author: quexeky <git@quexeky.dev>
    Date:   Sun Oct 12 18:33:43 2025 +1100

        refactor: Builds, but some logic still left to move back

        Signed-off-by: quexeky <git@quexeky.dev>

    commit 5d22b883d5
    Author: quexeky <git@quexeky.dev>
    Date:   Sun Oct 12 17:04:27 2025 +1100

        refactor: Improvements to src-tauri

        Signed-off-by: quexeky <git@quexeky.dev>

    commit 62a2561539
    Author: quexeky <git@quexeky.dev>
    Date:   Sat Oct 11 09:51:04 2025 +1100

        fix: Remote tauri dependency from process

        Signed-off-by: quexeky <git@quexeky.dev>

    commit 59f040bc8b
    Author: quexeky <git@quexeky.dev>
    Date:   Thu Oct 9 07:46:17 2025 +1100

        chore: Major refactoring

        Still needs a massive go-over because there shouldn't be anything referencing tauri in any of the workspaces except the original one. Process manager has been refactored as an example

        Signed-off-by: quexeky <git@quexeky.dev>

    Signed-off-by: quexeky <git@quexeky.dev>

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2025-10-13 08:21:27 +11:00
parent cc57ca7076
commit ef9f8caa54
111 changed files with 15706 additions and 1995 deletions

4862
client/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

12
client/Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[package]
name = "client"
version = "0.1.0"
edition = "2024"
[dependencies]
bitcode = "0.6.7"
database = { version = "0.1.0", path = "../database" }
log = "0.4.28"
serde = { version = "1.0.228", features = ["derive"] }
tauri = "2.8.5"
tauri-plugin-autostart = "2.5.0"

0
client/src/app_state.rs Normal file
View File

12
client/src/app_status.rs Normal file
View File

@ -0,0 +1,12 @@
use serde::Serialize;
#[derive(Clone, Copy, Serialize, Eq, PartialEq)]
pub enum AppStatus {
NotConfigured,
Offline,
ServerError,
SignedOut,
SignedIn,
SignedInNeedsReauth,
ServerUnavailable,
}

26
client/src/autostart.rs Normal file
View File

@ -0,0 +1,26 @@
use database::borrow_db_checked;
use log::debug;
use tauri::AppHandle;
use tauri_plugin_autostart::ManagerExt;
// New function to sync state on startup
pub fn sync_autostart_on_startup(app: &AppHandle) -> Result<(), String> {
let db_handle = borrow_db_checked();
let should_be_enabled = db_handle.settings.autostart;
drop(db_handle);
let manager = app.autolaunch();
let current_state = manager.is_enabled().map_err(|e| e.to_string())?;
if current_state != should_be_enabled {
if should_be_enabled {
manager.enable().map_err(|e| e.to_string())?;
debug!("synced autostart: enabled");
} else {
manager.disable().map_err(|e| e.to_string())?;
debug!("synced autostart: disabled");
}
}
Ok(())
}

52
client/src/compat.rs Normal file
View File

@ -0,0 +1,52 @@
use std::{
ffi::OsStr,
path::PathBuf,
process::{Command, Stdio},
sync::LazyLock,
};
use log::info;
pub static COMPAT_INFO: LazyLock<Option<CompatInfo>> = LazyLock::new(create_new_compat_info);
pub static UMU_LAUNCHER_EXECUTABLE: LazyLock<Option<PathBuf>> = LazyLock::new(|| {
let x = get_umu_executable();
info!("{:?}", &x);
x
});
#[derive(Clone)]
pub struct CompatInfo {
pub umu_installed: bool,
}
fn create_new_compat_info() -> Option<CompatInfo> {
#[cfg(target_os = "windows")]
return None;
let has_umu_installed = UMU_LAUNCHER_EXECUTABLE.is_some();
Some(CompatInfo {
umu_installed: has_umu_installed,
})
}
const UMU_BASE_LAUNCHER_EXECUTABLE: &str = "umu-run";
const UMU_INSTALL_DIRS: [&str; 4] = ["/app/share", "/use/local/share", "/usr/share", "/opt"];
fn get_umu_executable() -> Option<PathBuf> {
if check_executable_exists(UMU_BASE_LAUNCHER_EXECUTABLE) {
return Some(PathBuf::from(UMU_BASE_LAUNCHER_EXECUTABLE));
}
for dir in UMU_INSTALL_DIRS {
let p = PathBuf::from(dir).join(UMU_BASE_LAUNCHER_EXECUTABLE);
if check_executable_exists(&p) {
return Some(p);
}
}
None
}
fn check_executable_exists<P: AsRef<OsStr>>(exec: P) -> bool {
let has_umu_installed = Command::new(exec).stdout(Stdio::null()).output();
has_umu_installed.is_ok()
}

4
client/src/lib.rs Normal file
View File

@ -0,0 +1,4 @@
pub mod app_status;
pub mod autostart;
pub mod compat;
pub mod user;

12
client/src/user.rs Normal file
View File

@ -0,0 +1,12 @@
use bitcode::{Decode, Encode};
use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, Encode, Decode)]
#[serde(rename_all = "camelCase")]
pub struct User {
id: String,
username: String,
admin: bool,
display_name: String,
profile_picture_object_id: String,
}