Compare commits

..

3 Commits

Author SHA1 Message Date
8e08f3b7e7 chore: Revert Clients to using static LazyLock
Signed-off-by: quexeky <git@quexeky.dev>
2025-10-13 09:26:22 +11:00
f0e46c4a46 refactor: Convert some things from static to const and refactor into drop-consts
Signed-off-by: quexeky <git@quexeky.dev>
2025-10-13 09:07:24 +11:00
ef9f8caa54 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>
2025-10-13 08:21:27 +11:00
150 changed files with 9249 additions and 16878 deletions

8303
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

14
Cargo.toml Normal file
View File

@ -0,0 +1,14 @@
[workspace]
members = [
"client",
"database",
"src-tauri",
"process",
"remote",
"utils",
"cloud_saves",
"download_manager",
"games", "drop-consts",
]
resolver = "3"

View File

@ -1,15 +1,12 @@
use std::{ use std::{
ffi::OsStr, cell::LazyCell, ffi::OsStr, path::PathBuf, process::{Command, Stdio}
path::PathBuf,
process::{Command, Stdio},
sync::LazyLock,
}; };
use log::info; use log::info;
pub static COMPAT_INFO: LazyLock<Option<CompatInfo>> = LazyLock::new(create_new_compat_info); pub const COMPAT_INFO: LazyCell<Option<CompatInfo>> = LazyCell::new(create_new_compat_info);
pub static UMU_LAUNCHER_EXECUTABLE: LazyLock<Option<PathBuf>> = LazyLock::new(|| { pub const UMU_LAUNCHER_EXECUTABLE: LazyCell<Option<PathBuf>> = LazyCell::new(|| {
let x = get_umu_executable(); let x = get_umu_executable();
info!("{:?}", &x); info!("{:?}", &x);
x x

View File

@ -6,6 +6,7 @@ edition = "2024"
[dependencies] [dependencies]
database = { version = "0.1.0", path = "../database" } database = { version = "0.1.0", path = "../database" }
dirs = "6.0.0" dirs = "6.0.0"
drop-consts = { version = "0.1.0", path = "../drop-consts" }
log = "0.4.28" log = "0.4.28"
regex = "1.11.3" regex = "1.11.3"
rustix = "1.1.2" rustix = "1.1.2"

View File

@ -2,7 +2,8 @@ use std::{collections::HashMap, path::PathBuf, str::FromStr};
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
use database::platform::Platform; use database::platform::Platform;
use database::{GameVersion, db::DATA_ROOT_DIR}; use database::GameVersion;
use drop_consts::DATA_ROOT_DIR;
use log::warn; use log::warn;
use crate::error::BackupError; use crate::error::BackupError;

View File

@ -6,6 +6,7 @@ edition = "2024"
[dependencies] [dependencies]
chrono = "0.4.42" chrono = "0.4.42"
dirs = "6.0.0" dirs = "6.0.0"
drop-consts = { version = "0.1.0", path = "../drop-consts" }
log = "0.4.28" log = "0.4.28"
native_model = { version = "0.6.4", features = ["rmp_serde_1_3"], git = "https://github.com/Drop-OSS/native_model.git"} native_model = { version = "0.6.4", features = ["rmp_serde_1_3"], git = "https://github.com/Drop-OSS/native_model.git"}
rustbreak = "2.0.0" rustbreak = "2.0.0"

View File

@ -1,6 +1,5 @@
use std::{ use std::{
path::PathBuf, sync::LazyLock,
sync::{Arc, LazyLock},
}; };
use rustbreak::{DeSerError, DeSerializer}; use rustbreak::{DeSerError, DeSerializer};
@ -10,19 +9,6 @@ use crate::interface::{DatabaseImpls, DatabaseInterface};
pub static DB: LazyLock<DatabaseInterface> = LazyLock::new(DatabaseInterface::set_up_database); pub static DB: LazyLock<DatabaseInterface> = LazyLock::new(DatabaseInterface::set_up_database);
#[cfg(not(debug_assertions))]
static DATA_ROOT_PREFIX: &str = "drop";
#[cfg(debug_assertions)]
static DATA_ROOT_PREFIX: &str = "drop-debug";
pub static DATA_ROOT_DIR: LazyLock<Arc<PathBuf>> = LazyLock::new(|| {
Arc::new(
dirs::data_dir()
.expect("Failed to get data dir")
.join(DATA_ROOT_PREFIX),
)
});
// Custom JSON serializer to support everything we need // Custom JSON serializer to support everything we need
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]
pub struct DropDatabaseSerializer; pub struct DropDatabaseSerializer;
@ -39,7 +25,7 @@ impl<T: native_model::Model + Serialize + DeserializeOwned> DeSerializer<T>
s.read_to_end(&mut buf) s.read_to_end(&mut buf)
.map_err(|e| rustbreak::error::DeSerError::Other(e.into()))?; .map_err(|e| rustbreak::error::DeSerError::Other(e.into()))?;
let (val, _version) = let (val, _version) =
native_model::decode(buf).map_err(|e| DeSerError::Internal(e.to_string()))?; native_model::decode(buf).map_err(|e| rustbreak::error::DeSerError::Internal(e.to_string()))?;
Ok(val) Ok(val)
} }
} }

