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", "name": "ezpplauncher",
"version": "3.2.1", "version": "3.2.3",
"description": "", "description": "",
"type": "module", "type": "module",
"scripts": { "scripts": {
+3
View File
@@ -34,4 +34,7 @@ function run(cmd: string, args: string[]): Promise<void> {
await run('bun', ['./scripts/sync-version.ts']); await run('bun', ['./scripts/sync-version.ts']);
await runVite(); 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']); 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" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" 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]] [[package]]
name = "aes" name = "aes"
version = "0.9.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "66bd29a732b644c0431c6140f370d097879203d79b80c94a6747ba0872adaef8" checksum = "66bd29a732b644c0431c6140f370d097879203d79b80c94a6747ba0872adaef8"
dependencies = [ dependencies = [
"cipher", "cipher 0.5.2",
"cpubits", "cpubits",
"cpufeatures 0.3.0", "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]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.1.4" version = "1.1.4"
@@ -449,7 +484,7 @@ dependencies = [
"semver", "semver",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.17", "thiserror 2.0.18",
] ]
[[package]] [[package]]
@@ -525,6 +560,16 @@ dependencies = [
"windows-link 0.2.1", "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]] [[package]]
name = "cipher" name = "cipher"
version = "0.5.2" version = "0.5.2"
@@ -532,7 +577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c" checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c"
dependencies = [ dependencies = [
"crypto-common 0.2.2", "crypto-common 0.2.2",
"inout", "inout 0.2.2",
] ]
[[package]] [[package]]
@@ -734,6 +779,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
dependencies = [ dependencies = [
"generic-array", "generic-array",
"rand_core 0.6.4",
"typenum", "typenum",
] ]
@@ -802,6 +848,15 @@ version = "0.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52560adf09603e58c9a7ee1fe1dcb95a16927b17c127f0ac02d6e768a0e25bc1" 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]] [[package]]
name = "ctutils" name = "ctutils"
version = "0.4.2" version = "0.4.2"
@@ -1184,8 +1239,9 @@ dependencies = [
[[package]] [[package]]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.1" version = "3.2.3"
dependencies = [ dependencies = [
"aes-gcm",
"anyhow", "anyhow",
"base64 0.22.1", "base64 0.22.1",
"byteorder", "byteorder",
@@ -1197,10 +1253,12 @@ dependencies = [
"open", "open",
"presenceforge", "presenceforge",
"reqwest", "reqwest",
"rusqlite",
"serde", "serde",
"serde_json", "serde_json",
"serde_repr", "serde_repr",
"sha1", "sha1",
"sha2 0.11.0",
"sysinfo", "sysinfo",
"tauri", "tauri",
"tauri-build", "tauri-build",
@@ -1209,6 +1267,7 @@ dependencies = [
"tauri-plugin-fs", "tauri-plugin-fs",
"tauri-plugin-shell", "tauri-plugin-shell",
"tauri-plugin-single-instance", "tauri-plugin-single-instance",
"thiserror 2.0.18",
"tokio", "tokio",
"url", "url",
"widestring", "widestring",
@@ -1218,6 +1277,18 @@ dependencies = [
"zip", "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]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.3.0" version = "2.3.0"
@@ -1602,6 +1673,16 @@ dependencies = [
"wasm-bindgen", "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]] [[package]]
name = "gio" name = "gio"
version = "0.18.4" version = "0.18.4"
@@ -1799,6 +1880,18 @@ name = "hashbrown"
version = "0.16.1" version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" 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]] [[package]]
name = "heck" name = "heck"
@@ -2153,6 +2246,15 @@ dependencies = [
"cfb", "cfb",
] ]
[[package]]
name = "inout"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01"
dependencies = [
"generic-array",
]
[[package]] [[package]]
name = "inout" name = "inout"
version = "0.2.2" version = "0.2.2"
@@ -2384,6 +2486,17 @@ dependencies = [
"libc", "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]] [[package]]
name = "libz-rs-sys" name = "libz-rs-sys"
version = "0.5.5" version = "0.5.5"
@@ -2554,7 +2667,7 @@ dependencies = [
"once_cell", "once_cell",
"png 0.18.1", "png 0.18.1",
"serde", "serde",
"thiserror 2.0.17", "thiserror 2.0.18",
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
@@ -2916,6 +3029,12 @@ version = "1.21.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]]
name = "opaque-debug"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]] [[package]]
name = "open" name = "open"
version = "5.3.5" version = "5.3.5"
@@ -3291,6 +3410,18 @@ dependencies = [
"windows-sys 0.61.2", "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]] [[package]]
name = "potential_utf" name = "potential_utf"
version = "0.1.4" version = "0.1.4"
@@ -3340,7 +3471,7 @@ dependencies = [
"log", "log",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.17", "thiserror 2.0.18",
"tokio", "tokio",
"uuid", "uuid",
] ]
@@ -3462,7 +3593,7 @@ dependencies = [
"rustc-hash", "rustc-hash",
"rustls", "rustls",
"socket2", "socket2",
"thiserror 2.0.17", "thiserror 2.0.18",
"tokio", "tokio",
"tracing", "tracing",
"web-time", "web-time",
@@ -3484,7 +3615,7 @@ dependencies = [
"rustls", "rustls",
"rustls-pki-types", "rustls-pki-types",
"slab", "slab",
"thiserror 2.0.17", "thiserror 2.0.18",
"tinyvec", "tinyvec",
"tracing", "tracing",
"web-time", "web-time",
@@ -3658,7 +3789,7 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
dependencies = [ dependencies = [
"getrandom 0.2.16", "getrandom 0.2.16",
"libredox", "libredox",
"thiserror 2.0.17", "thiserror 2.0.18",
] ]
[[package]] [[package]]
@@ -3794,6 +3925,31 @@ dependencies = [
"windows-sys 0.52.0", "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]] [[package]]
name = "rustc-hash" name = "rustc-hash"
version = "2.1.1" version = "2.1.1"
@@ -4402,6 +4558,18 @@ dependencies = [
"system-deps", "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]] [[package]]
name = "stable_deref_trait" name = "stable_deref_trait"
version = "1.2.1" version = "1.2.1"
@@ -4676,7 +4844,7 @@ dependencies = [
"tauri-runtime", "tauri-runtime",
"tauri-runtime-wry", "tauri-runtime-wry",
"tauri-utils", "tauri-utils",
"thiserror 2.0.17", "thiserror 2.0.18",
"tokio", "tokio",
"tray-icon", "tray-icon",
"url", "url",
@@ -4727,7 +4895,7 @@ dependencies = [
"sha2 0.10.9", "sha2 0.10.9",
"syn 2.0.113", "syn 2.0.113",
"tauri-utils", "tauri-utils",
"thiserror 2.0.17", "thiserror 2.0.18",
"time", "time",
"url", "url",
"uuid", "uuid",
@@ -4780,7 +4948,7 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.17", "thiserror 2.0.18",
"tokio", "tokio",
"url", "url",
] ]
@@ -4799,7 +4967,7 @@ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tauri-plugin-fs", "tauri-plugin-fs",
"thiserror 2.0.17", "thiserror 2.0.18",
"url", "url",
] ]
@@ -4822,7 +4990,7 @@ dependencies = [
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tauri-utils", "tauri-utils",
"thiserror 2.0.17", "thiserror 2.0.18",
"toml 1.1.0+spec-1.1.0", "toml 1.1.0+spec-1.1.0",
"url", "url",
] ]
@@ -4844,7 +5012,7 @@ dependencies = [
"shared_child", "shared_child",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.17", "thiserror 2.0.18",
"tokio", "tokio",
] ]
@@ -4857,7 +5025,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
"thiserror 2.0.17", "thiserror 2.0.18",
"tracing", "tracing",
"windows-sys 0.60.2", "windows-sys 0.60.2",
"zbus", "zbus",
@@ -4881,7 +5049,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri-utils", "tauri-utils",
"thiserror 2.0.17", "thiserror 2.0.18",
"url", "url",
"webkit2gtk", "webkit2gtk",
"webview2-com", "webview2-com",
@@ -4946,7 +5114,7 @@ dependencies = [
"serde_json", "serde_json",
"serde_with", "serde_with",
"swift-rs", "swift-rs",
"thiserror 2.0.17", "thiserror 2.0.18",
"toml 1.1.0+spec-1.1.0", "toml 1.1.0+spec-1.1.0",
"url", "url",
"urlpattern", "urlpattern",
@@ -5010,11 +5178,11 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "2.0.17" version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
dependencies = [ dependencies = [
"thiserror-impl 2.0.17", "thiserror-impl 2.0.18",
] ]
[[package]] [[package]]
@@ -5030,9 +5198,9 @@ dependencies = [
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "2.0.17" version = "2.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -5361,7 +5529,7 @@ dependencies = [
"once_cell", "once_cell",
"png 0.18.1", "png 0.18.1",
"serde", "serde",
"thiserror 2.0.17", "thiserror 2.0.18",
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
@@ -5459,6 +5627,16 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" 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]] [[package]]
name = "untrusted" name = "untrusted"
version = "0.9.0" version = "0.9.0"
@@ -5514,6 +5692,12 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]] [[package]]
name = "version-compare" name = "version-compare"
version = "0.2.1" version = "0.2.1"
@@ -5817,7 +6001,7 @@ version = "0.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36695906a1b53a3bf5c4289621efedac12b73eeb0b89e7e1a89b517302d5d75c" checksum = "36695906a1b53a3bf5c4289621efedac12b73eeb0b89e7e1a89b517302d5d75c"
dependencies = [ dependencies = [
"thiserror 2.0.17", "thiserror 2.0.18",
"windows 0.61.3", "windows 0.61.3",
"windows-core 0.61.2", "windows-core 0.61.2",
] ]
@@ -6510,7 +6694,7 @@ dependencies = [
"sha2 0.10.9", "sha2 0.10.9",
"soup3", "soup3",
"tao-macros", "tao-macros",
"thiserror 2.0.17", "thiserror 2.0.18",
"url", "url",
"webkit2gtk", "webkit2gtk",
"webkit2gtk-sys", "webkit2gtk-sys",
@@ -6712,7 +6896,7 @@ version = "8.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b" checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b"
dependencies = [ dependencies = [
"aes", "aes 0.9.0",
"bzip2", "bzip2",
"constant_time_eq", "constant_time_eq",
"crc32fast", "crc32fast",
+6 -2
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.1" version = "3.2.3"
description = "EZPPLauncher redefined." description = "EZPPLauncher redefined."
authors = ["HorizonCode"] authors = ["HorizonCode"]
edition = "2024" edition = "2024"
@@ -51,11 +51,15 @@ url = "2.5.8"
zip = "8.6.0" zip = "8.6.0"
sha1 = "0.11.0" sha1 = "0.11.0"
hex = "0.4.3" 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] [target.'cfg(windows)'.dependencies]
winreg = "0.56.0" winreg = "0.56.0"
winapi = { version = "0.3.9", features = ["winuser", "wincrypt", "memoryapi", "winbase", "dpapi"] } winapi = { version = "0.3.9", features = ["winuser", "wincrypt", "memoryapi", "winbase", "dpapi"] }
base64 = "0.22.1"
widestring = "1.2.1" widestring = "1.2.1"
windows-sys = "0.61.2" windows-sys = "0.61.2"
+83 -42
View File
@@ -1,6 +1,8 @@
use crate::config::ConfigError;
use hardware_id::get_id; use hardware_id::get_id;
use reqwest::Client; use reqwest::Client;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashSet; use std::collections::HashSet;
use std::io::Read; use std::io::Read;
use std::path::PathBuf; use std::path::PathBuf;
@@ -9,15 +11,16 @@ use sysinfo::System;
use tauri::AppHandle; use tauri::AppHandle;
use tauri::Emitter; use tauri::Emitter;
use tauri::Manager; use tauri::Manager;
use tauri::State;
use tauri_plugin_fs::FsExt; use tauri_plugin_fs::FsExt;
use tokio::fs; use tokio::fs;
use tokio::io::AsyncWriteExt; use tokio::io::AsyncWriteExt;
use tokio::process::Command; use tokio::process::Command;
use tokio::time::{Duration, sleep}; use tokio::time::{Duration, sleep};
use crate::OpenedUrls;
use crate::osudb::parse_osudb; use crate::osudb::parse_osudb;
use crate::presence; use crate::presence;
use crate::state::AppState;
use crate::utils::{ use crate::utils::{
check_folder_completeness, encrypt_password, get_osu_config, get_osu_user_config, 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, get_window_title_by_pid, is_net8_installed, is_osuwinello_available, is_wmctrl_available,
@@ -26,21 +29,22 @@ use crate::utils::{
#[tauri::command] #[tauri::command]
pub fn opened_urls(app: tauri::AppHandle) -> Vec<PathBuf> { pub fn opened_urls(app: tauri::AppHandle) -> Vec<PathBuf> {
let args = app.state::<OpenedUrls>().0.lock().unwrap().clone(); let args = app.state::<AppState>().opened_files.lock().unwrap().clone();
app.state::<OpenedUrls>().0.lock().unwrap().clear(); app.state::<AppState>().opened_files.lock().unwrap().clear();
args args
} }
#[tauri::command] #[tauri::command]
pub fn get_launcher_version() -> String { pub fn get_launcher_version(app: tauri::AppHandle) -> String {
env!("CARGO_PKG_VERSION").to_string() app.package_info().version.to_string()
} }
#[tauri::command] #[tauri::command]
pub fn get_hwid() -> String { pub fn get_hwid() -> String {
let hwid = get_id().unwrap(); get_id()
hwid.into() .unwrap_or("recorderinsandybridge".to_string())
.into()
} }
#[tauri::command(rename_all = "snake_case")] #[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 check_folder_completeness(path, &osu_folder_files) >= 70.0
} }
#[cfg(windows)]
#[tauri::command] #[tauri::command]
pub fn find_osu_installation() -> Option<String> { pub fn find_osu_installation() -> Option<String> {
#[cfg(windows)] #[cfg(windows)]
@@ -447,48 +450,52 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
} }
}; };
#[cfg(windows)] if patch {
{ let patcher_exe_path = PathBuf::from(&folder)
if patch { .join("EZPPLauncher")
let patcher_exe_path = PathBuf::from(&folder) .join("patcher")
.join("EZPPLauncher") .join("osu!.patcher.exe");
.join("patcher")
.join("osu!.patcher.exe");
if patcher_exe_path.exists() { if patcher_exe_path.exists() {
#[cfg(windows)] let mut sys = System::new_all();
{
let mut sys = System::new_all();
loop { loop {
sys.refresh_processes(sysinfo::ProcessesToUpdate::All, true); sys.refresh_processes(sysinfo::ProcessesToUpdate::All, true);
let mut found = false; let mut found = false;
for (_pid, process) in sys.processes() { for (_pid, process) in sys.processes() {
if process.name() == "osu!.exe" { if process.name() == "osu!.exe" {
let pid = process.pid(); let pid = process.pid();
let title = get_window_title_by_pid(pid); let title = get_window_title_by_pid(pid);
if !title.is_empty() && !title.contains("updater") { if !title.is_empty() && !title.contains("updater") {
found = true; found = true;
break;
}
}
}
if found {
break; break;
} }
sleep(Duration::from_millis(500)).await;
} }
let _ = Command::new(&patcher_exe_path)
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn()
.map_err(|e| format!("Failed to run patcher: {e}"))?;
} }
if found {
break;
}
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(()) Ok(())
} }
#[cfg(windows)]
#[tauri::command] #[tauri::command]
pub async fn install_ezpp_launcher_update(app: AppHandle) -> Result<(), String> { pub async fn install_ezpp_launcher_update(app: AppHandle) -> Result<(), String> {
#[cfg(windows)] #[cfg(windows)]
@@ -1315,3 +1321,38 @@ pub async fn read_theme_info(app: AppHandle, file_path: String) -> Result<ThemeI
.await .await
.map_err(|e| format!("Thread error: {}", e))? .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()))
}
}
+45 -20
View File
@@ -1,28 +1,34 @@
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
use hardware_id::get_id;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::Mutex; use std::sync::Mutex;
use tauri::Manager; use tauri::Manager;
use tauri_plugin_fs::FsExt; use tauri_plugin_fs::FsExt;
pub mod commands; pub mod commands;
pub mod config;
pub mod osudb; pub mod osudb;
pub mod presence; pub mod presence;
pub mod state;
pub mod utils; pub mod utils;
use crate::commands::{ use crate::{
check_for_corruption, download_and_extract_theme, download_ezpp_launcher_update, commands::{
download_ezpp_launcher_update_files, encrypt_string, exit, extract_theme, check_for_corruption, config_all, config_clear, config_delete, config_exists, config_get,
find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid, config_set, download_and_extract_theme, download_ezpp_launcher_update,
get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform, download_ezpp_launcher_update_files, encrypt_string, exit, extract_theme,
get_skins, get_skins_count, has_net8, has_osuwinello, has_wmctrl, install_ezpp_launcher_update, find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid,
is_open_tablet_driver_path_valid, is_open_tablet_driver_running, is_osu_running, get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform,
open_url_in_browser, opened_urls, presence_connect, presence_disconnect, presence_is_connected, get_skins, get_skins_count, has_net8, has_osuwinello, has_wmctrl,
presence_update_button, presence_update_status, presence_update_user, read_theme_info, install_ezpp_launcher_update, is_open_tablet_driver_path_valid,
replace_ui_files, run_open_tablet_driver, run_osu, run_osu_updater, set_osu_config_values, is_open_tablet_driver_running, is_osu_running, open_url_in_browser, opened_urls,
set_osu_user_config_values, stop_open_tablet_driver, valid_osu_folder, 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)] #[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() { pub fn run() {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
@@ -60,26 +66,39 @@ pub fn run() {
} }
let app = builder let app = builder
.manage(OpenedUrls(Mutex::new(vec![])))
.setup(|app| { .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<_>>(); let args = std::env::args().collect::<Vec<_>>();
if args.len() > 1 { if args.len() > 1 {
let mut files = Vec::new();
for maybe_file in args.iter().skip(1) { for maybe_file in args.iter().skip(1) {
if maybe_file.starts_with("-") { if maybe_file.starts_with("-") {
continue; continue;
} }
let path = PathBuf::from(maybe_file); let path = PathBuf::from(maybe_file);
if path.extension().and_then(|e| e.to_str()) == Some("ezpplauncher-theme") { if path.extension().and_then(|e| e.to_str()) == Some("ezpplauncher-theme") {
app.fs_scope().allow_file(&path).ok(); 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(()) Ok(())
}) })
.invoke_handler(tauri::generate_handler![ .invoke_handler(tauri::generate_handler![
@@ -121,6 +140,12 @@ pub fn run() {
read_theme_info, read_theme_info,
extract_theme, extract_theme,
download_and_extract_theme, download_and_extract_theme,
config_get,
config_set,
config_exists,
config_delete,
config_clear,
config_all,
run_open_tablet_driver, run_open_tablet_driver,
stop_open_tablet_driver, stop_open_tablet_driver,
is_open_tablet_driver_running, 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; 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 let osu_config_path = osu_folder_path
.as_ref() .as_ref()
.join(format!("osu!.{}.cfg", current_user)); .join(format!("osu!.{}.cfg", current_user));
println!("Looking for user config at: {:?}", osu_config_path);
if !osu_config_path.exists() { if !osu_config_path.exists() {
return None; return None;
} }
@@ -48,7 +51,9 @@ pub fn set_osu_user_config_vals(
osu_folder_path: &str, osu_folder_path: &str,
key_values: &[(&str, Option<&str>)], key_values: &[(&str, Option<&str>)],
) -> Result<bool, String> { ) -> 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)); let osu_config_path = Path::new(osu_folder_path).join(format!("osu!.{}.cfg", current_user));
if !osu_config_path.exists() { 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); 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, Err(_) => false,
} }
+17 -2
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "EZPPLauncher", "productName": "EZPPLauncher",
"version": "3.2.1", "version": "3.2.3",
"identifier": "farm.EZPPFarm.Launcher", "identifier": "farm.EZPPFarm.Launcher",
"mainBinaryName": "ezpplauncher", "mainBinaryName": "ezpplauncher",
"build": { "build": {
@@ -26,7 +26,22 @@
], ],
"withGlobalTauri": true, "withGlobalTauri": true,
"security": { "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": { "assetProtocol": {
"enable": true, "enable": true,
"scope": [ "scope": [
-56
View File
@@ -148,62 +148,6 @@
--color-sidebar-ring: var(--sidebar-ring); --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 { @layer base {
* { * {
@apply border-border outline-ring/50; @apply border-border outline-ring/50;
@@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { config } from '$lib/config';
import { custom_theme_audio_playing, custom_theme_volume } from '$lib/global'; 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 { Volume, Volume1, VolumeOff } from '@lucide/svelte';
import Minimize from '@lucide/svelte/icons/minus'; import Minimize from '@lucide/svelte/icons/minus';
import Volume2 from '@lucide/svelte/icons/volume-2'; import Volume2 from '@lucide/svelte/icons/volume-2';
@@ -62,8 +63,7 @@
step="0.01" step="0.01"
bind:value={$custom_theme_volume} bind:value={$custom_theme_volume}
on:input={() => { on:input={() => {
$userSettings.value('volume').set($custom_theme_volume); config.value<number>('volume').set($custom_theme_volume);
$userSettings.save();
}} }}
class="volume-slider" class="volume-slider"
/> />
+31 -79
View File
@@ -1,87 +1,39 @@
import { Crypto } from './crypto'; import { invoke } from '@tauri-apps/api/core';
import { getHWID } from './osuUtil';
import * as path from '@tauri-apps/api/path';
import { exists, mkdir, readTextFile, writeFile } from '@tauri-apps/plugin-fs';
export class Config { interface ConfigValue<T> {
private fileName: string; set(value: T, opts?: { encrypt?: boolean }): Promise<void>;
private config: Record<string, unknown> = {}; get(fallback: T): Promise<T>;
private crypto: Crypto | undefined; exists(): Promise<boolean>;
private configFilePath: string | undefined; delete(): Promise<void>;
private encrypt: boolean; }
constructor(fileName: string, encrypt?: boolean) { export const config = {
this.fileName = fileName; value<T = unknown>(key: string): ConfigValue<T> {
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) 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) {
return { return {
set: <T>(val: T) => { set(value: T, opts?: { encrypt?: boolean }): Promise<void> {
this.config[key] = val; 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 { active_custom_theme, custom_themes } from './global';
import { setGlobalVolume } from './utils'; import { disableMediaControls, setGlobalVolume } from './utils';
import { betterFetch } from '@better-fetch/fetch'; import { betterFetch } from '@better-fetch/fetch';
import { convertFileSrc } from '@tauri-apps/api/core'; import { convertFileSrc } from '@tauri-apps/api/core';
import { invoke } from '@tauri-apps/api/core'; import { invoke } from '@tauri-apps/api/core';
@@ -14,6 +14,7 @@ export type Theme = {
version: string; version: string;
author: string; author: string;
scriptUrl: string; scriptUrl: string;
cssStyle: string;
assets: string; assets: string;
preview: string; preview: string;
status: 'installed' | 'downloading' | 'extracting' | 'deleting' | 'not-installed'; status: 'installed' | 'downloading' | 'extracting' | 'deleting' | 'not-installed';
@@ -77,6 +78,7 @@ export const getDownloadableThemes = async () => {
status: 'not-installed', status: 'not-installed',
progress: 0, progress: 0,
updateAvailable: false, updateAvailable: false,
cssStyle: '',
}); });
} }
} else { } else {
@@ -99,6 +101,7 @@ export const getThemes = async (): Promise<Theme[]> => {
status: 'installed', status: 'installed',
progress: 0, progress: 0,
updateAvailable: false, updateAvailable: false,
cssStyle: '',
}); });
const folderPath = await path.join(await path.homeDir(), '.ezpplauncher', 'themes'); const folderPath = await path.join(await path.homeDir(), '.ezpplauncher', 'themes');
if (await fs.exists(folderPath)) { if (await fs.exists(folderPath)) {
@@ -110,6 +113,8 @@ export const getThemes = async (): Promise<Theme[]> => {
const themeConfig = await fs.readTextFile(themeConfigFilePath); const themeConfig = await fs.readTextFile(themeConfigFilePath);
const theme = JSON.parse(themeConfig) as ThemeInfo; const theme = JSON.parse(themeConfig) as ThemeInfo;
const scriptFile = await path.join(folderPath, themeFolder.name, theme.entry); 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)) { if (await fs.exists(scriptFile)) {
themes.push({ themes.push({
folder_name: themeFolder.name, folder_name: themeFolder.name,
@@ -124,6 +129,7 @@ export const getThemes = async (): Promise<Theme[]> => {
status: 'installed', status: 'installed',
progress: 0, progress: 0,
updateAvailable: false, updateAvailable: false,
cssStyle,
}); });
} }
} }
@@ -233,11 +239,14 @@ export const downloadTheme = async (
const themePreview = convertFileSrc( const themePreview = convertFileSrc(
await path.normalize(`${themeFolder}/assets/${themeInfoObj.preview}`) 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) => { custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === theme.name); const matchedTheme = themes.find((t) => t.name === theme.name);
if (matchedTheme) { if (matchedTheme) {
matchedTheme.scriptUrl = themeScriptUrl; matchedTheme.scriptUrl = themeScriptUrl;
matchedTheme.cssStyle = cssStyle;
matchedTheme.assets = themeAssets; matchedTheme.assets = themeAssets;
matchedTheme.preview = themePreview; matchedTheme.preview = themePreview;
matchedTheme.status = 'installed'; matchedTheme.status = 'installed';
@@ -259,10 +268,10 @@ export const loadTheme = async (theme: Theme, themeContainer: HTMLElement, volum
themeScript.mountTheme(themeContainer, { assets: theme.assets }); themeScript.mountTheme(themeContainer, { assets: theme.assets });
} }
setGlobalVolume(volume); setGlobalVolume(volume);
disableMediaControls();
}; };
export const deleteTheme = async (themeToUninstall: Theme) => { export const deleteTheme = async (themeToUninstall: Theme) => {
console.log('Uninstall', themeToUninstall);
if (themeToUninstall.status !== 'installed') { if (themeToUninstall.status !== 'installed') {
return false; return false;
} }
@@ -287,6 +296,7 @@ export const deleteTheme = async (themeToUninstall: Theme) => {
const matchedTheme = themes.find((t) => t.name === themeToUninstall.name); const matchedTheme = themes.find((t) => t.name === themeToUninstall.name);
if (matchedTheme) { if (matchedTheme) {
matchedTheme.scriptUrl = ''; matchedTheme.scriptUrl = '';
matchedTheme.cssStyle = '';
matchedTheme.assets = ''; matchedTheme.assets = '';
matchedTheme.preview = `https://git.ez-pp.farm/EZPPFarm/EZPPLauncher-Themes/raw/branch/main/previews/${toSafeName(themeToUninstall.name)}.png`; matchedTheme.preview = `https://git.ez-pp.farm/EZPPFarm/EZPPLauncher-Themes/raw/branch/main/previews/${toSafeName(themeToUninstall.name)}.png`;
matchedTheme.status = 'not-installed'; matchedTheme.status = 'not-installed';
@@ -353,11 +363,14 @@ export const importThemeFromFile = async (themeName: string, filePath: string) =
const themePreview = convertFileSrc( const themePreview = convertFileSrc(
await path.normalize(`${themeFolder}/assets/${themeInfoObj.preview}`) 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) => { custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === themeInfoObj.name); const matchedTheme = themes.find((t) => t.name === themeInfoObj.name);
if (matchedTheme) { if (matchedTheme) {
matchedTheme.scriptUrl = themeScriptUrl; matchedTheme.scriptUrl = themeScriptUrl;
matchedTheme.cssStyle = cssStyle;
matchedTheme.assets = themeAssets; matchedTheme.assets = themeAssets;
matchedTheme.preview = themePreview; matchedTheme.preview = themePreview;
matchedTheme.status = 'installed'; matchedTheme.status = 'installed';
@@ -407,6 +420,7 @@ export const reloadThemes = async () => {
storeTheme.version = theme.version; storeTheme.version = theme.version;
storeTheme.author = theme.author; storeTheme.author = theme.author;
storeTheme.updateAvailable = theme.updateAvailable; storeTheme.updateAvailable = theme.updateAvailable;
storeTheme.cssStyle = theme.cssStyle;
} }
const newThemes = combinedThemes.filter((t) => !storeMap.has(t.name)); 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 = { export type EZPPUserResponse = {
code: number; code: number;
message: string; message: string;
-2
View File
@@ -1,6 +1,4 @@
import { Config } from './config';
import type { EZPPUser } from './types'; import type { EZPPUser } from './types';
import { writable } from 'svelte/store'; import { writable } from 'svelte/store';
export const userAuth = writable<Config>(new Config('user_auth', true));
export const currentUser = writable<EZPPUser | undefined>(undefined); export const currentUser = writable<EZPPUser | undefined>(undefined);
-3
View File
@@ -1,8 +1,5 @@
import { Config } from './config';
import { writable } from 'svelte/store'; import { writable } from 'svelte/store';
export const userSettings = writable<Config>(new Config('user_settings', false));
export const customCursor = writable<boolean>(false); export const customCursor = writable<boolean>(false);
export const cursorSmoothening = writable<boolean>(false); export const cursorSmoothening = writable<boolean>(false);
export const cursorSmoothness = writable<number>(180); 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 { export function calculateGitBlobSha(fileBuffer: Buffer): string {
const header = Buffer.from(`blob ${fileBuffer.length}\0`); const header = Buffer.from(`blob ${fileBuffer.length}\0`);
const store = Buffer.concat([header, fileBuffer]); 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 OsuCursor from '$lib/components/ui/osu-cursor/OsuCursor.svelte';
import SileoToast from '$lib/components/ui/sileo/sileo-toast.svelte'; import SileoToast from '$lib/components/ui/sileo/sileo-toast.svelte';
import Titlebar from '$lib/components/ui/titlebar/titlebar.svelte'; import Titlebar from '$lib/components/ui/titlebar/titlebar.svelte';
import { config } from '$lib/config';
import { Config } from '$lib/config_old';
import { import {
active_custom_theme, active_custom_theme,
currentLoadingInfo, currentLoadingInfo,
@@ -25,15 +27,7 @@
import { exit, getLauncherVersion, getPlatform } from '$lib/osuUtil'; import { exit, getLauncherVersion, getPlatform } from '$lib/osuUtil';
import * as presence from '$lib/presence'; import * as presence from '$lib/presence';
import { getDownloadableThemes, getThemes, loadTheme } from '$lib/themes'; import { getDownloadableThemes, getThemes, loadTheme } from '$lib/themes';
import { userAuth } from '$lib/userAuthentication'; import { cursorSmoothening, customCursor, patch, reduceAnimations } from '$lib/userSettings';
import {
cursorSmoothening,
customCursor,
osuInstallationPath,
patch,
reduceAnimations,
userSettings,
} from '$lib/userSettings';
import { trackMediaContainer } from '$lib/utils'; import { trackMediaContainer } from '$lib/utils';
import '../app.css'; import '../app.css';
import { Buffer } from 'buffer'; import { Buffer } from 'buffer';
@@ -94,51 +88,77 @@
disableReload(); disableReload();
setupValues(); setupValues();
launcherVersion.set(await getLauncherVersion()); launcherVersion.set(await getLauncherVersion());
const isFirstStartup = await $userSettings.init();
firstStartup.set(isFirstStartup); const oldUserConfig = new Config('user_settings', false);
$userAuth.init(); 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...'); currentLoadingInfo.set('Loading config...');
const config_theme = $userSettings.value('theme'); const config_theme = config.value<string>('theme');
const config_theme_volume = $userSettings.value('volume'); const config_theme_volume = config.value<number>('volume');
const config_patching = $userSettings.value('patching'); const config_patching = config.value<boolean>('patching');
const config_custom_cursor = $userSettings.value('custom_cursor'); const config_custom_cursor = config.value<boolean>('custom_cursor');
const config_cursor_smoothening = $userSettings.value('cursor_smoothening'); const config_cursor_smoothening = config.value<boolean>('cursor_smoothening');
const config_reduce_animations = $userSettings.value('reduce_animations'); const config_reduce_animations = config.value<boolean>('reduce_animations');
const config_osu_installation_path = $userSettings.value('osu_installation_path'); const config_discord_presence = config.value<boolean>('discord_presence');
const config_discord_presence = $userSettings.value('discord_presence'); const config_tracking_enabled = config.value<boolean>('tracking_consent');
const config_tracking_enabled = $userSettings.value('tracking_consent'); const config_otd_enabled = config.value<boolean>('otd_enabled');
const config_otd_enabled = $userSettings.value('otd_enabled'); const config_otd_path = config.value<string>('otd_path');
const config_otd_path = $userSettings.value('otd_path');
const localThemes = await getThemes(); const localThemes = await getThemes();
const last_theme = localThemes.find((t) => t.name === config_theme.get('Default')); const lastThemeName = await config_theme.get('Default');
if (!last_theme) { const last_theme = localThemes.find((t) => t.name === lastThemeName);
$userSettings.value('theme').set('Default'); if (!last_theme || $platform === 'linux') {
await $userSettings.save(); await config.value<string>('theme').set('Default');
loadTheme(localThemes[0], $custom_theme_container!, config_theme_volume.get(0.15)); loadTheme(localThemes[0], $custom_theme_container!, await config_theme_volume.get(0.15));
} else { } 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)); custom_theme_volume.set(await config_theme_volume.get(0.15));
patch.set(config_patching.get(true)); patch.set(await config_patching.get(true));
customCursor.set(config_custom_cursor.get(true)); customCursor.set(await config_custom_cursor.get(true));
cursorSmoothening.set(config_cursor_smoothening.get(true)); cursorSmoothening.set(await config_cursor_smoothening.get(true));
reduceAnimations.set(config_reduce_animations.get(false)); reduceAnimations.set(await config_reduce_animations.get(false));
osuInstallationPath.set(config_osu_installation_path.get('')); discordPresence.set(await config_discord_presence.get(true));
discordPresence.set(config_discord_presence.get(true)); openTabletDriverEnabled.set(await config_otd_enabled.get(false));
openTabletDriverEnabled.set(config_otd_enabled.get(false)); openTabletDriverPath.set(await config_otd_path.get(''));
openTabletDriverPath.set(config_otd_path.get('')); if (await config_tracking_enabled.exists()) {
if (config_tracking_enabled.exists()) { trackingEnabled.set(await config_tracking_enabled.get(false));
trackingEnabled.set(config_tracking_enabled.get(false));
} }
patch.subscribe((val) => config_patching.set(val)); patch.subscribe(async (val) => await config_patching.set(val));
customCursor.subscribe((val) => config_custom_cursor.set(val)); customCursor.subscribe(async (val) => await config_custom_cursor.set(val));
cursorSmoothening.subscribe((val) => config_cursor_smoothening.set(val)); cursorSmoothening.subscribe(async (val) => await config_cursor_smoothening.set(val));
reduceAnimations.subscribe((val) => config_reduce_animations.set(val)); reduceAnimations.subscribe(async (val) => await config_reduce_animations.set(val));
openTabletDriverEnabled.subscribe((val) => config_otd_enabled.set(val)); openTabletDriverEnabled.subscribe(async (val) => config_otd_enabled.set(val));
discordPresence.subscribe(async (val) => { discordPresence.subscribe(async (val) => {
config_discord_presence.set(val); config_discord_presence.set(val);
@@ -207,6 +227,11 @@
}); });
</script> </script>
<svelte:head>
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html `<style>${$active_custom_theme?.cssStyle || ''}</style>`}
</svelte:head>
{#if $customCursor} {#if $customCursor}
<OsuCursor smoothCursor={$cursorSmoothening} /> <OsuCursor smoothCursor={$cursorSmoothening} />
{/if} {/if}
+211 -187
View File
@@ -15,6 +15,7 @@
import Progress from '$lib/components/ui/progress/progress.svelte'; import Progress from '$lib/components/ui/progress/progress.svelte';
import ScrollContainer from '$lib/components/ui/scroll-container/ScrollContainer.svelte'; import ScrollContainer from '$lib/components/ui/scroll-container/ScrollContainer.svelte';
import * as Select from '$lib/components/ui/select'; import * as Select from '$lib/components/ui/select';
import { config } from '$lib/config';
import { currentUserInfo } from '$lib/data'; import { currentUserInfo } from '$lib/data';
import { useDropZone } from '$lib/dropZone.svelte'; import { useDropZone } from '$lib/dropZone.svelte';
import { import {
@@ -87,8 +88,8 @@
loadTheme, loadTheme,
type ThemeInfo, type ThemeInfo,
} from '$lib/themes'; } from '$lib/themes';
import { EZPPActionStatus } from '$lib/types'; import { EZPPActionStatus, type LaunchView } from '$lib/types';
import { currentUser, userAuth } from '$lib/userAuthentication'; import { currentUser } from '$lib/userAuthentication';
import { import {
cursorSmoothening, cursorSmoothening,
customCursor, customCursor,
@@ -97,7 +98,6 @@
preferredMode, preferredMode,
preferredType, preferredType,
reduceAnimations, reduceAnimations,
userSettings,
} from '$lib/userSettings'; } from '$lib/userSettings';
import { import {
compareBuildNumbers, compareBuildNumbers,
@@ -141,7 +141,7 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { fade, fly, scale } from 'svelte/transition'; import { fade, fly, scale } from 'svelte/transition';
let selectedView = $state('home'); let selectedView = $state<LaunchView>('HOME');
let progress = $state(-1); let progress = $state(-1);
let launchInfo = $state(''); let launchInfo = $state('');
let launchError = $state<Error | undefined>(undefined); let launchError = $state<Error | undefined>(undefined);
@@ -220,8 +220,7 @@
return; return;
} }
osuInstallationPath.set(selectedPath); osuInstallationPath.set(selectedPath);
$userSettings.value('osu_installation_path').set(selectedPath); await config.value<string>('osu_installation_path').set(selectedPath);
await $userSettings.save();
sileo.success({ sileo.success({
title: 'Yay!', title: 'Yay!',
description: 'osu! installation path set successfully.', description: 'osu! installation path set successfully.',
@@ -305,7 +304,9 @@
try { try {
launchInfo = 'Looking for file updates...'; 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) {
if (updateResult.filesToDownload.length > 0) { if (updateResult.filesToDownload.length > 0) {
@@ -404,8 +405,10 @@
launchInfo = 'You are up to date!'; launchInfo = 'You are up to date!';
} }
if ($currentUser) { if ($currentUser) {
const username = $userAuth.value('username').get(''); const [username, password] = await Promise.all([
const password = $userAuth.value('password').get(''); config.value<string>('username').get(''),
config.value<string>('password').get(''),
]);
if (username.length > 0 && password.length > 0) { if (username.length > 0 && password.length > 0) {
await setUserConfigValues(osuPath, [ await setUserConfigValues(osuPath, [
{ {
@@ -572,10 +575,11 @@
const beatmapCoverImage = `https://assets.ppy.sh/beatmaps/${userStatus.player_status.status.beatmap.set_id}/covers/list@2x.jpg`; const beatmapCoverImage = `https://assets.ppy.sh/beatmaps/${userStatus.player_status.status.beatmap.set_id}/covers/list@2x.jpg`;
const isValidImage = await urlIsValidImage(beatmapCoverImage); const isValidImage = await urlIsValidImage(beatmapCoverImage);
if (isValidImage) largeImageKey = beatmapCoverImage; if (isValidImage) largeImageKey = beatmapCoverImage;
customButton = { if (userStatus.player_status.status.action !== EZPPActionStatus.DIRECT)
text: 'View Beatmap', customButton = {
url: `https://ez-pp.farm/beatmapsets/${userStatus.player_status.status.beatmap.set_id}/${userStatus.player_status.status.beatmap.id}`, text: 'View Beatmap',
}; url: `https://ez-pp.farm/beatmapsets/${userStatus.player_status.status.beatmap.set_id}/${userStatus.player_status.status.beatmap.id}`,
};
} }
details = `[${gamemodeName}] ${details}`; details = `[${gamemodeName}] ${details}`;
@@ -703,13 +707,13 @@
title: 'Login successful!', title: 'Login successful!',
description: `Welcome back, ${loginResult.user.name}!`, description: `Welcome back, ${loginResult.user.name}!`,
}); });
await Promise.all([
$userAuth.value('username').set(username); config.value<string>('username').set(username, { encrypt: true }),
$userAuth.value('password').set(password); config.value<string>('password').set(password, { encrypt: true }),
await $userAuth.save(); ]);
currentUser.set(loginResult.user); currentUser.set(loginResult.user);
selectedView = 'home'; selectedView = 'HOME';
} else { } else {
sileo.error({ sileo.error({
title: 'Login failed!', title: 'Login failed!',
@@ -839,8 +843,7 @@
} }
openTabletDriverPath.set(selectedPath); openTabletDriverPath.set(selectedPath);
$userSettings.value('otd_path').set(selectedPath); await config.value<string>('otd_path').set(selectedPath);
await $userSettings.save();
sileo.success({ sileo.success({
title: 'Yay!', title: 'Yay!',
description: 'OpenTabletDriver set successfully.', description: 'OpenTabletDriver set successfully.',
@@ -849,13 +852,14 @@
}; };
onMount(() => { onMount(() => {
const config = $userSettings; (async () => {
const trackingConsent = config.value('tracking_consent'); const trackingConsent = config.value<boolean>('tracking_consent');
if (trackingConsent.exists()) { if (await trackingConsent.exists()) {
trackingEnabled.set(trackingConsent.get(false)); trackingEnabled.set(await trackingConsent.get(false));
} else { } else {
askForTrackingPermission = true; askForTrackingPermission = true;
} }
})();
animate(ezppLogo, { animate(ezppLogo, {
opacity: [0, 1], opacity: [0, 1],
@@ -1008,9 +1012,7 @@
<Button <Button
onclick={async () => { onclick={async () => {
trackingEnabled.set(true); trackingEnabled.set(true);
const config = $userSettings; await config.value<boolean>('tracking_consent').set(true);
config.value('tracking_consent').set(true);
await config.save();
askForTrackingPermission = false; askForTrackingPermission = false;
}}>Yes, I consent</Button }}>Yes, I consent</Button
> >
@@ -1018,9 +1020,7 @@
variant="outline" variant="outline"
onclick={async () => { onclick={async () => {
trackingEnabled.set(false); trackingEnabled.set(false);
const config = $userSettings; await config.value<boolean>('tracking_consent').set(false);
config.value('tracking_consent').set(false);
await config.save();
askForTrackingPermission = false; askForTrackingPermission = false;
}}>No, I do not consent</Button }}>No, I do not consent</Button
> >
@@ -1071,6 +1071,13 @@
themeInstalling = true; themeInstalling = true;
try { 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( await sileo.promise(
importThemeFromFile(droppedTheme.themeInfo.name, droppedTheme.filePath), importThemeFromFile(droppedTheme.themeInfo.name, droppedTheme.filePath),
{ {
@@ -1145,36 +1152,36 @@
<Badge class="text-[0.5rem] py-0 px-2">{$launcherVersion || 'dev'}</Badge> <Badge class="text-[0.5rem] py-0 px-2">{$launcherVersion || 'dev'}</Badge>
<Button <Button
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView === class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
'home' 'HOME'
? 'bg-primary/50' ? 'bg-primary/50'
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3" : 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
disabled={$launching} disabled={$launching}
onclick={() => { onclick={() => {
if (!$launching) selectedView = 'home'; if (!$launching) selectedView = 'HOME';
}} }}
> >
<House class="text-theme-200 size-5!" /> <House class="text-theme-200 size-5!" />
</Button> </Button>
<Button <Button
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView === class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
'themes' 'THEMES'
? 'bg-primary/50' ? 'bg-primary/50'
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3" : 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
disabled={$launching} disabled={$launching}
onclick={() => { onclick={() => {
if (!$launching) selectedView = 'themes'; if (!$launching) selectedView = 'THEMES';
}} }}
> >
<Paintbrush class="text-theme-200 size-5!" /> <Paintbrush class="text-theme-200 size-5!" />
</Button> </Button>
<Button <Button
class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView === class="flex size-12 items-center gap-2 ring-1 ring-inset ring-white/15 {selectedView ===
'settings' 'SETTINGS'
? 'bg-primary/50' ? 'bg-primary/50'
: 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3" : 'bg-black/20 border-black/20'} hover:bg-primary/50 rounded-[0.85rem] p-3 mt-3"
disabled={$launching} disabled={$launching}
onclick={() => { onclick={() => {
if (!$launching) selectedView = 'settings'; if (!$launching) selectedView = 'SETTINGS';
}} }}
> >
<Settings class="text-theme-200 size-5!" /> <Settings class="text-theme-200 size-5!" />
@@ -1194,9 +1201,10 @@
<DropdownMenu.Item <DropdownMenu.Item
class="text-destructive focus:text-destructive text-xs" class="text-destructive focus:text-destructive text-xs"
onclick={async () => { onclick={async () => {
$userAuth.value('username').del(); await Promise.all([
$userAuth.value('password').del(); config.value<string>('username').set(''),
await $userAuth.save(); config.value<string>('password').set(''),
]);
sileo.success({ sileo.success({
title: 'Logout successful!', title: 'Logout successful!',
description: 'See you soon!', description: 'See you soon!',
@@ -1204,14 +1212,14 @@
}); });
currentUser.set(undefined); currentUser.set(undefined);
currentUserInfo.set(undefined); currentUserInfo.set(undefined);
selectedView = 'home'; selectedView = 'HOME';
}} }}
> >
<LogOut class="size-3.5 mr-2" /> <LogOut class="size-3.5 mr-2" />
Logout Logout
</DropdownMenu.Item> </DropdownMenu.Item>
{:else} {: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 class="size-3.5 mr-2" />
Login Login
</DropdownMenu.Item> </DropdownMenu.Item>
@@ -1221,7 +1229,7 @@
</div> </div>
</div> </div>
<div class="z-10 h-full overflow-hidden"> <div class="z-10 h-full overflow-hidden">
{#if selectedView === 'home'} {#if selectedView === 'HOME'}
<div <div
class="flex flex-col-reverse h-full" class="flex flex-col-reverse h-full"
in:fly={{ in:fly={{
@@ -1517,7 +1525,7 @@
<Button <Button
class="flex-1 h-7 text-xs" class="flex-1 h-7 text-xs"
onclick={() => { onclick={() => {
selectedView = 'login'; selectedView = 'LOGIN';
}}>Log In</Button }}>Log In</Button
> >
<Button <Button
@@ -1538,7 +1546,7 @@
> >
</div> </div>
</div> </div>
{:else if selectedView === 'settings'} {:else if selectedView === 'SETTINGS'}
<div <div
class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm" class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm"
in:fly={{ in:fly={{
@@ -1553,20 +1561,18 @@
<div class="flex flex-col"> <div class="flex flex-col">
<Label class="text-sm" for="setting-patch">Patching</Label> <Label class="text-sm" for="setting-patch">Patching</Label>
<div class="text-muted-foreground text-xs"> <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]!" 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 >currently only on windows!</span
> > -->
{/if} {/if}
</div> </div>
</div> </div>
<Checkbox <Checkbox
id="setting-patch" id="setting-patch"
checked={$platform === 'windows' ? $patch : false} checked={$patch}
disabled={$platform !== 'windows'}
onCheckedChange={async (e) => { onCheckedChange={async (e) => {
patch.set(e); patch.set(e);
$userSettings.save();
}} }}
class="flex items-center justify-center w-5 h-5" class="flex items-center justify-center w-5 h-5"
></Checkbox> ></Checkbox>
@@ -1585,8 +1591,6 @@
cursorSmoothening.set(false); cursorSmoothening.set(false);
} }
customCursor.set(e); customCursor.set(e);
$userSettings.save();
}} }}
class="flex items-center justify-center w-5 h-5" class="flex items-center justify-center w-5 h-5"
></Checkbox> ></Checkbox>
@@ -1603,7 +1607,6 @@
onCheckedChange={async (e) => { onCheckedChange={async (e) => {
if (!$customCursor) return; if (!$customCursor) return;
cursorSmoothening.set(e); cursorSmoothening.set(e);
$userSettings.save();
}} }}
disabled={!$customCursor} disabled={!$customCursor}
class="flex items-center justify-center w-5 h-5" class="flex items-center justify-center w-5 h-5"
@@ -1620,7 +1623,6 @@
checked={$reduceAnimations} checked={$reduceAnimations}
onCheckedChange={async (e) => { onCheckedChange={async (e) => {
reduceAnimations.set(e); reduceAnimations.set(e);
$userSettings.save();
}} }}
class="flex items-center justify-center w-5 h-5" class="flex items-center justify-center w-5 h-5"
></Checkbox> ></Checkbox>
@@ -1656,8 +1658,7 @@
checked={$trackingEnabled} checked={$trackingEnabled}
onCheckedChange={async (e) => { onCheckedChange={async (e) => {
trackingEnabled.set(e); trackingEnabled.set(e);
$userSettings.value('tracking_consent').set(e); await config.value<boolean>('tracking_consent').set(e);
await $userSettings.save();
}} }}
class="flex items-center justify-center w-5 h-5" class="flex items-center justify-center w-5 h-5"
></Checkbox> ></Checkbox>
@@ -1718,6 +1719,7 @@
</div> </div>
</div> </div>
<div class="flex flex-row w-full"> <div class="flex flex-row w-full">
<!-- only stable release stream for linux -->
<Select.Root <Select.Root
type="single" type="single"
bind:value={$launcherStream} bind:value={$launcherStream}
@@ -1738,9 +1740,8 @@
}); });
return; return;
} }
$userSettings.value('patcherStream').set(newStream); await config.value<string>('patcherStream').set(newStream);
launcherStream.set(newStream); launcherStream.set(newStream);
await $userSettings.save();
}} }}
> >
<Select.Trigger <Select.Trigger
@@ -1764,7 +1765,7 @@
{/if} {/if}
</div> </div>
</div> </div>
{:else if selectedView === 'login'} {:else if selectedView === 'LOGIN'}
<div <div
class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm" class="h-screen w-full flex flex-col items-center justify-center bg-black/20 backdrop-blur-sm"
in:fly={{ in:fly={{
@@ -1815,7 +1816,7 @@
</Button> </Button>
</form> </form>
</div> </div>
{:else if selectedView === 'themes'} {:else if selectedView === 'THEMES'}
<div <div
class="h-screen w-full flex flex-col items-center bg-black/20 backdrop-blur-sm" class="h-screen w-full flex flex-col items-center bg-black/20 backdrop-blur-sm"
in:fly={{ in:fly={{
@@ -1826,150 +1827,173 @@
}} }}
out:fly={{ duration: $reduceAnimations ? 0 : 400, y: -5, opacity: 0 }} out:fly={{ duration: $reduceAnimations ? 0 : 400, y: -5, opacity: 0 }}
> >
<ScrollContainer class="pt-8" topOffset={45}> {#if $platform === 'linux'}
<div class="grid w-full gap-1 grid-cols-3 p-3 pr-5"> <div
{#each $custom_themes as theme (theme.folder_name)} class="flex flex-col items-center gap-4 mt-12 px-6 text-center h-full justify-center"
<div >
class="group overflow-hidden rounded-3xl border {$active_custom_theme && <!-- 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 -->
$active_custom_theme.folder_name === theme.folder_name <span class="text-2xl font-bold drop-shadow-lg"
? 'border-primary' >Custom themes are not supported on Linux yet(we are working on it!)</span
: 'border-theme-800'} bg-theme-950 transition hover:border-white/20 h-73.75" >
> <span class="text-muted-foreground font-semibold drop-shadow-lg"
<img >Due to technical limitations on Linux, custom themes are currently not supported.
src={theme.preview || DefaultThemePreview} </span>
alt="Preview of {theme.name}" <span class="text-muted-foreground font-semibold drop-shadow-lg"
class="mb-2 h-40 w-full rounded-t-3xl object-cover object-center pointer-events-none select-none" >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 class="flex flex-col gap-1 p-3"> >
<div class="mb-4 flex items-center justify-between gap-2"> </div>
<div class="flex flex-col items-start"> {:else}
<span class="text-sm font-semibold">{theme.name}</span> <ScrollContainer class="pt-8" topOffset={45}>
<span class="text-xs text-muted-foreground">by {theme.author}</span> <div class="grid w-full gap-1 grid-cols-3 p-3 pr-5">
{#each $custom_themes as theme (theme.folder_name)}
<div
class="group overflow-hidden rounded-3xl border {$active_custom_theme &&
$active_custom_theme.folder_name === theme.folder_name
? 'border-primary'
: 'border-theme-800'} bg-theme-950 transition hover:border-white/20 h-73.75"
>
<img
src={theme.preview || DefaultThemePreview}
alt="Preview of {theme.name}"
class="mb-2 h-40 w-full rounded-t-3xl object-cover object-center pointer-events-none select-none"
/>
<div class="flex flex-col gap-1 p-3">
<div class="mb-4 flex items-center justify-between gap-2">
<div class="flex flex-col items-start">
<span class="text-sm font-semibold">{theme.name}</span>
<span class="text-xs text-muted-foreground">by {theme.author}</span>
</div>
<span class="text-xs text-muted-foreground">v{theme.version}</span>
</div> </div>
<span class="text-xs text-muted-foreground">v{theme.version}</span> <div class="flex items-center gap-1">
</div> <Button
<div class="flex items-center gap-1"> class="w-full"
<Button disabled={($active_custom_theme &&
class="w-full" $active_custom_theme.folder_name === theme.folder_name) ||
disabled={($active_custom_theme && theme.status === 'downloading' ||
$active_custom_theme.folder_name === theme.folder_name) || theme.status === 'extracting' ||
theme.status === 'downloading' || theme.status === 'deleting'}
theme.status === 'extracting' || onclick={async () => {
theme.status === 'deleting'} if (theme.status === 'installed') {
onclick={async () => { if ($custom_theme_container) {
if (theme.status === 'installed') { loadTheme(theme, $custom_theme_container, $custom_theme_volume);
if ($custom_theme_container) { await config.value<string>('theme').set(theme.name);
loadTheme(theme, $custom_theme_container, $custom_theme_volume); } else {
$userSettings.value('theme').set(theme.name);
$userSettings.save();
} else {
sileo.error({
title: 'Uhhm..',
description: 'Failed to apply theme.',
});
}
} else {
const downloadThemeResult = await downloadTheme(theme);
if (!downloadThemeResult.success) {
if (downloadThemeResult.error && downloadThemeResult.error.length > 0) {
sileo.error({ sileo.error({
title: 'Uhhm..', title: 'Uhhm..',
description: downloadThemeResult.error, description: 'Failed to apply theme.',
}); });
} }
} else { } else {
sileo.success({ const downloadThemeResult = await downloadTheme(theme);
title: 'Yaay!', if (!downloadThemeResult.success) {
description: 'Theme installed successfully!', if (
}); downloadThemeResult.error &&
} downloadThemeResult.error.length > 0
} ) {
}} sileo.error({
> title: 'Uhhm..',
{#if $active_custom_theme && $active_custom_theme.folder_name === theme.folder_name} description: downloadThemeResult.error,
Theme in use });
{:else if theme.status !== 'installed'} }
{#if theme.status === 'downloading'} } else {
{theme.updateAvailable ? 'Updating' : 'Downloading'} Theme... ({Math.round( sileo.success({
theme.progress * 100 title: 'Yaay!',
)}%) description: 'Theme installed successfully!',
{:else if theme.status === 'extracting'}
Extracting Theme... ({Math.round(theme.progress * 100)}%)
{:else if theme.status === 'deleting'}
Uninstalling Theme...
{:else}
Download Theme
{/if}
{:else}
Use Theme
{/if}
</Button>
{#if theme.status === 'installed' && theme.updateAvailable}
<Button
class="min-w-10"
size="icon"
variant="secondary"
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();
if (!(await downloadTheme(theme, true))) {
sileo.error({
title: 'Uhhm..',
description: 'Failed to update theme.',
}); });
} }
} }
}} }}
> >
<CloudDownload /> {#if $active_custom_theme && $active_custom_theme.folder_name === theme.folder_name}
Theme in use
{:else if theme.status !== 'installed'}
{#if theme.status === 'downloading'}
{theme.updateAvailable ? 'Updating' : 'Downloading'} Theme... ({Math.round(
theme.progress * 100
)}%)
{:else if theme.status === 'extracting'}
Extracting Theme... ({Math.round(theme.progress * 100)}%)
{:else if theme.status === 'deleting'}
Uninstalling Theme...
{:else}
Download Theme
{/if}
{:else}
Use Theme
{/if}
</Button> </Button>
{/if} {#if theme.status === 'installed' && theme.updateAvailable}
{#if (theme.status === 'installed' || theme.status === 'deleting') && $active_custom_theme && $active_custom_theme.folder_name !== theme.folder_name && theme.name !== 'Default'} <Button
<Button class="min-w-10"
class="min-w-10" size="icon"
size="icon" variant="secondary"
variant="destructive" onclick={async () => {
disabled={theme.status !== 'installed'} const defaultTheme = $custom_themes.find((t) => t.name === 'Default');
onclick={async () => { if (defaultTheme) {
try { loadTheme(
const deleteResult = await deleteTheme(theme); defaultTheme,
if (deleteResult) { $custom_theme_container!,
sileo.success({ $custom_theme_volume
title: 'Yaay!', );
description: 'Theme uninstalled successfully!', await config.value<string>('theme').set(defaultTheme.name);
});
} else { if (!(await downloadTheme(theme, true))) {
sileo.error({
title: 'Uhhm..',
description: 'Failed to update theme.',
});
}
}
}}
>
<CloudDownload />
</Button>
{/if}
{#if (theme.status === 'installed' || theme.status === 'deleting') && $active_custom_theme && $active_custom_theme.folder_name !== theme.folder_name && theme.name !== 'Default'}
<Button
class="min-w-10"
size="icon"
variant="destructive"
disabled={theme.status !== 'installed'}
onclick={async () => {
try {
const deleteResult = await deleteTheme(theme);
if (deleteResult) {
sileo.success({
title: 'Yaay!',
description: 'Theme uninstalled successfully!',
});
} else {
sileo.error({
title: 'Uhhm..',
description: 'Failed to uninstall theme.',
});
}
} catch (err) {
console.log(err);
sileo.error({ sileo.error({
title: 'Uhhm..', title: 'Uhhm..',
description: 'Failed to uninstall theme.', description: 'Failed to uninstall theme.',
}); });
} }
} catch (err) { }}
console.log(err); >
sileo.error({ {#if theme.status === 'deleting'}
title: 'Uhhm..', <LoaderCircle class="animate-spin" />
description: 'Failed to uninstall theme.', {:else}
}); <Trash />
} {/if}
}} </Button>
> {/if}
{#if theme.status === 'deleting'} </div>
<LoaderCircle class="animate-spin" />
{:else}
<Trash />
{/if}
</Button>
{/if}
</div> </div>
</div> </div>
</div> {/each}
{/each} </div>
</div> </ScrollContainer>
</ScrollContainer> {/if}
</div> </div>
{/if} {/if}
</div> </div>
+10 -9
View File
@@ -2,6 +2,7 @@
import Logo from '$assets/logo.png'; import Logo from '$assets/logo.png';
import { ezppfarm } from '$lib/api/ezpp'; import { ezppfarm } from '$lib/api/ezpp';
import { git } from '$lib/api/git'; import { git } from '$lib/api/git';
import { config } from '$lib/config';
import { currentUserInfo } from '$lib/data'; import { currentUserInfo } from '$lib/data';
import { estimateFrameRate } from '$lib/displayUtils'; import { estimateFrameRate } from '$lib/displayUtils';
import { import {
@@ -29,13 +30,12 @@
isValidOsuFolder, isValidOsuFolder,
} from '$lib/osuUtil'; } from '$lib/osuUtil';
import type { EZPPUser } from '$lib/types'; import type { EZPPUser } from '$lib/types';
import { currentUser, userAuth } from '$lib/userAuthentication'; import { currentUser } from '$lib/userAuthentication';
import { import {
cursorSmoothness, cursorSmoothness,
osuInstallationPath, osuInstallationPath,
preferredMode, preferredMode,
preferredType, preferredType,
userSettings,
} from '$lib/userSettings'; } from '$lib/userSettings';
import Launch from './Launch.svelte'; import Launch from './Launch.svelte';
import SetupWizard from './SetupWizard.svelte'; import SetupWizard from './SetupWizard.svelte';
@@ -75,15 +75,14 @@
const clamped = Math.min(Math.max(refreshRate, hzMin), hzMax); const clamped = Math.min(Math.max(refreshRate, hzMin), hzMax);
const duration = const duration =
durationMin + ((clamped - hzMin) / (hzMax - hzMin)) * (durationMax - durationMin); durationMin + ((clamped - hzMin) / (hzMax - hzMin)) * (durationMax - durationMin);
console.log(Math.round(duration));
cursorSmoothness.set(Math.round(duration)); cursorSmoothness.set(Math.round(duration));
}; };
const prepare = async () => { const prepare = async () => {
await calculateCursorSmoothness(); await calculateCursorSmoothness();
const username = $userAuth.value('username').get(''); const username = await config.value<string>('username').get('');
const password = $userAuth.value('password').get(''); const password = await config.value<string>('password').get('');
const shouldLogin = username.length > 0 && password.length > 0; const shouldLogin = username.length > 0 && password.length > 0;
let userLoginResult: { message: string; user?: EZPPUser } = { let userLoginResult: { message: string; user?: EZPPUser } = {
@@ -134,16 +133,18 @@
if (!$firstStartup) { if (!$firstStartup) {
currentLoadingInfo.set('Checking osu installation path...'); 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) { if (!validFolder) {
await config_osu_installation_path.set('');
osuInstallationPath.set(''); osuInstallationPath.set('');
$userSettings.value('osu_installation_path').del();
await $userSettings.save();
sileo.error({ sileo.error({
title: 'Hmm...', title: 'Hmm...',
description: 'Your previously set osu! installation path seems to be invalid.', description: 'Your previously set osu! installation path seems to be invalid.',
}); });
} else { } else {
osuInstallationPath.set(osuInstallationPathVal);
currentLoadingInfo.set('Getting osu version...'); currentLoadingInfo.set('Getting osu version...');
const osuReleaseStream = await getReleaseStream($osuInstallationPath); const osuReleaseStream = await getReleaseStream($osuInstallationPath);
osuStream.set(osuReleaseStream); osuStream.set(osuReleaseStream);
@@ -177,7 +178,7 @@
const ezpplauncherStreams = await getEZPPLauncherStreams(); const ezpplauncherStreams = await getEZPPLauncherStreams();
if (ezpplauncherStreams) launcherStreams.set(ezpplauncherStreams); 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)) { if ($launcherStreams.includes(selectedLauncherStream)) {
launcherStream.set(selectedLauncherStream); launcherStream.set(selectedLauncherStream);
} }
+7 -9
View File
@@ -5,6 +5,7 @@
import Checkbox from '$lib/components/ui/checkbox/checkbox.svelte'; import Checkbox from '$lib/components/ui/checkbox/checkbox.svelte';
import Input from '$lib/components/ui/input/input.svelte'; import Input from '$lib/components/ui/input/input.svelte';
import Label from '$lib/components/ui/label/label.svelte'; import Label from '$lib/components/ui/label/label.svelte';
import { config } from '$lib/config';
import { import {
beatmapSets, beatmapSets,
currentSkin, currentSkin,
@@ -12,7 +13,6 @@
discordPresence, discordPresence,
osuBuild, osuBuild,
osuStream, osuStream,
platform,
presenceLoading, presenceLoading,
skins, skins,
skinsCount, skinsCount,
@@ -32,7 +32,6 @@
osuInstallationPath, osuInstallationPath,
patch, patch,
reduceAnimations, reduceAnimations,
userSettings,
} from '$lib/userSettings'; } from '$lib/userSettings';
import Launch from './Launch.svelte'; import Launch from './Launch.svelte';
import { Check, CircleCheckBig, CircleOff, LoaderCircle } from '@lucide/svelte'; import { Check, CircleCheckBig, CircleOff, LoaderCircle } from '@lucide/svelte';
@@ -95,9 +94,9 @@
}; };
const saveConfig = async () => { const saveConfig = async () => {
$userSettings.value('osu_installation_path').set(osuInstallPath); await config.value<string>('osu_installation_path').set(osuInstallPath);
await $userSettings.save();
osuInstallationPath.set(osuInstallPath); osuInstallationPath.set(osuInstallPath);
await config.value<boolean>('setup_complete').set(true);
const beatmapSetCount = await getBeatmapSetsCount(osuInstallPath); const beatmapSetCount = await getBeatmapSetsCount(osuInstallPath);
if (beatmapSetCount) { if (beatmapSetCount) {
@@ -128,7 +127,7 @@
if (osuPath) { if (osuPath) {
osuInstallPath = osuPath; osuInstallPath = osuPath;
autoDetectedOsuPath = true; autoDetectedOsuPath = true;
$userSettings.value('osu_installation_path').set(osuInstallPath); await config.value<string>('osu_installation_path').set(osuInstallPath);
} }
}); });
</script> </script>
@@ -266,17 +265,16 @@
<div class="flex flex-col"> <div class="flex flex-col">
<Label class="text-sm" for="setting-patch">Patching</Label> <Label class="text-sm" for="setting-patch">Patching</Label>
<div class="text-muted-foreground text-xs"> <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]!" 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 >currently only on windows!</span
> >
{/if} {/if} -->
</div> </div>
</div> </div>
<Checkbox <Checkbox
id="setting-patch" id="setting-patch"
checked={$platform === 'windows' ? $patch : false} checked={$patch}
disabled={$platform !== 'windows'}
onCheckedChange={async (e) => { onCheckedChange={async (e) => {
patch.set(e); patch.set(e);
}} }}