Compare commits

...

39 Commits

Author SHA1 Message Date
HorizonCode 195eae4980 chore: update deps 2026-07-05 12:08:19 +02:00
HorizonCode 8c70c00ebd feat: add memory reader 2026-07-05 12:07:58 +02:00
HorizonCode 6dc1f4f703 fix: mode select height 2026-06-26 10:58:35 +02:00
HorizonCode 21710d0e02 chore: bump version 2026-06-26 10:42:28 +02:00
HorizonCode b478e7ba95 Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher 2026-06-26 10:01:06 +02:00
HorizonCode bd368adfe5 chore: add scorev2 type and gamemodes 2026-06-26 10:00:56 +02:00
HorizonCode 85ea4167ab fix: update check on launch 2026-06-14 14:33:48 +02:00
HorizonCode adf7e487b9 feat: add update check failure dialog, ability to skip update check 2026-06-08 16:36:48 +02:00
HorizonCode 22d97a0068 chore: bump version 2026-06-07 16:59:50 +02:00
HorizonCode 992127ecb6 fix: only accept json 2026-06-07 00:13:55 +02:00
HorizonCode 0f53057897 chore: implement mirror of osu changelog 2026-06-07 00:10:24 +02:00
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
27 changed files with 1833 additions and 653 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "ezpplauncher", "name": "ezpplauncher",
"version": "3.2.1", "version": "3.2.5",
"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 -53
View File
@@ -8,6 +8,16 @@ 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.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1973cfbc1a2daf9cf550e74e1f088c28e7f7d8c1e1418fb6c9dc5184b7e84c99"
dependencies = [
"crypto-common 0.2.2",
"inout",
]
[[package]] [[package]]
name = "aes" name = "aes"
version = "0.9.0" version = "0.9.0"
@@ -19,6 +29,20 @@ dependencies = [
"cpufeatures 0.3.0", "cpufeatures 0.3.0",
] ]
[[package]]
name = "aes-gcm"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdf011db2e21ce0d575593d749db5554b47fed37aff429e4dc50bc91ac93a028"
dependencies = [
"aead",
"aes",
"cipher",
"ctr",
"ghash",
"subtle",
]
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.1.4" version = "1.1.4"
@@ -54,9 +78,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.102" version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3"
[[package]] [[package]]
name = "async-broadcast" name = "async-broadcast"
@@ -449,7 +473,7 @@ dependencies = [
"semver", "semver",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.17", "thiserror 2.0.18",
] ]
[[package]] [[package]]
@@ -531,6 +555,7 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c" checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c"
dependencies = [ dependencies = [
"block-buffer 0.12.0",
"crypto-common 0.2.2", "crypto-common 0.2.2",
"inout", "inout",
] ]
@@ -743,7 +768,9 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453"
dependencies = [ dependencies = [
"getrandom 0.4.2",
"hybrid-array", "hybrid-array",
"rand_core 0.10.1",
] ]
[[package]] [[package]]
@@ -802,6 +829,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.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baaca1c4b237092596f64d571e9db6ce4109c4ef9742e27590f1709594461f21"
dependencies = [
"cipher",
]
[[package]] [[package]]
name = "ctutils" name = "ctutils"
version = "0.4.2" version = "0.4.2"
@@ -1184,8 +1220,9 @@ dependencies = [
[[package]] [[package]]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.1" version = "3.2.5"
dependencies = [ dependencies = [
"aes-gcm",
"anyhow", "anyhow",
"base64 0.22.1", "base64 0.22.1",
"byteorder", "byteorder",
@@ -1197,10 +1234,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,15 +1248,29 @@ 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",
"winapi", "winapi",
"windows 0.62.2",
"windows-sys 0.61.2", "windows-sys 0.61.2",
"winreg 0.56.0", "winreg 0.56.0",
"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"
@@ -1597,11 +1650,21 @@ dependencies = [
"js-sys", "js-sys",
"libc", "libc",
"r-efi 6.0.0", "r-efi 6.0.0",
"rand_core 0.10.1",
"wasip2", "wasip2",
"wasip3", "wasip3",
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "ghash"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eecf2d5dc9b66b732b97707a0210906b1d30523eb773193ab777c0c84b3e8d5"
dependencies = [
"polyval",
]
[[package]] [[package]]
name = "gio" name = "gio"
version = "0.18.4" version = "0.18.4"
@@ -1799,6 +1862,27 @@ 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 = "hashbrown"
version = "0.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
dependencies = [
"foldhash 0.2.0",
]
[[package]]
name = "hashlink"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5081f264ed7adee96ea4b4778b6bb9da0a7228b084587aa3bd3ff05da7c5a3b"
dependencies = [
"hashbrown 0.17.1",
]
[[package]] [[package]]
name = "heck" name = "heck"
@@ -2384,6 +2468,17 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "libsqlite3-sys"
version = "0.38.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6c19a05435c21ac299d71b6a9c13db3e3f47c520517d58990a462a1397a61db"
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 +2649,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",
] ]
@@ -2918,14 +3013,13 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
[[package]] [[package]]
name = "open" name = "open"
version = "5.3.5" version = "5.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fbaa89d2ddc8473c78a3adf69eea8cffa28c483b8e02a971ef31527cd0fc92c" checksum = "cd8d3b65c44123a56e0133d2cd06ce4361bd3ca99d41198b2f25e3c3db9b8b4a"
dependencies = [ dependencies = [
"dunce", "dunce",
"is-wsl", "is-wsl",
"libc", "libc",
"pathdiff",
] ]
[[package]] [[package]]
@@ -3014,12 +3108,6 @@ dependencies = [
"windows-link 0.2.1", "windows-link 0.2.1",
] ]
[[package]]
name = "pathdiff"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
[[package]] [[package]]
name = "pbkdf2" name = "pbkdf2"
version = "0.13.0" version = "0.13.0"
@@ -3291,6 +3379,17 @@ dependencies = [
"windows-sys 0.61.2", "windows-sys 0.61.2",
] ]
[[package]]
name = "polyval"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dfc63250416fea14f5749b90725916a6c903f599d51cb635aa7a52bfd03eede"
dependencies = [
"cpubits",
"cpufeatures 0.3.0",
"universal-hash",
]
[[package]] [[package]]
name = "potential_utf" name = "potential_utf"
version = "0.1.4" version = "0.1.4"
@@ -3340,7 +3439,7 @@ dependencies = [
"log", "log",
"serde", "serde",
"serde_json", "serde_json",
"thiserror 2.0.17", "thiserror 2.0.18",
"tokio", "tokio",
"uuid", "uuid",
] ]
@@ -3462,7 +3561,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 +3583,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",
@@ -3617,6 +3716,12 @@ dependencies = [
"getrandom 0.3.4", "getrandom 0.3.4",
] ]
[[package]]
name = "rand_core"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
[[package]] [[package]]
name = "rand_hc" name = "rand_hc"
version = "0.2.0" version = "0.2.0"
@@ -3658,7 +3763,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 +3899,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.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11438310b19e3109b6446c33d1ed5e889428cf2e278407bc7896bc4aaea43323"
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 +4532,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"
@@ -4530,9 +4672,9 @@ dependencies = [
[[package]] [[package]]
name = "sysinfo" name = "sysinfo"
version = "0.39.2" version = "0.39.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14311e7e9a03114cd4b65eedd54e8fed2945e17f08586ae97ef53bc0669f9581" checksum = "2c8bd2130a9b60bee2581bf82cfe89ee836424d1f37dcfa4ce21509611684673"
dependencies = [ dependencies = [
"libc", "libc",
"memchr", "memchr",
@@ -4636,9 +4778,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]] [[package]]
name = "tauri" name = "tauri"
version = "2.11.2" version = "2.11.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "437404997acf375d85f1177afa7e11bb971f274ed6a7b83a2a3e339015f4cc28" checksum = "667b20e2726d572dea2de7370da16e188eb06008faf9a92fab7cdc46791190b5"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -4676,7 +4818,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",
@@ -4688,9 +4830,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-build" name = "tauri-build"
version = "2.6.2" version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4aa1f9055fc23919a54e4e125052bed16ed04aef0487086e758fe01a67b451c7" checksum = "bc9ce40b16101cb6ea63d3e221567affd1c3a9205f95d7bc574941a10636b632"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_toml", "cargo_toml",
@@ -4709,9 +4851,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-codegen" name = "tauri-codegen"
version = "2.6.2" version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4a0319528a025a38c4078e7dae2c446f4e63620ddb0659a643ede1cb38f90e9" checksum = "08279169ff42f8fc45a1dbc9dcae888893ba95288142e5880c59b93a26d2cfc5"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"brotli", "brotli",
@@ -4727,7 +4869,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",
@@ -4736,9 +4878,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-macros" name = "tauri-macros"
version = "2.6.2" version = "2.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae6cb4e3896c21d2f6da5b31251d2faea0153bba56ed0e970f918115dbee4924" checksum = "e8b394794f399a421811d06966343e7933fcae92d59f5180b9388d1174497a45"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
@@ -4780,7 +4922,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 +4941,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 +4964,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 +4986,7 @@ dependencies = [
"shared_child", "shared_child",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"thiserror 2.0.17", "thiserror 2.0.18",
"tokio", "tokio",
] ]
@@ -4857,7 +4999,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",
@@ -4865,9 +5007,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime" name = "tauri-runtime"
version = "2.11.2" version = "2.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48222d7116c8807eaa6fe2f372e023fae125084e61e6eca6d70b7961cdf129ef" checksum = "b0b4bc95aed361b0019067d189a1174a603d460d0f6c72606512d59fc9c12ec8"
dependencies = [ dependencies = [
"cookie", "cookie",
"dpi", "dpi",
@@ -4881,7 +5023,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",
@@ -4890,9 +5032,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime-wry" name = "tauri-runtime-wry"
version = "2.11.2" version = "2.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b83849ee63ecb27a8e8d0fe51915ca215076914aca43f96db1179f0f415f6cd9" checksum = "4e6fac707727b7a2f48e4ded90976324267371073edbb415ffb73bb0458d203f"
dependencies = [ dependencies = [
"gtk", "gtk",
"http", "http",
@@ -4916,9 +5058,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri-utils" name = "tauri-utils"
version = "2.9.2" version = "2.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "092379df9a707631978e6c56b1bc2401d387f01e2d4a3c123360d167bbb9aa95" checksum = "3e176a18e67764923c4f1ce66f25ae4abe5f688384d5eb1a0fa6c77f3d90f887"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"brotli", "brotli",
@@ -4946,7 +5088,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 +5152,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 +5172,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",
@@ -5345,9 +5487,9 @@ dependencies = [
[[package]] [[package]]
name = "tray-icon" name = "tray-icon"
version = "0.23.1" version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15edbb0d80583e85ee8df283410038e17314df5cba30da2087a54a85216c0773" checksum = "65ba1e5f6b9ef9fd87e21b9c6f351554dbd717960089168fcfdef854686961dc"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"dirs", "dirs",
@@ -5361,7 +5503,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 +5601,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.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4987bdc12753382e0bec4a65c50738ffaabc998b9cdd1f952fb5f39b0048a96"
dependencies = [
"crypto-common 0.2.2",
"ctutils",
]
[[package]] [[package]]
name = "untrusted" name = "untrusted"
version = "0.9.0" version = "0.9.0"
@@ -5514,6 +5666,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 +5975,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 +6668,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",
+18 -7
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.1" version = "3.2.5"
description = "EZPPLauncher redefined." description = "EZPPLauncher redefined."
authors = ["HorizonCode"] authors = ["HorizonCode"]
edition = "2024" edition = "2024"
@@ -25,10 +25,10 @@ name = "ezpplauncher_lib"
crate-type = ["staticlib", "cdylib", "rlib"] crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies] [build-dependencies]
tauri-build = { version = "2.6.2", features = [] } tauri-build = { version = "2.6.3", features = [] }
[dependencies] [dependencies]
tauri = { version = "2.11.2", features = ["protocol-asset"] } tauri = { version = "2.11.5", features = ["protocol-asset"] }
tauri-plugin-shell = "2.3.5" tauri-plugin-shell = "2.3.5"
serde = { version = "1.0.228", features = ["derive"] } serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.150" serde_json = "1.0.150"
@@ -37,27 +37,38 @@ tauri-plugin-dialog = "2.7.1"
tauri-plugin-fs = "2.5.1" tauri-plugin-fs = "2.5.1"
hardware-id = "0.3.0" hardware-id = "0.3.0"
tauri-plugin-cors-fetch = "5.0.0" tauri-plugin-cors-fetch = "5.0.0"
sysinfo = "0.39.2" sysinfo = "0.39.5"
reqwest = { version = "0.13.4", features = ["json", "stream", "query"] } reqwest = { version = "0.13.4", features = ["json", "stream", "query"] }
md5 = "0.8.0" md5 = "0.8.0"
tokio = { version = "1.52.3", features = ["full"] } tokio = { version = "1.52.3", features = ["full"] }
open = "5.3.5" open = "5.3.6"
presenceforge = { version = "0.2.1", features = ["tokio-runtime"] } presenceforge = { version = "0.2.1", features = ["tokio-runtime"] }
once_cell = "1.21.4" once_cell = "1.21.4"
futures-util = "0.3.32" futures-util = "0.3.32"
byteorder = "1.5.0" byteorder = "1.5.0"
anyhow = "1.0.102" anyhow = "1.0.103"
url = "2.5.8" 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.1", features = ["bundled"] }
aes-gcm = "0.11.0"
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"
windows = { version = "0.62.2", features = [
"Win32_System_Diagnostics_ToolHelp",
"Win32_System_Memory",
"Win32_System_Threading",
"Win32_System_Diagnostics_Debug",
"Win32_Foundation"
] }
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-single-instance = "2.4.2" tauri-plugin-single-instance = "2.4.2"
+55 -14
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,8 +450,6 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
} }
}; };
#[cfg(windows)]
{
if patch { if patch {
let patcher_exe_path = PathBuf::from(&folder) let patcher_exe_path = PathBuf::from(&folder)
.join("EZPPLauncher") .join("EZPPLauncher")
@@ -456,8 +457,6 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
.join("osu!.patcher.exe"); .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 {
@@ -483,12 +482,20 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
sleep(Duration::from_millis(500)).await; sleep(Duration::from_millis(500)).await;
} }
#[cfg(windows)]
{
let _ = Command::new(&patcher_exe_path) let _ = Command::new(&patcher_exe_path)
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP) .creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn() .spawn()
.map_err(|e| format!("Failed to run patcher: {e}"))?; .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()))
}
}
+42 -16
View File
@@ -1,28 +1,35 @@
// 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 memory_reader;
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::{
check_for_corruption, config_all, config_clear, config_delete, config_exists, config_get,
config_set, download_and_extract_theme, download_ezpp_launcher_update,
download_ezpp_launcher_update_files, encrypt_string, exit, extract_theme, download_ezpp_launcher_update_files, encrypt_string, exit, extract_theme,
find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid, find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid,
get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform, get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform,
get_skins, get_skins_count, has_net8, has_osuwinello, has_wmctrl, install_ezpp_launcher_update, get_skins, get_skins_count, has_net8, has_osuwinello, has_wmctrl,
is_open_tablet_driver_path_valid, is_open_tablet_driver_running, is_osu_running, install_ezpp_launcher_update, is_open_tablet_driver_path_valid,
open_url_in_browser, opened_urls, presence_connect, presence_disconnect, presence_is_connected, is_open_tablet_driver_running, is_osu_running, open_url_in_browser, opened_urls,
presence_update_button, presence_update_status, presence_update_user, read_theme_info, presence_connect, presence_disconnect, presence_is_connected, presence_update_button,
replace_ui_files, run_open_tablet_driver, run_osu, run_osu_updater, set_osu_config_values, 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, 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 +67,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 +141,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,
+519
View File
@@ -0,0 +1,519 @@
//! osu_memory_reader.rs
//!
//! External, read-only memory reader for the osu! stable client, structured
//! the same way community tools like tosu / gosumemory work:
//!
//! 1. Open the osu process with PROCESS_VM_READ.
//! 2. Enumerate its committed memory regions.
//! 3. Scan those regions for known byte-pattern "signatures".
//! 4. Walk a short pointer chain from each signature to the real struct.
//! 5. Parse out the fields you care about (username, mods, combo, etc).
//!
//! IMPORTANT: The actual signature bytes below are PLACEHOLDERS. osu!
//! updates its binary regularly, which shifts/breaks raw byte signatures.
//! Community tools maintain live, current signatures — pull up-to-date
//! ones from tosu's open-source repo (github.com/KotRikD/tosu, see its
//! `packages/tosu/src/memory/` signature definitions) and drop them into
//! the `SIGNATURES` table below. This file gives you the engine; you keep
//! the signature table current.
//!
//! This is entirely read-only (ReadProcessMemory only, never Write) and
//! only targets your own launched osu! process — no injection involved.
//!
//! ---------------------------------------------------------------------
//! Cargo.toml additions (on top of the ones from osu_scanner.rs):
//!
//! [dependencies]
//! windows = { version = "0.58", features = [
//! "Win32_System_Diagnostics_ToolHelp",
//! "Win32_System_Memory",
//! "Win32_System_Threading",
//! "Win32_System_Diagnostics_Debug",
//! "Win32_Foundation"
//! ] }
//! ---------------------------------------------------------------------
use serde::Serialize;
use std::collections::HashMap;
use windows::Win32::Foundation::{CloseHandle, HANDLE};
use windows::Win32::System::Diagnostics::Debug::ReadProcessMemory;
use windows::Win32::System::Memory::{
MEM_COMMIT, MEMORY_BASIC_INFORMATION, PAGE_GUARD, PAGE_NOACCESS, VirtualQueryEx,
};
use windows::Win32::System::Threading::{OpenProcess, PROCESS_QUERY_INFORMATION, PROCESS_VM_READ};
// =========================================================================
// Signature table — REPLACE with current values, see module doc comment.
// =========================================================================
/// A byte pattern to search for in process memory. `None` = wildcard byte.
#[derive(Clone)]
pub struct Signature {
pub name: &'static str,
pub pattern: &'static [Option<u8>],
/// Byte offset from the START of the matched pattern to the address
/// (or start of a pointer chain) you actually want to read.
pub offset: isize,
}
/// Helper macro so signatures can be written like Cheat Engine AOB strings,
/// e.g. sig!("F8 01 74 04 ?? ?? ?? ??", offset = 5).
macro_rules! sig {
($bytes:expr) => {{ parse_aob($bytes) }};
}
fn parse_aob(s: &str) -> Vec<Option<u8>> {
s.split_whitespace()
.map(|tok| {
if tok == "??" || tok == "?" {
None
} else {
Some(u8::from_str_radix(tok, 16).expect("bad AOB byte"))
}
})
.collect()
}
/// NOTE: These are PLACEHOLDER patterns illustrating the *shape* tosu-style
/// signatures take (short, somewhat unique byte runs with wildcards around
/// the volatile parts). Do not expect these exact bytes to match a real
/// osu! binary — swap them for current ones before using this for real.
pub fn build_signature_table() -> HashMap<&'static str, Signature> {
let mut map = HashMap::new();
map.insert(
"username_ptr",
Signature {
name: "username_ptr",
pattern: Box::leak(sig!("75 04 33 C0 EB 0A A1 ?? ?? ?? ??").into_boxed_slice()),
offset: 7, // offset to the 4-byte address embedded in the instruction
},
);
map.insert(
"game_mode_ptr",
Signature {
name: "game_mode_ptr",
pattern: Box::leak(sig!("83 F8 08 7D 05 ?? ?? ?? ?? ??").into_boxed_slice()),
offset: 5,
},
);
map.insert(
"current_beatmap_ptr",
Signature {
name: "current_beatmap_ptr",
pattern: Box::leak(sig!("6A 01 6A 00 A1 ?? ?? ?? ?? 8B 00").into_boxed_slice()),
offset: 4,
},
);
map.insert(
"combo_ptr",
Signature {
name: "combo_ptr",
pattern: Box::leak(
sig!("83 3D ?? ?? ?? ?? 00 7E 34 A1 ?? ?? ?? ??").into_boxed_slice(),
),
offset: 9,
},
);
// userId typically lives on the same "player info" object as username,
// just at a different field offset — but tosu-style tools usually give
// it its own independent signature since it's read even when the
// username string hasn't been touched yet (e.g. right after login).
map.insert(
"user_id_ptr",
Signature {
name: "user_id_ptr",
pattern: Box::leak(sig!("A1 ?? ?? ?? ?? 89 45 ?? 8B 45 ?? 8B 0D").into_boxed_slice()),
offset: 1,
},
);
map
}
// =========================================================================
// Process handle + raw memory access
// =========================================================================
pub struct MemoryReader {
handle: HANDLE,
pid: u32,
/// Cached list of readable committed memory regions.
regions: Vec<(usize, usize)>, // (base_address, size)
}
impl MemoryReader {
/// Opens the given PID for reading. Returns None if the process can't
/// be opened (e.g. insufficient privileges, process exited).
pub fn open(pid: u32) -> Option<Self> {
let handle =
unsafe { OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, false, pid).ok()? };
Some(Self {
handle,
pid,
regions: Vec::new(),
})
}
/// Re-enumerates committed, readable memory regions. Call once after
/// open() and periodically after (e.g. once per scan cycle), since the
/// process's memory layout can change.
pub fn refresh_regions(&mut self) {
self.regions.clear();
let mut address: usize = 0;
loop {
let mut mbi = MEMORY_BASIC_INFORMATION::default();
let result = unsafe {
VirtualQueryEx(
self.handle,
Some(address as *const _),
&mut mbi,
std::mem::size_of::<MEMORY_BASIC_INFORMATION>(),
)
};
if result == 0 {
break; // no more regions
}
let region_size = mbi.RegionSize;
let is_committed = mbi.State == MEM_COMMIT;
let is_guarded = (mbi.Protect & PAGE_GUARD).0 != 0;
let is_no_access = mbi.Protect == PAGE_NOACCESS;
if is_committed && !is_guarded && !is_no_access && region_size > 0 {
self.regions.push((mbi.BaseAddress as usize, region_size));
}
address = (mbi.BaseAddress as usize).saturating_add(region_size);
if address == 0 {
break;
}
}
}
/// Reads `size` bytes starting at `address`. Returns None on failure
/// (unmapped page, access denied, process exited mid-read, etc).
pub fn read_bytes(&self, address: usize, size: usize) -> Option<Vec<u8>> {
let mut buffer = vec![0u8; size];
let mut bytes_read = 0usize;
unsafe {
ReadProcessMemory(
self.handle,
address as *const _,
buffer.as_mut_ptr() as *mut _,
size,
Some(&mut bytes_read),
)
.ok()?;
}
buffer.truncate(bytes_read);
if buffer.is_empty() {
None
} else {
Some(buffer)
}
}
pub fn read_i32(&self, address: usize) -> Option<i32> {
let bytes = self.read_bytes(address, 4)?;
Some(i32::from_le_bytes(bytes.try_into().ok()?))
}
pub fn read_u32(&self, address: usize) -> Option<u32> {
let bytes = self.read_bytes(address, 4)?;
Some(u32::from_le_bytes(bytes.try_into().ok()?))
}
pub fn read_u16(&self, address: usize) -> Option<u16> {
let bytes = self.read_bytes(address, 2)?;
Some(u16::from_le_bytes(bytes.try_into().ok()?))
}
pub fn read_f64(&self, address: usize) -> Option<f64> {
let bytes = self.read_bytes(address, 8)?;
Some(f64::from_le_bytes(bytes.try_into().ok()?))
}
/// Reads a pointer-sized value (4 bytes for the 32-bit osu! stable
/// client). Change to 8 bytes if you ever target a 64-bit build.
pub fn read_ptr(&self, address: usize) -> Option<usize> {
self.read_u32(address).map(|v| v as usize)
}
/// Reads a .NET-style string: [object header][length: i32][utf16 chars].
/// `base` should point at the object header; the classic offset for
/// .NET string length is +0x4 and chars start at +0x8, but verify
/// against your target since layouts can differ.
pub fn read_dotnet_string(&self, base: usize, max_len: usize) -> Option<String> {
let len = self.read_i32(base + 0x4)? as usize;
let len = len.min(max_len);
if len == 0 {
return Some(String::new());
}
let bytes = self.read_bytes(base + 0x8, len * 2)?;
let utf16: Vec<u16> = bytes
.chunks_exact(2)
.map(|b| u16::from_le_bytes([b[0], b[1]]))
.collect();
String::from_utf16(&utf16).ok()
}
/// Scans all cached regions for `signature.pattern`, returning the
/// absolute address where the pattern begins (before applying offset).
pub fn find_signature(&self, signature: &Signature) -> Option<usize> {
for &(base, size) in &self.regions {
// Read in chunks to avoid gigantic single allocations on huge
// regions; 1MB chunks with overlap so patterns aren't missed
// across a chunk boundary.
const CHUNK: usize = 1 << 20;
let overlap = signature.pattern.len().saturating_sub(1);
let mut offset = 0;
while offset < size {
let read_size = CHUNK.min(size - offset);
let Some(mem) = self.read_bytes(base + offset, read_size) else {
offset += CHUNK;
continue;
};
if let Some(pos) = find_pattern(&mem, signature.pattern) {
return Some(base + offset + pos);
}
offset += CHUNK.saturating_sub(overlap).max(1);
}
}
None
}
pub fn pid(&self) -> u32 {
self.pid
}
}
impl Drop for MemoryReader {
fn drop(&mut self) {
unsafe {
let _ = CloseHandle(self.handle);
}
}
}
/// Naive substring search over a byte pattern with wildcards. Fine for
/// per-scan-cycle use; swap for a Boyer-Moore-style skip table if you need
/// to scan very large regions many times per second.
fn find_pattern(haystack: &[u8], pattern: &[Option<u8>]) -> Option<usize> {
if pattern.is_empty() || haystack.len() < pattern.len() {
return None;
}
haystack.windows(pattern.len()).position(|window| {
window
.iter()
.zip(pattern.iter())
.all(|(b, p)| p.map_or(true, |expected| *b == expected))
})
}
// =========================================================================
// High-level "osu state" reader
// =========================================================================
#[derive(Serialize, Debug, Default, Clone)]
pub struct OsuState {
pub username: Option<String>,
pub user_id: Option<i32>,
pub game_mode: Option<i32>,
pub combo: Option<i32>,
pub beatmap_id: Option<i32>,
}
pub struct OsuMemoryClient {
reader: MemoryReader,
signatures: HashMap<&'static str, Signature>,
/// Cached resolved addresses so we don't re-scan the whole memory space
/// every single read — only re-resolve if a read at the cached address
/// stops making sense (e.g. after an osu update / restart).
resolved: HashMap<&'static str, usize>,
/// When true, prints signature resolution + read results to stderr.
/// Toggle via `new_with_debug`, or flip at runtime with `set_debug`.
debug: bool,
}
impl OsuMemoryClient {
pub fn new(pid: u32) -> Option<Self> {
Self::new_with_debug(pid, false)
}
/// Same as `new`, but with debug logging to stderr enabled/disabled
/// explicitly. Handy to wire up to a `--debug` CLI flag or a Tauri
/// dev-mode check (`cfg!(debug_assertions)`).
pub fn new_with_debug(pid: u32, debug: bool) -> Option<Self> {
let mut reader = MemoryReader::open(pid)?;
if debug {
eprintln!("[osu_memory] opening pid {pid} for reading");
}
reader.refresh_regions();
if debug {
eprintln!(
"[osu_memory] found {} readable regions",
reader.regions.len()
);
}
Some(Self {
reader,
signatures: build_signature_table(),
resolved: HashMap::new(),
debug,
})
}
pub fn set_debug(&mut self, debug: bool) {
self.debug = debug;
}
/// Call periodically (e.g. every few seconds, or whenever osu restarts)
/// to pick up new memory layout / re-find signatures.
pub fn refresh(&mut self) {
if self.debug {
eprintln!(
"[osu_memory] refreshing regions + clearing {} cached signature(s)",
self.resolved.len()
);
}
self.reader.refresh_regions();
self.resolved.clear();
if self.debug {
eprintln!(
"[osu_memory] {} readable regions after refresh",
self.reader.regions.len()
);
}
}
fn resolve(&mut self, key: &'static str) -> Option<usize> {
if let Some(addr) = self.resolved.get(key) {
if self.debug {
eprintln!("[osu_memory] {key} -> 0x{addr:X} (cached)");
}
return Some(*addr);
}
let sig = self.signatures.get(key)?.clone();
let Some(found) = self.reader.find_signature(&sig) else {
if self.debug {
eprintln!("[osu_memory] {key}: signature NOT FOUND in any scanned region");
}
return None;
};
let target = (found as isize + sig.offset) as usize;
if self.debug {
eprintln!(
"[osu_memory] {key}: signature matched at 0x{found:X}, target (offset {}) -> 0x{target:X}",
sig.offset
);
}
self.resolved.insert(key, target);
Some(target)
}
pub fn read_username(&mut self) -> Option<String> {
let addr = self.resolve("username_ptr")?;
let ptr = self.reader.read_ptr(addr)?;
let value = self.reader.read_dotnet_string(ptr, 64);
if self.debug {
eprintln!("[osu_memory] username -> {value:?}");
}
value
}
pub fn read_user_id(&mut self) -> Option<i32> {
let addr = self.resolve("user_id_ptr")?;
// Unlike username/combo/beatmap, this signature usually points
// straight at a static int slot rather than through an extra
// object pointer — verify against whatever real signature you use,
// some variants do need an extra self.reader.read_ptr() hop first.
let value = self.reader.read_i32(addr);
if self.debug {
eprintln!("[osu_memory] user_id -> {value:?}");
}
value
}
pub fn read_game_mode(&mut self) -> Option<i32> {
let addr = self.resolve("game_mode_ptr")?;
let ptr = self.reader.read_ptr(addr)?;
let value = self.reader.read_i32(ptr);
if self.debug {
eprintln!("[osu_memory] game_mode -> {value:?}");
}
value
}
pub fn read_combo(&mut self) -> Option<i32> {
let addr = self.resolve("combo_ptr")?;
let ptr = self.reader.read_ptr(addr)?;
let value = self.reader.read_i32(ptr);
if self.debug {
eprintln!("[osu_memory] combo -> {value:?}");
}
value
}
pub fn read_beatmap_id(&mut self) -> Option<i32> {
let addr = self.resolve("current_beatmap_ptr")?;
let ptr = self.reader.read_ptr(addr)?;
let value = self.reader.read_i32(ptr + 0xC); // example nested offset into the beatmap struct
if self.debug {
eprintln!("[osu_memory] beatmap_id -> {value:?}");
}
value
}
/// Convenience: read everything at once into a single struct, suitable
/// for bundling into your existing scan payload / emitting to the
/// frontend.
pub fn read_state(&mut self) -> OsuState {
if self.debug {
eprintln!(
"[osu_memory] --- reading full state (pid {}) ---",
self.reader.pid()
);
}
let state = OsuState {
username: self.read_username(),
user_id: self.read_user_id(),
game_mode: self.read_game_mode(),
combo: self.read_combo(),
beatmap_id: self.read_beatmap_id(),
};
if self.debug {
eprintln!("[osu_memory] state = {state:?}");
}
state
}
}
// =========================================================================
// Example wiring into your existing watcher loop
// =========================================================================
//
// let mut mem_client = OsuMemoryClient::new(osu_pid)?;
// loop {
// let state = mem_client.read_state();
// // attach `state` to your ScanPayload before POSTing to the server
// // if a read silently comes back all-None a few cycles in a row,
// // call mem_client.refresh() in case osu updated/restarted.
// }
+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.5",
"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;
+29
View File
@@ -3,9 +3,11 @@ import type {
EZPPUserInfoResponse, EZPPUserInfoResponse,
EZPPUserResponse, EZPPUserResponse,
EZPPUSerStatusResponse, EZPPUSerStatusResponse,
StreamsResult,
} from '$lib/types'; } from '$lib/types';
import { betterFetch } from '@better-fetch/fetch'; import { betterFetch } from '@better-fetch/fetch';
const VERSION_ENDPOINT = 'https://version.ez-pp.farm/';
const BANCHO_ENDPOINT = 'https://c.ez-pp.farm/'; const BANCHO_ENDPOINT = 'https://c.ez-pp.farm/';
const API_ENDPOINT = 'https://api.ez-pp.farm/'; const API_ENDPOINT = 'https://api.ez-pp.farm/';
const ENDPOINT = 'https://ez-pp.farm/'; const ENDPOINT = 'https://ez-pp.farm/';
@@ -89,4 +91,31 @@ export const ezppfarm = {
); );
return request.error ? undefined : request.data; return request.error ? undefined : request.data;
}, },
latestBuildVersion: async (releaseStream: string): Promise<string | undefined> => {
const request = await betterFetch<StreamsResult>(`${VERSION_ENDPOINT}api/changelog`, {
timeout,
query: {
stream: 'none',
},
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'User-Agent': 'EZPPLauncher',
},
});
if (request.error) {
return undefined;
}
const releaseData = request.data;
if (!releaseData || !releaseData.streams) {
return undefined;
}
if (releaseData.streams.length === 0) return undefined;
const selectedRelease = releaseData.streams.find(
(releaseBuild) =>
releaseBuild.name.toLowerCase() === releaseStream.replaceAll(' ', '').toLowerCase()
);
if (!selectedRelease) return undefined;
return selectedRelease.latest_build.display_version;
},
}; };
-35
View File
@@ -1,35 +0,0 @@
import type { StreamsResult } from '$lib/types';
import { betterFetch } from '@better-fetch/fetch';
const API_ENDPOINT = 'https://osu.ppy.sh/api/';
const timeout = 5000; // 5 seconds;
export const osuapi = {
latestBuildVersion: async (releaseStream: string): Promise<string | undefined> => {
const request = await betterFetch<StreamsResult>(`${API_ENDPOINT}v2/changelog`, {
timeout,
query: {
stream: 'none',
},
headers: {
'Content-Type': 'application/json',
'User-Agent': 'EZPPLauncher',
},
});
if (request.error) {
return undefined;
}
const releaseData = request.data;
if (!releaseData || !releaseData.streams) {
return undefined;
}
if (releaseData.streams.length === 0) return undefined;
const selectedRelease = releaseData.streams.find(
(releaseBuild) =>
releaseBuild.name.toLowerCase() === releaseStream.replaceAll(' ', '').toLowerCase()
);
if (!selectedRelease) return undefined;
return selectedRelease.latest_build.display_version;
},
};
@@ -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];
},
};
}
}
+51 -6
View File
@@ -9,6 +9,11 @@ export enum Gamemodes {
RELAX_CATCH = 6, RELAX_CATCH = 6,
AUTOPILOT_OSU = 8, AUTOPILOT_OSU = 8,
SCOREV2_OSU = 12,
SCOREV2_TAIKO = 13,
SCOREV2_CATCH = 14,
SCOREV2_MANIA = 15,
} }
export enum Mode { export enum Mode {
@@ -22,12 +27,39 @@ export enum Type {
VANILLA = 0, VANILLA = 0,
RELAX = 4, RELAX = 4,
AUTOPILOT = 8, AUTOPILOT = 8,
SCOREV2 = 12,
} }
export const validModes = [Mode.OSU, Mode.TAIKO, Mode.CATCH, Mode.MANIA]; export const validModes = [Mode.OSU, Mode.TAIKO, Mode.CATCH, Mode.MANIA];
export const validTypes = [Type.VANILLA, Type.RELAX, Type.AUTOPILOT]; export const validTypes = [Type.VANILLA, Type.RELAX, Type.AUTOPILOT, Type.SCOREV2];
export const validModeTypeCombinations = [0, 1, 2, 3, 4, 5, 6, 8]; export const validModeTypeCombinations = [
export const validModeTypeCombinationsSorted = [0, 4, 8, 1, 5, 2, 6, 3]; Gamemodes.VANILLA_OSU,
Gamemodes.VANILLA_TAIKO,
Gamemodes.VANILLA_CATCH,
Gamemodes.VANILLA_MANIA,
Gamemodes.RELAX_OSU,
Gamemodes.RELAX_TAIKO,
Gamemodes.RELAX_CATCH,
Gamemodes.AUTOPILOT_OSU,
Gamemodes.SCOREV2_OSU,
Gamemodes.SCOREV2_TAIKO,
Gamemodes.SCOREV2_CATCH,
Gamemodes.SCOREV2_MANIA,
];
export const validModeTypeCombinationsSorted = [
Gamemodes.VANILLA_OSU,
Gamemodes.RELAX_OSU,
Gamemodes.AUTOPILOT_OSU,
Gamemodes.SCOREV2_OSU,
Gamemodes.VANILLA_TAIKO,
Gamemodes.RELAX_TAIKO,
Gamemodes.SCOREV2_TAIKO,
Gamemodes.VANILLA_CATCH,
Gamemodes.RELAX_CATCH,
Gamemodes.SCOREV2_CATCH,
Gamemodes.VANILLA_MANIA,
Gamemodes.SCOREV2_MANIA,
];
export const validMode = (modeStr: string) => modeStrToInt(modeStr) !== undefined; export const validMode = (modeStr: string) => modeStrToInt(modeStr) !== undefined;
export const validType = (typeStr: string) => typeStrToInt(typeStr) !== undefined; export const validType = (typeStr: string) => typeStrToInt(typeStr) !== undefined;
@@ -60,7 +92,7 @@ export const modeIntToStr = (modeInt: number) => {
return undefined; return undefined;
}; };
export const typeStrToInt = (typeStr: 'vanilla' | 'relax' | 'autopilot' | string) => { export const typeStrToInt = (typeStr: 'vanilla' | 'relax' | 'autopilot' | 'v2' | string) => {
switch (typeStr) { switch (typeStr) {
case 'relax': case 'relax':
return Type.RELAX; return Type.RELAX;
@@ -68,6 +100,8 @@ export const typeStrToInt = (typeStr: 'vanilla' | 'relax' | 'autopilot' | string
return Type.AUTOPILOT; return Type.AUTOPILOT;
case 'vanilla': case 'vanilla':
return Type.VANILLA; return Type.VANILLA;
case 'scorev2':
return Type.SCOREV2;
} }
return undefined; return undefined;
}; };
@@ -80,13 +114,15 @@ export const typeIntToStr = (typeInt: number) => {
return 'autopilot'; return 'autopilot';
case Type.VANILLA: case Type.VANILLA:
return 'vanilla'; return 'vanilla';
case Type.SCOREV2:
return 'scorev2';
} }
return undefined; return undefined;
}; };
export const getGamemodeInt = ( export const getGamemodeInt = (
mode: 'osu' | 'taiko' | 'catch' | 'mania' | string | undefined, mode: 'osu' | 'taiko' | 'catch' | 'mania' | string | undefined,
type: 'vanilla' | 'relax' | 'autopilot' | string | undefined type: 'vanilla' | 'relax' | 'autopilot' | 'scorev2' | string | undefined
) => { ) => {
let modee = 0; let modee = 0;
switch (mode) { switch (mode) {
@@ -108,6 +144,9 @@ export const getGamemodeInt = (
case 'autopilot': case 'autopilot':
modee += Type.AUTOPILOT; modee += Type.AUTOPILOT;
break; break;
case 'scorev2':
modee += Type.SCOREV2;
break;
} }
return modee; return modee;
@@ -115,7 +154,7 @@ export const getGamemodeInt = (
export const getGamemodeName = ( export const getGamemodeName = (
mode: 'osu' | 'taiko' | 'catch' | 'mania' | string | undefined, mode: 'osu' | 'taiko' | 'catch' | 'mania' | string | undefined,
type: 'vanilla' | 'relax' | 'autopilot' | string | undefined type: 'vanilla' | 'relax' | 'autopilot' | 'scorev2' | string | undefined
) => { ) => {
let modeStr = ''; let modeStr = '';
switch (mode) { switch (mode) {
@@ -140,6 +179,9 @@ export const getGamemodeName = (
case 'autopilot': case 'autopilot':
modeStr += 'ap'; modeStr += 'ap';
break; break;
case 'scorev2':
modeStr += 'v2';
break;
default: default:
modeStr += 'vn'; modeStr += 'vn';
break; break;
@@ -173,6 +215,9 @@ export const getModeAndTypeFromGamemode = (gamemode: number) => {
case Type.AUTOPILOT: case Type.AUTOPILOT:
type = Type.AUTOPILOT; type = Type.AUTOPILOT;
break; break;
case Type.SCOREV2:
type = Type.SCOREV2;
break;
} }
return { return {
+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}
+137 -66
View File
@@ -2,7 +2,6 @@
import DefaultThemePreview from '$assets/default_preview.png'; import DefaultThemePreview from '$assets/default_preview.png';
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 { osuapi } from '$lib/api/osuapi';
import * as AlertDialog from '$lib/components/ui/alert-dialog'; import * as AlertDialog from '$lib/components/ui/alert-dialog';
import * as Avatar from '$lib/components/ui/avatar'; import * as Avatar from '$lib/components/ui/avatar';
import Badge from '$lib/components/ui/badge/badge.svelte'; import Badge from '$lib/components/ui/badge/badge.svelte';
@@ -15,6 +14,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 +87,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 +97,6 @@
preferredMode, preferredMode,
preferredType, preferredType,
reduceAnimations, reduceAnimations,
userSettings,
} from '$lib/userSettings'; } from '$lib/userSettings';
import { import {
compareBuildNumbers, compareBuildNumbers,
@@ -141,7 +140,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);
@@ -151,6 +150,8 @@
let downloadingUpdate = $state(false); let downloadingUpdate = $state(false);
let updateCheckFailed = $state(false);
let dragAndDrop = useDropZone({ let dragAndDrop = useDropZone({
onDrop: async (file) => { onDrop: async (file) => {
const firstFile = file[0]; const firstFile = file[0];
@@ -220,8 +221,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.',
@@ -246,7 +246,7 @@
} }
}; };
const launch = async () => { const launch = async (skipUpdateCheck = false) => {
if ($launching) return; if ($launching) return;
launchInfo = 'Checking if osu! is already running...'; launchInfo = 'Checking if osu! is already running...';
launching.set(true); launching.set(true);
@@ -303,9 +303,12 @@
} }
} }
if (!skipUpdateCheck) {
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) {
@@ -335,15 +338,18 @@
launching.set(false); launching.set(false);
return; return;
} }
}
try { try {
const streamInfo = await osuapi.latestBuildVersion('stable40'); if (!skipUpdateCheck) {
const streamInfo = await ezppfarm.latestBuildVersion('stable40');
if (!streamInfo) { if (!streamInfo) {
sileo.error({ sileo.error({
title: 'Hmmm...', title: 'Hmmm...',
description: 'Failed to check for updates, maybe osu! is down?', description: 'Failed to check for updates, maybe osu! is down?',
}); });
launching.set(false); launching.set(false);
updateCheckFailed = true;
return; return;
} }
@@ -403,9 +409,12 @@
} else { } else {
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,6 +581,7 @@
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;
if (userStatus.player_status.status.action !== EZPPActionStatus.DIRECT)
customButton = { customButton = {
text: 'View Beatmap', text: 'View Beatmap',
url: `https://ez-pp.farm/beatmapsets/${userStatus.player_status.status.beatmap.set_id}/${userStatus.player_status.status.beatmap.id}`, url: `https://ez-pp.farm/beatmapsets/${userStatus.player_status.status.beatmap.set_id}/${userStatus.player_status.status.beatmap.id}`,
@@ -703,13 +713,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 +849,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 +858,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 +1018,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 +1026,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
> >
@@ -1028,6 +1034,47 @@
</AlertDialog.Content> </AlertDialog.Content>
</AlertDialog.Root> </AlertDialog.Root>
<AlertDialog.Root open={updateCheckFailed}>
<AlertDialog.Content
class="bg-theme-950 border-theme-800 p-0 max-w-2xl"
escapeKeydownBehavior="ignore"
interactOutsideBehavior="ignore"
>
<div
class="flex flex-col items-center justify-center border-b border-theme-800 bg-black/40 rounded-t-lg p-3"
>
<Import size={40} />
<span class="font-semibold text-xl">Update check failed</span>
</div>
<div
class="flex flex-col items-center text-sm text-center bg-theme-900 border border-theme-800 rounded-lg mx-3 p-3"
>
<p class="mb-4">Failed to check for updates.</p>
<p>Do you want to launch anyway?</p>
</div>
<div class="flex items-center justify-center mb-3 gap-4 mt-4">
<Button
class="min-w-28"
onclick={async () => {
await launch(true);
updateCheckFailed = false;
}}
>
Launch anyways
</Button>
<Button
variant="outline"
onclick={async () => {
updateCheckFailed = false;
}}
>
Abort
</Button>
</div>
</AlertDialog.Content>
</AlertDialog.Root>
<AlertDialog.Root open={$newVersion === undefined && !!droppedTheme && !themeInstalling}> <AlertDialog.Root open={$newVersion === undefined && !!droppedTheme && !themeInstalling}>
<AlertDialog.Content <AlertDialog.Content
class="bg-theme-950 border-theme-800 p-0 max-w-2xl" class="bg-theme-950 border-theme-800 p-0 max-w-2xl"
@@ -1071,6 +1118,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 +1199,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 +1248,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 +1259,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 +1276,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={{
@@ -1346,7 +1401,7 @@
? 'No connection...' ? 'No connection...'
: undefined} : undefined}
disabled={$osuInstallationPath === '' || $serverConnectionFails > 1} disabled={$osuInstallationPath === '' || $serverConnectionFails > 1}
onClick={launch} onClick={async () => await launch()}
/> />
</div> </div>
<div class="relative h-50"> <div class="relative h-50">
@@ -1377,7 +1432,7 @@
{getGamemodeName(modeIntToStr(selectedMode), typeIntToStr(selectedType))} {getGamemodeName(modeIntToStr(selectedMode), typeIntToStr(selectedType))}
</div> </div>
</Select.Trigger> </Select.Trigger>
<Select.Content class="bg-theme-950 border border-theme-900 rounded-lg"> <Select.Content class="bg-theme-950 border border-theme-900 rounded-lg max-h-72">
{#each validModeTypeCombinationsSorted as gamemode (gamemode)} {#each validModeTypeCombinationsSorted as gamemode (gamemode)}
{@const gamemod = getModeAndTypeFromGamemode(gamemode)} {@const gamemod = getModeAndTypeFromGamemode(gamemode)}
<Select.Item value={gamemode.toFixed()}> <Select.Item value={gamemode.toFixed()}>
@@ -1517,7 +1572,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 +1593,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 +1608,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 +1638,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 +1654,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 +1670,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 +1705,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 +1766,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 +1787,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 +1812,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 +1863,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,6 +1874,23 @@
}} }}
out:fly={{ duration: $reduceAnimations ? 0 : 400, y: -5, opacity: 0 }} out:fly={{ duration: $reduceAnimations ? 0 : 400, y: -5, opacity: 0 }}
> >
{#if $platform === 'linux'}
<div
class="flex flex-col items-center gap-4 mt-12 px-6 text-center h-full justify-center"
>
<!-- currently there is a bug when applying themes on Linux, the Launcher freezes, also when trying to load assets via the assetProtocol it fails because it says the asset was loaded insecurely -->
<span class="text-2xl font-bold drop-shadow-lg"
>Custom themes are not supported on Linux yet(we are working on it!)</span
>
<span class="text-muted-foreground font-semibold drop-shadow-lg"
>Due to technical limitations on Linux, custom themes are currently not supported.
</span>
<span class="text-muted-foreground font-semibold drop-shadow-lg"
>We are working on a solution to bring custom themes to Linux in a future update, but
we don't have an ETA yet. Stay tuned!</span
>
</div>
{:else}
<ScrollContainer class="pt-8" topOffset={45}> <ScrollContainer class="pt-8" topOffset={45}>
<div class="grid w-full gap-1 grid-cols-3 p-3 pr-5"> <div class="grid w-full gap-1 grid-cols-3 p-3 pr-5">
{#each $custom_themes as theme (theme.folder_name)} {#each $custom_themes as theme (theme.folder_name)}
@@ -1860,8 +1925,7 @@
if (theme.status === 'installed') { if (theme.status === 'installed') {
if ($custom_theme_container) { if ($custom_theme_container) {
loadTheme(theme, $custom_theme_container, $custom_theme_volume); loadTheme(theme, $custom_theme_container, $custom_theme_volume);
$userSettings.value('theme').set(theme.name); await config.value<string>('theme').set(theme.name);
$userSettings.save();
} else { } else {
sileo.error({ sileo.error({
title: 'Uhhm..', title: 'Uhhm..',
@@ -1871,7 +1935,10 @@
} else { } else {
const downloadThemeResult = await downloadTheme(theme); const downloadThemeResult = await downloadTheme(theme);
if (!downloadThemeResult.success) { if (!downloadThemeResult.success) {
if (downloadThemeResult.error && downloadThemeResult.error.length > 0) { if (
downloadThemeResult.error &&
downloadThemeResult.error.length > 0
) {
sileo.error({ sileo.error({
title: 'Uhhm..', title: 'Uhhm..',
description: downloadThemeResult.error, description: downloadThemeResult.error,
@@ -1912,9 +1979,12 @@
onclick={async () => { onclick={async () => {
const defaultTheme = $custom_themes.find((t) => t.name === 'Default'); const defaultTheme = $custom_themes.find((t) => t.name === 'Default');
if (defaultTheme) { if (defaultTheme) {
loadTheme(defaultTheme, $custom_theme_container!, $custom_theme_volume); loadTheme(
$userSettings.value('theme').set(defaultTheme.name); defaultTheme,
$userSettings.save(); $custom_theme_container!,
$custom_theme_volume
);
await config.value<string>('theme').set(defaultTheme.name);
if (!(await downloadTheme(theme, true))) { if (!(await downloadTheme(theme, true))) {
sileo.error({ sileo.error({
@@ -1970,6 +2040,7 @@
{/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);
}} }}