diff --git a/.cargo/config.toml b/.cargo/config.toml
index fc6e856d..48c6e34b 100644
--- a/.cargo/config.toml
+++ b/.cargo/config.toml
@@ -3,3 +3,5 @@ rustflags = [
"-C",
"link-args=/STACK:16777220"
]
+
+[alias]
diff --git a/.clippy.toml b/.clippy.toml
new file mode 100644
index 00000000..154626ef
--- /dev/null
+++ b/.clippy.toml
@@ -0,0 +1 @@
+allow-unwrap-in-tests = true
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 00000000..e69de29b
diff --git a/.gitignore b/.gitignore
index ccadbf92..a89d5a5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,7 +9,6 @@ dev.db
dev.db-journal
# Vendor
-dist
.eslintcache
# .env*
vendor/
@@ -261,7 +260,7 @@ out
# Nuxt.js build / generate output
.nuxt
-dist
+
# Gatsby files
.cache/
diff --git a/Cargo.toml b/Cargo.toml
index cb982a91..ec688021 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,6 +31,10 @@ tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-works
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2", features = [ "rustls-tls" ] }
+rspc = { version = "0.2.0", features = [ "specta2" ] }
+specta = { version = "=2.0.0-rc.12" }
+rspc-tauri2 = { git = "https://github.com/specta-rs/tauri2" }
+
interpulse = { version = "0.1.3" }
tracing = { version = "0.1" }
@@ -115,6 +119,10 @@ whoami = { version = "1.5" }
cocoa = { version = "0.25" }
objc = { version = "0.2" }
+[patch.crates-io]
+specta = { git = "https://github.com/oscartbeaumont/specta", rev = "f3bc75ec6120ea0fc6cd8e2e2e3aebef049e93cb" }
+rspc = { git = "https://github.com/oscartbeaumont/rspc", rev = "f250409db9e21a67ae252c963d605f863f73d5f0" }
+
[profile.dev]
# add debug symbols/logic and optimize for reduced build time (parallel)
debug = true
diff --git a/client/package.json b/client/package.json
new file mode 100644
index 00000000..4ed440a0
--- /dev/null
+++ b/client/package.json
@@ -0,0 +1,26 @@
+{
+ "name": "@onelauncher/client",
+ "type": "module",
+ "version": "1.0.0",
+ "private": true,
+ "description": "RSPC Client for OneLauncher",
+ "license": "GPL-3.0-only",
+ "repository": {
+ "type": "git",
+ "url": "git@github.com:polyfrost/onelauncher",
+ "directory": "client"
+ },
+ "sideEffects": false,
+ "main": "./src/index.ts",
+ "types": "./src/index.ts",
+ "dependencies": {
+ "@rspc/client": "^0.2.0",
+ "@rspc/tauri": "^0.2.0",
+ "@solid-primitives/deep": "^0.2.8",
+ "@tanstack/solid-query": "^5.35.5",
+ "fast-equals": "^5.0.1",
+ "plausible-tracker": "^0.3.8",
+ "solid-js": "^1.8.17",
+ "zod": "^3.23.8"
+ }
+}
diff --git a/client/src/index.ts b/client/src/index.ts
new file mode 100644
index 00000000..e69de29b
diff --git a/client/tsconfig.json b/client/tsconfig.json
new file mode 100644
index 00000000..cbc15950
--- /dev/null
+++ b/client/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "../tsconfig.base.json",
+ "compilerOptions": {
+ "rootDir": "src",
+ "emitDeclarationOnly": false,
+ "outDir": "./dist"
+ },
+ "include": ["src/**/*.ts", "src/**/*.d.ts"]
+}
diff --git a/desktop/.gitignore b/desktop/.gitignore
index 151488bf..b3bed89e 100644
--- a/desktop/.gitignore
+++ b/desktop/.gitignore
@@ -1,3 +1,2 @@
-/dist
/dist-isolation
/coverage
diff --git a/desktop/dist/.gitignore b/desktop/dist/.gitignore
new file mode 100644
index 00000000..c5327226
--- /dev/null
+++ b/desktop/dist/.gitignore
@@ -0,0 +1,5 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
+# This is done so that Tauri never complains that '../dist does not exist'
diff --git a/desktop/package.json b/desktop/package.json
index 3751777f..ca8cc04d 100644
--- a/desktop/package.json
+++ b/desktop/package.json
@@ -3,16 +3,13 @@
"type": "module",
"version": "1.0.0",
"description": "Next-generation open source Minecraft desktop launcher",
- "license": "MIT",
+ "license": "GPL-3.0-only",
"repository": {
"type": "git",
"url": "git@github.com:polyfrost/onelauncher",
"directory": "desktop"
},
"scripts": {
- "test": "vitest run",
- "test:dev": "vitest",
- "test:ui": "vitest --ui",
"tauri": "tauri",
"dev": "vite dev",
"build": "vite build"
@@ -20,6 +17,9 @@
"dependencies": {
"@fontsource/poppins": "^5.0.14",
"@iconify-json/logos": "^1.1.42",
+ "@onelauncher/client": "workspace:*",
+ "@rspc/client": "^0.2.0",
+ "@rspc/tauri": "^0.2.0",
"@solid-primitives/refs": "^1.0.8",
"@solidjs/router": "^0.13.3",
"@tauri-apps/api": "^2.0.0-beta",
@@ -38,15 +38,10 @@
"@tauri-apps/cli": "2.0.0-beta.10",
"@testing-library/jest-dom": "^6.4.5",
"@types/uuid": "^9.0.8",
- "@vitest/ui": "^1.6.0",
"jsdom": "^24.0.0",
"sass": "^1.77.1",
- "ts-node": "^10.9.2",
- "typescript": "^5.4.5",
"unocss": "^0.60.0",
- "vite": "^5.2.11",
"vite-plugin-solid": "^2.10.2",
- "vite-tsconfig-paths": "^4.3.2",
- "vitest": "^1.6.0"
+ "vite-tsconfig-paths": "^4.3.2"
}
}
diff --git a/desktop/src-tauri/Cargo.toml b/desktop/src-tauri/Cargo.toml
index 56d5dbd1..c0675306 100644
--- a/desktop/src-tauri/Cargo.toml
+++ b/desktop/src-tauri/Cargo.toml
@@ -26,7 +26,6 @@ tauri-build = { workspace = true, features = [
[dependencies]
onelauncher = { path = "../../core", features = [ "tauri" ] }
-
interpulse = { workspace = true, features = [ "bincode" ] }
tauri = { workspace = true, features = [
@@ -41,6 +40,7 @@ tauri-plugin-window-state = { workspace = true }
tauri-plugin-single-instance = { workspace = true }
tauri-plugin-updater = { workspace = true }
tauri-plugin-authenticator = { workspace = true }
+
tokio = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
@@ -61,5 +61,14 @@ cocoa = "0.25.0"
objc = "0.2.7"
[features]
+default = [ "custom-protocol" ]
+devtools = [ "tauri/devtools" ]
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!
custom-protocol = [ "tauri/custom-protocol" ]
+
+[profile.release]
+panic = "abort"
+codegen-units = 1
+lto = true
+opt-level = "s"
+strip = true
diff --git a/desktop/src-tauri/src/ext/mod.rs b/desktop/src-tauri/src/ext/mod.rs
index 8b137891..a880d9de 100644
--- a/desktop/src-tauri/src/ext/mod.rs
+++ b/desktop/src-tauri/src/ext/mod.rs
@@ -1 +1 @@
-
+pub mod updater;
diff --git a/desktop/src-tauri/src/ext/updater.rs b/desktop/src-tauri/src/ext/updater.rs
new file mode 100644
index 00000000..54d19862
--- /dev/null
+++ b/desktop/src-tauri/src/ext/updater.rs
@@ -0,0 +1,115 @@
+use tauri::{plugin::TauriPlugin, Manager, Runtime};
+use tauri_plugin_updater::{Update as TauriPluginUpdate, UpdaterExt};
+use tokio::sync::Mutex;
+
+#[derive(Debug, Clone, serde::Serialize)]
+pub struct Update {
+ pub version: String,
+}
+
+impl Update {
+ fn new(update: &TauriPluginUpdate) -> Self {
+ Self {
+ version: update.version.clone(),
+ }
+ }
+}
+
+#[derive(Default)]
+pub struct State {
+ install_lock: Mutex<()>,
+}
+
+async fn get_update(app: tauri::AppHandle) -> Result