Compare commits

..

28 Commits

Author SHA1 Message Date
HorizonCode 03b326e142 Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher 2026-06-04 16:36:27 +02:00
HorizonCode 2ec8b08983 fix: dont show dynamic beatmap button on direct page 2026-06-04 16:36:20 +02:00
HorizonCode 344f15b8da fix: user config retrival on linux 2026-06-03 20:51:14 +02:00
HorizonCode 554f07412b chore: disable themes on linux for now until fix is found 2026-06-03 19:57:21 +02:00
HorizonCode f8f53c4236 fix: user config retrival on linux 2026-06-03 19:57:00 +02:00
HorizonCode 64f76d95a6 fix: remove platform dependency from patching settings in SetupWizard 2026-06-03 16:38:28 +02:00
HorizonCode 02fecd237c fix: update launcher version retrieval and improve HWID fallback 2026-06-03 16:16:11 +02:00
HorizonCode eaffc35288 fix: build for linux 2026-06-03 01:01:17 +02:00
HorizonCode 78c7fdb756 chore: bump version 2026-06-03 01:01:03 +02:00
HorizonCode ec7ce53016 chore: bump version 2026-06-03 00:51:28 +02:00
HorizonCode 0610d4beef chore: make patch settings available to linux users, force stable patcher stream 2026-06-03 00:49:35 +02:00
HorizonCode 416067f2ea Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher 2026-06-02 23:46:02 +02:00
HorizonCode e58be09bdb chore: add patcher support for linux 2026-06-02 23:45:43 +02:00
HorizonCode ccb0c467f2 chore: add type usage for views in selectedView 2026-06-01 10:47:58 +02:00
HorizonCode 67bc968497 feat: add disableMediaControls function to prevent media key actions 2026-05-30 00:06:16 +02:00
HorizonCode dc06b53089 fix: if external imported theme is current active theme change to default for installation 2026-05-29 21:36:37 +02:00
HorizonCode d5e5fd4c43 fix: csp font-src rule, remove debug log 2026-05-28 22:52:46 +02:00
HorizonCode 29359c9242 chore: bump version 2026-05-28 22:34:34 +02:00
HorizonCode 71bd64a2cf fix: ahead value read 2026-05-28 22:21:18 +02:00
HorizonCode 7fa83d6d0a chore: add theme css support 2026-05-28 22:02:38 +02:00
HorizonCode f2e795e2c9 chore: remove old theme variables 2026-05-28 22:02:07 +02:00
HorizonCode cece28dd46 fix: only validate psu path if its not empty 2026-05-28 21:53:19 +02:00
HorizonCode 474f1f0c33 Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher 2026-05-28 11:41:26 +02:00
HorizonCode 871c40922e chore: replace json config with database 2026-05-28 11:35:42 +02:00
HorizonCode 20e8389409 chore: replace json config with database 2026-05-28 11:35:34 +02:00
HorizonCode 051a86943e fix: update Content Security Policy to include analytics and osu.ppy.sh 2026-05-28 00:39:45 +02:00
HorizonCode 7d0147edb9 fix: Content Security Policy rules 2026-05-28 00:09:23 +02:00
HorizonCode 7e2404753b fix: set csp to null, breaks assets in prod 2026-05-27 23:31:32 +02:00
23 changed files with 1086 additions and 493 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "ezpplauncher",
"version": "3.2.1",
"version": "3.2.3",
"description": "",
"type": "module",
"scripts": {
+3
View File
@@ -34,4 +34,7 @@ function run(cmd: string, args: string[]): Promise<void> {
await run('bun', ['./scripts/sync-version.ts']);
await runVite();
//set NO_STRIP=1 in env for linux to prevent stripping of debug symbols in tauri builds, which causes issues with source maps
if (process.platform === 'linux') process.env.NO_STRIP = '1';
await run('bunx', ['tauri', 'build']);
+211 -27
View File
@@ -8,17 +8,52 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "aead"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0"
dependencies = [
"crypto-common 0.1.7",
"generic-array",
]
[[package]]
name = "aes"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"
dependencies = [
"cfg-if",
"cipher 0.4.4",
"cpufeatures 0.2.17",
]
[[package]]
name = "aes"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66bd29a732b644c0431c6140f370d097879203d79b80c94a6747ba0872adaef8"
dependencies = [
"cipher",
"cipher 0.5.2",
"cpubits",
"cpufeatures 0.3.0",
]
[[package]]
name = "aes-gcm"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1"
dependencies = [
"aead",
"aes 0.8.4",
"cipher 0.4.4",
"ctr",
"ghash",
"subtle",
]
[[package]]
name = "aho-corasick"
version = "1.1.4"
@@ -449,7 +484,7 @@ dependencies = [
"semver",
"serde",
"serde_json",
"thiserror 2.0.17",
"thiserror 2.0.18",
]
[[package]]
@@ -525,6 +560,16 @@ dependencies = [
"windows-link 0.2.1",
]
[[package]]
name = "cipher"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
dependencies = [
"crypto-common 0.1.7",
"inout 0.1.4",
]
[[package]]
name = "cipher"
version = "0.5.2"
@@ -532,7 +577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c"
dependencies = [
"crypto-common 0.2.2",
"inout",
"inout 0.2.2",
]
[[package]]
@@ -734,6 +779,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
dependencies = [
"generic-array",
"rand_core 0.6.4",
"typenum",
]
@@ -802,6 +848,15 @@ version = "0.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1"
[[package]]
name = "ctr"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835"
dependencies = [
"cipher 0.4.4",
]
[[package]]
name = "ctutils"
version = "0.4.2"
@@ -1184,8 +1239,9 @@ dependencies = [
[[package]]
name = "ezpplauncher"
version = "3.2.1"
version = "3.2.3"
dependencies = [
"aes-gcm",
"anyhow",
"base64 0.22.1",
"byteorder",
@@ -1197,10 +1253,12 @@ dependencies = [
"open",
"presenceforge",
"reqwest",
"rusqlite",
"serde",
"serde_json",
"serde_repr",
"sha1",
"sha2 0.11.0",
"sysinfo",
"tauri",
"tauri-build",
@@ -1209,6 +1267,7 @@ dependencies = [
"tauri-plugin-fs",
"tauri-plugin-shell",
"tauri-plugin-single-instance",
"thiserror 2.0.18",
"tokio",
"url",
"widestring",
@@ -1218,6 +1277,18 @@ dependencies = [
"zip",
]
[[package]]
name = "fallible-iterator"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
[[package]]
name = "fallible-streaming-iterator"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
[[package]]
name = "fastrand"
version = "2.3.0"
@@ -1602,6 +1673,16 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "ghash"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1"
dependencies = [
"opaque-debug",
"polyval",
]
[[package]]
name = "gio"
version = "0.18.4"
@@ -1799,6 +1880,18 @@ name = "hashbrown"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
dependencies = [
"foldhash 0.2.0",
]
[[package]]
name = "hashlink"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea0b22561a9c04a7cb1a302c013e0259cd3b4bb619f145b32f72b8b4bcbed230"
dependencies = [
"hashbrown 0.16.1",
]
[[package]]
name = "heck"
@@ -2153,6 +2246,15 @@ dependencies = [
"cfb",
]
[[package]]
name = "inout"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
dependencies = [
"generic-array",
]
[[package]]
name = "inout"
version = "0.2.2"
@@ -2384,6 +2486,17 @@ dependencies = [
"libc",
]
[[package]]
name = "libsqlite3-sys"
version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a76001fb4daed01e5f2b518aac0b4dc592e7c734da63dbffcf0c64fa612a8d0c"
dependencies = [
"cc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "libz-rs-sys"
version = "0.5.5"
@@ -2554,7 +2667,7 @@ dependencies = [
"once_cell",
"png 0.18.1",
"serde",
"thiserror 2.0.17",
"thiserror 2.0.18",
"windows-sys 0.61.2",
]
@@ -2916,6 +3029,12 @@ version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "opaque-debug"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
name = "open"
version = "5.3.5"
@@ -3291,6 +3410,18 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "polyval"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25"
dependencies = [
"cfg-if",
"cpufeatures 0.2.17",
"opaque-debug",
"universal-hash",
]
[[package]]
name = "potential_utf"
version = "0.1.4"
@@ -3340,7 +3471,7 @@ dependencies = [
"log",
"serde",
"serde_json",
"thiserror 2.0.17",
"thiserror 2.0.18",
"tokio",
"uuid",
]
@@ -3462,7 +3593,7 @@ dependencies = [
"rustc-hash",
"rustls",
"socket2",
"thiserror 2.0.17",
"thiserror 2.0.18",
"tokio",
"tracing",
"web-time",
@@ -3484,7 +3615,7 @@ dependencies = [
"rustls",
"rustls-pki-types",
"slab",
"thiserror 2.0.17",
"thiserror 2.0.18",
"tinyvec",
"tracing",
"web-time",
@@ -3658,7 +3789,7 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
dependencies = [
"getrandom 0.2.16",
"libredox",
"thiserror 2.0.17",
"thiserror 2.0.18",
]
[[package]]
@@ -3794,6 +3925,31 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "rsqlite-vfs"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c51c9ae4df8a7fba42103df5c621fa3c37eccf3a3c650879e90fc48b11cc192c"
dependencies = [
"hashbrown 0.16.1",
"thiserror 2.0.18",
]
[[package]]
name = "rusqlite"
version = "0.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b3492ea85308705c3a5cc24fb9b9cf77273d30590349070db42991202b214c4"
dependencies = [
"bitflags 2.10.0",
"fallible-iterator",
"fallible-streaming-iterator",
"hashlink",
"libsqlite3-sys",
"smallvec",
"sqlite-wasm-rs",
]
[[package]]
name = "rustc-hash"
version = "2.1.1"
@@ -4402,6 +4558,18 @@ dependencies = [
"system-deps",
]
[[package]]
name = "sqlite-wasm-rs"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc3efc0da82635d7e1ced0053bbbfa8c7ab9645d0bf36ceb4f7127bb85315d75"
dependencies = [
"cc",
"js-sys",
"rsqlite-vfs",
"wasm-bindgen",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.1"
@@ -4676,7 +4844,7 @@ dependencies = [
"tauri-runtime",
"tauri-runtime-wry",
"tauri-utils",
"thiserror 2.0.17",
"thiserror 2.0.18",
"tokio",
"tray-icon",
"url",
@@ -4727,7 +4895,7 @@ dependencies = [
"sha2 0.10.9",
"syn 2.0.113",
"tauri-utils",
"thiserror 2.0.17",
"thiserror 2.0.18",
"time",
"url",
"uuid",
@@ -4780,7 +4948,7 @@ dependencies = [
"serde_json",
"tauri",
"tauri-plugin",
"thiserror 2.0.17",
"thiserror 2.0.18",
"tokio",
"url",
]
@@ -4799,7 +4967,7 @@ dependencies = [
"tauri",
"tauri-plugin",
"tauri-plugin-fs",
"thiserror 2.0.17",
"thiserror 2.0.18",
"url",
]
@@ -4822,7 +4990,7 @@ dependencies = [
"tauri",
"tauri-plugin",
"tauri-utils",
"thiserror 2.0.17",
"thiserror 2.0.18",
"toml 1.1.0+spec-1.1.0",
"url",
]
@@ -4844,7 +5012,7 @@ dependencies = [
"shared_child",
"tauri",
"tauri-plugin",
"thiserror 2.0.17",
"thiserror 2.0.18",
"tokio",
]
@@ -4857,7 +5025,7 @@ dependencies = [
"serde",
"serde_json",
"tauri",
"thiserror 2.0.17",
"thiserror 2.0.18",
"tracing",
"windows-sys 0.60.2",
"zbus",
@@ -4881,7 +5049,7 @@ dependencies = [
"serde",
"serde_json",
"tauri-utils",
"thiserror 2.0.17",
"thiserror 2.0.18",
"url",
"webkit2gtk",
"webview2-com",
@@ -4946,7 +5114,7 @@ dependencies = [
"serde_json",
"serde_with",
"swift-rs",
"thiserror 2.0.17",
"thiserror 2.0.18",
"toml 1.1.0+spec-1.1.0",
"url",
"urlpattern",
@@ -5010,11 +5178,11 @@ dependencies = [
[[package]]
name = "thiserror"
version = "2.0.17"
version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
dependencies = [
"thiserror-impl 2.0.17",
"thiserror-impl 2.0.18",
]
[[package]]
@@ -5030,9 +5198,9 @@ dependencies = [
[[package]]
name = "thiserror-impl"
version = "2.0.17"
version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
dependencies = [
"proc-macro2",
"quote",
@@ -5361,7 +5529,7 @@ dependencies = [
"once_cell",
"png 0.18.1",
"serde",
"thiserror 2.0.17",
"thiserror 2.0.18",
"windows-sys 0.61.2",
]
@@ -5459,6 +5627,16 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "universal-hash"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"
dependencies = [
"crypto-common 0.1.7",
"subtle",
]
[[package]]
name = "untrusted"
version = "0.9.0"
@@ -5514,6 +5692,12 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version-compare"
version = "0.2.1"
@@ -5817,7 +6001,7 @@ version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36695906a1b53a3bf5c4289621efedac12b73eeb0b89e7e1a89b517302d5d75c"
dependencies = [
"thiserror 2.0.17",
"thiserror 2.0.18",
"windows 0.61.3",
"windows-core 0.61.2",
]
@@ -6510,7 +6694,7 @@ dependencies = [
"sha2 0.10.9",
"soup3",
"tao-macros",
"thiserror 2.0.17",
"thiserror 2.0.18",
"url",
"webkit2gtk",
"webkit2gtk-sys",
@@ -6712,7 +6896,7 @@ version = "8.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b"
dependencies = [
"aes",
"aes 0.9.0",
"bzip2",
"constant_time_eq",
"crc32fast",
+6 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "ezpplauncher"
version = "3.2.1"
version = "3.2.3"
description = "EZPPLauncher redefined."
authors = ["HorizonCode"]
edition = "2024"
@@ -51,11 +51,15 @@ url = "2.5.8"
zip = "8.6.0"
sha1 = "0.11.0"
hex = "0.4.3"
rusqlite = { version = "0.40.0", features = ["bundled"] }
aes-gcm = "0.10.3"
base64 = "0.22.1"
sha2 = "0.11.0"
thiserror = "2.0.18"
[target.'cfg(windows)'.dependencies]
winreg = "0.56.0"
winapi = { version = "0.3.9", features = ["winuser", "wincrypt", "memoryapi", "winbase", "dpapi"] }
base64 = "0.22.1"
widestring = "1.2.1"
windows-sys = "0.61.2"
+55 -14
View File
@@ -1,6 +1,8 @@
use crate::config::ConfigError;
use hardware_id::get_id;
use reqwest::Client;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashSet;
use std::io::Read;
use std::path::PathBuf;
@@ -9,15 +11,16 @@ use sysinfo::System;
use tauri::AppHandle;
use tauri::Emitter;
use tauri::Manager;
use tauri::State;
use tauri_plugin_fs::FsExt;
use tokio::fs;
use tokio::io::AsyncWriteExt;
use tokio::process::Command;
use tokio::time::{Duration, sleep};
use crate::OpenedUrls;
use crate::osudb::parse_osudb;
use crate::presence;
use crate::state::AppState;
use crate::utils::{
check_folder_completeness, encrypt_password, get_osu_config, get_osu_user_config,
get_window_title_by_pid, is_net8_installed, is_osuwinello_available, is_wmctrl_available,
@@ -26,21 +29,22 @@ use crate::utils::{
#[tauri::command]
pub fn opened_urls(app: tauri::AppHandle) -> Vec<PathBuf> {
let args = app.state::<OpenedUrls>().0.lock().unwrap().clone();
app.state::<OpenedUrls>().0.lock().unwrap().clear();
let args = app.state::<AppState>().opened_files.lock().unwrap().clone();
app.state::<AppState>().opened_files.lock().unwrap().clear();
args
}
#[tauri::command]
pub fn get_launcher_version() -> String {
env!("CARGO_PKG_VERSION").to_string()
pub fn get_launcher_version(app: tauri::AppHandle) -> String {
app.package_info().version.to_string()
}
#[tauri::command]
pub fn get_hwid() -> String {
let hwid = get_id().unwrap();
hwid.into()
get_id()
.unwrap_or("recorderinsandybridge".to_string())
.into()
}
#[tauri::command(rename_all = "snake_case")]
@@ -76,7 +80,6 @@ pub fn valid_osu_folder(folder: String) -> bool {
check_folder_completeness(path, &osu_folder_files) >= 70.0
}
#[cfg(windows)]
#[tauri::command]
pub fn find_osu_installation() -> Option<String> {
#[cfg(windows)]
@@ -447,8 +450,6 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
}
};
#[cfg(windows)]
{
if patch {
let patcher_exe_path = PathBuf::from(&folder)
.join("EZPPLauncher")
@@ -456,8 +457,6 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
.join("osu!.patcher.exe");
if patcher_exe_path.exists() {
#[cfg(windows)]
{
let mut sys = System::new_all();
loop {
@@ -483,12 +482,20 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
sleep(Duration::from_millis(500)).await;
}
#[cfg(windows)]
{
let _ = Command::new(&patcher_exe_path)
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn()
.map_err(|e| format!("Failed to run patcher: {e}"))?;
}
#[cfg(not(windows))]
{
let _ = Command::new("osu-wine")
.arg("--wine")
.arg(&patcher_exe_path)
.spawn()
.map_err(|e| format!("Failed to run patcher: {}", e))?;
}
}
}
@@ -955,7 +962,6 @@ pub async fn download_ezpp_launcher_update(app: AppHandle, url: String) -> Resul
Ok(())
}
#[cfg(windows)]
#[tauri::command]
pub async fn install_ezpp_launcher_update(app: AppHandle) -> Result<(), String> {
#[cfg(windows)]
@@ -1315,3 +1321,38 @@ pub async fn read_theme_info(app: AppHandle, file_path: String) -> Result<ThemeI
.await
.map_err(|e| format!("Thread error: {}", e))?
}
#[tauri::command]
pub fn config_get(key: String, state: State<AppState>) -> Result<Option<Value>, ConfigError> {
state.config.lock().unwrap().get(&key)
}
#[tauri::command]
pub fn config_set(
key: String,
value: Value,
encrypt: bool,
state: State<AppState>,
) -> Result<(), ConfigError> {
state.config.lock().unwrap().set(&key, value, encrypt)
}
#[tauri::command]
pub fn config_exists(key: String, state: State<AppState>) -> Result<bool, ConfigError> {
state.config.lock().unwrap().exists(&key)
}
#[tauri::command]
pub fn config_delete(key: String, state: State<AppState>) -> Result<(), ConfigError> {
state.config.lock().unwrap().delete(&key)
}
#[tauri::command]
pub fn config_clear(state: State<AppState>) -> Result<(), ConfigError> {
state.config.lock().unwrap().clear()
}
#[tauri::command]
pub fn config_all(state: State<AppState>) -> Result<Vec<(String, Value)>, ConfigError> {
state.config.lock().unwrap().all()
}
+219
View File
@@ -0,0 +1,219 @@
use aes_gcm::aead::rand_core::RngCore;
use aes_gcm::{
Aes256Gcm, Key, Nonce,
aead::{Aead, KeyInit, OsRng},
};
use base64::{Engine, engine::general_purpose::STANDARD as BASE64};
use rusqlite::{Connection, OptionalExtension, params};
use serde_json::Value;
use sha2::{Digest, Sha256};
use std::path::PathBuf;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ConfigError {
#[error("SQLite error: {0}")]
Sqlite(#[from] rusqlite::Error),
#[error("Encryption error: {0}")]
Encryption(String),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("Base64 error: {0}")]
Base64(#[from] base64::DecodeError),
#[error("Config not initialized")]
NotInitialized,
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
}
impl serde::Serialize for ConfigError {
fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
s.serialize_str(&self.to_string())
}
}
pub struct Config {
db_path: PathBuf,
conn: Option<Connection>,
hwid_key: Option<[u8; 32]>,
}
impl Config {
pub fn new(db_path: impl Into<PathBuf>) -> Self {
Self {
db_path: db_path.into(),
conn: None,
hwid_key: None,
}
}
pub fn init(&mut self, hwid: &str) -> Result<bool, ConfigError> {
let mut hasher = Sha256::new();
hasher.update(hwid.as_bytes());
let key_bytes: [u8; 32] = hasher.finalize().into();
self.hwid_key = Some(key_bytes);
let is_new = !self.db_path.exists();
if let Some(parent) = self.db_path.parent() {
std::fs::create_dir_all(parent)?;
}
let conn = Connection::open(&self.db_path)?;
conn.execute_batch(
"
PRAGMA journal_mode=WAL;
CREATE TABLE IF NOT EXISTS config (
key TEXT PRIMARY KEY,
value TEXT NOT NULL,
encrypted INTEGER NOT NULL DEFAULT 0
);
",
)?;
self.conn = Some(conn);
Ok(is_new)
}
pub fn get(&self, key: &str) -> Result<Option<Value>, ConfigError> {
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
let mut stmt = conn.prepare("SELECT value, encrypted FROM config WHERE key = ?1")?;
let row: Option<(String, bool)> = stmt
.query_row(params![key], |r| Ok((r.get(0)?, r.get(1)?)))
.optional()?;
match row {
None => Ok(None),
Some((raw, false)) => Ok(Some(serde_json::from_str::<Value>(&raw)?)),
Some((raw, true)) => {
let plaintext = self
.decrypt_value(&raw)
.map_err(|_| ConfigError::Encryption(format!("failed to decrypt '{}'", key)))?;
serde_json::from_str::<Value>(&plaintext)
.map(Some)
.map_err(|_| {
ConfigError::Encryption(format!("decrypted '{}' is not valid JSON", key))
})
}
}
}
pub fn exists(&self, key: &str) -> Result<bool, ConfigError> {
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
let count: i64 = conn.query_row(
"SELECT COUNT(*) FROM config WHERE key = ?1",
params![key],
|r| r.get(0),
)?;
Ok(count > 0)
}
/// Return all key/value pairs (decrypting encrypted ones).
pub fn all(&self) -> Result<Vec<(String, Value)>, ConfigError> {
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
let mut stmt = conn.prepare("SELECT key, value, encrypted FROM config")?;
let rows = stmt.query_map([], |r| {
Ok((
r.get::<_, String>(0)?,
r.get::<_, String>(1)?,
r.get::<_, bool>(2)?,
))
})?;
let mut out = Vec::new();
for row in rows {
let (k, raw, enc) = row?;
let v: Value = if enc {
let pt = self.decrypt_value(&raw)?;
serde_json::from_str(&pt)?
} else {
serde_json::from_str(&raw)?
};
out.push((k, v));
}
Ok(out)
}
pub fn set<T: serde::Serialize>(
&self,
key: &str,
value: T,
encrypt: bool,
) -> Result<(), ConfigError> {
let json = serde_json::to_string(&value)?;
if encrypt {
let blob = self.encrypt_value(&json)?;
self.upsert(key, &blob, true)
} else {
self.upsert(key, &json, false)
}
}
pub fn delete(&self, key: &str) -> Result<(), ConfigError> {
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
conn.execute("DELETE FROM config WHERE key = ?1", params![key])?;
Ok(())
}
pub fn clear(&self) -> Result<(), ConfigError> {
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
conn.execute("DELETE FROM config", [])?;
Ok(())
}
fn upsert(&self, key: &str, raw: &str, encrypted: bool) -> Result<(), ConfigError> {
let conn = self.conn.as_ref().ok_or(ConfigError::NotInitialized)?;
conn.execute(
"INSERT INTO config (key, value, encrypted)
VALUES (?1, ?2, ?3)
ON CONFLICT(key) DO UPDATE SET value = excluded.value,
encrypted = excluded.encrypted",
params![key, raw, encrypted as i32],
)?;
Ok(())
}
fn cipher(&self) -> Result<Aes256Gcm, ConfigError> {
let key_bytes = self.hwid_key.ok_or(ConfigError::NotInitialized)?;
let key = Key::<Aes256Gcm>::from_slice(&key_bytes);
Ok(Aes256Gcm::new(key))
}
fn encrypt_value(&self, plaintext: &str) -> Result<String, ConfigError> {
let cipher = self.cipher()?;
let mut nonce_bytes = [0u8; 12];
OsRng.fill_bytes(&mut nonce_bytes);
let nonce = Nonce::from_slice(&nonce_bytes);
let ciphertext = cipher
.encrypt(nonce, plaintext.as_bytes())
.map_err(|e| ConfigError::Encryption(e.to_string()))?;
let mut combined = nonce_bytes.to_vec();
combined.extend_from_slice(&ciphertext);
Ok(BASE64.encode(&combined))
}
fn decrypt_value(&self, blob: &str) -> Result<String, ConfigError> {
let cipher = self.cipher()?;
let combined = BASE64.decode(blob)?;
if combined.len() < 12 {
return Err(ConfigError::Encryption("blob too short".into()));
}
let (nonce_bytes, ciphertext) = combined.split_at(12);
let nonce = Nonce::from_slice(nonce_bytes);
let plaintext = cipher
.decrypt(nonce, ciphertext)
.map_err(|e| ConfigError::Encryption(e.to_string()))?;
String::from_utf8(plaintext).map_err(|e| ConfigError::Encryption(e.to_string()))
}
}
+41 -16
View File
@@ -1,28 +1,34 @@
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
use hardware_id::get_id;
use std::path::PathBuf;
use std::sync::Mutex;
use tauri::Manager;
use tauri_plugin_fs::FsExt;
pub mod commands;
pub mod config;
pub mod osudb;
pub mod presence;
pub mod state;
pub mod utils;
use crate::commands::{
check_for_corruption, download_and_extract_theme, download_ezpp_launcher_update,
use crate::{
commands::{
check_for_corruption, config_all, config_clear, config_delete, config_exists, config_get,
config_set, download_and_extract_theme, download_ezpp_launcher_update,
download_ezpp_launcher_update_files, encrypt_string, exit, extract_theme,
find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid,
get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform,
get_skins, get_skins_count, has_net8, has_osuwinello, has_wmctrl, install_ezpp_launcher_update,
is_open_tablet_driver_path_valid, is_open_tablet_driver_running, is_osu_running,
open_url_in_browser, opened_urls, presence_connect, presence_disconnect, presence_is_connected,
presence_update_button, presence_update_status, presence_update_user, read_theme_info,
replace_ui_files, run_open_tablet_driver, run_osu, run_osu_updater, set_osu_config_values,
get_skins, get_skins_count, has_net8, has_osuwinello, has_wmctrl,
install_ezpp_launcher_update, is_open_tablet_driver_path_valid,
is_open_tablet_driver_running, is_osu_running, open_url_in_browser, opened_urls,
presence_connect, presence_disconnect, presence_is_connected, presence_update_button,
presence_update_status, presence_update_user, read_theme_info, replace_ui_files,
run_open_tablet_driver, run_osu, run_osu_updater, set_osu_config_values,
set_osu_user_config_values, stop_open_tablet_driver, valid_osu_folder,
},
state::AppState,
};
struct OpenedUrls(Mutex<Vec<PathBuf>>);
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
#[cfg(target_os = "linux")]
@@ -60,26 +66,39 @@ pub fn run() {
}
let app = builder
.manage(OpenedUrls(Mutex::new(vec![])))
.setup(|app| {
// ── Config ────────────────────────────────────────────────────────
let home = std::env::var("HOME")
.or_else(|_| std::env::var("USERPROFILE"))
.unwrap_or_else(|_| ".".into());
let db_path = PathBuf::from(home).join(".ezpplauncher").join("config.db");
let hwid = get_id().unwrap_or_else(|_| "recorderinsandybridge".into());
let mut cfg = config::Config::new(db_path);
cfg.init(&hwid)?;
// ── Opened files ──────────────────────────────────────────────────
let mut opened_files = Vec::new();
let args = std::env::args().collect::<Vec<_>>();
if args.len() > 1 {
let mut files = Vec::new();
for maybe_file in args.iter().skip(1) {
if maybe_file.starts_with("-") {
continue;
}
let path = PathBuf::from(maybe_file);
if path.extension().and_then(|e| e.to_str()) == Some("ezpplauncher-theme") {
app.fs_scope().allow_file(&path).ok();
files.push(path);
opened_files.push(path);
}
}
}
app.state::<OpenedUrls>().0.lock().unwrap().extend(files);
}
app.manage(AppState {
config: Mutex::new(cfg),
opened_files: Mutex::new(opened_files),
});
Ok(())
})
.invoke_handler(tauri::generate_handler![
@@ -121,6 +140,12 @@ pub fn run() {
read_theme_info,
extract_theme,
download_and_extract_theme,
config_get,
config_set,
config_exists,
config_delete,
config_clear,
config_all,
run_open_tablet_driver,
stop_open_tablet_driver,
is_open_tablet_driver_running,
+9
View File
@@ -0,0 +1,9 @@
// state.rs
use crate::config::Config;
use std::path::PathBuf;
use std::sync::Mutex;
pub struct AppState {
pub config: Mutex<Config>,
pub opened_files: Mutex<Vec<PathBuf>>,
}
+10 -3
View File
@@ -24,10 +24,13 @@ pub fn get_osu_user_config<P: AsRef<Path>>(
return None;
}
let current_user = std::env::var("USERNAME").unwrap_or_else(|_| "Admin".to_string());
let current_user = std::env::var("USERNAME")
.or_else(|_| std::env::var("USER"))
.unwrap_or_else(|_| "Admin".to_string());
let osu_config_path = osu_folder_path
.as_ref()
.join(format!("osu!.{}.cfg", current_user));
println!("Looking for user config at: {:?}", osu_config_path);
if !osu_config_path.exists() {
return None;
}
@@ -48,7 +51,9 @@ pub fn set_osu_user_config_vals(
osu_folder_path: &str,
key_values: &[(&str, Option<&str>)],
) -> Result<bool, String> {
let current_user = std::env::var("USERNAME").unwrap_or_else(|_| "Admin".to_string());
let current_user = std::env::var("USERNAME")
.or_else(|_| std::env::var("USER"))
.unwrap_or_else(|_| "Admin".to_string());
let osu_config_path = Path::new(osu_folder_path).join(format!("osu!.{}.cfg", current_user));
if !osu_config_path.exists() {
@@ -310,7 +315,9 @@ pub async fn is_net8_installed() -> bool {
}
let stdout_str = String::from_utf8_lossy(&output.stdout);
stdout_str.lines().any(|line| line.starts_with("Microsoft.WindowsDesktop.App 8."))
stdout_str
.lines()
.any(|line| line.starts_with("Microsoft.WindowsDesktop.App 8."))
}
Err(_) => false,
}
+17 -2
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "EZPPLauncher",
"version": "3.2.1",
"version": "3.2.3",
"identifier": "farm.EZPPFarm.Launcher",
"mainBinaryName": "ezpplauncher",
"build": {
@@ -26,7 +26,22 @@
],
"withGlobalTauri": true,
"security": {
"csp": "default-src 'self' tauri: asset:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' asset: data: blob: https://assets.ppy.sh https://a.ez-pp.farm https://git.ez-pp.farm https://osu.direct; connect-src 'self' https://ez-pp.farm https://api.ez-pp.farm https://c.ez-pp.farm https://analytics.ez-pp.farm https://git.ez-pp.farm https://osu.direct; media-src 'self' asset: blob:;",
"csp": {
"default-src": "'self' tauri: customprotocol: asset:",
"script-src": "'self' 'unsafe-inline' asset: http://asset.localhost https://asset.localhost https://analytics.ez-pp.farm",
"style-src": "'self' 'unsafe-inline' asset: http://asset.localhost https://asset.localhost",
"img-src": "'self' asset: http://asset.localhost https://asset.localhost blob: data: https://assets.ppy.sh https://a.ez-pp.farm https://git.ez-pp.farm https://osu.direct",
"connect-src": "'self' ipc: http://ipc.localhost https://ez-pp.farm https://api.ez-pp.farm https://c.ez-pp.farm https://analytics.ez-pp.farm https://git.ez-pp.farm https://osu.direct https://osu.ppy.sh",
"media-src": "'self' asset: http://asset.localhost https://asset.localhost blob:",
"font-src": [
"'self'",
"asset:",
"blob:",
"data:",
"http://asset.localhost",
"https://asset.localhost"
]
},
"assetProtocol": {
"enable": true,
"scope": [
-56
View File
@@ -148,62 +148,6 @@
--color-sidebar-ring: var(--sidebar-ring);
}
main[data-theme="execution_clap"] {
--primary: #fc112b;
--primary-foreground: #fff;
--ring: #fc112b;
--color-primary-50: #fef2f2;
--color-primary-100: #fee2e2;
--color-primary-200: #fecaca;
--color-primary-300: #fca5a5;
--color-primary-400: #f87171;
--color-primary-500: #ef4444;
--color-primary-600: #dc2626;
--color-primary-700: #b91c1c;
--color-primary-800: #991b1b;
--color-primary-900: #7f1d1d;
--color-primary-950: #450a0a;
--bg-primary-50: #fef2f2;
--bg-primary-100: #fee2e2;
--bg-primary-200: #fecaca;
--bg-primary-300: #fca5a5;
--bg-primary-400: #f87171;
--bg-primary-500: #ef4444;
--bg-primary-600: #dc2626;
--bg-primary-700: #b91c1c;
--bg-primary-800: #991b1b;
--bg-primary-900: #7f1d1d;
--bg-primary-950: #450a0a;
}
main[data-theme="lost_umbrella"] {
--primary: #e5e5e5;
--primary-foreground: #000;
--ring: #e5e5e5;
--color-primary-50: #0d0d0d;
--color-primary-100: #1a1a1a;
--color-primary-200: #333333;
--color-primary-300: #4d4d4d;
--color-primary-400: #666666;
--color-primary-500: #808080;
--color-primary-600: #999999;
--color-primary-700: #b3b3b3;
--color-primary-800: #cccccc;
--color-primary-900: #e6e6e6;
--color-primary-950: #f2f2f2;
--bg-primary-50: #0d0d0d;
--bg-primary-100: #1a1a1a;
--bg-primary-200: #333333;
--bg-primary-300: #4d4d4d;
--bg-primary-400: #666666;
--bg-primary-500: #808080;
--bg-primary-600: #999999;
--bg-primary-700: #b3b3b3;
--bg-primary-800: #cccccc;
--bg-primary-900: #e6e6e6;
--bg-primary-950: #f2f2f2;
}
@layer base {
* {
@apply border-border outline-ring/50;
@@ -1,6 +1,7 @@
<script lang="ts">
import { config } from '$lib/config';
import { custom_theme_audio_playing, custom_theme_volume } from '$lib/global';
import { reduceAnimations, userSettings } from '$lib/userSettings';
import { reduceAnimations } from '$lib/userSettings';
import { Volume, Volume1, VolumeOff } from '@lucide/svelte';
import Minimize from '@lucide/svelte/icons/minus';
import Volume2 from '@lucide/svelte/icons/volume-2';
@@ -62,8 +63,7 @@
step="0.01"
bind:value={$custom_theme_volume}
on:input={() => {
$userSettings.value('volume').set($custom_theme_volume);
$userSettings.save();
config.value<number>('volume').set($custom_theme_volume);
}}
class="volume-slider"
/>
+30 -78
View File
@@ -1,87 +1,39 @@
import { Crypto } from './crypto';
import { getHWID } from './osuUtil';
import * as path from '@tauri-apps/api/path';
import { exists, mkdir, readTextFile, writeFile } from '@tauri-apps/plugin-fs';
import { invoke } from '@tauri-apps/api/core';
export class Config {
private fileName: string;
private config: Record<string, unknown> = {};
private crypto: Crypto | undefined;
private configFilePath: string | undefined;
private encrypt: boolean;
constructor(fileName: string, encrypt?: boolean) {
this.fileName = fileName;
this.encrypt = encrypt ?? false;
interface ConfigValue<T> {
set(value: T, opts?: { encrypt?: boolean }): Promise<void>;
get(fallback: T): Promise<T>;
exists(): Promise<boolean>;
delete(): Promise<void>;
}
async init(): Promise<boolean> {
const hwid = (await getHWID()) ?? 'recorderinsandybridge';
this.crypto = new Crypto(hwid);
const homeDir = await path.homeDir();
const folderPath = await path.join(homeDir, '.ezpplauncher');
this.configFilePath = await path.join(folderPath, this.fileName);
const createFolder = !(await exists(folderPath));
if (createFolder) await mkdir(folderPath);
const configExists = await exists(this.configFilePath);
if (!configExists) return true;
await this.load();
return false;
}
private async load() {
if (!this.configFilePath) throw Error('configFilePath not set');
if (this.encrypt && !this.crypto) throw Error('crypto not initialized');
const fileStream = await readTextFile(this.configFilePath);
try {
const decryptedJSON = JSON.parse(
this.encrypt && this.crypto ? this.crypto.decrypt(fileStream) : fileStream
) as Record<string, unknown>;
this.config = decryptedJSON;
} catch (err) {
console.log(err);
this.config = {};
await this.save();
}
}
async save() {
if (!this.configFilePath) throw Error('configFilePath not set');
if (this.encrypt && !this.crypto) throw Error('crypto not initialized');
const encryptedJSON =
this.encrypt && this.crypto
? this.crypto.encrypt(JSON.stringify(this.config))
: JSON.stringify(this.config);
await writeFile(this.configFilePath, Buffer.from(encryptedJSON), {
append: false,
});
}
values() {
return this.config;
}
value(key: string) {
export const config = {
value<T = unknown>(key: string): ConfigValue<T> {
return {
set: <T>(val: T) => {
this.config[key] = val;
set(value: T, opts?: { encrypt?: boolean }): Promise<void> {
return invoke('config_set', { key, value, encrypt: opts?.encrypt ?? false });
},
exists: () => {
return this.config[key] !== undefined;
async get(fallback: T): Promise<T> {
const result = await invoke<T | null>('config_get', { key });
return result ?? fallback;
},
get: <T>(fallback: T): T => {
return (this.config[key] as T) ?? fallback;
exists(): Promise<boolean> {
return invoke<boolean>('config_exists', { key });
},
del: () => {
delete this.config[key];
delete(): Promise<void> {
return invoke('config_delete', { key });
},
};
},
all(): Promise<[string, unknown][]> {
return invoke<[string, unknown][]>('config_all');
},
clear(): Promise<void> {
return invoke('config_clear');
},
};
}
}
+94
View File
@@ -0,0 +1,94 @@
import { Crypto } from './crypto';
import { getHWID } from './osuUtil';
import * as path from '@tauri-apps/api/path';
import { exists, mkdir, readTextFile, writeFile, remove } from '@tauri-apps/plugin-fs';
export class Config {
private fileName: string;
private config: Record<string, unknown> = {};
private crypto: Crypto | undefined;
private configFilePath: string | undefined;
private encrypt: boolean;
constructor(fileName: string, encrypt?: boolean) {
this.fileName = fileName;
this.encrypt = encrypt ?? false;
}
async init(): Promise<boolean> {
const hwid = (await getHWID()) ?? 'recorderinsandybridge';
this.crypto = new Crypto(hwid);
const homeDir = await path.homeDir();
const folderPath = await path.join(homeDir, '.ezpplauncher');
this.configFilePath = await path.join(folderPath, this.fileName);
const createFolder = !(await exists(folderPath));
if (createFolder) await mkdir(folderPath);
const configExists = await exists(this.configFilePath);
if (configExists) {
await this.load();
return true;
}
return false;
}
private async load() {
if (!this.configFilePath) throw Error('configFilePath not set');
if (this.encrypt && !this.crypto) throw Error('crypto not initialized');
const fileStream = await readTextFile(this.configFilePath);
try {
const decryptedJSON = JSON.parse(
this.encrypt && this.crypto ? this.crypto.decrypt(fileStream) : fileStream
) as Record<string, unknown>;
this.config = decryptedJSON;
} catch (err) {
console.log(err);
this.config = {};
await this.save();
}
}
async delete() {
if (!this.configFilePath) throw Error('configFilePath not set');
await remove(this.configFilePath);
}
async save() {
if (!this.configFilePath) throw Error('configFilePath not set');
if (this.encrypt && !this.crypto) throw Error('crypto not initialized');
const encryptedJSON =
this.encrypt && this.crypto
? this.crypto.encrypt(JSON.stringify(this.config))
: JSON.stringify(this.config);
await writeFile(this.configFilePath, Buffer.from(encryptedJSON), {
append: false,
});
}
values() {
return this.config;
}
value(key: string) {
return {
set: <T>(val: T) => {
this.config[key] = val;
},
exists: () => {
return this.config[key] !== undefined;
},
get: <T>(fallback: T): T => {
return (this.config[key] as T) ?? fallback;
},
del: () => {
delete this.config[key];
},
};
}
}
+16 -2
View File
@@ -1,5 +1,5 @@
import { active_custom_theme, custom_themes } from './global';
import { setGlobalVolume } from './utils';
import { disableMediaControls, setGlobalVolume } from './utils';
import { betterFetch } from '@better-fetch/fetch';
import { convertFileSrc } from '@tauri-apps/api/core';
import { invoke } from '@tauri-apps/api/core';
@@ -14,6 +14,7 @@ export type Theme = {
version: string;
author: string;
scriptUrl: string;
cssStyle: string;
assets: string;
preview: string;
status: 'installed' | 'downloading' | 'extracting' | 'deleting' | 'not-installed';
@@ -77,6 +78,7 @@ export const getDownloadableThemes = async () => {
status: 'not-installed',
progress: 0,
updateAvailable: false,
cssStyle: '',
});
}
} else {
@@ -99,6 +101,7 @@ export const getThemes = async (): Promise<Theme[]> => {
status: 'installed',
progress: 0,
updateAvailable: false,
cssStyle: '',
});
const folderPath = await path.join(await path.homeDir(), '.ezpplauncher', 'themes');
if (await fs.exists(folderPath)) {
@@ -110,6 +113,8 @@ export const getThemes = async (): Promise<Theme[]> => {
const themeConfig = await fs.readTextFile(themeConfigFilePath);
const theme = JSON.parse(themeConfig) as ThemeInfo;
const scriptFile = await path.join(folderPath, themeFolder.name, theme.entry);
const cssStylePath = await path.join(folderPath, themeFolder.name, theme.style);
const cssStyle = (await fs.exists(cssStylePath)) ? await fs.readTextFile(cssStylePath) : '';
if (await fs.exists(scriptFile)) {
themes.push({
folder_name: themeFolder.name,
@@ -124,6 +129,7 @@ export const getThemes = async (): Promise<Theme[]> => {
status: 'installed',
progress: 0,
updateAvailable: false,
cssStyle,
});
}
}
@@ -233,11 +239,14 @@ export const downloadTheme = async (
const themePreview = convertFileSrc(
await path.normalize(`${themeFolder}/assets/${themeInfoObj.preview}`)
);
const cssStylePath = await path.join(themeFolder, themeInfoObj.style);
const cssStyle = (await fs.exists(cssStylePath)) ? await fs.readTextFile(cssStylePath) : '';
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === theme.name);
if (matchedTheme) {
matchedTheme.scriptUrl = themeScriptUrl;
matchedTheme.cssStyle = cssStyle;
matchedTheme.assets = themeAssets;
matchedTheme.preview = themePreview;
matchedTheme.status = 'installed';
@@ -259,10 +268,10 @@ export const loadTheme = async (theme: Theme, themeContainer: HTMLElement, volum
themeScript.mountTheme(themeContainer, { assets: theme.assets });
}
setGlobalVolume(volume);
disableMediaControls();
};
export const deleteTheme = async (themeToUninstall: Theme) => {
console.log('Uninstall', themeToUninstall);
if (themeToUninstall.status !== 'installed') {
return false;
}
@@ -287,6 +296,7 @@ export const deleteTheme = async (themeToUninstall: Theme) => {
const matchedTheme = themes.find((t) => t.name === themeToUninstall.name);
if (matchedTheme) {
matchedTheme.scriptUrl = '';
matchedTheme.cssStyle = '';
matchedTheme.assets = '';
matchedTheme.preview = `https://git.ez-pp.farm/EZPPFarm/EZPPLauncher-Themes/raw/branch/main/previews/${toSafeName(themeToUninstall.name)}.png`;
matchedTheme.status = 'not-installed';
@@ -353,11 +363,14 @@ export const importThemeFromFile = async (themeName: string, filePath: string) =
const themePreview = convertFileSrc(
await path.normalize(`${themeFolder}/assets/${themeInfoObj.preview}`)
);
const cssStylePath = await path.join(themeFolder, themeInfoObj.style);
const cssStyle = (await fs.exists(cssStylePath)) ? await fs.readTextFile(cssStylePath) : '';
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === themeInfoObj.name);
if (matchedTheme) {
matchedTheme.scriptUrl = themeScriptUrl;
matchedTheme.cssStyle = cssStyle;
matchedTheme.assets = themeAssets;
matchedTheme.preview = themePreview;
matchedTheme.status = 'installed';
@@ -407,6 +420,7 @@ export const reloadThemes = async () => {
storeTheme.version = theme.version;
storeTheme.author = theme.author;
storeTheme.updateAvailable = theme.updateAvailable;
storeTheme.cssStyle = theme.cssStyle;
}
const newThemes = combinedThemes.filter((t) => !storeMap.has(t.name));
+2
View File
@@ -1,3 +1,5 @@
export type LaunchView = 'HOME' | 'LOGIN' | 'SETTINGS' | 'THEMES';
export type EZPPUserResponse = {
code: number;
message: string;
-2
View File
@@ -1,6 +1,4 @@
import { Config } from './config';
import type { EZPPUser } from './types';
import { writable } from 'svelte/store';
export const userAuth = writable<Config>(new Config('user_auth', true));
export const currentUser = writable<EZPPUser | undefined>(undefined);
-3
View File
@@ -1,8 +1,5 @@
import { Config } from './config';
import { writable } from 'svelte/store';
export const userSettings = writable<Config>(new Config('user_settings', false));
export const customCursor = writable<boolean>(false);
export const cursorSmoothening = writable<boolean>(false);
export const cursorSmoothness = writable<number>(180);
+37
View File
@@ -203,6 +203,43 @@ export function trackMediaContainer(node: HTMLElement) {
};
}
const MEDIA_ACTIONS: MediaSessionAction[] = [
'play',
'pause',
'stop',
'previoustrack',
'nexttrack',
'seekbackward',
'seekforward',
];
export function disableMediaControls() {
const mediaElements: NodeListOf<HTMLMediaElement> = document.querySelectorAll('audio, video');
if ('mediaSession' in navigator) {
MEDIA_ACTIONS.forEach((action) => {
try {
navigator.mediaSession.setActionHandler(action, () => {});
} catch {}
});
}
document.addEventListener(
'keydown',
(e: KeyboardEvent) => {
if (e.key.startsWith('Media')) {
e.preventDefault();
e.stopPropagation();
}
},
true
);
mediaElements.forEach((el) => {
el.disableRemotePlayback = true;
});
}
export function calculateGitBlobSha(fileBuffer: Buffer): string {
const header = Buffer.from(`blob ${fileBuffer.length}\0`);
const store = Buffer.concat([header, fileBuffer]);
+70 -45
View File
@@ -6,6 +6,8 @@
import OsuCursor from '$lib/components/ui/osu-cursor/OsuCursor.svelte';
import SileoToast from '$lib/components/ui/sileo/sileo-toast.svelte';
import Titlebar from '$lib/components/ui/titlebar/titlebar.svelte';
import { config } from '$lib/config';
import { Config } from '$lib/config_old';
import {
active_custom_theme,
currentLoadingInfo,
@@ -25,15 +27,7 @@
import { exit, getLauncherVersion, getPlatform } from '$lib/osuUtil';
import * as presence from '$lib/presence';
import { getDownloadableThemes, getThemes, loadTheme } from '$lib/themes';
import { userAuth } from '$lib/userAuthentication';
import {
cursorSmoothening,
customCursor,
osuInstallationPath,
patch,
reduceAnimations,
userSettings,
} from '$lib/userSettings';
import { cursorSmoothening, customCursor, patch, reduceAnimations } from '$lib/userSettings';
import { trackMediaContainer } from '$lib/utils';
import '../app.css';
import { Buffer } from 'buffer';
@@ -94,51 +88,77 @@
disableReload();
setupValues();
launcherVersion.set(await getLauncherVersion());
const isFirstStartup = await $userSettings.init();
firstStartup.set(isFirstStartup);
$userAuth.init();
const oldUserConfig = new Config('user_settings', false);
const oldUserConfigExists = await oldUserConfig.init();
if (oldUserConfigExists) {
const oldUserConfigValues = oldUserConfig.values();
if (Object.keys(oldUserConfigValues).length > 0) {
await config.value<boolean>('setup_complete').set(true);
for (const key in oldUserConfigValues) {
const value = oldUserConfigValues[key];
await config.value<typeof value>(key).set(value);
}
}
await oldUserConfig.delete();
}
const oldUserAuth = new Config('user_auth', true);
const oldUserAuthExists = await oldUserAuth.init();
if (oldUserAuthExists) {
const oldUserAuthValues = oldUserAuth.values();
if (Object.keys(oldUserAuthValues).length > 0) {
for (const key in oldUserAuthValues) {
const value = oldUserAuthValues[key];
await config.value<typeof value>(key).set(value);
}
}
await oldUserAuth.delete();
}
const isSetupComplete = await config.value<boolean>('setup_complete').get(false);
firstStartup.set(!isSetupComplete);
currentLoadingInfo.set('Loading config...');
const config_theme = $userSettings.value('theme');
const config_theme_volume = $userSettings.value('volume');
const config_patching = $userSettings.value('patching');
const config_custom_cursor = $userSettings.value('custom_cursor');
const config_cursor_smoothening = $userSettings.value('cursor_smoothening');
const config_reduce_animations = $userSettings.value('reduce_animations');
const config_osu_installation_path = $userSettings.value('osu_installation_path');
const config_discord_presence = $userSettings.value('discord_presence');
const config_tracking_enabled = $userSettings.value('tracking_consent');
const config_otd_enabled = $userSettings.value('otd_enabled');
const config_otd_path = $userSettings.value('otd_path');
const config_theme = config.value<string>('theme');
const config_theme_volume = config.value<number>('volume');
const config_patching = config.value<boolean>('patching');
const config_custom_cursor = config.value<boolean>('custom_cursor');
const config_cursor_smoothening = config.value<boolean>('cursor_smoothening');
const config_reduce_animations = config.value<boolean>('reduce_animations');
const config_discord_presence = config.value<boolean>('discord_presence');
const config_tracking_enabled = config.value<boolean>('tracking_consent');
const config_otd_enabled = config.value<boolean>('otd_enabled');
const config_otd_path = config.value<string>('otd_path');
const localThemes = await getThemes();
const last_theme = localThemes.find((t) => t.name === config_theme.get('Default'));
if (!last_theme) {
$userSettings.value('theme').set('Default');
await $userSettings.save();
loadTheme(localThemes[0], $custom_theme_container!, config_theme_volume.get(0.15));
const lastThemeName = await config_theme.get('Default');
const last_theme = localThemes.find((t) => t.name === lastThemeName);
if (!last_theme || $platform === 'linux') {
await config.value<string>('theme').set('Default');
loadTheme(localThemes[0], $custom_theme_container!, await config_theme_volume.get(0.15));
} else {
loadTheme(last_theme, $custom_theme_container!, config_theme_volume.get(0.15));
loadTheme(last_theme, $custom_theme_container!, await config_theme_volume.get(0.15));
}
custom_theme_volume.set(config_theme_volume.get(0.15));
patch.set(config_patching.get(true));
customCursor.set(config_custom_cursor.get(true));
cursorSmoothening.set(config_cursor_smoothening.get(true));
reduceAnimations.set(config_reduce_animations.get(false));
osuInstallationPath.set(config_osu_installation_path.get(''));
discordPresence.set(config_discord_presence.get(true));
openTabletDriverEnabled.set(config_otd_enabled.get(false));
openTabletDriverPath.set(config_otd_path.get(''));
if (config_tracking_enabled.exists()) {
trackingEnabled.set(config_tracking_enabled.get(false));
custom_theme_volume.set(await config_theme_volume.get(0.15));
patch.set(await config_patching.get(true));
customCursor.set(await config_custom_cursor.get(true));
cursorSmoothening.set(await config_cursor_smoothening.get(true));
reduceAnimations.set(await config_reduce_animations.get(false));
discordPresence.set(await config_discord_presence.get(true));
openTabletDriverEnabled.set(await config_otd_enabled.get(false));
openTabletDriverPath.set(await config_otd_path.get(''));
if (await config_tracking_enabled.exists()) {
trackingEnabled.set(await config_tracking_enabled.get(false));
}
patch.subscribe((val) => config_patching.set(val));
customCursor.subscribe((val) => config_custom_cursor.set(val));
cursorSmoothening.subscribe((val) => config_cursor_smoothening.set(val));
reduceAnimations.subscribe((val) => config_reduce_animations.set(val));
openTabletDriverEnabled.subscribe((val) => config_otd_enabled.set(val));
patch.subscribe(async (val) => await config_patching.set(val));
customCursor.subscribe(async (val) => await config_custom_cursor.set(val));
cursorSmoothening.subscribe(async (val) => await config_cursor_smoothening.set(val));
reduceAnimations.subscribe(async (val) => await config_reduce_animations.set(val));
openTabletDriverEnabled.subscribe(async (val) => config_otd_enabled.set(val));
discordPresence.subscribe(async (val) => {
config_discord_presence.set(val);
@@ -207,6 +227,11 @@
});
</script>
<svelte:head>
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html `<style>${$active_custom_theme?.cssStyle || ''}</style>`}
</svelte:head>
{#if $customCursor}
<OsuCursor smoothCursor={$cursorSmoothening} />
{/if}
+85 -61
View File
@@ -15,6 +15,7 @@
import Progress from '$lib/components/ui/progress/progress.svelte';
import ScrollContainer from '$lib/components/ui/scroll-container/ScrollContainer.svelte';
import * as Select from '$lib/components/ui/select';
import { config } from '$lib/config';
import { currentUserInfo } from '$lib/data';
import { useDropZone } from '$lib/dropZone.svelte';
import {
@@ -87,8 +88,8 @@
loadTheme,
type ThemeInfo,
} from '$lib/themes';
import { EZPPActionStatus } from '$lib/types';
import { currentUser, userAuth } from '$lib/userAuthentication';
import { EZPPActionStatus, type LaunchView } from '$lib/types';
import { currentUser } from '$lib/userAuthentication';
import {
cursorSmoothening,
customCursor,
@@ -97,7 +98,6 @@
preferredMode,
preferredType,
reduceAnimations,
userSettings,
} from '$lib/userSettings';
import {
compareBuildNumbers,
@@ -141,7 +141,7 @@
import { onMount } from 'svelte';
import { fade, fly, scale } from 'svelte/transition';
let selectedView = $state('home');
let selectedView = $state<LaunchView>('HOME');
let progress = $state(-1);
let launchInfo = $state('');
let launchError = $state<Error | undefined>(undefined);
@@ -220,8 +220,7 @@
return;
}
osuInstallationPath.set(selectedPath);
$userSettings.value('osu_installation_path').set(selectedPath);
await $userSettings.save();
await config.value<string>('osu_installation_path').set(selectedPath);
sileo.success({
title: 'Yay!',
description: 'osu! installation path set successfully.',
@@ -305,7 +304,9 @@
try {
launchInfo = 'Looking for file updates...';
const updateResult = await getEZPPLauncherUpdateFiles(osuPath, $launcherStream);
let launchStream = $launcherStream;
if ($platform !== 'windows') launchStream = 'stable'; //fallback to stable for non windows systems
const updateResult = await getEZPPLauncherUpdateFiles(osuPath, launchStream);
if (updateResult) {
if (updateResult.filesToDownload.length > 0) {
@@ -404,8 +405,10 @@
launchInfo = 'You are up to date!';
}
if ($currentUser) {
const username = $userAuth.value('username').get('');
const password = $userAuth.value('password').get('');
const [username, password] = await Promise.all([
config.value<string>('username').get(''),
config.value<string>('password').get(''),
]);
if (username.length > 0 && password.length > 0) {
await setUserConfigValues(osuPath, [
{
@@ -572,6 +575,7 @@
const beatmapCoverImage = `https://assets.ppy.sh/beatmaps/${userStatus.player_status.status.beatmap.set_id}/covers/list@2x.jpg`;
const isValidImage = await urlIsValidImage(beatmapCoverImage);
if (isValidImage) largeImageKey = beatmapCoverImage;
if (userStatus.player_status.status.action !== EZPPActionStatus.DIRECT)
customButton = {
text: 'View Beatmap',
url: `https://ez-pp.farm/beatmapsets/${userStatus.player_status.status.beatmap.set_id}/${userStatus.player_status.status.beatmap.id}`,
@@ -703,13 +707,13 @@
title: 'Login successful!',
description: `Welcome back, ${loginResult.user.name}!`,
});
$userAuth.value('username').set(username);
$userAuth.value('password').set(password);
await $userAuth.save();
await Promise.all([
config.value<string>('username').set(username, { encrypt: true }),
config.value<string>('password').set(password, { encrypt: true }),
]);
currentUser.set(loginResult.user);
selectedView = 'home';
selectedView = 'HOME';
} else {
sileo.error({
title: 'Login failed!',
@@ -839,8 +843,7 @@
}
openTabletDriverPath.set(selectedPath);
$userSettings.value('otd_path').set(selectedPath);
await $userSettings.save();
await config.value<string>('otd_path').set(selectedPath);
sileo.success({
title: 'Yay!',
description: 'OpenTabletDriver set successfully.',
@@ -849,13 +852,14 @@
};
onMount(() => {
const config = $userSettings;
const trackingConsent = config.value('tracking_consent');
if (trackingConsent.exists()) {
trackingEnabled.set(trackingConsent.get(false));
(async () => {
const trackingConsent = config.value<boolean>('tracking_consent');
if (await trackingConsent.exists()) {
trackingEnabled.set(await trackingConsent.get(false));
} else {
askForTrackingPermission = true;
}
})();
animate(ezppLogo, {
opacity: [0, 1],
@@ -1008,9 +1012,7 @@
<Button
onclick={async () => {
trackingEnabled.set(true);
const config = $userSettings;
config.value('tracking_consent').set(true);
await config.save();
await config.value<boolean>('tracking_consent').set(true);
askForTrackingPermission = false;
}}>Yes, I consent</Button
>
@@ -1018,9 +1020,7 @@
variant="outline"
onclick={async () => {
trackingEnabled.set(false);
const config = $userSettings;
config.value('tracking_consent').set(false);
await config.save();
await config.value<boolean>('tracking_consent').set(false);
askForTrackingPermission = false;
}}>No, I do not consent</Button
>
@@ -1071,6 +1071,13 @@
themeInstalling = true;
try {
if ($active_custom_theme && $active_custom_theme.name === droppedTheme.themeInfo.name) {
const defaultTheme = $custom_themes.find((t) => t.name === 'Default');
if (defaultTheme) {
loadTheme(defaultTheme, $custom_theme_container!, $custom_theme_volume);
await config.value<string>('theme').set(defaultTheme.name);
}
}
await sileo.promise(
importThemeFromFile(droppedTheme.themeInfo.name, droppedTheme.filePath),
{
@@ -1145,36 +1152,36 @@
<Badge class="text-[0.5rem] py-0 px-2">{$launcherVersion || 'dev'}</Badge>
<Button
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
'home'
'HOME'
? 'bg-primary/50'
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
disabled={$launching}
onclick={() => {
if (!$launching) selectedView = 'home';
if (!$launching) selectedView = 'HOME';
}}
>
<House class="text-theme-200 size-5!" />
</Button>
<Button
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
'themes'
'THEMES'
? 'bg-primary/50'
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
disabled={$launching}
onclick={() => {
if (!$launching) selectedView = 'themes';
if (!$launching) selectedView = 'THEMES';
}}
>
<Paintbrush class="text-theme-200 size-5!" />
</Button>
<Button
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
'settings'
'SETTINGS'
? 'bg-primary/50'
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
disabled={$launching}
onclick={() => {
if (!$launching) selectedView = 'settings';
if (!$launching) selectedView = 'SETTINGS';
}}
>
<Settings class="text-theme-200 size-5!" />
@@ -1194,9 +1201,10 @@
<DropdownMenu.Item
class="text-destructive focus:text-destructive text-xs"
onclick={async () => {
$userAuth.value('username').del();
$userAuth.value('password').del();
await $userAuth.save();
await Promise.all([
config.value<string>('username').set(''),
config.value<string>('password').set(''),
]);
sileo.success({
title: 'Logout successful!',
description: 'See you soon!',
@@ -1204,14 +1212,14 @@
});
currentUser.set(undefined);
currentUserInfo.set(undefined);
selectedView = 'home';
selectedView = 'HOME';
}}
>
<LogOut class="size-3.5 mr-2" />
Logout
</DropdownMenu.Item>
{:else}
<DropdownMenu.Item class="text-xs" onclick={() => (selectedView = 'login')}>
<DropdownMenu.Item class="text-xs" onclick={() => (selectedView = 'LOGIN')}>
<LogIn class="size-3.5 mr-2" />
Login
</DropdownMenu.Item>
@@ -1221,7 +1229,7 @@
</div>
</div>
<div class="z-10 h-full overflow-hidden">
{#if selectedView === 'home'}
{#if selectedView === 'HOME'}
<div
class="flex flex-col-reverse h-full"
in:fly={{
@@ -1517,7 +1525,7 @@
<Button
class="flex-1 h-7 text-xs"
onclick={() => {
selectedView = 'login';
selectedView = 'LOGIN';
}}>Log In</Button
>
<Button
@@ -1538,7 +1546,7 @@
>
</div>
</div>
{:else if selectedView === 'settings'}
{:else if selectedView === 'SETTINGS'}
<div
class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm"
in:fly={{
@@ -1553,20 +1561,18 @@
<div class="flex flex-col">
<Label class="text-sm" for="setting-patch">Patching</Label>
<div class="text-muted-foreground text-xs">
Shows misses in Relax and Autopilot {#if $platform !== 'windows'}<span
Shows misses in Relax and Autopilot {#if $platform !== 'windows'}<!-- <span
class="text-red-500 bg-red-800/20 border border-red-600/20 p-0.5 mx-1 px-2 rounded-lg text-[0.55rem]!"
>currently only on windows!</span
>
> -->
{/if}
</div>
</div>
<Checkbox
id="setting-patch"
checked={$platform === 'windows' ? $patch : false}
disabled={$platform !== 'windows'}
checked={$patch}
onCheckedChange={async (e) => {
patch.set(e);
$userSettings.save();
}}
class="flex items-center justify-center w-5 h-5"
></Checkbox>
@@ -1585,8 +1591,6 @@
cursorSmoothening.set(false);
}
customCursor.set(e);
$userSettings.save();
}}
class="flex items-center justify-center w-5 h-5"
></Checkbox>
@@ -1603,7 +1607,6 @@
onCheckedChange={async (e) => {
if (!$customCursor) return;
cursorSmoothening.set(e);
$userSettings.save();
}}
disabled={!$customCursor}
class="flex items-center justify-center w-5 h-5"
@@ -1620,7 +1623,6 @@
checked={$reduceAnimations}
onCheckedChange={async (e) => {
reduceAnimations.set(e);
$userSettings.save();
}}
class="flex items-center justify-center w-5 h-5"
></Checkbox>
@@ -1656,8 +1658,7 @@
checked={$trackingEnabled}
onCheckedChange={async (e) => {
trackingEnabled.set(e);
$userSettings.value('tracking_consent').set(e);
await $userSettings.save();
await config.value<boolean>('tracking_consent').set(e);
}}
class="flex items-center justify-center w-5 h-5"
></Checkbox>
@@ -1718,6 +1719,7 @@
</div>
</div>
<div class="flex flex-row w-full">
<!-- only stable release stream for linux -->
<Select.Root
type="single"
bind:value={$launcherStream}
@@ -1738,9 +1740,8 @@
});
return;
}
$userSettings.value('patcherStream').set(newStream);
await config.value<string>('patcherStream').set(newStream);
launcherStream.set(newStream);
await $userSettings.save();
}}
>
<Select.Trigger
@@ -1764,7 +1765,7 @@
{/if}
</div>
</div>
{:else if selectedView === 'login'}
{:else if selectedView === 'LOGIN'}
<div
class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm"
in:fly={{
@@ -1815,7 +1816,7 @@
</Button>
</form>
</div>
{:else if selectedView === 'themes'}
{:else if selectedView === 'THEMES'}
<div
class="h-screen w-full flex flex-col items-center bg-black/20 backdrop-blur-sm"
in:fly={{
@@ -1826,6 +1827,23 @@
}}
out:fly={{ duration: $reduceAnimations ? 0 : 400, y: -5, opacity: 0 }}
>
{#if $platform === 'linux'}
<div
class="flex flex-col items-center gap-4 mt-12 px-6 text-center h-full justify-center"
>
<!-- currently there is a bug when applying themes on Linux, the Launcher freezes, also when trying to load assets via the assetProtocol it fails because it says the asset was loaded insecurely -->
<span class="text-2xl font-bold drop-shadow-lg"
>Custom themes are not supported on Linux yet(we are working on it!)</span
>
<span class="text-muted-foreground font-semibold drop-shadow-lg"
>Due to technical limitations on Linux, custom themes are currently not supported.
</span>
<span class="text-muted-foreground font-semibold drop-shadow-lg"
>We are working on a solution to bring custom themes to Linux in a future update, but
we don't have an ETA yet. Stay tuned!</span
>
</div>
{:else}
<ScrollContainer class="pt-8" topOffset={45}>
<div class="grid w-full gap-1 grid-cols-3 p-3 pr-5">
{#each $custom_themes as theme (theme.folder_name)}
@@ -1860,8 +1878,7 @@
if (theme.status === 'installed') {
if ($custom_theme_container) {
loadTheme(theme, $custom_theme_container, $custom_theme_volume);
$userSettings.value('theme').set(theme.name);
$userSettings.save();
await config.value<string>('theme').set(theme.name);
} else {
sileo.error({
title: 'Uhhm..',
@@ -1871,7 +1888,10 @@
} else {
const downloadThemeResult = await downloadTheme(theme);
if (!downloadThemeResult.success) {
if (downloadThemeResult.error && downloadThemeResult.error.length > 0) {
if (
downloadThemeResult.error &&
downloadThemeResult.error.length > 0
) {
sileo.error({
title: 'Uhhm..',
description: downloadThemeResult.error,
@@ -1912,9 +1932,12 @@
onclick={async () => {
const defaultTheme = $custom_themes.find((t) => t.name === 'Default');
if (defaultTheme) {
loadTheme(defaultTheme, $custom_theme_container!, $custom_theme_volume);
$userSettings.value('theme').set(defaultTheme.name);
$userSettings.save();
loadTheme(
defaultTheme,
$custom_theme_container!,
$custom_theme_volume
);
await config.value<string>('theme').set(defaultTheme.name);
if (!(await downloadTheme(theme, true))) {
sileo.error({
@@ -1970,6 +1993,7 @@
{/each}
</div>
</ScrollContainer>
{/if}
</div>
{/if}
</div>
+10 -9
View File
@@ -2,6 +2,7 @@
import Logo from '$assets/logo.png';
import { ezppfarm } from '$lib/api/ezpp';
import { git } from '$lib/api/git';
import { config } from '$lib/config';
import { currentUserInfo } from '$lib/data';
import { estimateFrameRate } from '$lib/displayUtils';
import {
@@ -29,13 +30,12 @@
isValidOsuFolder,
} from '$lib/osuUtil';
import type { EZPPUser } from '$lib/types';
import { currentUser, userAuth } from '$lib/userAuthentication';
import { currentUser } from '$lib/userAuthentication';
import {
cursorSmoothness,
osuInstallationPath,
preferredMode,
preferredType,
userSettings,
} from '$lib/userSettings';
import Launch from './Launch.svelte';
import SetupWizard from './SetupWizard.svelte';
@@ -75,15 +75,14 @@
const clamped = Math.min(Math.max(refreshRate, hzMin), hzMax);
const duration =
durationMin + ((clamped - hzMin) / (hzMax - hzMin)) * (durationMax - durationMin);
console.log(Math.round(duration));
cursorSmoothness.set(Math.round(duration));
};
const prepare = async () => {
await calculateCursorSmoothness();
const username = $userAuth.value('username').get('');
const password = $userAuth.value('password').get('');
const username = await config.value<string>('username').get('');
const password = await config.value<string>('password').get('');
const shouldLogin = username.length > 0 && password.length > 0;
let userLoginResult: { message: string; user?: EZPPUser } = {
@@ -134,16 +133,18 @@
if (!$firstStartup) {
currentLoadingInfo.set('Checking osu installation path...');
const validFolder = await isValidOsuFolder($osuInstallationPath);
const config_osu_installation_path = config.value<string>('osu_installation_path');
const osuInstallationPathVal = await config_osu_installation_path.get('');
const validFolder = await isValidOsuFolder(osuInstallationPathVal);
if (!validFolder) {
await config_osu_installation_path.set('');
osuInstallationPath.set('');
$userSettings.value('osu_installation_path').del();
await $userSettings.save();
sileo.error({
title: 'Hmm...',
description: 'Your previously set osu! installation path seems to be invalid.',
});
} else {
osuInstallationPath.set(osuInstallationPathVal);
currentLoadingInfo.set('Getting osu version...');
const osuReleaseStream = await getReleaseStream($osuInstallationPath);
osuStream.set(osuReleaseStream);
@@ -177,7 +178,7 @@
const ezpplauncherStreams = await getEZPPLauncherStreams();
if (ezpplauncherStreams) launcherStreams.set(ezpplauncherStreams);
const selectedLauncherStream = $userSettings.value('patcherStream').get('stable');
const selectedLauncherStream = await config.value<string>('patcherStream').get('stable');
if ($launcherStreams.includes(selectedLauncherStream)) {
launcherStream.set(selectedLauncherStream);
}
+7 -9
View File
@@ -5,6 +5,7 @@
import Checkbox from '$lib/components/ui/checkbox/checkbox.svelte';
import Input from '$lib/components/ui/input/input.svelte';
import Label from '$lib/components/ui/label/label.svelte';
import { config } from '$lib/config';
import {
beatmapSets,
currentSkin,
@@ -12,7 +13,6 @@
discordPresence,
osuBuild,
osuStream,
platform,
presenceLoading,
skins,
skinsCount,
@@ -32,7 +32,6 @@
osuInstallationPath,
patch,
reduceAnimations,
userSettings,
} from '$lib/userSettings';
import Launch from './Launch.svelte';
import { Check, CircleCheckBig, CircleOff, LoaderCircle } from '@lucide/svelte';
@@ -95,9 +94,9 @@
};
const saveConfig = async () => {
$userSettings.value('osu_installation_path').set(osuInstallPath);
await $userSettings.save();
await config.value<string>('osu_installation_path').set(osuInstallPath);
osuInstallationPath.set(osuInstallPath);
await config.value<boolean>('setup_complete').set(true);
const beatmapSetCount = await getBeatmapSetsCount(osuInstallPath);
if (beatmapSetCount) {
@@ -128,7 +127,7 @@
if (osuPath) {
osuInstallPath = osuPath;
autoDetectedOsuPath = true;
$userSettings.value('osu_installation_path').set(osuInstallPath);
await config.value<string>('osu_installation_path').set(osuInstallPath);
}
});
</script>
@@ -266,17 +265,16 @@
<div class="flex flex-col">
<Label class="text-sm" for="setting-patch">Patching</Label>
<div class="text-muted-foreground text-xs">
Shows misses in Relax and Autopilot {#if $platform !== 'windows'}<span
Shows misses in Relax and Autopilot <!-- {#if $platform !== 'windows'}<span
class="text-red-500 bg-red-800/20 border border-red-600/20 p-0.5 mx-1 px-2 rounded-lg text-[0.55rem]!"
>currently only on windows!</span
>
{/if}
{/if} -->
</div>
</div>
<Checkbox
id="setting-patch"
checked={$platform === 'windows' ? $patch : false}
disabled={$platform !== 'windows'}
checked={$patch}
onCheckedChange={async (e) => {
patch.set(e);
}}