View File

@ -7,12 +7,13 @@ use std::{
}; };
use chrono::Utc; use chrono::Utc;
use drop_consts::DATA_ROOT_DIR;
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rustbreak::{PathDatabase, RustbreakError}; use rustbreak::{PathDatabase, RustbreakError};
use url::Url; use url::Url;
use crate::{ use crate::{
db::{DATA_ROOT_DIR, DB, DropDatabaseSerializer}, db::{DB, DropDatabaseSerializer},
models::data::Database, models::data::Database,
}; };

7
drop-consts/Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[package]
name = "drop-consts"
version = "0.1.0"
edition = "2024"
[dependencies]
dirs = "6.0.0"

23
drop-consts/src/lib.rs Normal file
View File

@ -0,0 +1,23 @@
use std::{cell::LazyCell, path::PathBuf};
#[cfg(not(debug_assertions))]
pub const DATA_ROOT_PREFIX: &str = "drop";
#[cfg(debug_assertions)]
pub const DATA_ROOT_PREFIX: &str = "drop-debug";
pub const DATA_ROOT_DIR: LazyCell<PathBuf> = LazyCell::new(|| {
dirs::data_dir()
.expect("Failed to get data dir")
.join(DATA_ROOT_PREFIX)
});
pub const DROP_DATA_PATH: &str = ".dropdata";
// Downloads
pub const MAX_PACKET_LENGTH: usize = 4096 * 4;
pub const BUMP_SIZE: usize = 4096 * 16;
pub const RETRY_COUNT: usize = 3;
pub const TARGET_BUCKET_SIZE: usize = 63 * 1000 * 1000;
pub const MAX_FILES_PER_BUCKET: usize = (1024 / 4) - 1;

View File

@ -24,3 +24,4 @@ throttle_my_fn = "0.2.6"
utils = { version = "0.1.0", path = "../utils" } utils = { version = "0.1.0", path = "../utils" }
native_model = { version = "0.6.4", features = ["rmp_serde_1_3"], git = "https://github.com/Drop-OSS/native_model.git"} native_model = { version = "0.6.4", features = ["rmp_serde_1_3"], git = "https://github.com/Drop-OSS/native_model.git"}
serde_json = "1.0.145" serde_json = "1.0.145"
drop-consts = { version = "0.1.0", path = "../drop-consts" }

View File

