squash(autostart): added adenmgb's autostart feature

Squashed commit of the following:

commit 085cd9481d
Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Date:   Mon Dec 30 16:29:41 2024 +1030

    Update lib.rs for the DB sync of autostart

commit 86f2fb19bd
Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Date:   Mon Dec 30 16:29:13 2024 +1030

    Update db.rs to accomidate the settings sync

commit ece11e7581
Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Date:   Mon Dec 30 16:27:48 2024 +1030

    Update autostart.rs to include DB

commit 7ea8a24fdc
Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Date:   Mon Dec 30 15:17:38 2024 +1030

    Add files via upload

commit af2f232d94
Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Date:   Mon Dec 30 15:17:09 2024 +1030

    Delete src-tauri/Cargo.toml

commit 5d27b65612
Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Date:   Mon Dec 30 15:15:42 2024 +1030

    Add files via upload

commit 2eea7b97a8
Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Date:   Mon Dec 30 15:15:31 2024 +1030

    Delete src-tauri/src/lib.rs

commit 9a635a10d1
Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Date:   Mon Dec 30 15:14:49 2024 +1030

    Add files via upload

commit 2fb049531a
Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Date:   Mon Dec 30 15:13:37 2024 +1030

    Add files via upload

commit ea1be4d750
Author: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
Date:   Mon Dec 30 15:13:20 2024 +1030

    Delete pages/settings/index.vue
This commit is contained in:
DecDuck
2024-12-30 17:31:03 +11:00
parent 6b96e408b2
commit 472eb1d435
6 changed files with 224 additions and 13 deletions

View File

@ -72,9 +72,24 @@ pub struct DatabaseGames {
pub transient_statuses: HashMap<String, GameTransientStatus>,
}
#[derive(Serialize, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Serialize, Deserialize, Clone)]
pub struct Settings {
pub autostart: bool,
// ... other settings ...
}
impl Default for Settings {
fn default() -> Self {
Self {
autostart: false,
// ... other settings defaults ...
}
}
}
#[derive(Serialize, Deserialize, Clone)]
pub struct Database {
pub settings: Settings,
pub auth: Option<DatabaseAuth>,
pub base_url: String,
pub games: DatabaseGames,
@ -118,13 +133,14 @@ impl DatabaseImpls for DatabaseInterface {
debug!("Creating logs directory");
create_dir_all(logs_root_dir.clone()).unwrap();
#[allow(clippy::let_and_return)]
let exists = fs::exists(db_path.clone()).unwrap();
match exists {
true => PathDatabase::load_from_path(db_path).expect("Database loading failed"),
true => PathDatabase::load_from_path(db_path)
.expect("Database loading failed"),
false => {
let default = Database {
settings: Settings::default(),
auth: None,
base_url: "".to_string(),
games: DatabaseGames {