Compare commits

...

179 Commits

Author SHA1 Message Date
HorizonCode 44ad025d3d fix: font importing 2026-05-21 23:12:41 +02:00
HorizonCode ec80b13de3 chore: remove unneeded tailwind config file 2026-05-21 23:12:03 +02:00
HorizonCode 6a279de728 chore: update deps, switch from lucide-svelte to @lucide/svelte 2026-05-21 23:02:45 +02:00
HorizonCode 4e33ec3451 fix: resolve vite dynamic import warning 2026-05-21 23:02:14 +02:00
HorizonCode 6fdb2376a1 chore: switch to async rpc framework, fix buttons 2026-05-21 21:24:17 +02:00
HorizonCode afdd74175a fix: cursor smooth movement on higher refreshrate monitors 2026-05-21 20:30:00 +02:00
HorizonCode 6f8043d2d0 fix: cursor rotating on higher refreshrate monitors 2026-05-21 20:23:04 +02:00
HorizonCode f7fff7748a chore: format 2026-05-21 15:31:13 +02:00
HorizonCode d5286263b9 chore: add nsis hook on uninstall to delete user .ezpplauncher dir 2026-05-21 15:30:54 +02:00
HorizonCode 1cc1a4a0c3 chore: remove theme debug script 2026-05-21 14:54:33 +02:00
HorizonCode d2ae9e939f chore: add dynamic button for beatmap display 2026-05-21 14:48:10 +02:00
HorizonCode bde922ab9f fix: file theme import by association file 2026-05-21 14:26:16 +02:00
HorizonCode a1f96a7de3 fix: build 2026-05-21 14:25:13 +02:00
HorizonCode 3b2c902264 fix: build 2026-05-21 14:25:08 +02:00
HorizonCode 40a32d7a60 chore: add theme import for file association 2026-05-21 13:27:31 +02:00
HorizonCode 52c60acf37 chore: add drag and drop theme import 2026-05-21 13:23:03 +02:00
HorizonCode 2788cd6e8b chore: format 2026-05-21 11:44:56 +02:00
HorizonCode 2d1941db33 chore: add drag-and-drop box to Launch page 2026-05-21 11:43:59 +02:00
HorizonCode 00958d5238 chore: only handle .ezpplauncher-theme files 2026-05-21 10:51:51 +02:00
HorizonCode b8a0b448c7 fix: type def for beatmapSetCount 2026-05-21 10:42:13 +02:00
HorizonCode 09487e945e fix: cleanup type defs 2026-05-21 10:41:22 +02:00
HorizonCode 2532ab0059 fix: add ezpplauncher-theme file association to tauri.config.json 2026-05-21 10:27:44 +02:00
HorizonCode 16fe91b3a5 chore: rework presence, add dynamic button functions to presence 2026-05-21 09:21:15 +02:00
HorizonCode eca08f16c5 fix: wait spawning patcher until osu is spawned 2026-05-21 08:18:50 +02:00
HorizonCode e76d67f3a8 fix: add missing imports 2026-05-20 16:32:26 +02:00
HorizonCode 9811b36e58 wip: theme file import from fs 2026-05-20 16:09:05 +02:00
HorizonCode 0f10beb3b4 chore: bump version 2026-05-08 18:06:58 +02:00
HorizonCode 4326199a56 chore: add theme hash checking and alerts 2026-05-08 18:03:26 +02:00
HorizonCode 7f65384b1c chore: add code signing to vscode config 2026-05-08 18:02:32 +02:00
HorizonCode aacd0d1d91 chore: update readme 2026-05-08 18:02:16 +02:00
HorizonCode 079a076f99 chore: update launcher preview 2026-05-08 18:01:55 +02:00
HorizonCode 6d88c39ce2 chore: pause media when launcher is hidden 2026-05-03 17:50:06 +02:00
HorizonCode 56608a64fc chore: use folder name as identification 2026-05-03 15:24:31 +02:00
HorizonCode eaf6f5976d fix: always use underscore 2026-05-03 00:17:50 +02:00
HorizonCode 93f1f380ec fix: regex es6 issue 2026-05-03 00:16:26 +02:00
HorizonCode c47ea1f976 fix: toSafeName windows forbidden symbols 2026-05-03 00:09:01 +02:00
HorizonCode 09af78f1aa fix: use actual setted volume for fade 2026-05-02 22:21:28 +02:00
HorizonCode 3900b5c6cf chore: add volume slider
Co-authored-by: Copilot <copilot@github.com>
2026-05-02 22:15:39 +02:00
HorizonCode adf607e24c chore: clean up comments 2026-05-02 19:56:37 +02:00
HorizonCode 1128b51778 fix: multiple downloads 2026-05-02 19:55:49 +02:00
HorizonCode d435f0c09a chore: add theme uninstall and update 2026-05-02 02:19:00 +02:00
HorizonCode b188e2dee8 chore: remove bundled themes 2026-05-02 00:39:47 +02:00
HorizonCode 8fd56ae749 chore: add custom themes
Co-authored-by: Copilot <copilot@github.com>
2026-05-02 00:38:56 +02:00
HorizonCode b2e7d22d28 chore: add lost umbrella video 2026-04-29 23:33:51 +02:00
HorizonCode d871e06172 chore: add execution clap video 2026-04-29 23:33:15 +02:00
HorizonCode 6a1c5441c3 chore: remove konami code, add themes 2026-04-29 23:32:47 +02:00
HorizonCode ef36f49a6f fix: improve presence reconnection logic and error handling
Co-authored-by: Copilot <copilot@github.com>
2026-04-26 14:04:06 +02:00
HorizonCode 7e40536ec8 chore: add installerIcon to NSIS configuration 2026-04-26 11:29:31 +02:00
HorizonCode 694d403aeb chore: bump version 2026-04-26 11:19:53 +02:00
HorizonCode 9515892b2f fix: remove console log 2026-04-26 11:19:42 +02:00
HorizonCode 0a58f0f63b chore: update profile settings 2026-04-26 11:19:27 +02:00
HorizonCode 60e3ef4131 chore: add umami typing 2026-04-21 09:25:59 +02:00
HorizonCode 7375cccc05 chore: bump version 2026-04-20 12:16:26 +02:00
HorizonCode 251bf8177c chore: add all avalilable fields to beatmap struct 2026-04-20 08:22:40 +02:00
HorizonCode bf4ce18671 chore: replace osynic_osudb with own osudb parser 2026-04-19 18:43:22 +02:00
HorizonCode 4dc83c882d todo: check if this is still needed for linux 2026-04-18 02:34:16 +02:00
HorizonCode e20f11be64 chore: bump version 2026-04-18 02:34:00 +02:00
HorizonCode 407996269e fix: do not save config in setupwizard on value change 2026-04-18 02:33:43 +02:00
HorizonCode 95c6db6a1d fix: remove unused import, set firstStartup on top 2026-04-18 02:33:24 +02:00
HorizonCode a87a4bcc54 chore: bump version and update deps 2026-04-18 02:32:54 +02:00
HorizonCode 97f072f4ce refactor: improve error handling and code readability in replace_ui_files and check_for_corruption functions 2026-04-14 22:52:16 +02:00
HorizonCode 1aa3070ea1 refactor: remove PermissionDenied variant from ReplaceUIError enum 2026-04-14 22:37:33 +02:00
HorizonCode d3c3e4e771 refactor: replace symlink approach with a marker file approach 2026-04-14 22:36:26 +02:00
HorizonCode 921dbd716c chore: update dependencies and version bump to 3.1.3 2026-04-12 22:46:15 +02:00
HorizonCode 34e82f89e8 chore: remove todo note 2026-04-11 21:50:30 +02:00
HorizonCode 901fbefd1b chore: remove unused imports 2026-04-10 12:00:16 +02:00
HorizonCode a795978827 Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher 2026-04-10 11:59:20 +02:00
HorizonCode a9152cc376 chore: remove unused imports 2026-04-10 11:59:18 +02:00
HorizonCode 8d790c7da3 chore: improve UI file replacement logic and fix corruption check 2026-04-10 11:58:11 +02:00
HorizonCode f5a2c4365b fix: check connection issues on load 2026-03-20 13:33:07 +01:00
HorizonCode a925548ae9 refactor: conditionally render patcher release stream for Windows platform 2026-03-05 21:24:37 +01:00
HorizonCode a6495ea353 fix: add schema.tauri.app as trusted schema url 2026-03-03 23:22:10 +01:00
HorizonCode 24802b5132 fix: read beatmapset count from osu!.db instead of iterating songs folder 2026-03-01 23:50:36 +01:00
HorizonCode f09405ed58 refactor: enhance audio fade-in logic for improved user experience 2026-03-01 23:50:06 +01:00
HorizonCode eeda85f48f style: enhance button animations in titlebar for improved visual feedback 2026-03-01 23:49:42 +01:00
HorizonCode 9770e81d6f refactor: improve presence handling and update disconnect logic for clarity 2026-02-28 16:56:46 +01:00
HorizonCode 31b7d17b09 feat: implement sorting functionality for skins using default windows sorting algotythm 2026-02-23 18:23:46 +01:00
HorizonCode 1fc0391113 style: format code for consistency and readability in sileo-toast component 2026-02-22 20:18:37 +01:00
HorizonCode 62f03cf7c0 fix: update ESLint configuration to disable no-empty rule and adjust unused vars handling 2026-02-22 20:18:21 +01:00
HorizonCode 94f6e850cf feat: update icons and launcher files 2026-02-22 20:14:38 +01:00
HorizonCode d6fdb2a152 chore: update Tauri dependencies to latest versions 2026-02-22 20:14:11 +01:00
HorizonCode 9cd990cf96 chore: update dependencies in Cargo.toml 2026-02-22 20:10:15 +01:00
HorizonCode 2e0ef81bcb feat: implement skin management 2026-02-22 17:05:52 +01:00
HorizonCode 96680ff8b5 fix: update button styles to use ring for better accessibility 2026-02-22 14:12:32 +01:00
HorizonCode 0b9d6373bf fix: add fade to bg and audio 2026-02-22 14:03:44 +01:00
HorizonCode 295c1424c9 chore: add audio 2026-02-22 12:35:08 +01:00
HorizonCode 0e12a801d2 chore: add secret :^) 2026-02-22 00:21:42 +01:00
HorizonCode cf86dba5c4 chore: rework titlebar buttons 2026-02-21 23:31:43 +01:00
HorizonCode 540c653399 fix: reconnect presence after pipe was closed 2026-02-21 23:18:01 +01:00
HorizonCode c9b8d9f599 fix: respect reducedAnimations 2026-02-21 22:59:19 +01:00
HorizonCode 49665d94bc fix: Setup WIzard styling 2026-02-19 19:38:21 +01:00
HorizonCode 1a19c19399 chore: bump version 2026-02-19 15:48:26 +01:00
HorizonCode cbfe5ec868 fix: Setup Wizard not working 2026-02-19 15:41:29 +01:00
HorizonCode c5b18dacbb chore: update lucide-svelte 2026-02-19 15:41:10 +01:00
HorizonCode ef01984875 fix: osu installation detection 2026-02-19 15:40:56 +01:00
HorizonCode 46ee36ce81 fix: disable all buttons and dropdowns on launch 2026-02-17 20:34:57 +01:00
HorizonCode c4658ae4cc fix: sort streaks by depth 2026-02-17 20:13:43 +01:00
HorizonCode ca15ff566f chore: bump version 2026-02-17 19:20:19 +01:00
HorizonCode a6fdda4487 fix: also use color-primary for pp stat 2026-02-17 19:19:09 +01:00
HorizonCode a30946eb60 chore: update animatedbg gradient background colors 2026-02-17 19:18:10 +01:00
HorizonCode 9106ad89b3 chore: replace all bg-pink and border-pink with bg-primary and border-primary 2026-02-17 19:15:38 +01:00
HorizonCode 194709df0c style: adjust primary color 2026-02-17 19:13:23 +01:00
HorizonCode 20f625be60 chore: improve line spreading alogrythm 2026-02-17 19:04:04 +01:00
HorizonCode 66a5fd84ae chore: set AnimatedBg globally 2026-02-17 19:02:37 +01:00
HorizonCode 44d7401947 chore: set AnimatedBg globally 2026-02-17 19:02:28 +01:00
HorizonCode f973e48561 chore: add border to view buttons 2026-02-17 18:58:16 +01:00
HorizonCode de186b7ff9 fix: change beatmapSets count icon 2026-02-17 18:55:45 +01:00
HorizonCode 244d526933 chore: make page switch transitions smoother 2026-02-17 18:52:41 +01:00
HorizonCode c7a990e3fe fix: show login result after redirect to home view 2026-02-17 18:46:12 +01:00
HorizonCode ed1f741a9e chore: remove all console.log 2026-02-17 17:43:05 +01:00
HorizonCode b6616a37f4 fix: isNet8Installed condition 2026-02-17 17:41:04 +01:00
HorizonCode 63433ac626 chore: update sileo 2026-02-17 17:40:46 +01:00
HorizonCode 149b4715d7 fix: updateUrl 2026-02-17 17:40:35 +01:00
HorizonCode ae3443d0b9 fix: osu running check 2026-02-16 21:53:53 +01:00
HorizonCode abc7b9d9d9 chore: replace sonner with sileo 2026-02-16 21:53:07 +01:00
HorizonCode d9dd21d3be chore: cleanup commands, fix osu folder check 2026-02-16 20:46:58 +01:00
HorizonCode 0df31178f4 fix: make count functions async to prevent frontend lock 2026-02-16 20:20:29 +01:00
HorizonCode 6825f9e99b fix: login box width, update releasestream and version 2026-02-15 19:08:04 +01:00
HorizonCode 08a8e34781 chore: add launch button states 2026-02-15 19:02:07 +01:00
HorizonCode 1aa973f6bb chore: bump version 2026-02-15 18:57:38 +01:00
HorizonCode 0999832985 fix: titlebar margin 2026-02-15 18:57:30 +01:00
HorizonCode 11798318f4 chore: only display user stats when logged in 2026-02-15 18:57:17 +01:00
HorizonCode f1b909e248 chore: make pp value better visible 2026-02-15 18:43:51 +01:00
HorizonCode 1f845f1282 chore: rework launcher design 2026-02-15 18:42:01 +01:00
HorizonCode f9b38ec9eb fix: improve error handling for network connection launch failures 2026-01-04 20:20:19 +01:00
HorizonCode 623559cf8e chore: update syn and other dependencies to latest versions 2026-01-04 20:08:26 +01:00
HorizonCode 80bd096834 chore: bump version 2026-01-04 19:36:57 +01:00
HorizonCode e1c6e35f95 chore: refactor version syncing logic in sync-version.ts 2026-01-04 19:36:39 +01:00
HorizonCode 57158bab15 chore: force dark theme to toast component 2026-01-04 19:27:01 +01:00
HorizonCode 58837053c7 chore: update button text color to improve visibility 2026-01-04 19:26:42 +01:00
HorizonCode 458a2cca36 chore: update @lucide/svelte dependency 2026-01-04 17:16:39 +01:00
HorizonCode cb66df6082 chore: update text color for user name display 2026-01-04 17:16:23 +01:00
HorizonCode 1d1904e995 chore: update interactive role checks in OsuCursor component 2026-01-04 17:16:09 +01:00
HorizonCode c07e390b65 chore: redesign user display, remove tabs switch from main view 2026-01-04 17:03:22 +01:00
HorizonCode bae0fad19b chore: update rust and bun dependencies to latest versions 2026-01-02 22:02:40 +01:00
HorizonCode 993eb167fc chore: bump version for tauri too .-. 2025-12-22 22:31:18 +01:00
HorizonCode ea2e348ccc chore: bump version for tauri backend too 2025-12-22 22:28:41 +01:00
HorizonCode 2855880c18 chore: bump version 2025-12-22 22:27:46 +01:00
HorizonCode dcb57c5452 chore: add seasonal assets 2025-12-22 22:25:18 +01:00
HorizonCode c9def2c46b chore: bump version to 3.0.8 2025-12-07 16:22:29 +01:00
HorizonCode b8ebcf5509 feat: conditionally track app launch, exit, and failure events based on trackingEnabled state 2025-12-07 16:21:21 +01:00
HorizonCode a338df6a36 chore: bump version to 3.0.7 in package.json, Cargo.toml, Cargo.lock, and tauri.conf.json; update +page.svelte to include trackingEnabled 2025-12-07 00:50:21 +01:00
HorizonCode d67d58824b feat: implement app tracking consent dialog and update tracking state management 2025-12-07 00:46:33 +01:00
HorizonCode ad090ce38c feat: add umami tracking for app launch and exit events; update dependencies in package.json and bun.lock 2025-12-07 00:11:49 +01:00
HorizonCode 3d57524a16 fix: update build script to include vite build step 2025-12-06 13:04:07 +01:00
HorizonCode d6bf3ccb3c chore: bump version to 3.0.6 in package.json, Cargo.toml, Cargo.lock, and tauri.conf.json; remove unused styles in Launch.svelte 2025-12-06 13:01:59 +01:00
HorizonCode a548dc875e chore: update .net8 desktop url 2025-12-06 12:46:31 +01:00
HorizonCode 3029cc66fb chore: update launch button to be more present 2025-12-06 12:40:37 +01:00
HorizonCode adf40b70cb upgrade deps, fix dotnet8 detection, preperations for skins tab 2025-09-08 20:14:20 +02:00
HorizonCode ff00b27330 wip: add skins tab 2025-08-05 22:18:30 +02:00
HorizonCode 95a5591c70 wip: add skins tab 2025-08-05 22:16:48 +02:00
HorizonCode cdc3c78ffe fix: skin count loader 2025-08-05 22:14:54 +02:00
HorizonCode 509aa36379 chore: change easing method of tab crossfade 2025-08-05 22:12:22 +02:00
HorizonCode 20e5961b7c chore: remove old tab selector 2025-08-05 22:07:23 +02:00
HorizonCode 9b816e1e5c chore: add crossfade to tab selector 2025-08-05 22:06:40 +02:00
HorizonCode ada83b32dc chore: update deps 2025-08-05 21:51:24 +02:00
HorizonCode cbf85753a8 fix: tailwind dark mode variant selector 2025-08-05 21:51:13 +02:00
HorizonCode eb1ef06c07 chore: add check and install for dotnet8 on preinstall 2025-08-05 07:24:46 +02:00
HorizonCode a64655ec5d Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher 2025-07-31 15:36:06 +02:00
HorizonCode 45b902cfb6 chore: update dependencies 2025-07-31 15:36:04 +02:00
HorizonCode f53aba9a7b fix: add CREATE_NO_WINDOW flag to command creation 2025-07-31 15:35:47 +02:00
HorizonCode f7c2dc689a fix: update silent argument for nsis 2025-07-30 21:35:44 +02:00
HorizonCode b778a5a369 chore: bump version 2025-07-30 20:27:02 +02:00
HorizonCode 084e006f06 chore: add inline updater 2025-07-30 20:26:05 +02:00
HorizonCode 9b3cb0bd26 fix: remove duplicate key 2025-07-30 19:13:07 +02:00
HorizonCode c5649c3f8a Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher 2025-07-30 19:07:14 +02:00
HorizonCode fac54f3e59 fix: switch to nsis installer 2025-07-30 19:04:21 +02:00
HorizonCode b6f7f84955 fix: overflow issue on error dialog 2025-07-24 08:55:08 +02:00
HorizonCode aa52ff3b8c chore: bump version 2025-07-24 08:42:41 +02:00
HorizonCode d72d2731d9 chore: remove unneeded component and tauri app register 2025-07-24 08:42:14 +02:00
HorizonCode f3ac7cc684 chore: update tauri and tauri-apps 2025-07-24 08:41:47 +02:00
HorizonCode b1b3de295c chore: remove unneeded modules 2025-07-24 08:41:30 +02:00
HorizonCode e76affaea1 fix: force stable release stream 2025-07-24 08:31:37 +02:00
HorizonCode 700274d7d8 fix: invalid responses from osu api 2025-07-24 08:31:26 +02:00
HorizonCode 53b6c2e174 Merge branch 'master' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher 2025-07-23 12:06:39 +02:00
HorizonCode 93ecea9083 fix: button typo 2025-07-23 12:06:33 +02:00
HorizonCode 2549b18e8c fix: skins count display when no skins are in the skins directory 2025-07-21 22:54:21 +02:00
HorizonCode fd4d911075 chore: add vendor info, bump version 2025-07-17 09:03:01 +02:00
HorizonCode 5edd53eead chore: update frontend modules 2025-07-17 09:02:20 +02:00
109 changed files with 6432 additions and 3700 deletions
+9
View File
@@ -1,7 +1,16 @@
{
"svelte.enable-ts-plugin": true,
"git.enableCommitSigning": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
},
"json.schemaDownload.trustedDomains": {
"https://schemastore.azurewebsites.net/": true,
"https://raw.githubusercontent.com/": true,
"https://www.schemastore.org/": true,
"https://json.schemastore.org/": true,
"https://json-schema.org/": true,
"https://schema.tauri.app/": true
}
}
+8
View File
@@ -22,6 +22,7 @@ It enhances the osu! experience with quality-of-life features and integration sp
- [x] Displays ping to the EZPPFarm server
- [x] Discord Rich Presence
- [x] Performance Display Overlay (currently in experimental patcher release stream)
- [x] Launcher Theming
---
@@ -43,6 +44,7 @@ It enhances the osu! experience with quality-of-life features and integration sp
- **Rust** (installed via [rustup](https://rustup.rs/) – recommended for Windows)
- **Cargo** (comes with rustup)
- **[CMake](https://cmake.org/download/)**
- **[Bun](https://bun.sh/)** (JavaScript runtime)
### Steps
@@ -72,3 +74,9 @@ src-tauri/target/release/ezpplauncher.exe
├── package.json # Bun project config
└── README.md
```
---
## 🎨 Launcher Themes
By default, the launcher includes several downloadable themes. If you want to create your own custom theme, please use the [create-ezpplauncher-theme](https://git.ez-pp.farm/EZPPFarm/create-ezpplauncher-theme) repository for a template and instructions.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 157 KiB

+323 -281
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -36,5 +36,14 @@ export default ts.config(
svelteConfig,
},
},
},
{
rules: {
'no-empty': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^\\$\\$(Props|Events|Slots|Generic)$' },
],
},
}
);
+51 -48
View File
@@ -1,13 +1,13 @@
{
"name": "ezpplauncher",
"version": "3.0.0",
"version": "3.2.0",
"description": "",
"type": "module",
"scripts": {
"debug": "bun run tauri dev",
"build": "bun ./scripts/sync-version.ts && bun run tauri:build",
"build": "bun ./scripts/build.ts",
"vite:dev": "vite dev",
"vite:build": "vite build",
"vite:build": "vite build && exit 0",
"tauri:build": "tauri build",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
@@ -18,61 +18,64 @@
},
"license": "GPL-3.0-only",
"dependencies": {
"@better-fetch/fetch": "^1.1.18",
"@fontsource/sora": "^5.2.6",
"@fontsource/space-mono": "^5.2.8",
"@iarna/toml": "2.2.5",
"@number-flow/svelte": "^0.3.9",
"@tailwindcss/typography": "0.5.16",
"@tailwindcss/vite": "^4.1.11",
"@tauri-apps/api": "2.6.0",
"@tauri-apps/plugin-dialog": "2.3.0",
"@tauri-apps/plugin-fs": "2.4.0",
"@tauri-apps/plugin-shell": "2.3.0",
"@tauri-apps/plugin-sql": "2.3.0",
"animejs": "^4.0.2",
"@better-fetch/fetch": "^1.1.21",
"@fontsource-variable/sora": "^5.2.8",
"@fontsource/space-mono": "^5.2.9",
"@number-flow/svelte": "^0.4.0",
"@tailwindcss/typography": "^0.5.19",
"@tailwindcss/vite": "^4.3.0",
"@tauri-apps/api": "^2.11.0",
"@tauri-apps/plugin-dialog": "^2.7.1",
"@tauri-apps/plugin-fs": "^2.5.1",
"@tauri-apps/plugin-shell": "^2.3.5",
"@types/node": "^25.9.1",
"animejs": "^4.4.1",
"buffer": "^6.0.3",
"crypto-js": "^4.2.0",
"lucide-svelte": "0.525.0",
"osu-classes": "3.1.0",
"osu-parsers": "4.1.7",
"jszip": "^3.10.1",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"react-to-webcomponent": "^2.0.1",
"semver": "^7.7.2",
"tw-animate-css": "^1.3.0",
"svelte-confetti": "^2.0.0"
"sileo": "^0.1.3",
"svelte-confetti": "^2.3.2",
"tw-animate-css": "^1.3.8"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/js": "^9.18.0",
"@lucide/svelte": "^0.525.0",
"@sveltejs/adapter-static": "3.0.8",
"@sveltejs/kit": "2.22.2",
"@sveltejs/vite-plugin-svelte": "5.1.0",
"@tauri-apps/cli": "2.6.1",
"@types/bun": "^1.2.18",
"@eslint/compat": "^2.0.0",
"@eslint/js": "^9.35.0",
"@iarna/toml": "2.2.5",
"@lucide/svelte": "^1.16.0",
"@sveltejs/adapter-static": "^3.0.9",
"@sveltejs/kit": "^2.57.1",
"@sveltejs/vite-plugin-svelte": "^7.0.0",
"@tauri-apps/cli": "^2.10.0",
"@types/bun": "^1.2.21",
"@types/crypto-js": "^4.2.2",
"@types/semver": "^7.7.0",
"@types/react-dom": "^19.2.3",
"@types/semver": "^7.7.1",
"autoprefixer": "10.4.21",
"bits-ui": "^2.8.10",
"clsx": "2.1.1",
"eslint": "^9.18.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-svelte": "^3.0.0",
"globals": "^16.0.0",
"mode-watcher": "^1.0.6",
"prettier": "^3.4.2",
"prettier-plugin-svelte": "^3.3.3",
"sass-embedded": "1.89.2",
"svelte": "5.34.8",
"svelte-check": "4.2.2",
"bits-ui": "^1.4.7",
"clsx": "^2.1.1",
"eslint": "^9.35.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-svelte": "^3.12.2",
"globals": "^17.0.0",
"mode-watcher": "^1.1.0",
"prettier": "^3.6.2",
"prettier-plugin-svelte": "^3.4.0",
"sass-embedded": "^1.92.1",
"svelte": "^5.55.3",
"svelte-check": "^4.3.1",
"svelte-sonner": "^1.0.5",
"tailwind-merge": "^3.3.1",
"tailwind-variants": "^1.0.0",
"tailwind-variants": "^3.1.0",
"tailwindcss": "^4.1.7",
"tailwindcss-animate": "^1.0.7",
"tslib": "2.8.1",
"typescript": "5.8.3",
"typescript-eslint": "^8.20.0",
"vite": "7.0.0",
"vite-plugin-devtools-json": "^0.2.0"
"tslib": "^2.8.1",
"typescript": "^6.0.2",
"typescript-eslint": "^8.42.0",
"vite": "^8.0.8",
"vite-plugin-devtools-json": "^1.0.0"
}
}
+37
View File
@@ -0,0 +1,37 @@
import { spawn } from 'child_process';
function runVite(): Promise<void> {
return new Promise((resolve, reject) => {
const proc = spawn('bunx', ['--bun', 'vite', 'build'], { stdio: ['inherit', 'pipe', 'pipe'] });
proc.stdout?.on('data', (data: Buffer) => {
process.stdout.write(data);
if (data.toString().includes('✔ done')) {
setTimeout(() => {
proc.kill();
resolve();
}, 500);
}
});
proc.stderr?.on('data', (data: Buffer) => process.stderr.write(data));
proc.on('close', (code) => {
if (code === 0 || code === null) resolve();
else reject(new Error(`vite build exited with code ${code}`));
});
});
}
function run(cmd: string, args: string[]): Promise<void> {
return new Promise((resolve, reject) => {
const proc = spawn(cmd, args, { stdio: 'inherit' });
proc.on('close', (code) => {
if (code === 0) resolve();
else reject(new Error(`${cmd} exited with code ${code}`));
});
});
}
await run('bun', ['./scripts/sync-version.ts']);
await runVite();
await run('bunx', ['tauri', 'build']);
+12 -5
View File
@@ -3,19 +3,26 @@ import path from 'path';
import * as toml from '@iarna/toml';
import { cwd } from 'process';
const packageJsonPath = path.join(cwd(), 'package.json');
const cargoTomlPath = path.join(cwd(), 'src-tauri', 'Cargo.toml');
const tauriConfPath = path.join(cwd(), 'src-tauri', 'tauri.conf.json');
const cargoToml = fs.readFileSync(cargoTomlPath, 'utf8');
const cargo = toml.parse(cargoToml) as Record<string, string>;
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const version = packageJson.version;
if (!version) throw new Error('Could not find version in package.json');
const version = cargo.package['version'];
if (!version) throw new Error('Could not find version in Cargo.toml');
let cargoTomlContent = fs.readFileSync(cargoTomlPath, 'utf8');
const cargo = toml.parse(cargoTomlContent) as { package: { version: string } };
if (cargo.package.version !== version) {
cargoTomlContent = cargoTomlContent.replace(/version = ".*?"/, `version = "${version}"`);
fs.writeFileSync(cargoTomlPath, cargoTomlContent);
console.log(`✅ Synced Cargo.toml version to ${version}`);
}
const tauriConf = JSON.parse(fs.readFileSync(tauriConfPath, 'utf8'));
if (tauriConf.version !== version) {
tauriConf.version = version;
fs.writeFileSync(tauriConfPath, JSON.stringify(tauriConf, null, 2));
console.log(`✅ Synced tauri.conf.json version to ${version}`);
}
+11
View File
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"skipLibCheck": true,
"types": ["@types/bun", "@types/node"]
},
"include": ["*.ts"]
}
+1433 -1680
View File
File diff suppressed because it is too large Load Diff
+34 -21
View File
@@ -1,12 +1,22 @@
[package]
name = "ezpplauncher"
version = "3.0.1"
version = "3.2.0"
description = "EZPPLauncher redefined."
authors = ["HorizonCode"]
edition = "2024"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[profile.dev]
incremental = true # Compile your binary in smaller steps.
[profile.release]
codegen-units = 1 # Allows LLVM to perform better optimization.
lto = true # Enables link-time-optimizations.
opt-level = "s" # Prioritizes small binary size. Use `3` if you prefer speed.
panic = "abort" # Higher performance by disabling panic handlers.
strip = true # Ensures debug symbols are removed.
[lib]
# The `_lib` suffix may seem redundant but it is necessary
# to make the lib name unique and wouldn't conflict with the bin name.
@@ -15,34 +25,37 @@ name = "ezpplauncher_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2.3.0", features = [] }
tauri-build = { version = "2.6.2", features = [] }
[dependencies]
tauri = { version = "2.6.2", features = [] }
tauri-plugin-shell = "2.3.0"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
tauri = { version = "2.11.2", features = ["protocol-asset"] }
tauri-plugin-shell = "2.3.5"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.150"
serde_repr = "0.1.20"
tauri-plugin-sql = "2.3.0"
tauri-plugin-dialog = "2.3.0"
tauri-plugin-fs = "2.4.0"
tauri-plugin-dialog = "2.7.1"
tauri-plugin-fs = "2.5.1"
hardware-id = "0.3.0"
tauri-plugin-cors-fetch = "4.1.0"
sysinfo = "0.35.2"
reqwest = { version = "0.12.22", features = ["json", "stream"] }
tauri-plugin-cors-fetch = "5.0.0"
sysinfo = "0.39.2"
reqwest = { version = "0.13.3", features = ["json", "stream", "query"] }
md5 = "0.8.0"
tokio = { version = "1.46.1", features = ["full"] }
open = "5.3.2"
windows-sys = "0.60.2"
discord-rich-presence = "0.2.5"
once_cell = "1.21.3"
tokio = { version = "1.52.2", features = ["full"] }
open = "5.3.5"
presenceforge = { version = "0.2.1", features = ["tokio-runtime"] }
once_cell = "1.21.4"
futures-util = "0.3.32"
byteorder = "1.5.0"
anyhow = "1.0.102"
url = "2.5.8"
[target.'cfg(windows)'.dependencies]
winreg = "0.55.0"
winreg = "0.56.0"
winapi = { version = "0.3", features = ["winuser", "wincrypt", "memoryapi", "winbase", "dpapi"] }
base64 = "0.21"
widestring = "1.0"
base64 = "0.22.1"
widestring = "1.2.1"
windows-sys = "0.61.2"
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-single-instance = "2.3.0"
tauri-plugin-single-instance = "2.4.2"
+94 -22
View File
@@ -2,7 +2,9 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"windows": [
"main"
],
"permissions": [
"core:default",
"shell:allow-open",
@@ -19,57 +21,127 @@
{
"identifier": "fs:allow-read",
"allow": [
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
{
"path": "$HOME/.ezpplauncher"
},
{
"path": "$HOME/.ezpplauncher/*"
},
{
"path": "$HOME/.ezpplauncher/**/*"
}
]
},
{
"identifier": "fs:allow-write",
"allow": [
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
{
"path": "$HOME/.ezpplauncher"
},
{
"path": "$HOME/.ezpplauncher/*"
},
{
"path": "$HOME/.ezpplauncher/**/*"
}
]
},
{
"identifier": "fs:allow-exists",
"allow": [
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
{
"path": "$HOME/.ezpplauncher"
},
{
"path": "$HOME/.ezpplauncher/*"
},
{
"path": "$HOME/.ezpplauncher/**/*"
}
]
},
{
"identifier": "fs:allow-read-file",
"allow": [
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
{
"path": "$HOME/.ezpplauncher"
},
{
"path": "$HOME/.ezpplauncher/*"
},
{
"path": "$HOME/.ezpplauncher/**/*"
}
]
},
{
"identifier": "fs:allow-write-file",
"allow": [
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
{
"path": "$HOME/.ezpplauncher"
},
{
"path": "$HOME/.ezpplauncher/*"
},
{
"path": "$HOME/.ezpplauncher/**/*"
}
]
},
{
"identifier": "fs:allow-read-text-file",
"allow": [
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
{
"path": "$HOME/.ezpplauncher"
},
{
"path": "$HOME/.ezpplauncher/*"
},
{
"path": "$HOME/.ezpplauncher/**/*"
}
]
},
{
"identifier": "fs:allow-mkdir",
"allow": [
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
{
"path": "$HOME/.ezpplauncher"
},
{
"path": "$HOME/.ezpplauncher/*"
},
{
"path": "$HOME/.ezpplauncher/**/*"
}
]
},
{
"identifier": "fs:allow-read-dir",
"allow": [
{
"path": "$HOME/.ezpplauncher"
},
{
"path": "$HOME/.ezpplauncher/*"
},
{
"path": "$HOME/.ezpplauncher/**/*"
}
]
},
{
"identifier": "fs:allow-remove",
"allow": [
{
"path": "$HOME/.ezpplauncher"
},
{
"path": "$HOME/.ezpplauncher/*"
},
{
"path": "$HOME/.ezpplauncher/**/*"
}
]
}
]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<background android:drawable="@color/ic_launcher_background"/>
</adaptive-icon>
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#fff</color>
</resources>
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

+21
View File
@@ -0,0 +1,21 @@
!macro NSIS_HOOK_POSTINSTALL
${If} $PassiveMode = 1
${OrIf} ${Silent}
Exec '"$INSTDIR\${MAINBINARYNAME}.exe"'
${EndIf}
!macroend
!macro NSIS_HOOK_PREUNINSTALL
${If} $DeleteAppDataCheckboxState = 1
MessageBox MB_YESNO "Do you want to remove all EZPPLauncher data and themes?" IDYES do_delete IDNO skip_delete
do_delete:
StrCpy $R9 1
skip_delete:
${EndIf}
!macroend
!macro NSIS_HOOK_POSTUNINSTALL
${If} $R9 = 1
RMDir /r "$PROFILE\.ezpplauncher"
${EndIf}
!macroend
+395 -150
View File
@@ -6,11 +6,14 @@ use std::path::PathBuf;
use sysinfo::System;
use tauri::AppHandle;
use tauri::Emitter;
use tauri::Manager;
use tokio::fs;
use tokio::io::AsyncWriteExt;
use tokio::process::Command;
use tokio::time::{Duration, sleep};
use crate::OpenedUrls;
use crate::osudb::parse_osudb;
use crate::presence;
use crate::utils::{
check_folder_completeness, encrypt_password, get_osu_config, get_osu_user_config,
@@ -18,6 +21,11 @@ use crate::utils::{
set_osu_config_vals, set_osu_user_config_vals,
};
#[tauri::command]
pub fn opened_urls(app: tauri::AppHandle) -> Vec<PathBuf> {
app.state::<OpenedUrls>().0.lock().unwrap().clone()
}
#[tauri::command]
pub fn get_launcher_version() -> String {
env!("CARGO_PKG_VERSION").to_string()
@@ -55,17 +63,11 @@ pub fn valid_osu_folder(folder: String) -> bool {
"scores.db",
];
let folder_files: Vec<&str> = osu_folder_files.iter().map(|&s| s).collect();
if folder_files.iter().any(|&file| file == "osu!.exe") == false {
let path = PathBuf::from(folder);
if !path.join("osu!.exe").exists() {
return false;
}
let path = PathBuf::from(folder);
let match_percentage = check_folder_completeness(path, &osu_folder_files) >= 70.0;
if match_percentage {
return true;
}
return false;
check_folder_completeness(path, &osu_folder_files) >= 70.0
}
#[cfg(not(windows))]
@@ -82,10 +84,10 @@ pub fn find_osu_installation() -> Option<String> {
let hklm_registry_paths = ["SOFTWARE\\Classes\\osu\\DefaultIcon"];
let hkcr_registry_paths = [
"osustable.File.osk\\DefaultIcon",
"osustable.File.osr\\DefaultIcon",
"osustable.File.osz\\DefaultIcon",
let hkcu_registry_paths = [
"Software\\Classes\\osustable.File.osk\\DefaultIcon",
"Software\\Classes\\osustable.File.osr\\DefaultIcon",
"Software\\Classes\\osustable.File.osz\\DefaultIcon",
];
let osu_folder_files = [
@@ -134,10 +136,10 @@ pub fn find_osu_installation() -> Option<String> {
}
}
let hkcr = RegKey::predef(HKEY_CLASSES_ROOT);
let hkcu = RegKey::predef(HKEY_CURRENT_USER);
for reg_path in &hkcr_registry_paths {
if let Ok(subkey) = hkcr.open_subkey_with_flags(reg_path, KEY_READ | KEY_WOW64_32KEY) {
for reg_path in &hkcu_registry_paths {
if let Ok(subkey) = hkcu.open_subkey_with_flags(reg_path, KEY_READ | KEY_WOW64_32KEY) {
let value_names = [""];
for value_name in &value_names {
if let Ok(value) = subkey.get_value::<String, _>(value_name) {
@@ -159,53 +161,108 @@ pub fn find_osu_installation() -> Option<String> {
}
#[tauri::command]
pub fn get_beatmapsets_count(folder: String) -> Option<u64> {
pub async fn get_beatmapsets_count(folder: String) -> Option<u64> {
let path = PathBuf::from(folder);
let osu_user_config = get_osu_user_config(path.clone());
let songs_path = osu_user_config
.and_then(|config| config.get("Songs").cloned())
.unwrap_or_else(|| path.join("Songs").to_string_lossy().into_owned());
let songs_folder = PathBuf::from(songs_path);
if !songs_folder.exists() {
return None;
let osu_db_path = path.join("osu!.db");
if !osu_db_path.exists() {
return Some(0);
}
let osu_db_bytes = fs::read(osu_db_path).await.ok()?;
let osu_db = parse_osudb(osu_db_bytes).ok()?;
let beatmap_sets = osu_db
.beatmaps
.iter()
.map(|b| b.beatmapset_id)
.collect::<HashSet<_>>()
.len();
Some(beatmap_sets as u64)
}
let mut count = 0;
if let Ok(entries) = std::fs::read_dir(songs_folder) {
for entry in entries.flatten() {
if entry.file_type().map_or(false, |ft| ft.is_dir()) {
let dir_path = entry.path();
if let Ok(files) = std::fs::read_dir(&dir_path) {
for file in files.flatten() {
if file.path().extension().map_or(false, |ext| ext == "osu") {
count += 1;
break;
}
}
}
}
}
}
return Some(count);
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct SkinInfo {
pub name: String,
pub author: Option<String>,
pub modified: u64,
}
#[tauri::command]
pub fn get_skins_count(folder: String) -> Option<u64> {
let path = PathBuf::from(folder);
let skins_folder = path.join("Skins");
pub async fn get_skins(folder: String) -> Option<Vec<SkinInfo>> {
use std::path::PathBuf;
use std::time::UNIX_EPOCH;
use tokio::fs;
let skins_folder = PathBuf::from(folder).join("Skins");
if !skins_folder.exists() {
return None;
}
let mut entries = fs::read_dir(skins_folder).await.ok()?;
let mut skins = Vec::new();
while let Some(entry) = entries.next_entry().await.ok()? {
if !entry.file_type().await.ok()?.is_dir() {
continue;
}
let dir_path = entry.path();
let skin_ini = dir_path.join("skin.ini");
if !skin_ini.exists() {
continue;
}
let name = entry.file_name().to_string_lossy().to_string();
let author = fs::read_to_string(&skin_ini)
.await
.ok()
.and_then(|content| {
content.lines().find_map(|line| {
let (key, value) = line.split_once(':')?;
key.trim()
.eq_ignore_ascii_case("Author")
.then(|| value.trim().to_string())
})
});
let modified = entry
.metadata()
.await
.ok()
.and_then(|m| m.modified().ok())
.and_then(|t| t.duration_since(UNIX_EPOCH).ok())
.map(|d| d.as_secs())
.unwrap_or(0);
skins.push(SkinInfo {
name,
author,
modified,
});
}
Some(skins)
}
#[tauri::command]
pub async fn get_skins_count(folder: String) -> Option<u64> {
let path = PathBuf::from(folder);
let skins_folder = path.join("Skins");
if !skins_folder.exists() {
return Some(0);
}
let mut count = 0;
if let Ok(entries) = std::fs::read_dir(skins_folder) {
for entry in entries.flatten() {
if entry.file_type().map_or(false, |ft| ft.is_dir()) {
if let Ok(mut entries) = fs::read_dir(skins_folder).await {
while let Ok(Some(entry)) = entries.next_entry().await {
if entry.file_type().await.map_or(false, |ft| ft.is_dir()) {
let dir_path = entry.path();
if let Ok(files) = std::fs::read_dir(&dir_path) {
for file in files.flatten() {
if let Ok(mut files) = fs::read_dir(&dir_path).await {
while let Ok(Some(file)) = files.next_entry().await {
if file.path().extension().map_or(false, |ext| ext == "ini") {
count += 1;
break;
@@ -221,28 +278,28 @@ pub fn get_skins_count(folder: String) -> Option<u64> {
#[tauri::command]
pub fn get_osu_skin(folder: String) -> String {
let path = PathBuf::from(folder);
let osu_user_config = get_osu_user_config(path.clone());
return osu_user_config
let osu_user_config = get_osu_user_config(path);
osu_user_config
.and_then(|config| config.get("Skin").cloned())
.unwrap_or_else(|| "Default".to_string());
.unwrap_or_else(|| "Default".to_string())
}
#[tauri::command]
pub fn get_osu_version(folder: String) -> String {
let path = PathBuf::from(folder);
let osu_user_config = get_osu_user_config(path.clone());
return osu_user_config
let osu_user_config = get_osu_user_config(path);
osu_user_config
.and_then(|config| config.get("LastVersion").cloned())
.unwrap_or_else(|| "failed".to_string());
.unwrap_or_else(|| "failed".to_string())
}
#[tauri::command]
pub fn get_osu_release_stream(folder: String) -> String {
let path = PathBuf::from(folder);
let osu_config = get_osu_config(path.clone());
return osu_config
let osu_config = get_osu_config(path);
osu_config
.and_then(|config| config.get("_ReleaseStream").cloned())
.unwrap_or_else(|| "Stable40".to_string());
.unwrap_or_else(|| "Stable40".to_string())
}
#[derive(serde::Deserialize)]
@@ -260,10 +317,7 @@ pub fn set_osu_user_config_values(
.iter()
.map(|entry| (entry.key.as_str(), Some(entry.value.as_str())))
.collect();
match set_osu_user_config_vals(&osu_folder_path, &converted) {
Ok(_) => Ok(true),
Err(_) => Ok(false),
}
Ok(set_osu_user_config_vals(&osu_folder_path, &converted).is_ok())
}
#[tauri::command]
@@ -275,22 +329,16 @@ pub fn set_osu_config_values(
.iter()
.map(|entry| (entry.key.as_str(), Some(entry.value.as_str())))
.collect();
match set_osu_config_vals(&osu_folder_path, &converted) {
Ok(_) => Ok(true),
Err(_) => Ok(false),
}
Ok(set_osu_config_vals(&osu_folder_path, &converted).is_ok())
}
#[tauri::command]
pub async fn run_osu_updater(folder: String) -> Result<(), String> {
#[cfg(windows)]
const DETACHED_PROCESS: u32 = 0x00000008;
#[cfg(windows)]
const CREATE_NEW_PROCESS_GROUP: u32 = 0x00000200;
let mut updater_process = {
#[cfg(windows)]
{
const DETACHED_PROCESS: u32 = 0x00000008;
const CREATE_NEW_PROCESS_GROUP: u32 = 0x00000200;
let osu_exe_path = PathBuf::from(&folder).join("osu!.exe");
Command::new(&osu_exe_path)
.arg("-repair")
@@ -367,9 +415,6 @@ pub async fn run_osu_updater(folder: String) -> Result<(), String> {
#[tauri::command]
pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
/* #[cfg(windows)]
use std::os::windows::process::CommandExt; */
#[cfg(windows)]
const DETACHED_PROCESS: u32 = 0x00000008;
#[cfg(windows)]
@@ -384,7 +429,7 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
.arg("ez-pp.farm")
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn()
.map_err(|e| format!("Failed to spawn updater: {}", e))?
.map_err(|e| format!("Failed to spawn osu: {}", e))?
}
#[cfg(not(windows))]
@@ -393,25 +438,52 @@ pub async fn run_osu(folder: String, patch: bool) -> Result<(), String> {
.arg("--devserver")
.arg("ez-pp.farm")
.spawn()
.map_err(|e| format!("Failed to spawn updater: {}", e))?
.map_err(|e| format!("Failed to spawn osu: {}", e))?
}
};
if patch {
sleep(Duration::from_secs(3)).await;
#[cfg(windows)]
{
if patch {
let patcher_exe_path = PathBuf::from(&folder)
.join("EZPPLauncher")
.join("patcher")
.join("osu!.patcher.exe");
let patcher_exe_path = PathBuf::from(&folder)
.join("EZPPLauncher")
.join("patcher")
.join("osu!.patcher.exe");
if patcher_exe_path.exists() {
#[cfg(windows)]
{
let mut sys = System::new_all();
if patcher_exe_path.exists() {
#[cfg(windows)]
{
let _ = Command::new(&patcher_exe_path)
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn()
.map_err(|e| format!("Failed to run patcher: {e}"))?;
loop {
sys.refresh_processes(sysinfo::ProcessesToUpdate::All, true);
let mut found = false;
for (_pid, process) in sys.processes() {
if process.name() == "osu!.exe" {
let pid = process.pid();
let title = get_window_title_by_pid(pid);
if !title.is_empty() && !title.contains("updater") {
found = true;
break;
}
}
}
if found {
break;
}
sleep(Duration::from_millis(500)).await;
}
let _ = Command::new(&patcher_exe_path)
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn()
.map_err(|e| format!("Failed to run patcher: {e}"))?;
}
}
}
}
@@ -556,7 +628,6 @@ pub async fn download_ezpp_launcher_update_files(
#[serde(tag = "type", content = "details")]
pub enum ReplaceUIError {
FileNotFound(String),
PermissionDenied(String),
IoError(String),
}
@@ -565,44 +636,169 @@ pub fn replace_ui_files(folder: String, revert: bool) -> Result<(), ReplaceUIErr
let osu_path = PathBuf::from(folder);
let ezpp_ui = osu_path.join("EZPPLauncher").join("ezpp!ui.dll");
let osu_ui = osu_path.join("osu!ui.dll");
let ezpp_seasonal = osu_path.join("EZPPLauncher").join("ezpp!seasonal.dll");
let osu_seasonal = osu_path.join("osu!seasonal.dll");
let ezpp_gameplay = osu_path.join("EZPPLauncher").join("ezpp!gameplay.dll");
let osu_gameplay = osu_path.join("osu!gameplay.dll");
let osu_ui_bak = osu_path.join("osu!ui.dll.bak");
let osu_seasonal_bak = osu_path.join("osu!seasonal.dll.bak");
let osu_gameplay_bak = osu_path.join("osu!gameplay.dll.bak");
let try_rename = |from: &PathBuf, to: &PathBuf| -> Result<(), ReplaceUIError> {
if !from.exists() {
return Err(ReplaceUIError::FileNotFound(from.display().to_string()));
let temp_file = osu_path.join(".ezpplauncher_files");
let copy_file = |source: &PathBuf, dest: &PathBuf, name: &str| -> Result<(), ReplaceUIError> {
if !source.exists() {
return Err(ReplaceUIError::FileNotFound(source.display().to_string()));
}
std::fs::rename(from, to).map_err(|e| match e.kind() {
std::io::ErrorKind::NotFound => {
ReplaceUIError::FileNotFound(from.display().to_string())
}
std::io::ErrorKind::PermissionDenied => {
ReplaceUIError::PermissionDenied(from.display().to_string())
}
_ => ReplaceUIError::IoError(e.to_string()),
})
if dest.exists() {
std::fs::remove_file(dest).map_err(|e| {
ReplaceUIError::IoError(format!("Failed to remove {}: {}", name, e))
})?;
}
std::fs::copy(source, dest)
.map_err(|e| ReplaceUIError::IoError(format!("Failed to copy {}: {}", name, e)))?;
Ok(())
};
let restore_backup =
|bak: &PathBuf, dest: &PathBuf, name: &str| -> Result<(), ReplaceUIError> {
if bak.exists() {
if dest.exists() {
std::fs::remove_file(dest).map_err(|e| {
ReplaceUIError::IoError(format!("Failed to remove {}: {}", name, e))
})?;
}
std::fs::rename(bak, dest).map_err(|e| {
ReplaceUIError::IoError(format!("Failed to rename {} from backup: {}", name, e))
})?;
}
Ok(())
};
if !revert {
try_rename(&osu_ui, &osu_ui_bak)?;
try_rename(&ezpp_ui, &osu_ui)?;
if osu_ui.exists() && !osu_ui_bak.exists() {
std::fs::rename(&osu_ui, &osu_ui_bak).map_err(|e| {
ReplaceUIError::IoError(format!("Failed to backup osu!ui.dll: {}", e))
})?;
}
if osu_seasonal.exists() && !osu_seasonal_bak.exists() {
std::fs::rename(&osu_seasonal, &osu_seasonal_bak).map_err(|e| {
ReplaceUIError::IoError(format!("Failed to backup osu!seasonal.dll: {}", e))
})?;
}
if osu_gameplay.exists() && !osu_gameplay_bak.exists() {
std::fs::rename(&osu_gameplay, &osu_gameplay_bak).map_err(|e| {
ReplaceUIError::IoError(format!("Failed to backup osu!gameplay.dll: {}", e))
})?;
}
try_rename(&osu_gameplay, &osu_gameplay_bak)?;
try_rename(&ezpp_gameplay, &osu_gameplay)?;
copy_file(&ezpp_ui, &osu_ui, "osu!ui.dll")?;
copy_file(&ezpp_seasonal, &osu_seasonal, "osu!seasonal.dll")?;
copy_file(&ezpp_gameplay, &osu_gameplay, "osu!gameplay.dll")?;
std::fs::write(&temp_file, b"1")
.map_err(|e| ReplaceUIError::IoError(format!("Failed to write marker file: {}", e)))?;
} else {
try_rename(&osu_ui, &ezpp_ui)?;
try_rename(&osu_ui_bak, &osu_ui)?;
restore_backup(&osu_ui_bak, &osu_ui, "osu!ui.dll")?;
restore_backup(&osu_seasonal_bak, &osu_seasonal, "osu!seasonal.dll")?;
restore_backup(&osu_gameplay_bak, &osu_gameplay, "osu!gameplay.dll")?;
try_rename(&osu_gameplay, &ezpp_gameplay)?;
try_rename(&osu_gameplay_bak, &osu_gameplay)?;
if osu_ui.exists() && osu_seasonal.exists() && osu_gameplay.exists() {
std::fs::remove_file(&temp_file).map_err(|e| {
ReplaceUIError::IoError(format!("Failed to remove marker file: {}", e))
})?;
}
}
Ok(())
}
#[derive(Serialize)]
#[serde(tag = "type", content = "details")]
pub enum CorruptionCheckError {
IoError(String),
FileNotFound(String),
}
#[tauri::command]
pub async fn check_for_corruption(folder: String) -> Result<bool, CorruptionCheckError> {
let osu_path = PathBuf::from(folder);
let osu_ui = osu_path.join("osu!ui.dll");
let osu_gameplay = osu_path.join("osu!gameplay.dll");
let osu_seasonal = osu_path.join("osu!seasonal.dll");
let osu_ui_bak = osu_path.join("osu!ui.dll.bak");
let osu_gameplay_bak = osu_path.join("osu!gameplay.dll.bak");
let osu_seasonal_bak = osu_path.join("osu!seasonal.dll.bak");
let temp_file = osu_path.join(".ezpplauncher_files");
if temp_file.exists() {
if osu_ui_bak.exists() {
if osu_ui.exists() {
fs::remove_file(&osu_ui).await.map_err(|e| {
CorruptionCheckError::IoError(format!("Failed to remove osu!ui.dll: {}", e))
})?;
}
fs::rename(&osu_ui_bak, &osu_ui).await.map_err(|e| {
CorruptionCheckError::IoError(format!(
"Failed to restore osu!ui.dll from backup: {}",
e
))
})?;
}
if osu_gameplay_bak.exists() {
if osu_gameplay.exists() {
fs::remove_file(&osu_gameplay).await.map_err(|e| {
CorruptionCheckError::IoError(format!(
"Failed to remove osu!gameplay.dll: {}",
e
))
})?;
}
fs::rename(&osu_gameplay_bak, &osu_gameplay)
.await
.map_err(|e| {
CorruptionCheckError::IoError(format!(
"Failed to restore osu!gameplay.dll from backup: {}",
e
))
})?;
}
if osu_seasonal_bak.exists() {
if osu_seasonal.exists() {
fs::remove_file(&osu_seasonal).await.map_err(|e| {
CorruptionCheckError::IoError(format!(
"Failed to remove osu!seasonal.dll: {}",
e
))
})?;
}
fs::rename(&osu_seasonal_bak, &osu_seasonal)
.await
.map_err(|e| {
CorruptionCheckError::IoError(format!(
"Failed to restore osu!seasonal.dll from backup: {}",
e
))
})?;
}
return Ok(false);
}
if !osu_ui.exists() || !osu_gameplay.exists() || !osu_seasonal.exists() {
return Ok(true);
}
Ok(false)
}
#[tauri::command]
pub fn is_osu_running() -> bool {
let mut sys = System::new_all();
@@ -632,35 +828,6 @@ pub fn get_platform() -> String {
std::env::consts::OS.to_string()
}
#[tauri::command]
pub async fn check_for_corruption(folder: String) -> Result<bool, String> {
let osu_path = PathBuf::from(folder);
let osu_ui = osu_path.join("osu!ui.dll");
let osu_gameplay = osu_path.join("osu!gameplay.dll");
let osu_ui_bak = osu_path.join("osu!ui.dll.bak");
let osu_gameplay_bak = osu_path.join("osu!gameplay.dll.bak");
let required_files = [&osu_ui, &osu_gameplay];
for file in &required_files {
if !file.exists() {
return Ok(true);
}
}
let bak_files = [&osu_ui_bak, &osu_gameplay_bak];
for bak in &bak_files {
if bak.exists() {
if let Err(e) = fs::remove_file(bak).await {
return Err(format!("Failed to delete {}: {}", bak.display(), e));
}
}
}
Ok(false)
}
#[tauri::command]
pub async fn presence_connect() -> bool {
presence::connect().await
@@ -700,6 +867,21 @@ pub async fn presence_update_user(user: PresenceUser) {
presence::update_user(user.username.as_deref(), user.id.as_deref());
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PresenceButton {
text: Option<String>,
url: Option<String>,
}
#[tauri::command]
pub async fn presence_update_button(button: PresenceButton) {
match (button.text.as_deref(), button.url.as_deref()) {
(Some(text), Some(url)) => presence::set_button(text, url),
_ =>presence::clear_button()
}
}
#[tauri::command]
pub async fn presence_is_connected() -> bool {
presence::has_presence().await
@@ -720,20 +902,83 @@ pub async fn has_net8() -> bool {
is_net8_installed().await
}
#[cfg(windows)]
#[tauri::command]
pub fn encrypt_string(string: String, entropy: String) -> String {
let encrypted = encrypt_password(&string, &entropy);
match encrypted {
Ok(encrypted_vec) => encrypted_vec,
Err(_) => string,
}
encrypt_password(&string, &entropy).unwrap_or(string)
}
#[tauri::command]
pub async fn download_ezpp_launcher_update(app: AppHandle, url: String) -> Result<(), String> {
let client = Client::new();
let mut response = client.get(&url).send().await.map_err(|e| e.to_string())?;
if !response.status().is_success() {
return Err(format!("Failed to download update: {}", response.status()));
}
let temp_dir = app.path().temp_dir().expect("Failed to get temp directory");
let file_path = temp_dir.join("ezpplauncher_update.exe");
let mut file_out = fs::File::create(&file_path)
.await
.map_err(|e| e.to_string())?;
let mut downloaded = 0u64;
let size = response
.content_length()
.ok_or("Failed to get content length")? as usize;
while let Some(chunk) = response.chunk().await.map_err(|e| e.to_string())? {
downloaded += chunk.len() as u64;
file_out
.write_all(&chunk)
.await
.map_err(|e| e.to_string())?;
app.emit(
"download-progress",
UpdateStatus {
file_name: "Update".to_string(),
downloaded,
size,
progress: ((downloaded as f64 / size as f64 * 100.0) * 100.0).trunc() / 100.0,
},
)
.unwrap_or_default();
}
Ok(())
}
#[cfg(windows)]
#[tauri::command]
pub async fn install_ezpp_launcher_update(app: AppHandle) -> Result<(), String> {
let temp_dir = app.path().temp_dir().expect("Failed to get temp directory");
let file_path = temp_dir.join("ezpplauncher_update.exe");
if !file_path.exists() {
return Err("Update file does not exist".to_string());
}
// run this app detached and exit
const DETACHED_PROCESS: u32 = 0x00000008;
const CREATE_NEW_PROCESS_GROUP: u32 = 0x00000200;
Command::new(&file_path)
.arg("/S")
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn()
.map_err(|e| format!("Failed to spawn updater: {}", e))?;
sleep(Duration::from_millis(250)).await;
app.exit(0x0100);
Ok(())
}
// NOTE: should not be called by tauri on non windows systems, return the string nonthenless
#[cfg(not(windows))]
#[tauri::command]
pub fn encrypt_string(string: String, _entropy: String) -> String {
string
pub async fn install_ezpp_launcher_update(_app: AppHandle) -> Result<(), String> {
Ok(())
}
+72 -18
View File
@@ -1,41 +1,98 @@
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
use std::path::PathBuf;
use std::sync::Mutex;
use tauri::Manager;
use tauri_plugin_fs::FsExt;
pub mod commands;
pub mod osudb;
pub mod presence;
pub mod utils;
use crate::commands::{
check_for_corruption, download_ezpp_launcher_update_files, encrypt_string, exit,
find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid,
get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform,
get_skins_count, has_net8, has_osuwinello, has_wmctrl, is_osu_running, open_url_in_browser,
presence_connect, presence_disconnect, presence_is_connected, presence_update_status,
presence_update_user, replace_ui_files, run_osu, run_osu_updater, set_osu_config_values,
set_osu_user_config_values, valid_osu_folder,
check_for_corruption, download_ezpp_launcher_update, download_ezpp_launcher_update_files,
encrypt_string, exit, find_osu_installation, get_beatmapsets_count,
get_ezpp_launcher_update_files, get_hwid, get_launcher_version, get_osu_release_stream,
get_osu_skin, get_osu_version, get_platform, get_skins, get_skins_count, has_net8,
has_osuwinello, has_wmctrl, install_ezpp_launcher_update, is_osu_running, open_url_in_browser,
opened_urls, presence_connect, presence_disconnect, presence_is_connected,
presence_update_status, presence_update_user, presence_update_button, replace_ui_files, run_osu, run_osu_updater,
set_osu_config_values, set_osu_user_config_values, valid_osu_folder,
};
struct OpenedUrls(Mutex<Vec<PathBuf>>);
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
#[cfg(target_os = "linux")]
unsafe {
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
// std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
}
let mut builder = tauri::Builder::default();
#[cfg(desktop)]
{
builder = builder.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
builder = builder.plugin(tauri_plugin_single_instance::init(|app, args, _cwd| {
let app_window = app.get_webview_window("main").expect("no main window");
app_window.set_focus().expect("failed to focus");
if args.len() > 1 {
use tauri::Emitter;
let mut files = Vec::new();
for maybe_file in args.iter().skip(1) {
if maybe_file.starts_with("-") {
continue;
}
let path = PathBuf::from(maybe_file);
if path.extension().and_then(|e| e.to_str()) == Some("ezpplauncher-theme") {
app.fs_scope().allow_file(&path).ok();
files.push(path);
}
}
app.state::<OpenedUrls>()
.0
.lock()
.unwrap()
.extend(files.clone());
app.emit("opened", files.clone()).ok();
}
}));
}
let app = builder
.manage(OpenedUrls(Mutex::new(vec![])))
.setup(|app| {
let args = std::env::args().collect::<Vec<_>>();
if args.len() > 1 {
let mut files = Vec::new();
for maybe_file in args.iter().skip(1) {
if maybe_file.starts_with("-") {
continue;
}
let path = PathBuf::from(maybe_file);
if path.extension().and_then(|e| e.to_str()) == Some("ezpplauncher-theme") {
app.fs_scope().allow_file(&path).ok();
files.push(path);
}
}
app.state::<OpenedUrls>().0.lock().unwrap().extend(files);
}
Ok(())
})
.invoke_handler(tauri::generate_handler![
opened_urls,
get_hwid,
find_osu_installation,
valid_osu_folder,
get_beatmapsets_count,
get_skins,
get_skins_count,
get_osu_version,
get_osu_release_stream,
@@ -57,26 +114,23 @@ pub fn run() {
presence_disconnect,
presence_update_status,
presence_update_user,
presence_update_button,
presence_is_connected,
has_osuwinello,
has_wmctrl,
has_net8,
encrypt_string
encrypt_string,
download_ezpp_launcher_update,
install_ezpp_launcher_update
])
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_cors_fetch::init())
.plugin(tauri_plugin_sql::Builder::default().build())
.build(tauri::generate_context!())
.expect("error while building tauri application");
app.run(|_app_handle, event| {
if let tauri::RunEvent::ExitRequested { api, .. } = event {
api.prevent_exit();
tauri::async_runtime::block_on(presence::disconnect());
std::process::exit(0);
}
app.run(|app, event| {
presence::handle_run_event(app, &event);
});
}
+370
View File
@@ -0,0 +1,370 @@
use std::io::{Cursor, Read};
use anyhow::{Result, anyhow};
use byteorder::{LittleEndian, ReadBytesExt};
use std::collections::HashMap;
pub struct OsuReader {
cursor: Cursor<Vec<u8>>,
}
impl OsuReader {
pub fn new(data: Vec<u8>) -> Self {
Self {
cursor: Cursor::new(data),
}
}
fn read_i16(&mut self) -> Result<i16> {
Ok(self.cursor.read_i16::<LittleEndian>()?)
}
fn read_i32(&mut self) -> Result<i32> {
Ok(self.cursor.read_i32::<LittleEndian>()?)
}
fn read_i64(&mut self) -> Result<i64> {
Ok(self.cursor.read_i64::<LittleEndian>()?)
}
fn read_u8(&mut self) -> Result<u8> {
Ok(self.cursor.read_u8()?)
}
fn read_f32(&mut self) -> Result<f32> {
Ok(self.cursor.read_f32::<LittleEndian>()?)
}
fn read_f64(&mut self) -> Result<f64> {
Ok(self.cursor.read_f64::<LittleEndian>()?)
}
fn read_bool(&mut self) -> Result<bool> {
Ok(self.read_u8()? != 0)
}
fn read_string(&mut self) -> Result<Option<String>> {
let indicator = self.read_u8()?;
if indicator == 0 {
return Ok(None);
}
if indicator != 0x0B {
return Err(anyhow!("Invalid osu string indicator"));
}
let len = self.read_uleb128()? as usize;
let mut buf = vec![0; len];
self.cursor.read_exact(&mut buf)?;
Ok(Some(String::from_utf8(buf)?))
}
fn read_uleb128(&mut self) -> Result<u64> {
let mut result = 0;
let mut shift = 0;
loop {
let byte = self.read_u8()?;
result |= ((byte & 0x7F) as u64) << shift;
if (byte & 0x80) == 0 {
break;
}
shift += 7;
}
Ok(result)
}
}
#[derive(Debug)]
pub struct TimingPoint {
pub bpm: f64,
pub offset: f64,
pub inherited: bool,
}
#[derive(Debug)]
pub struct Beatmap {
pub artist_name: Option<String>,
pub artist_unicode: Option<String>,
pub song_title: Option<String>,
pub song_title_unicode: Option<String>,
pub creator: Option<String>,
pub difficulty: Option<String>,
pub audio: Option<String>,
pub md5: Option<String>,
pub osu_file_name: Option<String>,
pub ranked_status: u8,
pub hitcircles: i16,
pub slider_count: i16,
pub spinner_count: i16,
pub last_modification: i64,
pub approach_rate: f32,
pub circle_size: f32,
pub hp_drain: f32,
pub overall_difficulty: f32,
pub slider_velocity: f64,
pub difficulties: HashMap<i32, f64>,
pub drain_time: i32,
pub total_time: i32,
pub preview_offset: i32,
pub beatmap_id: i32,
pub beatmapset_id: i32,
pub thread_id: i32,
pub grade_standard: u8,
pub grade_taiko: u8,
pub grade_catch: u8,
pub grade_mania: u8,
pub local_beatmap_offset: i16,
pub stack_leniency: f32,
pub mode: u8,
pub song_source: Option<String>,
pub song_tags: Option<String>,
pub online_beatmap_offset: i16,
pub title_font: Option<String>,
pub unplayed: bool,
pub last_played: i64,
pub osz2: bool,
pub folder_name: Option<String>,
pub last_checked_against_repository: i64,
pub ignore_sound: bool,
pub ignore_skin: bool,
pub disable_storyboard: bool,
pub disable_video: bool,
pub visual_override: bool,
pub last_modification_time: i32,
pub mania_scroll_speed: u8,
pub timing_points: Vec<TimingPoint>,
}
#[derive(Debug)]
pub struct OsuDbData {
pub osuver: i32,
pub folder_count: i32,
pub is_unlocked: bool,
pub date_unlock_ticks: i64,
pub username: Option<String>,
pub beatmaps: Vec<Beatmap>,
pub userperms: i32,
}
//
// =========================
// PARSER
// =========================
//
pub fn parse_osudb(bytes: Vec<u8>) -> Result<OsuDbData> {
let mut reader = OsuReader::new(bytes);
let osuver = reader.read_i32()?;
let folder_count = reader.read_i32()?;
let is_unlocked = reader.read_bool()?;
let date_unlock_ticks = reader.read_i64()?;
let username = reader.read_string()?;
let beatmaps_count = reader.read_i32()?;
let mut beatmaps = Vec::new();
for _ in 0..beatmaps_count {
if osuver < 20191107 {
reader.read_i32()?; // entry size
}
let artist_name = reader.read_string()?;
let artist_unicode = reader.read_string()?;
let song_title = reader.read_string()?;
let song_title_unicode = reader.read_string()?;
let creator = reader.read_string()?;
let difficulty = reader.read_string()?;
let audio = reader.read_string()?;
let md5 = reader.read_string()?;
let osu_file_name = reader.read_string()?;
let ranked_status = reader.read_u8()?;
let hitcircles = reader.read_i16()?;
let slider_count = reader.read_i16()?;
let spinner_count = reader.read_i16()?;
let last_modification = reader.read_i64()?;
let approach_rate = if osuver < 20140609 {
reader.read_u8()? as f32
} else {
reader.read_f32()?
};
let circle_size = if osuver < 20140609 {
reader.read_u8()? as f32
} else {
reader.read_f32()?
};
let hp_drain = if osuver < 20140609 {
reader.read_u8()? as f32
} else {
reader.read_f32()?
};
let overall_difficulty = if osuver < 20140609 {
reader.read_u8()? as f32
} else {
reader.read_f32()?
};
let slider_velocity = reader.read_f64()?;
let mut difficulties: HashMap<i32, f64> = HashMap::new();
if osuver >= 20140609 {
for _ in 0..4 {
let len = reader.read_i32()?;
for _ in 0..len {
reader.read_u8()?;
let mode = reader.read_i32()?;
reader.read_u8()?;
let diff = if osuver > 20250107 {
reader.read_f32()? as f64
} else {
reader.read_f64()?
};
difficulties.insert(mode, diff);
}
}
}
let drain_time = reader.read_i32()?;
let total_time = reader.read_i32()?;
let preview_offset = reader.read_i32()?;
let timing_len = reader.read_i32()?;
let mut timing_points = Vec::new();
for _ in 0..timing_len {
timing_points.push(TimingPoint {
bpm: reader.read_f64()?,
offset: reader.read_f64()?,
inherited: reader.read_bool()?,
});
}
let beatmap_id = reader.read_i32()?;
let beatmapset_id = reader.read_i32()?;
let thread_id = reader.read_i32()?;
let grade_standard = reader.read_u8()?;
let grade_taiko = reader.read_u8()?;
let grade_catch = reader.read_u8()?;
let grade_mania = reader.read_u8()?;
let local_beatmap_offset = reader.read_i16()?;
let stack_leniency = reader.read_f32()?;
let mode = reader.read_u8()?;
let song_source = reader.read_string()?;
let song_tags = reader.read_string()?;
let online_beatmap_offset = reader.read_i16()?;
let title_font = reader.read_string()?;
let unplayed = reader.read_bool()?;
let last_played = reader.read_i64()?;
let osz2 = reader.read_bool()?;
let folder_name = reader.read_string()?;
let last_checked_against_repository = reader.read_i64()?;
let ignore_sound = reader.read_bool()?;
let ignore_skin = reader.read_bool()?;
let disable_storyboard = reader.read_bool()?;
let disable_video = reader.read_bool()?;
let visual_override = reader.read_bool()?;
if osuver < 20140609 {
reader.read_i16()?;
}
let last_modification_time = reader.read_i32()?;
let mania_scroll_speed = reader.read_u8()?;
beatmaps.push(Beatmap {
artist_name,
artist_unicode,
song_title,
song_title_unicode,
creator,
difficulty,
audio,
md5,
osu_file_name,
ranked_status,
hitcircles,
slider_count,
spinner_count,
last_modification,
approach_rate,
circle_size,
hp_drain,
overall_difficulty,
slider_velocity,
difficulties,
drain_time,
total_time,
preview_offset,
beatmap_id,
beatmapset_id,
thread_id,
grade_standard,
grade_taiko,
grade_catch,
grade_mania,
local_beatmap_offset,
stack_leniency,
mode,
song_source,
song_tags,
online_beatmap_offset,
title_font,
unplayed,
last_played,
osz2,
folder_name,
last_checked_against_repository,
ignore_sound,
ignore_skin,
disable_storyboard,
disable_video,
visual_override,
last_modification_time,
mania_scroll_speed,
timing_points,
});
}
let userperms = reader.read_i32()?;
Ok(OsuDbData {
osuver,
folder_count,
is_unlocked,
date_unlock_ticks,
username,
beatmaps,
userperms,
})
}
+246 -121
View File
@@ -1,12 +1,16 @@
use discord_rich_presence::{
activity::{Activity, Assets, Button, Timestamps},
DiscordIpc, DiscordIpcClient,
};
use once_cell::sync::Lazy;
use presenceforge::{ActivityBuilder, AsyncDiscordIpcClient};
use std::sync::Mutex as StdMutex;
use std::time::{SystemTime, UNIX_EPOCH};
use tauri::{AppHandle, RunEvent};
use tokio::sync::{mpsc, oneshot};
use tokio::time::{interval, Duration};
use tokio::time::{Duration, interval};
#[derive(Clone, Debug)]
pub struct PresenceButton {
pub label: String,
pub url: String,
}
#[derive(Clone, Debug)]
pub struct PresenceData {
@@ -16,6 +20,21 @@ pub struct PresenceData {
pub large_image_text: String,
pub small_image_key: Option<String>,
pub small_image_text: Option<String>,
pub dynamic_button: Option<PresenceButton>,
}
impl Default for PresenceData {
fn default() -> Self {
Self {
state: "Idle in Launcher...".to_string(),
details: " ".to_string(),
large_image_key: "ezppfarm".to_string(),
large_image_text: "EZPPFarm".to_string(),
small_image_key: None,
small_image_text: None,
dynamic_button: None,
}
}
}
#[derive(Debug)]
@@ -26,11 +45,19 @@ enum PresenceCommand {
IsConnected(oneshot::Sender<bool>),
}
enum ReconnectResult {
Connected(AsyncDiscordIpcClient),
Failed,
}
struct PresenceActor {
receiver: mpsc::Receiver<PresenceCommand>,
client: Option<DiscordIpcClient>,
reconnect_rx: mpsc::Receiver<ReconnectResult>,
reconnect_tx: mpsc::Sender<ReconnectResult>,
client: Option<AsyncDiscordIpcClient>,
data: PresenceData,
start_timestamp: i64,
reconnecting: bool,
}
impl PresenceActor {
@@ -40,141 +67,184 @@ impl PresenceActor {
.unwrap()
.as_secs() as i64;
let data = PresenceData {
state: "Idle in Launcher...".to_string(),
details: " ".to_string(),
large_image_key: "ezppfarm".to_string(),
large_image_text: "EZPPFarm".to_string(),
small_image_key: None,
small_image_text: None,
};
let (reconnect_tx, reconnect_rx) = mpsc::channel(1);
PresenceActor {
Self {
receiver,
reconnect_rx,
reconnect_tx,
client: None,
data,
data: PresenceData::default(),
start_timestamp: start,
reconnecting: false,
}
}
async fn run(&mut self) {
let mut update_interval = interval(Duration::from_millis(2500));
let mut heartbeat = interval(Duration::from_secs(5));
heartbeat.tick().await;
loop {
tokio::select! {
Some(cmd) = self.receiver.recv() => {
match cmd {
PresenceCommand::Connect(responder) => self.handle_connect(responder).await,
PresenceCommand::Disconnect(responder) => {
self.handle_disconnect(responder).await;
},
PresenceCommand::UpdateData(new_data) => {
self.data = new_data;
},
PresenceCommand::IsConnected(responder) => {
let _ = responder.send(self.client.is_some());
PresenceCommand::Connect(resp) => self.cmd_connect(resp).await,
PresenceCommand::Disconnect(resp) => self.cmd_disconnect(resp).await,
PresenceCommand::UpdateData(data) => {
self.data = data;
self.push_presence().await;
}
PresenceCommand::IsConnected(resp) => {
let _ = resp.send(self.client.is_some());
}
}
}
_ = update_interval.tick() => {
if self.client.is_some() {
self.handle_update().await;
Some(result) = self.reconnect_rx.recv() => {
self.reconnecting = false;
match result {
ReconnectResult::Connected(client) => {
println!("Presence: reconnect succeeded.");
self.client = Some(client);
self.push_presence().await;
}
ReconnectResult::Failed => {
eprintln!("Presence: all reconnect attempts exhausted.");
}
}
}
_ = heartbeat.tick() => {
self.push_presence().await;
}
}
}
}
async fn handle_connect(&mut self, responder: oneshot::Sender<bool>) {
async fn cmd_connect(&mut self, resp: oneshot::Sender<bool>) {
if self.client.is_some() {
let _ = responder.send(true);
let _ = resp.send(true);
return;
}
println!("Actor: Connecting to Discord...");
match DiscordIpcClient::new("1032772293220384808").map_err(|e| e.to_string()) {
Ok(mut new_client) => {
if let Err(e) = new_client.connect().map_err(|e| e.to_string()) {
eprintln!("Failed to connect to Discord: {:?}", e);
let _ = responder.send(false);
match try_connect_once().await {
Some(client) => {
self.client = Some(client);
self.reconnecting = false;
self.push_presence().await;
let _ = resp.send(true);
}
None => {
eprintln!("Presence: initial connect failed; spawning reconnect task.");
let _ = resp.send(false);
self.spawn_reconnect_task();
}
}
}
async fn cmd_disconnect(&mut self, resp: oneshot::Sender<()>) {
if let Some(mut client) = self.client.take() {
let _ = client.clear_activity().await;
println!("Presence: disconnected.");
}
let _ = resp.send(());
}
async fn push_presence(&mut self) {
let client = match self.client.as_mut() {
Some(c) => c,
None => return,
};
let mut builder = ActivityBuilder::new()
.state(&self.data.state)
.details(&self.data.details)
.start_timestamp(self.start_timestamp as u64)
.large_image(&self.data.large_image_key)
.large_text(&self.data.large_image_text);
if let Some(key) = &self.data.small_image_key {
builder = builder.small_image(key);
}
if let Some(text) = &self.data.small_image_text {
builder = builder.small_text(text);
}
if let Some(btn) = &self.data.dynamic_button {
builder = builder.button(&btn.label, &btn.url);
} else {
builder = builder.button(
"Download the Launcher",
"https://git.ez-pp.farm/EZPPFarm/EZPPLauncher/releases/latest",
);
}
builder = builder.button("Join EZPPFarm", "https://ez-pp.farm/discord");
let activity = builder.build();
/* println!("Presence: updating activity: {:?}", activity); */
if let Err(e) = client.set_activity(&activity).await {
eprintln!("Presence: set_activity failed ({:?}); will reconnect.", e);
self.client = None;
self.spawn_reconnect_task();
}
}
fn spawn_reconnect_task(&mut self) {
if self.reconnecting {
return;
}
self.reconnecting = true;
let tx = self.reconnect_tx.clone();
tokio::spawn(async move {
const MAX_ATTEMPTS: u32 = 5;
for attempt in 1..=MAX_ATTEMPTS {
let delay = Duration::from_secs(5 * attempt as u64);
println!(
"Presence: reconnect attempt {}/{} in {:?}…",
attempt, MAX_ATTEMPTS, delay
);
tokio::time::sleep(delay).await;
if let Some(client) = try_connect_once().await {
let _ = tx.send(ReconnectResult::Connected(client)).await;
return;
}
self.client = Some(new_client);
println!("Actor: Connected successfully.");
self.handle_update().await;
let _ = responder.send(true);
}
let _ = tx.send(ReconnectResult::Failed).await;
});
}
}
async fn try_connect_once() -> Option<AsyncDiscordIpcClient> {
match AsyncDiscordIpcClient::new("1032772293220384808").await {
Ok(mut client) => match client.connect().await {
Ok(_) => {
println!("Presence: IPC connected.");
Some(client)
}
Err(e) => {
eprintln!("Failed to create Discord client: {:?}", e);
let _ = responder.send(false);
}
}
}
async fn handle_disconnect(&mut self, responder: oneshot::Sender<()>) {
if let Some(mut client) = self.client.take() {
println!("Actor: Disconnecting...");
let _ = client.clear_activity().map_err(|e| e.to_string());
let _ = client.close().map_err(|e| e.to_string());
println!("Actor: Disconnected successfully.");
}
let _ = responder.send(());
}
async fn handle_update(&mut self) {
if let Some(client) = self.client.as_mut() {
let mut assets = Assets::new()
.large_image(&self.data.large_image_key)
.large_text(&self.data.large_image_text);
if let Some(key) = &self.data.small_image_key {
assets = assets.small_image(key);
}
if let Some(text) = &self.data.small_image_text {
assets = assets.small_text(text);
}
let activity = Activity::new()
.state(&self.data.state)
.details(&self.data.details)
.timestamps(Timestamps::new().start(self.start_timestamp))
.assets(assets)
.buttons(vec![
Button::new(
"Download the Launcher",
"https://git.ez-pp.farm/EZPPFarm/EZPPLauncher/releases/latest",
),
Button::new("Join EZPZFarm", "https://ez-pp.farm/discord"),
]);
if let Err(e) = client.set_activity(activity).map_err(|e| e.to_string()) {
eprintln!("Failed to set activity, disconnecting: {:?}", e);
if let Some(mut client) = self.client.take() {
let _ = client.clear_activity();
let _ = client.close();
}
eprintln!("Presence: IPC connect error: {:?}", e);
None
}
},
Err(e) => {
eprintln!("Presence: failed to create client: {:?}", e);
None
}
}
}
static PRESENCE_TX: Lazy<mpsc::Sender<PresenceCommand>> = Lazy::new(|| {
let (tx, rx) = mpsc::channel(10);
let (tx, rx) = mpsc::channel(32);
let mut actor = PresenceActor::new(rx);
tokio::spawn(async move { actor.run().await });
tx
});
pub static PRESENCE_DATA: Lazy<StdMutex<PresenceData>> = Lazy::new(|| {
StdMutex::new(PresenceData {
state: "Idle in Launcher...".to_string(),
details: " ".to_string(),
large_image_key: "ezppfarm".to_string(),
large_image_text: "EZPPFarm".to_string(),
small_image_key: None,
small_image_text: None,
})
});
pub static PRESENCE_DATA: Lazy<StdMutex<PresenceData>> =
Lazy::new(|| StdMutex::new(PresenceData::default()));
pub async fn connect() -> bool {
let (tx, rx) = oneshot::channel();
@@ -187,45 +257,100 @@ pub async fn connect() -> bool {
pub async fn disconnect() {
let (tx, rx) = oneshot::channel();
if PRESENCE_TX.send(PresenceCommand::Disconnect(tx)).await.is_ok() {
let _ = rx.await;
} else {
println!("Could not send disconnect command; actor may not be running.");
let _ = tokio::time::timeout(Duration::from_secs(2), rx).await;
}
}
pub async fn has_presence() -> bool {
let (tx, rx) = oneshot::channel();
if PRESENCE_TX.send(PresenceCommand::IsConnected(tx)).await.is_ok() {
if PRESENCE_TX
.send(PresenceCommand::IsConnected(tx))
.await
.is_ok()
{
return rx.await.unwrap_or(false);
}
false
}
pub fn update_status(state: Option<&str>, details: Option<&str>, large_image_key: Option<&str>) {
let mut data = PRESENCE_DATA.lock().unwrap();
if let Some(s) = state {
data.state = s.to_string();
}
if let Some(d) = details {
data.details = d.to_string();
}
if let Some(img) = large_image_key {
data.large_image_key = img.to_string();
}
let data_clone = data.clone();
let data = {
let mut guard = PRESENCE_DATA.lock().unwrap();
if let Some(s) = state {
guard.state = s.to_string();
}
if let Some(d) = details {
guard.details = d.to_string();
}
if let Some(img) = large_image_key {
guard.large_image_key = img.to_string();
}
guard.clone()
};
let tx = PRESENCE_TX.clone();
tokio::spawn(async move {
let _ = tx.send(PresenceCommand::UpdateData(data_clone)).await;
let _ = tx.send(PresenceCommand::UpdateData(data)).await;
});
}
pub fn update_user(username: Option<&str>, id: Option<&str>) {
let mut data = PRESENCE_DATA.lock().unwrap();
data.small_image_key = id.map(|id_str| format!("https://a.ez-pp.farm/{}", id_str));
data.small_image_text = username.map(|s| s.to_string());
let data_clone = data.clone();
let data = {
let mut guard = PRESENCE_DATA.lock().unwrap();
guard.small_image_key = id.map(|s| format!("https://a.ez-pp.farm/{}", s));
guard.small_image_text = username.map(str::to_string);
guard.clone()
};
let tx = PRESENCE_TX.clone();
tokio::spawn(async move {
let _ = tx.send(PresenceCommand::UpdateData(data_clone)).await;
let _ = tx.send(PresenceCommand::UpdateData(data)).await;
});
}
pub fn set_button(label: &str, url: &str) {
let data = {
let mut guard = PRESENCE_DATA.lock().unwrap();
guard.dynamic_button = Some(PresenceButton {
label: label.to_string(),
url: url.to_string(),
});
guard.clone()
};
let tx = PRESENCE_TX.clone();
tokio::spawn(async move {
let _ = tx.send(PresenceCommand::UpdateData(data)).await;
});
}
pub fn clear_button() {
let data = {
let mut guard = PRESENCE_DATA.lock().unwrap();
guard.dynamic_button = None;
guard.clone()
};
let tx = PRESENCE_TX.clone();
tokio::spawn(async move {
let _ = tx.send(PresenceCommand::UpdateData(data)).await;
});
}
/// Register a Tauri event handler that cleanly disconnects presence when the
/// application exits. Call this once in your main.rs `tauri::Builder` run callback:
///
/// ```rust
/// .build(tauri::generate_context!())
/// .expect("error building app")
/// .run(|app, event| {
/// presence::handle_run_event(app, &event);
/// });
/// ```
pub fn handle_run_event(_app: &AppHandle, event: &RunEvent) {
if let RunEvent::ExitRequested { .. } | RunEvent::Exit = event {
tauri::async_runtime::block_on(async {
disconnect().await;
});
}
}
+18 -5
View File
@@ -286,8 +286,18 @@ pub fn get_window_title_by_pid(pid: Pid) -> String {
}
pub async fn is_net8_installed() -> bool {
use std::process::Command;
let output_result = Command::new("dotnet").arg("--list-runtimes").output();
use tokio::process::Command;
let mut command = Command::new("dotnet");
command.arg("--list-runtimes");
#[cfg(windows)]
{
const CREATE_NO_WINDOW: u32 = 0x08000000;
command.creation_flags(CREATE_NO_WINDOW);
}
let output_result = command.output().await;
match output_result {
Ok(output) => {
if !output.status.success() {
@@ -300,14 +310,17 @@ pub async fn is_net8_installed() -> bool {
}
let stdout_str = String::from_utf8_lossy(&output.stdout);
stdout_str
.lines()
.any(|line| line.starts_with("Microsoft.WindowsDesktop.App 8."))
stdout_str.lines().any(|line| line.starts_with("Microsoft.WindowsDesktop.App 8."))
}
Err(_) => false,
}
}
#[cfg(not(windows))]
pub fn encrypt_password(password: &str, _entropy: &str) -> Result<String, String> {
Ok(password.to_string())
}
#[cfg(windows)]
pub fn encrypt_password(password: &str, entropy: &str) -> Result<String, String> {
use base64::{Engine as _, engine::general_purpose};
+41 -8
View File
@@ -1,20 +1,21 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "ezpplauncher",
"version": "3.0.1",
"identifier": "farm.ezpp.launcher",
"productName": "EZPPLauncher",
"version": "3.2.0",
"identifier": "farm.EZPPFarm.Launcher",
"mainBinaryName": "ezpplauncher",
"build": {
"beforeDevCommand": "bun run vite:dev",
"devUrl": "http://localhost:1420",
"beforeBuildCommand": "bun run vite:build",
"beforeBuildCommand": "",
"frontendDist": "../build"
},
"app": {
"windows": [
{
"title": "ezpplauncher",
"title": "EZPPLauncher",
"width": 1000,
"height": 700,
"height": 650,
"decorations": false,
"resizable": false,
"maximizable": false
@@ -22,14 +23,46 @@
],
"withGlobalTauri": true,
"security": {
"csp": null
"csp": null,
"assetProtocol": {
"enable": true,
"scope": [
"$HOME/.ezpplauncher/themes/**"
]
}
}
},
"bundle": {
"publisher": "EZPPFarm",
"copyright": "EZPPFarm",
"homepage": "https://ez-pp.farm",
"license": "GPL-3.0",
"active": true,
"targets": [
"app"
"nsis",
"appimage"
],
"fileAssociations": [
{
"ext": ["ezpplauncher-theme"],
"name": "ezppLauncher Theme",
"description": "ezppLauncher Theme File",
"role": "Viewer",
"mimeType": "application/x-ezpplauncher-theme"
}
],
"windows": {
"webviewInstallMode": {
"silent": true,
"type": "downloadBootstrapper"
},
"nsis": {
"installMode": "currentUser",
"compression": "lzma",
"installerIcon": "icons/icon.ico",
"installerHooks": "./nsis/nsis-hooks.nsh"
}
},
"icon": [
"icons/32x32.png",
"icons/128x128.png",
+77 -20
View File
@@ -2,7 +2,10 @@
@import "tw-animate-css";
@custom-variant dark (&:is(.dark *));
@custom-variant dark (&:where(.dark, .dark *));
@import "@fontsource-variable/sora";
@import "@fontsource/space-mono";
:root {
--radius: 0.625rem;
@@ -41,7 +44,7 @@
--sidebar-ring: oklch(60.7% 0.226 299.68);
--font-sans:
"Sora", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
"Sora Variable", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
"Segoe UI Symbol", "Noto Color Emoji";
--font-mono:
"Space Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
@@ -55,7 +58,7 @@
--card-foreground: oklch(89.24% 0.079 263.24);
--popover: oklch(20.3% 0.05 282.86);
--popover-foreground: oklch(89.24% 0.079 263.24);
--primary: oklch(81.45% 0.159 300.53);
--primary: oklch(72.08% 0.196 356.34);
--primary-foreground: oklch(20.22% 0.048 282.86);
--secondary: oklch(42.99% 0.031 270.49);
--secondary-foreground: oklch(89.24% 0.079 263.24);
@@ -67,8 +70,8 @@
--destructive-foreground: oklch(20.22% 0.048 282.86);
--border: oklch(27.7% 0.041 276.87);
--input: oklch(27.7% 0.041 276.87);
--ring: oklch(81.45% 0.159 300.53);
--chart-1: oklch(81.45% 0.159 300.53);
--ring: oklch(72.08% 0.196 356.34);
--chart-1: oklch(72.08% 0.196 356.34);
--chart-2: oklch(77.19% 0.121 223.01);
--chart-3: oklch(79.1% 0.119 150.21);
--chart-4: oklch(79.74% 0.167 57.97);
@@ -76,12 +79,12 @@
--sidebar: oklch(13.29% 0.036 282.86);
--sidebar-background: oklch(13.29% 0.036 282.86);
--sidebar-foreground: oklch(89.24% 0.079 263.24);
--sidebar-primary: oklch(81.45% 0.159 300.53);
--sidebar-primary: oklch(72.08% 0.196 356.34);
--sidebar-primary-foreground: oklch(20.22% 0.048 282.86);
--sidebar-accent: oklch(75.21% 0.121 293.01);
--sidebar-accent-foreground: oklch(20.22% 0.048 282.86);
--sidebar-border: oklch(35.13% 0.03 273.31);
--sidebar-ring: oklch(81.45% 0.159 300.53);
--sidebar-ring: oklch(72.08% 0.196 356.34);
}
@theme inline {
@@ -108,20 +111,18 @@
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-50: #fefdff;
--color-primary-100: #faf6fe;
--color-primary-200: #f2e9fc;
--color-primary-300: #e9dbfa;
--color-primary-400: #e1cef9;
--color-primary-500: #d9c0f7;
--color-primary-600: #c6a0f3;
--color-primary-700: #b381ef;
--color-primary-800: #a061eb;
--color-primary-900: #8d41e7;
--color-primary-950: #8331e5;
--color-primary-50: #ffe5f1;
--color-primary-100: #ffcce2;
--color-primary-200: #ff99c5;
--color-primary-300: #ff66a8;
--color-primary-400: #ff338b;
--color-primary-500: #ff006e;
--color-primary-600: #cc0058;
--color-primary-700: #990042;
--color-primary-800: #66002c;
--color-primary-900: #330016;
--color-primary-950: #24000f;
--color-primary-foreground: var(--primary-foreground);
--color-primary-50: #fefdff;
--color-primary-100: #faf6fe;
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
@@ -147,6 +148,62 @@
--color-sidebar-ring: var(--sidebar-ring);
}
main[data-theme="execution_clap"] {
--primary: #fc112b;
--primary-foreground: #fff;
--ring: #fc112b;
--color-primary-50: #fef2f2;
--color-primary-100: #fee2e2;
--color-primary-200: #fecaca;
--color-primary-300: #fca5a5;
--color-primary-400: #f87171;
--color-primary-500: #ef4444;
--color-primary-600: #dc2626;
--color-primary-700: #b91c1c;
--color-primary-800: #991b1b;
--color-primary-900: #7f1d1d;
--color-primary-950: #450a0a;
--bg-primary-50: #fef2f2;
--bg-primary-100: #fee2e2;
--bg-primary-200: #fecaca;
--bg-primary-300: #fca5a5;
--bg-primary-400: #f87171;
--bg-primary-500: #ef4444;
--bg-primary-600: #dc2626;
--bg-primary-700: #b91c1c;
--bg-primary-800: #991b1b;
--bg-primary-900: #7f1d1d;
--bg-primary-950: #450a0a;
}
main[data-theme="lost_umbrella"] {
--primary: #e5e5e5;
--primary-foreground: #000;
--ring: #e5e5e5;
--color-primary-50: #0d0d0d;
--color-primary-100: #1a1a1a;
--color-primary-200: #333333;
--color-primary-300: #4d4d4d;
--color-primary-400: #666666;
--color-primary-500: #808080;
--color-primary-600: #999999;
--color-primary-700: #b3b3b3;
--color-primary-800: #cccccc;
--color-primary-900: #e6e6e6;
--color-primary-950: #f2f2f2;
--bg-primary-50: #0d0d0d;
--bg-primary-100: #1a1a1a;
--bg-primary-200: #333333;
--bg-primary-300: #4d4d4d;
--bg-primary-400: #666666;
--bg-primary-500: #808080;
--bg-primary-600: #999999;
--bg-primary-700: #b3b3b3;
--bg-primary-800: #cccccc;
--bg-primary-900: #e6e6e6;
--bg-primary-950: #f2f2f2;
}
@layer base {
* {
@apply border-border outline-ring/50;
Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

+4 -2
View File
@@ -18,11 +18,13 @@ export const osuapi = {
},
});
if (request.error) {
if (request.error.status >= 500 && request.error.status < 600)
throw new Error('Server not reachable');
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()
@@ -0,0 +1,86 @@
<script lang="ts">
import { reduceAnimations } from '@/userSettings';
//TODO: maybe dynamic background images fetched from ezpp?
const COUNT = 60;
function rand(min: number, max: number) {
return Math.random() * (max - min) + min;
}
const streaks = Array.from({ length: COUNT })
.map((_, i) => {
const depth = rand(0, 2);
const scale = 0.6 + depth * 0.8;
const speed = 0.4 + depth * 1.35;
const distance = 150;
const duration = distance / speed;
return {
width: rand(300, 320) * scale,
height: 32 * scale,
x: (i / COUNT) * 200 - 50,
y: ((i * 137.5) % 100) - 20,
opacity: 0.25 + depth * 0.65,
duration,
delay: rand(0, duration),
scale,
};
})
.sort((a, b) => a.scale - b.scale);
</script>
<div class="absolute bg blur-[2px]">
<div
class="relative h-full w-full from-0% to-90% bg-gradient-to-b from-transparent to-black z-50"
></div>
{#each streaks as s, index (index)}
<div
class="streak drop-shadow-lg transition-opacity duration-1000"
style="
width:{s.width}px;
height:{s.height}px;
left:{s.x}%;
top:{s.y}%;
opacity:{$reduceAnimations ? 0 : s.opacity};
animation-duration:{s.duration}s;
animation-delay:-{s.delay}s;
"
></div>
{/each}
</div>
<style>
.bg {
position: fixed;
inset: 0;
overflow: hidden;
background: linear-gradient(
180deg,
var(--color-primary-300) 0%,
var(--color-primary-600) 40%,
var(--color-primary-900) 100%
);
}
.streak {
position: absolute;
background: #d6f3ff;
border-radius: 999px;
transform: rotate(-35deg);
animation: move linear infinite;
will-change: transform;
}
@keyframes move {
from {
transform: translate(-150vw, 150vh) rotate(-35deg);
}
to {
transform: translate(150vw, -150vh) rotate(-35deg);
}
}
</style>
@@ -0,0 +1,91 @@
<script lang="ts">
import NyanCat from '$assets/themes/nyan_cat/image.gif';
import { reduceAnimations } from '@/userSettings';
//TODO: maybe dynamic background images fetched from ezpp?
const COUNT = 18;
function rand(min: number, max: number) {
return Math.random() * (max - min) + min;
}
const streaks = Array.from({ length: COUNT })
.map((_, i) => {
const depth = rand(0, 2);
const scale = 0.6 + depth * 0.8;
const speed = 0.4 + depth * 1.35;
const distance = 150;
const duration = distance / speed;
return {
width: 290 * scale,
height: 140 * scale,
x: (i / COUNT) * 200 - 50,
y: ((i * 137.5) % 100) - 20,
opacity: 0.25 + depth * 0.65,
duration,
delay: rand(0, duration),
scale,
};
})
.sort((a, b) => a.scale - b.scale);
</script>
<div class="absolute bg blur-[2px]">
<div
class="relative h-full w-full from-0% to-90% bg-gradient-to-b from-transparent to-black z-50"
></div>
{#each streaks as s, index (index)}
<div
class="streak drop-shadow-lg transition-opacity duration-1000"
style="
width:{s.width}px;
height:{s.height}px;
left:{s.x}%;
top:{s.y}%;
opacity:{$reduceAnimations ? 0 : s.opacity};
animation-duration:{s.duration}s;
animation-delay:-{s.delay}s;
"
>
<img
src={NyanCat}
alt="nyan cat"
class="w-full h-full"
style="opacity:{$reduceAnimations ? 0 : s.opacity};"
/>
</div>
{/each}
</div>
<style>
.bg {
position: fixed;
inset: 0;
overflow: hidden;
background: linear-gradient(
180deg,
var(--color-blue-800) 0%,
var(--color-blue-600) 40%,
var(--color-blue-900) 100%
);
}
.streak {
position: absolute;
animation: move linear infinite;
will-change: transform;
}
@keyframes move {
from {
transform: translate(-250vw, 0);
}
to {
transform: translate(250vw, 0);
}
}
</style>
@@ -0,0 +1,91 @@
<script lang="ts">
import Ellipsis from '@lucide/svelte/icons/ellipsis';
import Play from '@lucide/svelte/icons/play';
const prop: {
downloading: boolean;
progress: number;
text: string;
subtext?: string;
disabled?: boolean;
onClick?: () => void;
} = $props();
const radius = 16;
const circumference = 2 * Math.PI * radius;
const strokeDashoffset = $derived(circumference - (prop.progress / 100) * circumference);
</script>
<button
class="group flex items-center h-12 rounded-full bg-primary disabled:bg-primary/70 shadow-lg shadow-primary/25 transition-all not-disabled:hover:shadow-primary/40 not-disabled:hover:brightness-110 not-disabled:active:scale-[0.98] cursor-pointer w-fit"
disabled={prop.disabled}
onclick={prop.onClick}
>
<div class="relative size-12 shrink-0 flex items-center justify-center">
{#if prop.downloading}
{#if prop.progress === -1}
<svg class="absolute inset-0 animate-spin" viewBox="0 0 48 48">
<circle class="stroke-black/10" cx="24" cy="24" r={radius} fill="none" stroke-width="3" />
<circle
class="stroke-pink-950"
cx="24"
cy="24"
r={radius}
fill="none"
stroke-width="3"
stroke-linecap="round"
stroke-dasharray={circumference}
stroke-dashoffset={circumference * 0.7}
/>
</svg>
{:else}
<svg class="absolute inset-0 -rotate-90" viewBox="0 0 48 48">
<circle
cx="24"
cy="24"
r={radius}
fill="none"
stroke="rgba(0,0,0,0.2)"
stroke-width="3"
/>
<circle
cx="24"
cy="24"
r={radius}
fill="none"
stroke="rgba(0,0,0,0.7)"
stroke-width="3"
stroke-linecap="round"
stroke-dasharray={circumference}
stroke-dashoffset={strokeDashoffset}
class="transition-[stroke-dashoffset] duration-100"
/>
</svg>
{/if}
{/if}
<div class="size-9 rounded-full bg-black/30 flex items-center justify-center relative z-10">
{#if prop.downloading}
{#if prop.progress === -1}
<Ellipsis class="size-4 text-primary-foreground fill-current animate-pulse" />
{:else}
<span class="text-[10px] font-bold text-primary-foreground">
{prop.progress.toFixed()}
</span>
{/if}
{:else}
<Play class="size-4 text-primary-foreground fill-current ml-0.5" />
{/if}
</div>
</div>
<div class="pr-6 pl-1 text-center w-52">
<p class="text-sm font-bold text-primary-foreground leading-tight">
{prop.text}
</p>
{#if prop.subtext}
<p class="text-[10px] text-primary-foreground/70 leading-tight">
{prop.subtext}
</p>
{/if}
</div>
</button>
@@ -1,7 +1,7 @@
<script lang="ts">
import { DropdownMenu as DropdownMenuPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
import Check from 'lucide-svelte/icons/check';
import Minus from 'lucide-svelte/icons/minus';
import Check from '@lucide/svelte/icons/check';
import Minus from '@lucide/svelte/icons/minus';
import { cn } from '$lib/utils.js';
import type { Snippet } from 'svelte';
@@ -15,7 +15,7 @@
<DropdownMenuPrimitive.Item
bind:ref
class={cn(
'data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
'data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
inset && 'pl-8',
className
)}
@@ -1,6 +1,6 @@
<script lang="ts">
import { DropdownMenu as DropdownMenuPrimitive, type WithoutChild } from 'bits-ui';
import Circle from 'lucide-svelte/icons/circle';
import Circle from '@lucide/svelte/icons/circle';
import { cn } from '$lib/utils.js';
let {
@@ -1,6 +1,6 @@
<script lang="ts">
import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
import ChevronRight from 'lucide-svelte/icons/chevron-right';
import ChevronRight from '@lucide/svelte/icons/chevron-right';
import { cn } from '$lib/utils.js';
let {
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import { cn } from '$lib/utils';
import { Heart } from 'lucide-svelte';
import { Heart } from '@lucide/svelte';
interface Sparkle {
id: string;
-150
View File
@@ -1,150 +0,0 @@
<script lang="ts">
import ezppLogo from '../../../../assets/logo.png';
import { osudirect } from '@/api/osudirect';
import { gameSounds } from '@/utils';
import { BeatmapDecoder } from 'osu-parsers';
import { onMount } from 'svelte';
type logoProps = {
beatmapId: number;
extended: boolean;
onclick: () => void;
};
let { beatmapId, extended, onclick }: logoProps = $props();
let hovered = $state(false);
let bpm = $state(150); // 1000 * 60 / bpm
let lastTimeout: number | undefined = undefined;
onMount(async () => {
gameSounds.preload();
const beatmapData = await osudirect.osu(beatmapId);
if (beatmapData) {
const decoder = new BeatmapDecoder();
const beatmap = decoder.decodeFromString(beatmapData);
console.log(beatmap);
const audio = new Audio(`https://osu.direct/api/media/audio/${beatmapId}`);
audio.volume = 0.3;
// Function to play the heartbeat sound
const playHeartbeat = () => {
gameSounds.play('menuHeartbeat', {
volume: hovered ? 1 : 0.3,
});
};
// Function to synchronize the heartbeat with the song
const syncHeartbeat = () => {
const currentTime = audio.currentTime * 1000 - 25; // Convert to milliseconds
const timingPoint = beatmap.controlPoints.timingPointAt(currentTime);
const timingPointTime = timingPoint.startTime;
console.log(currentTime, timingPointTime);
if (timingPoint && bpm !== timingPoint.bpm) {
bpm = timingPoint.bpm;
if (lastTimeout) window.clearTimeout(lastTimeout);
const interval = (1000 * 60) / bpm; // Interval in milliseconds
const nextBeat = currentTime % interval; // Invert: time since last beat
// Schedule the next heartbeat at the correct time
lastTimeout = window.setTimeout(() => {
playHeartbeat();
// Clear any previous interval
if (lastTimeout) {
window.clearInterval(lastTimeout);
lastTimeout = undefined;
}
if (!lastTimeout) lastTimeout = window.setInterval(playHeartbeat, interval);
}, nextBeat);
}
// Continue syncing
requestAnimationFrame(syncHeartbeat);
};
// Wait for audio to be ready before starting playback and syncing
audio.addEventListener('canplay', async () => {
audio.addEventListener('play', syncHeartbeat);
audio.addEventListener('ended', async () => await audio.play());
await audio.play();
syncHeartbeat();
});
}
});
</script>
<div
class="w-screen {extended
? hovered
? '-translate-y-1 scale-100'
: '-translate-y-1 scale-90'
: hovered
? 'translate-y-5 scale-150'
: 'translate-y-5 scale-125'} transition-transform select-none"
>
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="logo-animation relative w-44 h-44 mx-auto cursor-pointer"
onmouseenter={() => (hovered = true)}
onmouseleave={() => (hovered = false)}
onclick={() => {
if (extended) {
gameSounds.play('menuBack');
} else {
gameSounds.play('menuHit');
}
onclick();
}}
>
<img
class="absolute pulse-logo"
style="animation-duration: {(1000 * 60) / bpm}ms;"
src={ezppLogo}
alt="logo-pulse"
/>
<img
class="absolute main-logo"
style="animation-duration: {(1000 * 60) / bpm}ms;"
src={ezppLogo}
alt="logo"
/>
</div>
</div>
<style lang="scss">
.logo-animation {
.pulse-logo {
animation: 0.5s 0.2s infinite forwards beat-pulse;
}
.main-logo {
animation: 0.5s infinite forwards beat;
}
}
@keyframes beat {
0%,
100% {
scale: 1;
}
90% {
scale: 1.08;
}
}
@keyframes beat-pulse {
0%,
10% {
scale: 0.5;
opacity: 0.5;
filter: blur(0px);
}
100% {
scale: 1.4;
opacity: 0;
filter: blur(2px);
}
}
</style>
@@ -7,17 +7,26 @@
let { smoothCursor = true }: { smoothCursor?: boolean } = $props();
const VELOCITY_WINDOW_MS = 16;
const SPEED_THRESHOLD = 9;
const REQUIRED_CONSECUTIVE = 3;
let mouseX = $state(0);
let mouseY = $state(0);
let lastMouseX = $state(0);
let lastMouseY = $state(0);
let lastMouseX = 0;
let lastMouseY = 0;
let isMouseDown = $state(false);
let isHoveringInteractive = $state(false);
let dragStartX = $state(0);
let dragStartY = $state(0);
let dragStartX = 0;
let dragStartY = 0;
let degrees = $state(0);
let applyRotation = $state(false);
let lastVelocityTime = 0;
let consecutiveHighSpeed = 0;
let velocityAccumX = 0;
let velocityAccumY = 0;
function isInteractive(el: Element | null): boolean {
while (el) {
const tag = el.tagName.toLowerCase();
@@ -25,12 +34,11 @@
const computed = getComputedStyle(el);
if (
['button', 'a', 'input', 'select', 'textarea', 'label', 'option'].includes(tag) ||
(role && ['button', 'link', 'checkbox', 'combobox'].includes(role)) ||
(role && ['button', 'link', 'checkbox', 'combobox', 'menuitem', 'option'].includes(role)) ||
computed.cursor === 'pointer'
) {
return true;
}
el = el.parentElement;
}
return false;
@@ -43,17 +51,32 @@
const deltaX = e.pageX - window.pageXOffset - dragStartX;
const deltaY = e.pageY - window.pageYOffset - dragStartY;
const velocityX = mouseX - lastMouseX;
const velocityY = mouseY - lastMouseY;
velocityAccumX += mouseX - lastMouseX;
velocityAccumY += mouseY - lastMouseY;
const dist = Math.sqrt(velocityX * velocityX + velocityY * velocityY);
const now = performance.now();
const dt = now - lastVelocityTime;
if (!applyRotation && isMouseDown && dist > 80) applyRotation = true;
if (dt >= VELOCITY_WINDOW_MS) {
const speed = Math.sqrt(velocityAccumX ** 2 + velocityAccumY ** 2) / dt;
if (speed > SPEED_THRESHOLD) {
consecutiveHighSpeed++;
if (!applyRotation && isMouseDown && consecutiveHighSpeed >= REQUIRED_CONSECUTIVE) {
applyRotation = true;
}
} else {
consecutiveHighSpeed = 0;
}
velocityAccumX = 0;
velocityAccumY = 0;
lastVelocityTime = now;
}
let newDegrees = (Math.atan2(-deltaX, deltaY) * 180) / Math.PI + 24.3;
let diff = (newDegrees - degrees) % 360;
if (diff < -180) diff += 360;
if (diff > 180) diff -= 360;
@@ -67,26 +90,18 @@
isHoveringInteractive = isInteractive(el);
if (!isMouseDown) {
if (isHoveringInteractive) {
animate(cursorAdditive, {
opacity: 1,
duration: 800,
ease: (t: number) => (t - 1) ** 5 + 1,
});
} else {
animate(cursorAdditive, {
opacity: 0,
duration: 800,
ease: (t: number) => (t - 1) ** 5 + 1,
});
}
animate(cursorAdditive, {
opacity: isHoveringInteractive ? 1 : 0,
duration: 800,
ease: (t: number) => (t - 1) ** 5 + 1,
});
}
animate(cursor, {
duration: smoothCursor ? $cursorSmoothness : 0,
translateX: mouseX,
translateY: mouseY - 50,
ease: (t: number) => (t - 1) ** 5 + 1,
translateY: mouseY,
ease: (t: number) => t === 1 ? 1 : 1 - Math.pow(2, -10 * t),
});
animate(cursor, {
@@ -107,6 +122,11 @@
dragStartX = event.clientX;
dragStartY = event.clientY;
velocityAccumX = 0;
velocityAccumY = 0;
consecutiveHighSpeed = 0;
lastVelocityTime = performance.now();
isMouseDown = true;
animate(cursorInner, {
scale: 0.9,
@@ -124,6 +144,10 @@
const handleMouseUp = () => {
isMouseDown = false;
applyRotation = false;
consecutiveHighSpeed = 0;
velocityAccumX = 0;
velocityAccumY = 0;
animate(cursorInner, {
scale: 1,
duration: 500,
@@ -0,0 +1,150 @@
<script lang="ts">
// Props
let { children, class: className = '', topOffset = 0 } = $props();
let wrapper: HTMLDivElement;
let container: HTMLDivElement;
let thumb: HTMLDivElement;
// Thumb state
let thumbHeight = $state(20);
let thumbTop = $state(0);
// Drag state
let dragging = false;
let startY = 0;
let startScroll = 0;
/** Update thumb height & position */
function updateScrollbar() {
if (!container) return;
const { scrollTop, scrollHeight, clientHeight } = container;
const scrollable = scrollHeight - clientHeight;
if (scrollable <= 0) {
thumbHeight = 0;
thumbTop = 0;
return;
}
thumbHeight = Math.max((clientHeight / scrollHeight) * clientHeight, 24);
const trackHeight = clientHeight - thumbHeight - topOffset;
thumbTop = (scrollTop / scrollable) * trackHeight;
}
/** Start dragging the thumb */
function startDrag(e: PointerEvent) {
dragging = true;
startY = e.clientY;
startScroll = container.scrollTop;
thumb.setPointerCapture(e.pointerId);
}
/** Drag the thumb */
function drag(e: PointerEvent) {
if (!dragging) return;
const delta = e.clientY - startY;
const { scrollHeight, clientHeight } = container;
const scrollable = scrollHeight - clientHeight;
const trackHeight = clientHeight - thumbHeight - topOffset;
container.scrollTop = startScroll + (delta / trackHeight) * scrollable;
}
/** End dragging */
function endDrag(e: PointerEvent) {
dragging = false;
thumb.releasePointerCapture(e.pointerId);
}
// Reactive effect to update scrollbar
$effect(() => updateScrollbar());
// ResizeObserver for dynamic content
$effect(() => {
if (!container) return;
const observer = new ResizeObserver(updateScrollbar);
observer.observe(container);
return () => observer.disconnect();
});
</script>
<div class="wrapper" bind:this={wrapper}>
<!-- Scrollable content -->
<div
class={`content ${className}`}
bind:this={container}
onscroll={updateScrollbar}
id="scrollable-content"
>
{@render children?.()}
</div>
<!-- Custom scrollbar -->
<div class="scrollbar" style="top: {topOffset}px;">
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="thumb"
bind:this={thumb}
onpointerdown={startDrag}
onpointermove={drag}
onpointerup={endDrag}
onpointercancel={endDrag}
aria-controls="scrollable-content"
style="height:{thumbHeight}px; transform:translateY({thumbTop}px);"
></div>
</div>
</div>
<style>
.wrapper {
position: relative;
height: 100%;
width: 100%;
}
/* Scrollable content */
.content {
height: 100%;
overflow-y: auto;
overflow-x: hidden;
scrollbar-width: none; /* Firefox */
}
.content::-webkit-scrollbar {
display: none; /* Chrome, Safari, Edge */
}
/* Scrollbar track */
.scrollbar {
position: absolute;
right: 2px;
bottom: 0;
width: 8px;
background: transparent;
border-radius: 999px;
}
/* Thumb */
.thumb {
position: absolute;
width: 100%;
background: var(--color-theme-700);
border-radius: 999px;
cursor: grab;
transition: background 0.15s;
}
.thumb:active {
cursor: grabbing;
background: var(--color-theme-600);
}
.thumb:hover {
background: var(--color-theme-700);
}
</style>
@@ -17,7 +17,7 @@
bind:ref
{value}
class={cn(
'data-[highlighted]:bg-primary-800/30 data-[highlighted]:text-accent-foreground relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
'data-[highlighted]:bg-primary data-[highlighted]:text-primary-foreground relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
className
)}
{...restProps}
@@ -0,0 +1,21 @@
<script lang="ts">
import { createElement } from 'react';
import { createRoot } from 'react-dom/client';
import type { SileoOptions } from 'sileo';
let props: SileoOptions = $props();
let rootEl: HTMLElement;
$effect(() => {
const root = createRoot(rootEl);
import('sileo').then(({ Toaster }) => {
const sileo = createElement(Toaster, { ...props });
root.render(sileo);
});
return () => root.unmount();
});
</script>
<div bind:this={rootEl}></div>
+7
View File
@@ -0,0 +1,7 @@
import Root from './switch.svelte';
export {
Root,
//
Root as Switch,
};
@@ -0,0 +1,27 @@
<script lang="ts">
import { Switch as SwitchPrimitive, type WithoutChildrenOrChild } from 'bits-ui';
import { cn } from '$lib/utils.js';
let {
ref = $bindable(null),
class: className,
checked = $bindable(false),
...restProps
}: WithoutChildrenOrChild<SwitchPrimitive.RootProps> = $props();
</script>
<SwitchPrimitive.Root
bind:ref
bind:checked
class={cn(
'focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-input peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
className
)}
{...restProps}
>
<SwitchPrimitive.Thumb
class={cn(
'bg-background pointer-events-none block size-5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0'
)}
/>
</SwitchPrimitive.Root>
+131 -37
View File
@@ -1,13 +1,13 @@
<script lang="ts">
import Minimize from 'lucide-svelte/icons/minus';
import Close from 'lucide-svelte/icons/x';
import Logo from '$assets/logo.png';
import Minimize from '@lucide/svelte/icons/minus';
import Close from '@lucide/svelte/icons/x';
import Volume2 from '@lucide/svelte/icons/volume-2';
import { getCurrentWindow } from '@tauri-apps/api/window';
import { onMount } from 'svelte';
import { launcherVersion } from '@/global';
import Badge from '../badge/badge.svelte';
import { custom_theme_audio_playing, custom_theme_volume } from '@/global';
import { reduceAnimations, userSettings } from '@/userSettings';
import { Volume, Volume1, VolumeOff } from '@lucide/svelte';
onMount(() => {
const appWindow = getCurrentWindow();
@@ -19,32 +19,93 @@
});
</script>
<div data-tauri-drag-region class="titlebar z-[60] border-b border-theme-800/90">
<div
class="mr-auto ms-2 flex flex-row gap-2 items-center text-[1.05rem] font-semibold pointer-events-none"
>
<img src={Logo} alt="EZPP Launcher Logo" class="h-11 w-11 inline-block" />
<span>EZPPLauncher</span>
<Badge class="!text-[0.6rem] py-[0.5px] bg-primary-500 hover:bg-primary-500"
>{$launcherVersion}</Badge
>
<div data-tauri-drag-region class="titlebar z-[100]">
{#if $custom_theme_audio_playing}
{#if $custom_theme_audio_playing}
<div class="relative flex items-center justify-center group">
<div class="relative flex items-center justify-center p-1 cursor-pointer">
<div
class="absolute inset-0 bg-background rounded
scale-80 opacity-0
group-hover:opacity-100
group-hover:scale-100
{$reduceAnimations ? '' : 'transition-all duration-200 ease-out'}"
></div>
{#if $custom_theme_volume > 0.7}
<Volume2 class="z-10 pointer-events-none" size={14} />
{:else if $custom_theme_volume >= 0.15}
<Volume1 class="z-10 pointer-events-none" size={14} />
{:else if $custom_theme_volume > 0}
<Volume class="z-10 pointer-events-none" size={14} />
{:else}
<VolumeOff class="z-10 pointer-events-none" size={14} />
{/if}
</div>
<div
class="absolute top-full right-0 translate-x-[7px]
opacity-0 invisible pointer-events-none -translate-y-2
group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto group-hover:translate-y-0
{$reduceAnimations ? '' : 'transition-all duration-200 ease-out'}
z-50"
>
<div class="h-2 w-full"></div>
<div
class="flex items-center justify-center h-[120px] w-[35px]
bg-black/20 backdrop-blur-sm border border-white/10 rounded-xl"
>
<input
type="range"
min="0"
max="1"
step="0.01"
bind:value={$custom_theme_volume}
on:input={() => {
$userSettings.value('volume').set($custom_theme_volume);
$userSettings.save();
}}
class="volume-slider"
/>
</div>
</div>
</div>
{/if}
{/if}
<div class="relative flex items-center justify-center p-1 group" id="titlebar-minimize">
<div
class="absolute inset-0 bg-background rounded
scale-80 opacity-0
group-hover:opacity-100
group-hover:scale-100
{$reduceAnimations ? '' : 'transition-all duration-200 ease-out'}
origin-center"
></div>
<Minimize class="z-10 pointer-events-none" size={14} />
</div>
<div class="titlebar-button rounded-lg transition-colors duration-75" id="titlebar-minimize">
<Minimize size={18} />
</div>
<div class="titlebar-button close rounded-lg transition-colors duration-75" id="titlebar-close">
<Close size={18} />
<div class="relative flex items-center justify-center p-1 group" id="titlebar-close">
<div
class="absolute inset-0 bg-red-500 rounded
scale-80 opacity-0
group-hover:opacity-100
group-hover:scale-100
{$reduceAnimations ? '' : 'transition-all duration-200 ease-out'}
origin-center"
></div>
<Close class="z-10 pointer-events-none" size={14} />
</div>
</div>
<style lang="scss">
.titlebar {
height: 50px;
/* background: #040612; */
height: 35px;
user-select: none;
display: flex;
justify-content: flex-end;
gap: 10px;
gap: 5px;
align-items: center;
position: fixed;
top: 0;
@@ -52,21 +113,54 @@
right: 0;
margin-bottom: 10px;
padding-right: 5px;
pointer-events: all !important;
pointer-events: auto;
}
.titlebar-button {
display: inline-flex;
justify-content: center;
align-items: center;
width: 40px;
height: 40px;
user-select: none;
-webkit-user-select: none;
.volume-slider {
appearance: none;
-webkit-appearance: none;
width: 100px; /* becomes vertical */
height: 6px;
background: transparent;
cursor: pointer;
transform: rotate(-90deg);
}
.titlebar-button:hover {
&.close {
background: #c22e2e;
}
background: #2d3049;
/* track */
.volume-slider::-webkit-slider-runnable-track {
height: 6px;
background: rgba(255, 255, 255, 0.25);
border-radius: 999px;
}
/* thumb */
.volume-slider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 14px;
height: 14px;
background: white;
border-radius: 50%;
border: none;
margin-top: -4px; /* center thumb */
}
/* Firefox */
.volume-slider::-moz-range-track {
height: 6px;
background: rgba(255, 255, 255, 0.25);
border-radius: 999px;
}
.volume-slider::-moz-range-thumb {
width: 14px;
height: 14px;
background: white;
border-radius: 50%;
border: none;
}
</style>
+4 -2
View File
@@ -44,8 +44,7 @@ export class Config {
this.encrypt && this.crypto ? this.crypto.decrypt(fileStream) : fileStream
) as Record<string, unknown>;
this.config = decryptedJSON;
} catch (err) {
console.log(err);
} catch {
this.config = {};
await this.save();
}
@@ -69,6 +68,9 @@ export class Config {
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;
},
+12 -11
View File
@@ -1,20 +1,21 @@
export function estimateRefreshRate(): Promise<number> {
export async function estimateFrameRate(): Promise<number> {
return new Promise((resolve) => {
const last = performance.now();
let frames = 0;
const samples: number[] = [];
let last = performance.now();
function loop() {
const tick = () => {
const now = performance.now();
frames++;
samples.push(now - last);
last = now;
if (now - last >= 1000) {
console.log(`Estimated Refresh Rate: ${frames - 2} FPS`);
resolve(frames - 2); // estimated Hz
if (samples.length < 60) {
requestAnimationFrame(tick);
} else {
requestAnimationFrame(loop);
const avgDelta = samples.reduce((a, b) => a + b) / samples.length;
resolve(Math.round(1000 / avgDelta));
}
}
};
requestAnimationFrame(loop);
requestAnimationFrame(tick);
});
}
+60
View File
@@ -0,0 +1,60 @@
import { listen } from '@tauri-apps/api/event';
import { onDestroy } from 'svelte';
type TauriDragDropEvent = {
paths: string[];
position: { x: number; y: number };
};
export const useDropZone = ({ onDrop }: { onDrop: (paths: string[]) => void }) => {
let element = $state<HTMLDivElement | null>(null);
let dragIn = $state(false);
let isDraggingOverApp = $state(false);
const isOver = (x: number, y: number) => {
if (!element) return false;
const el = document.elementFromPoint(x, y);
return element === el || element.contains(el); // ← fix
};
const dropUnlisten = listen<TauriDragDropEvent>('tauri://drag-drop', (e) => {
const { x, y } = e.payload.position;
if (isOver(x, y)) {
onDrop(e.payload.paths);
}
dragIn = false;
isDraggingOverApp = false;
});
const overUnlisten = listen<TauriDragDropEvent>('tauri://drag-over', (e) => {
const { x, y } = e.payload.position;
isDraggingOverApp = true;
dragIn = isOver(x, y);
});
const leaveUnlisten = listen('tauri://drag-leave', () => {
dragIn = false;
isDraggingOverApp = false;
});
onDestroy(async () => {
(await dropUnlisten)();
(await overUnlisten)();
(await leaveUnlisten)();
});
return {
get ref() {
return element;
},
set ref(el: HTMLDivElement | null) {
element = el;
},
get dragIn() {
return dragIn;
},
get isDraggingOverApp() {
return isDraggingOverApp;
},
};
};
+17 -2
View File
@@ -3,7 +3,9 @@ import { ezppfarm } from './api/ezpp';
import type { Component } from 'svelte';
import Loading from '../screens/Loading.svelte';
import type { Release } from './types';
import type { Theme } from './themes';
import { browser } from '$app/environment';
import { setGlobalVolume } from './utils';
export const currentView = writable<Component>(Loading);
export const platform = writable<string>('');
@@ -14,6 +16,8 @@ export const newVersion = writable<Release | undefined>(undefined);
export const launcherStreams = writable<string[]>(['stable']);
export const launcherStream = writable<string>('stable');
export const trackingEnabled = writable<boolean>(false);
export const discordPresence = writable<boolean>(false);
export const presenceLoading = writable<boolean>(false);
@@ -22,6 +26,16 @@ export const currentLoadingInfo = writable<string>('Initializing...');
export const firstStartup = writable<boolean>(false);
export const launching = writable<boolean>(false);
export const custom_themes = writable<Theme[]>([]);
export const custom_theme_container = writable<HTMLElement | undefined>(undefined);
export const active_custom_theme = writable<Theme | undefined>(undefined);
export const custom_theme_audio_playing = writable<boolean>(false);
export const custom_theme_volume = writable<number>(0.15);
custom_theme_volume.subscribe((val) => {
if (browser) {
setGlobalVolume(val);
}
});
export const serverPing = writable<number | undefined>(undefined);
export const serverConnectionFails = writable(0);
@@ -29,7 +43,8 @@ export const serverConnectionFails = writable(0);
export const onlineFriends = writable<number | undefined>(undefined);
export const beatmapSets = writable<number | undefined>(undefined);
export const skins = writable<number | undefined>(undefined);
export const skinsCount = writable<number | undefined>(undefined);
export const skins = writable<{ name: string; author: string | undefined; modified: number }[]>([]);
export const osuStream = writable<string | undefined>(undefined);
export const osuBuild = writable<string | undefined>(undefined);
+55 -47
View File
@@ -3,22 +3,28 @@ import type { UpdateFile, UpdateStatus } from './types';
import { listen } from '@tauri-apps/api/event';
import { betterFetch } from '@better-fetch/fetch';
const updateUrl = 'https://next.ez-pp.farm/api/ezpplauncher';
const updateUrl = 'https://ez-pp.farm/api/ezpplauncher';
export const getHWID = async () => {
const hwid = await invoke('get_hwid');
return typeof hwid === 'string' ? hwid : undefined;
};
export function normalizeOsuName(name: string): string {
return (
name
.trim()
// Remove leading symbols/spaces
.replace(/^[^a-zA-Z0-9]+/, '')
// Normalize spacing
.replace(/\s+/g, ' ')
.toLowerCase()
);
}
export const isValidOsuFolder = async (folder: string): Promise<boolean> => {
const result = await invoke('valid_osu_folder', { folder });
return typeof result === 'boolean' ? result : false;
};
export const getHWID = async (): Promise<string | undefined> =>
await invoke<string | undefined>('get_hwid');
export const autoDetectOsuInstallFolder = async () => {
const result = await invoke('find_osu_installation');
return typeof result === 'string' ? result : undefined;
};
export const isValidOsuFolder = async (folder: string): Promise<boolean | undefined> =>
await invoke<boolean | undefined>('valid_osu_folder', { folder });
export const autoDetectOsuInstallFolder = async () =>
await invoke<string | undefined>('find_osu_installation');
export const setUserConfigValues = async (
osuFolderPath: string,
@@ -38,36 +44,23 @@ export const setConfigValues = async (
entries,
});
export const getReleaseStream = async (folder: string) => {
const result = await invoke('get_osu_release_stream', { folder });
return typeof result === 'string' ? result : undefined;
};
export const getReleaseStream = async (folder: string): Promise<string | undefined> =>
await invoke<string | undefined>('get_osu_release_stream', { folder });
export const getVersion = async (folder: string) => {
const result = await invoke('get_osu_version', { folder });
return typeof result === 'string' ? result : undefined;
};
export const getVersion = async (folder: string): Promise<string | undefined> =>
await invoke<string | undefined>('get_osu_version', { folder });
export const getBeatmapSetsCount = async (folder: string) => {
const result = await invoke('get_beatmapsets_count', {
export const getBeatmapSetsCount = async (folder: string): Promise<number | undefined> =>
await invoke<number | undefined>('get_beatmapsets_count', {
folder,
});
return typeof result === 'number' ? result : 0;
};
export const getSkinsCount = async (folder: string) => {
const result = await invoke('get_skins_count', {
folder,
});
return typeof result === 'number' ? result : 0;
};
export const getSkin = async (folder: string) => {
const result = await invoke('get_osu_skin', {
const result = await invoke<string | undefined>('get_osu_skin', {
folder,
});
return typeof result === 'string' ? result : 'Default';
return result || 'Default';
};
export const runUpdater = async (folder: string) => await invoke('run_osu_updater', { folder });
@@ -82,7 +75,6 @@ export const getEZPPLauncherStreams = async () => {
if (!resp.error) {
return resp.data.streams;
}
return undefined;
};
@@ -109,8 +101,8 @@ export const downloadEZPPLauncherUpdateFiles = async (
allFiles: UpdateFile[],
progressCallback: (file: UpdateStatus) => void
) => {
const downloadStatusListen = await listen('download-progress', (event) =>
progressCallback(event.payload as UpdateStatus)
const downloadStatusListen = await listen<UpdateStatus>('download-progress', (event) =>
progressCallback(event.payload)
);
try {
await invoke('download_ezpp_launcher_update_files', { folder, updateFiles, allFiles });
@@ -123,18 +115,34 @@ export const replaceUIFiles = async (folder: string, revert: boolean) => {
await invoke('replace_ui_files', { folder, revert });
};
export const isOsuRunning = async () => {
const result = await invoke('is_osu_running');
return typeof result === 'boolean' ? result : false;
};
export const isOsuRunning = async (): Promise<boolean> => await invoke<boolean>('is_osu_running');
export const getLauncherVersion = async () => await invoke<string>('get_launcher_version');
export const exit = async () => await invoke('exit');
export const getPlatform = async () => await invoke<string>('get_platform');
export const isOsuCorrupted = async (folder: string) =>
export const getPlatform = async (): Promise<string> => await invoke<string>('get_platform');
export const isOsuCorrupted = async (folder: string): Promise<boolean> =>
await invoke<boolean>('check_for_corruption', { folder });
export const hasWMCTRL = async () => await invoke<boolean>('has_wmctrl');
export const hasOsuWinello = async () => await invoke<boolean>('has_osuwinello');
export const hasNet8 = async () => await invoke<boolean>('has_net8');
export const encryptString = async (str: string, entropy: string) =>
export const hasWMCTRL = async (): Promise<boolean> => await invoke<boolean>('has_wmctrl');
export const hasOsuWinello = async (): Promise<boolean> => await invoke<boolean>('has_osuwinello');
export const hasNet8 = async (): Promise<boolean> => await invoke<boolean>('has_net8');
export const encryptString = async (str: string, entropy: string): Promise<string> =>
await invoke<string>('encrypt_string', { string: str, entropy });
export const downloadUpdate = async (
url: string,
progressCallback: (file: UpdateStatus) => void
) => {
const downloadStatusListen = await listen('download-progress', (event) =>
progressCallback(event.payload as UpdateStatus)
);
try {
await invoke<string>('download_ezpp_launcher_update', { url });
} finally {
downloadStatusListen();
}
};
export const installUpdate = async () => await invoke('install_ezpp_launcher_update');
export const getSkins = async (folder: string) =>
await invoke<{ name: string; author: string | undefined; modified: number }[] | undefined>(
'get_skins',
{ folder }
);
+2
View File
@@ -16,4 +16,6 @@ export const updateStatus = async (status: {
});
export const updateUser = async (user: { username: string; id?: string | null }) =>
await invoke('presence_update_user', { user: { username: user.username, id: user.id } });
export const updateButton = async (button: { text?: string; url?: string }) =>
await invoke('presence_update_button', { button: button });
export const isConnected = async () => await invoke<boolean>('presence_is_connected');
+24
View File
@@ -0,0 +1,24 @@
const specialOrder = "'-!#$%&(),;@[]^_`{}~+=";
const priority = Object.fromEntries([...specialOrder].map((c, i) => [c, i]));
const osuSkinsCollator = new Intl.Collator(undefined, {
numeric: true,
sensitivity: 'base',
});
export const sortSkins = (
skins: { name: string; author: string | undefined; modified: number }[]
) =>
skins.sort((a, b) => {
const pa = priority[a.name[0]];
const pb = priority[b.name[0]];
if (pa !== undefined || pb !== undefined) {
if (pa === undefined) return 1;
if (pb === undefined) return -1;
return pa - pb;
}
return osuSkinsCollator.compare(a.name, b.name);
});
+545
View File
@@ -0,0 +1,545 @@
import * as path from '@tauri-apps/api/path';
import * as fs from '@tauri-apps/plugin-fs';
import { convertFileSrc } from '@tauri-apps/api/core';
import { active_custom_theme, custom_themes } from './global';
import { calculateGitBlobSha, setGlobalVolume } from './utils';
import { betterFetch } from '@better-fetch/fetch';
import zip from 'jszip';
import { SemVer } from 'semver';
export type Theme = {
folder_name: string;
name: string;
version: string;
author: string;
scriptUrl: string;
assets: string;
preview: string;
status: 'installed' | 'downloading' | 'extracting' | 'deleting' | 'not-installed';
progress: number;
updateAvailable: boolean;
};
export type ThemeInfo = {
name: string;
version: string;
apiVersion: string;
author: string;
entry: string;
style: string;
preview: string;
};
export const getDownloadableThemes = async () => {
const themes: Theme[] = [];
const downloadableThemes = await betterFetch<
{
name: string;
version: string;
author: string;
}[]
>('https://git.ez-pp.farm/EZPPFarm/EZPPLauncher-Themes/raw/branch/main/themes.json', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
},
});
if (downloadableThemes.data) {
for (const theme of downloadableThemes.data) {
themes.push({
folder_name: `${toSafeName(theme.name)}-${generateRandomString(16)}`,
name: theme.name,
version: theme.version,
author: theme.author,
scriptUrl: '',
assets: '',
preview: `https://git.ez-pp.farm/EZPPFarm/EZPPLauncher-Themes/raw/branch/main/previews/${toSafeName(theme.name)}.png`,
status: 'not-installed',
progress: 0,
updateAvailable: false,
});
}
} else {
console.error('Failed to fetch downloadable themes');
console.error(downloadableThemes.error);
}
return themes;
};
export const getThemes = async (): Promise<Theme[]> => {
const themes: Theme[] = [];
themes.push({
folder_name: 'default',
author: 'EZPPFarm',
name: 'Default',
version: '1.0.0',
scriptUrl: '',
assets: '',
preview: '',
status: 'installed',
progress: 0,
updateAvailable: false,
});
const folderPath = await path.join(await path.homeDir(), '.ezpplauncher', 'themes');
if (await fs.exists(folderPath)) {
const themeFolders = await fs.readDir(folderPath);
for (const themeFolder of themeFolders) {
const themeFolderPath = await path.join(folderPath, themeFolder.name);
const themeConfigFilePath = await path.join(folderPath, themeFolder.name, 'theme.json');
if (await fs.exists(themeConfigFilePath)) {
const themeConfig = await fs.readTextFile(themeConfigFilePath);
const theme = JSON.parse(themeConfig) as ThemeInfo;
const scriptFile = await path.join(folderPath, themeFolder.name, theme.entry);
if (await fs.exists(scriptFile)) {
themes.push({
folder_name: themeFolder.name,
name: theme.name,
version: theme.version,
author: theme.author,
scriptUrl: convertFileSrc(await path.normalize(`${themeFolderPath}/${theme.entry}`)),
assets: convertFileSrc(await path.normalize(`${themeFolderPath}/assets`)),
preview: convertFileSrc(
await path.normalize(`${themeFolderPath}/assets/${theme.preview}`)
),
status: 'installed',
progress: 0,
updateAvailable: false,
});
}
}
}
}
return themes;
};
function combineChunks(chunks: Uint8Array[], totalLength: number): Uint8Array {
const result = new Uint8Array(totalLength);
let offset = 0;
for (const chunk of chunks) {
result.set(chunk, offset);
offset += chunk.length;
}
return result;
}
export const downloadTheme = async (
theme: Theme,
force = false
): Promise<{ success: boolean; error?: string }> => {
if (theme.status !== 'not-installed' && !force) return { success: false };
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === theme.name);
if (matchedTheme) {
matchedTheme.status = 'downloading';
}
return themes;
});
const themeFileName = `${toSafeName(theme.name)}.ezpplauncher-theme`;
const themeContents = await betterFetch<{
file_contents: {
sha: string;
download_url: string;
};
}>(
`https://git.ez-pp.farm/api/v1/repos/EZPPFarm/EZPPLauncher-Themes/contents-ext/themes/${themeFileName}?ref=main`
);
if (themeContents.error) {
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === theme.name);
if (matchedTheme) {
matchedTheme.status = 'not-installed';
}
return themes;
});
return {
success: false,
error: themeContents.error.message ?? 'An unknown error occurred',
};
}
const downloadUrl = `https://git.ez-pp.farm/EZPPFarm/EZPPLauncher-Themes/raw/branch/main/themes/${themeFileName}`;
const downloadReq = await fetch(downloadUrl, {
method: 'GET',
headers: {
'User-Agent':
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
},
});
if (!downloadReq.ok || downloadReq.body === null) {
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === theme.name);
if (matchedTheme) {
matchedTheme.status = 'not-installed';
}
return themes;
});
return {
success: false,
error: 'Failed to download theme file.',
};
}
const total = Number(downloadReq.headers.get('content-length')) || 0;
const reader = downloadReq.body.getReader();
let received = 0;
const chunks = [];
while (true) {
const { done, value } = await reader.read();
if (done) break;
chunks.push(value);
received += value.length;
const progress = received / total;
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === theme.name);
if (matchedTheme) {
matchedTheme.progress = progress;
}
return themes;
});
}
const fileBuffer = combineChunks(chunks, total);
const sha = calculateGitBlobSha(Buffer.from(fileBuffer));
if (sha !== themeContents.data.file_contents.sha) {
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === theme.name);
if (matchedTheme) {
matchedTheme.status = 'not-installed';
}
return themes;
});
return {
success: false,
error: 'Failed to verify downloaded theme file hash.',
};
}
//TODO: check file hash
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === theme.name);
if (matchedTheme) {
matchedTheme.status = 'extracting';
}
return themes;
});
const baseThemeFolder = await path.join(await path.homeDir(), '.ezpplauncher', 'themes');
const themeFolder = await path.join(baseThemeFolder, toSafeName(theme.name));
if (!(await fs.exists(baseThemeFolder))) await fs.mkdir(baseThemeFolder, { recursive: true });
if (!(await fs.exists(themeFolder))) await fs.mkdir(themeFolder, { recursive: true });
const zipFile = await zip.loadAsync(fileBuffer);
const totalFiles = Object.keys(zipFile.files).length;
let extractedFiles = 0;
for (const zipEntry of Object.keys(zipFile.files)) {
const file = zipFile.file(zipEntry);
if (file) {
try {
const fileData = await file.async('uint8array');
const filePath = await path.join(themeFolder, zipEntry);
const dirPath = await path.dirname(filePath);
if (!(await fs.exists(dirPath))) await fs.mkdir(dirPath, { recursive: true });
await new Promise((res) => setTimeout(res, 250));
await fs.writeFile(filePath, fileData);
extractedFiles++;
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === theme.name);
if (matchedTheme) {
matchedTheme.progress = extractedFiles / totalFiles;
}
return themes;
});
} catch (err) {
console.log(err);
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === theme.name);
if (matchedTheme) {
matchedTheme.status = 'not-installed';
}
return themes;
});
return {
success: false,
error: 'Failed to extract theme file.',
};
}
}
}
const themeInfo = await fs.readTextFile(await path.join(themeFolder, 'theme.json'));
const themeInfoObj = JSON.parse(themeInfo) as ThemeInfo;
const themeScriptUrl = convertFileSrc(
await path.normalize(`${themeFolder}/${themeInfoObj.entry}`)
);
const themeAssets = convertFileSrc(await path.normalize(`${themeFolder}/assets`));
const themePreview = convertFileSrc(
await path.normalize(`${themeFolder}/assets/${themeInfoObj.preview}`)
);
const downloadableThemes = await getDownloadableThemes();
custom_themes.update((themes) => {
const reloadedThemes = [...themes];
for (const theme of downloadableThemes) {
if (theme.name === 'Default') continue; // never overwrite Default from remote
if (!reloadedThemes.find((t) => t.name === theme.name)) {
reloadedThemes.push(theme);
}
const installedTheme = reloadedThemes.find((t) => t.name === theme.name);
if (installedTheme) {
const installedThemeVersion = new SemVer(installedTheme.version);
const downloadableThemeVersion = new SemVer(theme.version);
if (downloadableThemeVersion.compare(installedThemeVersion) > 0) {
installedTheme.updateAvailable = true;
const index = reloadedThemes.findIndex((t) => t.name === theme.name);
reloadedThemes[index] = installedTheme;
}
}
}
for (const installedTheme of reloadedThemes) {
if (installedTheme.name === 'Default') continue; // never touch Default
if (installedTheme.name === theme.name) {
installedTheme.name = themeInfoObj.name;
installedTheme.author = themeInfoObj.author;
installedTheme.version = themeInfoObj.version;
installedTheme.scriptUrl = themeScriptUrl;
installedTheme.assets = themeAssets;
installedTheme.preview = themePreview;
installedTheme.status = 'installed';
}
}
return reloadedThemes.sort((a, b) => {
if (a.name === 'Default') return -1;
if (b.name === 'Default') return 1;
if (a.status === 'installed' && b.status !== 'installed') return -1;
if (a.status !== 'installed' && b.status === 'installed') return 1;
return a.name.localeCompare(b.name);
});
});
return {
success: true,
};
};
export const loadTheme = async (theme: Theme, themeContainer: HTMLElement, volume = 0.15) => {
active_custom_theme.set(theme);
themeContainer.innerHTML = '';
if (theme.scriptUrl.length > 0) {
const themeScript = await import(/* @vite-ignore */ theme.scriptUrl);
themeScript.mountTheme(themeContainer, { assets: theme.assets });
}
setGlobalVolume(volume);
};
export const deleteTheme = async (themeToUninstall: Theme) => {
if (themeToUninstall.status !== 'installed') return false;
const baseThemeFolder = await path.join(await path.homeDir(), '.ezpplauncher', 'themes');
if (!(await fs.exists(baseThemeFolder))) return false;
const themeFolder = await path.join(baseThemeFolder, themeToUninstall.folder_name);
if (!(await fs.exists(themeFolder))) return false;
custom_themes.update((themes) => {
const matchedTheme = themes.find((t) => t.name === themeToUninstall.name);
if (matchedTheme) {
matchedTheme.status = 'deleting';
}
return themes;
});
await fs.remove(themeFolder, { recursive: true });
const downloadableThemes = await getDownloadableThemes();
custom_themes.update((themes) => {
const reloadedThemes = [...themes];
for (const theme of downloadableThemes) {
if (theme.name === themeToUninstall.name) {
const themeIndex = reloadedThemes.findIndex((t) => t.name === theme.name);
if (themeIndex) {
reloadedThemes.splice(themeIndex, 1);
reloadedThemes.push(theme);
}
}
const installedTheme = reloadedThemes.find((t) => t.name === theme.name);
if (installedTheme) {
const installedThemeVersion = new SemVer(installedTheme.version);
const downloadableThemeVersion = new SemVer(theme.version);
if (downloadableThemeVersion.compare(installedThemeVersion) > 0) {
installedTheme.updateAvailable = true;
const index = reloadedThemes.findIndex((t) => t.name === theme.name);
reloadedThemes[index] = installedTheme;
}
}
}
return reloadedThemes.sort((a, b) => {
if (a.name === 'Default') return -1;
if (b.name === 'Default') return 1;
if (a.status === 'installed' && b.status !== 'installed') return -1;
if (a.status !== 'installed' && b.status === 'installed') return 1;
return a.name.localeCompare(b.name);
});
});
return true;
};
export const checkThemeFromFile = async (filePath: string) => {
const normalizedFilePath = await path.normalize(filePath);
if (!(await fs.exists(normalizedFilePath))) {
return {
success: false,
error: 'File not found',
};
}
const fileBuffer = await fs.readFile(normalizedFilePath);
let themeInfo: ThemeInfo | undefined = undefined;
try {
const zipFile = await zip.loadAsync(fileBuffer);
const themeConfig = zipFile.file('theme.json');
if (!themeConfig) {
return {
success: false,
error: 'Theme config file not found',
};
}
const themeConfigData = await themeConfig.async('string');
themeInfo = JSON.parse(themeConfigData) as {
name: string;
version: string;
apiVersion: string;
author: string;
entry: string;
style: string;
preview: string;
};
} catch {
return {
success: false,
error: 'Could not read theme file',
};
}
return {
success: !!themeInfo,
themeInfo,
};
};
export const importThemeFromFile = async (themeName: string, filePath: string) => {
const baseThemeFolder = await path.join(await path.homeDir(), '.ezpplauncher', 'themes');
const themeFolder = await path.join(baseThemeFolder, toSafeName(themeName));
if (!(await fs.exists(baseThemeFolder))) await fs.mkdir(baseThemeFolder, { recursive: true });
if (!(await fs.exists(themeFolder))) await fs.mkdir(themeFolder, { recursive: true });
const fileBuffer = await fs.readFile(filePath);
const zipFile = await zip.loadAsync(fileBuffer);
for (const zipEntry of Object.keys(zipFile.files)) {
const file = zipFile.file(zipEntry);
if (file) {
try {
const fileData = await file.async('uint8array');
const filePath = await path.join(themeFolder, zipEntry);
const dirPath = await path.dirname(filePath);
if (!(await fs.exists(dirPath))) await fs.mkdir(dirPath, { recursive: true });
await new Promise((res) => setTimeout(res, 250));
await fs.writeFile(filePath, fileData);
} catch (err) {
console.log(err);
return {
success: false,
error: 'Failed to extract theme file.',
};
}
}
}
const themeInfo = await fs.readTextFile(await path.join(themeFolder, 'theme.json'));
const themeInfoObj = JSON.parse(themeInfo) as ThemeInfo;
const themeScriptUrl = convertFileSrc(
await path.normalize(`${themeFolder}/${themeInfoObj.entry}`)
);
const themeAssets = convertFileSrc(await path.normalize(`${themeFolder}/assets`));
const themePreview = convertFileSrc(
await path.normalize(`${themeFolder}/assets/${themeInfoObj.preview}`)
);
const downloadableThemes = await getDownloadableThemes();
custom_themes.update((themes) => {
const reloadedThemes = [...themes];
for (const theme of downloadableThemes) {
if (theme.name === 'Default') continue; // never overwrite Default from remote
if (!reloadedThemes.find((t) => t.name === theme.name)) {
reloadedThemes.push(theme);
}
const installedTheme = reloadedThemes.find((t) => t.name === theme.name);
if (installedTheme) {
const installedThemeVersion = new SemVer(installedTheme.version);
const downloadableThemeVersion = new SemVer(theme.version);
if (downloadableThemeVersion.compare(installedThemeVersion) > 0) {
installedTheme.updateAvailable = true;
const index = reloadedThemes.findIndex((t) => t.name === theme.name);
reloadedThemes[index] = installedTheme;
}
}
}
for (const installedTheme of reloadedThemes) {
if (installedTheme.name === 'Default') continue; // never touch Default
if (installedTheme.name === themeName) {
installedTheme.name = themeInfoObj.name;
installedTheme.author = themeInfoObj.author;
installedTheme.version = themeInfoObj.version;
installedTheme.scriptUrl = themeScriptUrl;
installedTheme.assets = themeAssets;
installedTheme.preview = themePreview;
installedTheme.status = 'installed';
}
}
return reloadedThemes.sort((a, b) => {
if (a.name === 'Default') return -1;
if (b.name === 'Default') return 1;
if (a.status === 'installed' && b.status !== 'installed') return -1;
if (a.status !== 'installed' && b.status === 'installed') return 1;
return a.name.localeCompare(b.name);
});
});
return {
success: true,
};
};
export const toSafeName = (name: string) => {
return (
name
.toLowerCase()
.replace(/[<>:"/\\|?*]/g, '_')
// eslint-disable-next-line no-control-regex
.replace(/[\x00-\x1F\x7F]/g, '_')
.replace(/[\s-]+/g, '_')
.replace(/_+/g, '_')
.replace(/[. ]+$/g, '_')
);
};
const generateRandomString = (length: number) => {
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
return Array.from({ length }, () =>
characters.charAt(Math.floor(Math.random() * characters.length))
).join('');
};
+34
View File
@@ -0,0 +1,34 @@
declare global {
const umami: Umami;
}
/**
* @see {@link https://umami.is/docs/tracker-functions|Umami Docs}
*/
interface Umami {
track(): Promise<string> | undefined;
track(event_name: string, event_data?: Record<string, unknown>): Promise<string> | undefined;
track(custom_payload: { website: string; [key: string]: unknown }): Promise<string> | undefined;
track(
callback: (props: {
hostname: string;
language: string;
referrer: string;
screen: string;
title: string;
url: string;
website: string;
}) => { website: string; [key: string]: unknown }
): Promise<string> | undefined;
/** Pass in your own ID to identify a user. */
identify(identity_id: string): Promise<void>;
/** Save data about the current session. */
identify(identity_id: string, data: Record<string, unknown>): Promise<void>;
/** To save data without a unique ID, pass in only a JSON object. */
identify(data: Record<string, unknown>): Promise<void>;
}
export {};
+110 -1
View File
@@ -1,6 +1,8 @@
import { invoke } from '@tauri-apps/api/core';
import { type ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import { custom_theme_audio_playing } from './global';
import * as crypto from 'crypto-js';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
@@ -44,7 +46,6 @@ export const formatTimeReadable = (initialSeconds: number) => {
};
export const releaseStreamToReadable = (releaseStream: string) => {
console.log(releaseStream.replaceAll(' ', '').toLowerCase());
if (releaseStream.replaceAll(' ', '').toLowerCase() === 'cuttingedge') return 'Cutting Edge';
return 'Stable';
};
@@ -100,3 +101,111 @@ export const urlIsValidImage = async (url: string) => {
return false;
}
};
export function toURL(data: Buffer, type: string) {
return URL.createObjectURL(new Blob([new Uint8Array(data)], { type }));
}
export function setGlobalVolume(volume: number) {
const mediaElements: NodeListOf<HTMLMediaElement> = document.querySelectorAll('audio, video');
mediaElements.forEach((element) => {
element.volume = volume;
});
}
export function fadeGlobalVolume(
volumeFrom: number,
volumeTo: number,
duration: number,
onDone?: () => void
) {
const mediaElements: NodeListOf<HTMLMediaElement> = document.querySelectorAll('audio, video');
const startTime = performance.now();
function animate() {
const currentTime = performance.now();
const elapsedTime = currentTime - startTime;
const progress = Math.min(elapsedTime / duration, 1);
const interpolatedVolume = volumeFrom + (volumeTo - volumeFrom) * progress;
mediaElements.forEach((element) => {
element.volume = interpolatedVolume;
});
if (progress < 1) {
requestAnimationFrame(animate);
} else {
if (onDone) onDone();
}
}
animate();
}
export const pauseGlobalMedia = () => {
const mediaElements: NodeListOf<HTMLMediaElement> = document.querySelectorAll('audio, video');
mediaElements.forEach((element) => element.pause());
};
export const resumeGlobalMedia = () => {
const mediaElements: NodeListOf<HTMLMediaElement> = document.querySelectorAll('audio, video');
mediaElements.forEach((element) => element.play());
};
export const setCurrentTimeGlobalMedia = (time: number) => {
const mediaElements: NodeListOf<HTMLMediaElement> = document.querySelectorAll('audio, video');
mediaElements.forEach((element) => (element.currentTime = time));
};
export function trackMediaContainer(node: HTMLElement) {
const media = new Set<HTMLMediaElement>();
function update() {
custom_theme_audio_playing.set(Array.from(media).some((el) => !el.paused));
}
function register(el: HTMLMediaElement) {
media.add(el);
const handler = () => update();
el.addEventListener('play', handler);
el.addEventListener('pause', handler);
return () => {
media.delete(el);
el.removeEventListener('play', handler);
el.removeEventListener('pause', handler);
};
}
// find existing media inside the div
node.querySelectorAll<HTMLMediaElement>('video, audio').forEach(register);
const observer = new MutationObserver((mutations) => {
for (const m of mutations) {
m.addedNodes.forEach((n) => {
if (n instanceof HTMLMediaElement) register(n);
if (n instanceof HTMLElement) {
n.querySelectorAll<HTMLMediaElement>('video, audio').forEach(register);
}
});
}
});
observer.observe(node, { childList: true, subtree: true });
return {
destroy() {
observer.disconnect();
},
};
}
export function calculateGitBlobSha(fileBuffer: Buffer): string {
const header = Buffer.from(`blob ${fileBuffer.length}\0`);
const store = Buffer.concat([header, fileBuffer]);
return crypto.SHA1(crypto.lib.WordArray.create(store)).toString(crypto.enc.Hex);
}

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