@ -9,6 +9,7 @@ use download_manager::util::download_thread_control_flag::{
DownloadThreadControl, DownloadThreadControlFlag, DownloadThreadControl, DownloadThreadControlFlag,
}; };
use download_manager::util::progress_object::{ProgressHandle, ProgressObject}; use download_manager::util::progress_object::{ProgressHandle, ProgressObject};
use drop_consts::{MAX_FILES_PER_BUCKET, RETRY_COUNT, TARGET_BUCKET_SIZE};
use log::{debug, error, info, warn}; use log::{debug, error, info, warn};
use rayon::ThreadPoolBuilder; use rayon::ThreadPoolBuilder;
use remote::auth::generate_authorization_header; use remote::auth::generate_authorization_header;
@ -39,11 +40,6 @@ use crate::state::GameStatusManager;
use super::download_logic::download_game_bucket; use super::download_logic::download_game_bucket;
use super::drop_data::DropData; use super::drop_data::DropData;
static RETRY_COUNT: usize = 3;
const TARGET_BUCKET_SIZE: usize = 63 * 1000 * 1000;
const MAX_FILES_PER_BUCKET: usize = (1024 / 4) - 1;
pub struct GameDownloadAgent { pub struct GameDownloadAgent {
pub id: String, pub id: String,
pub version: String, pub version: String,

View File

@ -15,6 +15,7 @@ use download_manager::util::download_thread_control_flag::{
DownloadThreadControl, DownloadThreadControlFlag, DownloadThreadControl, DownloadThreadControlFlag,
}; };
use download_manager::util::progress_object::ProgressHandle; use download_manager::util::progress_object::ProgressHandle;
use drop_consts::{BUMP_SIZE, MAX_PACKET_LENGTH};
use log::{debug, info, warn}; use log::{debug, info, warn};
use md5::{Context, Digest}; use md5::{Context, Digest};
use remote::auth::generate_authorization_header; use remote::auth::generate_authorization_header;
@ -25,9 +26,6 @@ use reqwest::blocking::Response;
use crate::downloads::manifest::{ChunkBody, DownloadBucket, DownloadContext, DownloadDrop}; use crate::downloads::manifest::{ChunkBody, DownloadBucket, DownloadContext, DownloadDrop};
static MAX_PACKET_LENGTH: usize = 4096 * 4;
static BUMP_SIZE: usize = 4096 * 16;
pub struct DropWriter<W: Write> { pub struct DropWriter<W: Write> {
hasher: Context, hasher: Context,
destination: BufWriter<W>, destination: BufWriter<W>,

View File

@ -5,14 +5,13 @@ use std::{
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
use drop_consts::DROP_DATA_PATH;
use log::error; use log::error;
use native_model::{Decode, Encode}; use native_model::{Decode, Encode};
use utils::lock; use utils::lock;
pub type DropData = v1::DropData; pub type DropData = v1::DropData;
pub static DROP_DATA_PATH: &str = ".dropdata";
pub mod v1 { pub mod v1 {
use std::{collections::HashMap, path::PathBuf, sync::Mutex}; use std::{collections::HashMap, path::PathBuf, sync::Mutex};

View File

@ -1,10 +1,11 @@
use std::fs; use std::fs;
use database::{DownloadType, DownloadableMetadata, borrow_db_mut_checked}; use database::{DownloadType, DownloadableMetadata, borrow_db_mut_checked};
use drop_consts::DROP_DATA_PATH;
use log::warn; use log::warn;
use crate::{ use crate::{
downloads::drop_data::{DROP_DATA_PATH, DropData}, downloads::drop_data::DropData,
library::set_partially_installed_db, library::set_partially_installed_db,
}; };

View File

@ -7,7 +7,14 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import "~/composables/downloads.js";
import { invoke } from "@tauri-apps/api/core"; import { invoke } from "@tauri-apps/api/core";
import { useAppState } from "./composables/app-state.js";
import {
initialNavigation,
setupHooks,
} from "./composables/state-navigation.js";
const router = useRouter(); const router = useRouter();

View File

@ -2,7 +2,9 @@
<div class="h-16 bg-zinc-950 flex flex-row justify-between"> <div class="h-16 bg-zinc-950 flex flex-row justify-between">
<div class="flex flex-row grow items-center pl-5 pr-2 py-3"> <div class="flex flex-row grow items-center pl-5 pr-2 py-3">
<div class="inline-flex items-center gap-x-10"> <div class="inline-flex items-center gap-x-10">
<NuxtLink to="/store">
<Wordmark class="h-8 mb-0.5" /> <Wordmark class="h-8 mb-0.5" />
</NuxtLink>
<nav class="inline-flex items-center mt-0.5"> <nav class="inline-flex items-center mt-0.5">
<ol class="inline-flex items-center gap-x-6"> <ol class="inline-flex items-center gap-x-6">
<NuxtLink <NuxtLink

View File

@ -76,6 +76,7 @@ import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue";
import { ChevronDownIcon } from "@heroicons/vue/16/solid"; import { ChevronDownIcon } from "@heroicons/vue/16/solid";
import type { NavigationItem } from "../types"; import type { NavigationItem } from "../types";
import HeaderWidget from "./HeaderWidget.vue"; import HeaderWidget from "./HeaderWidget.vue";
import { useAppState } from "~/composables/app-state";
import { invoke } from "@tauri-apps/api/core"; import { invoke } from "@tauri-apps/api/core";
const open = ref(false); const open = ref(false);

View File

@ -73,7 +73,7 @@
alt="" alt=""
/> />
</div> </div>
<div class="flex flex-col gap-x-2"> <div class="inline-flex items-center gap-x-2">
<p <p
class="text-sm whitespace-nowrap font-display font-semibold" class="text-sm whitespace-nowrap font-display font-semibold"
> >

View File

@ -0,0 +1,7 @@
<template>
<NuxtLink
class="inline-flex items-center gap-x-2 px-1 py-0.5 rounded bg-blue-900 text-zinc-100 hover:bg-blue-800"
>
<slot />
</NuxtLink>
</template>

View File

@ -1,5 +1,5 @@
import { convertFileSrc } from "@tauri-apps/api/core"; import { convertFileSrc } from "@tauri-apps/api/core";
export const useObject = (id: string) => { export const useObject = async (id: string) => {
return convertFileSrc(id, "object"); return convertFileSrc(id, "object");
}; };

View File

@ -9,17 +9,13 @@ export default defineNuxtConfig({
}, },
}, },
css: ["~/assets/main.scss"],
ssr: false, ssr: false,
extends: ["../shared", "../libs/drop-base"], extends: [["../libs/drop-base"]],
app: { app: {
baseURL: "/main", baseURL: "/main",
}, }
devtools: {
enabled: false,
},
}); });

View File

@ -116,7 +116,7 @@ platformInfo.value = currentPlatform;
async function openDataDir() { async function openDataDir() {
if (!dataDir.value) return; if (!dataDir.value) return;
try { try {
await open(dataDir.value); await invoke("open_fs", { path: dataDir.value });
} catch (error) { } catch (error) {
console.error("Failed to open data dir:", error); console.error("Failed to open data dir:", error);
} }
@ -126,7 +126,7 @@ async function openLogFile() {
if (!dataDir.value) return; if (!dataDir.value) return;
try { try {
const logPath = `${dataDir.value}/drop.log`; const logPath = `${dataDir.value}/drop.log`;
await open(logPath); await invoke("open_fs", { path: logPath });
} catch (error) { } catch (error) {
console.error("Failed to open log file:", error); console.error("Failed to open log file:", error);
} }

View File

@ -7,7 +7,6 @@ export default {
"./plugins/**/*.{js,ts}", "./plugins/**/*.{js,ts}",
"./app.vue", "./app.vue",
"./error.vue", "./error.vue",
"../shared/components/**/*.vue"
], ],
theme: { theme: {
extend: { extend: {

View File

@ -7,6 +7,7 @@ edition = "2024"
chrono = "0.4.42" chrono = "0.4.42"
client = { version = "0.1.0", path = "../client" } client = { version = "0.1.0", path = "../client" }
database = { version = "0.1.0", path = "../database" } database = { version = "0.1.0", path = "../database" }
drop-consts = { version = "0.1.0", path = "../drop-consts" }
dynfmt = "0.1.5" dynfmt = "0.1.5"
games = { version = "0.1.0", path = "../games" } games = { version = "0.1.0", path = "../games" }
log = "0.4.28" log = "0.4.28"

Some files were not shown because too many files have changed in this diff Show More