Compare commits

..

504 Commits

Author SHA1 Message Date
MathieuG-P 0511540b98 bumb version 2023-03-23 21:19:34 +01:00
MathieuG-P dcb233c957 bumb version 2023-03-20 22:24:32 +01:00
MathieuG-P 804cb22f56 [hotfix] fix wrong order of to link folders 2023-03-20 22:23:20 +01:00
MathieuG-P 00e4059213 Merge pull request #191 from Zagrios/hotfix/move-if-no-version-use-link-when-unlink
[hotfix] move instead of copy if no other version use the linked folder
2023-03-20 22:17:36 +01:00
MathieuG-P 83fcbf6d04 [hotfix] move instead of copy if no other version use the linked folder 2023-03-20 22:16:38 +01:00
MathieuG-P 420ecc9ae6 delete useless console log 2023-03-20 00:51:14 +01:00
MathieuG-P 835e9a0678 Merge pull request #190 from Zagrios/hotfix/fix-create-empty-backup-if-target-folder-not-exist-when-linking
[hotfix] When link folder, if folder not exist, not create empty backup
2023-03-20 00:47:31 +01:00
MathieuG-P e1a6721f7d [hotfix] When link folder, if folder not exist, not create empty backup 2023-03-20 00:46:40 +01:00
MathieuG-P 2e588ef4cb Merge pull request #189 from Zagrios/hotfix/not-clone-link-content-when-clone-version
[hotfix] when clonning, contents of linked folder no longer duplicate
2023-03-20 00:31:05 +01:00
MathieuG-P d3e0099d14 [hotfix] When clone version, copy junction link and not copy their content 2023-03-20 00:29:21 +01:00
MathieuG-P b9acdc9578 Merge pull request #187 from Zagrios/hotfix/log-renderer-errors
[hotfix] log renderer errors
2023-03-18 15:38:14 +01:00
MathieuG-P fefd552f60 [hotfix] log renderer errors 2023-03-18 15:37:48 +01:00
MathieuG-P 6eb2866eee Merge pull request #186 from Zagrios/hotfix/older-mod-overwrite-latest-mod-on-install
[hotfix] older mod overwrite latest version of installed mod
2023-03-18 15:22:07 +01:00
MathieuG-P 01401c4691 [hotfix] older mod overwrite latest version of installed mod 2023-03-18 15:10:38 +01:00
MathieuG-P 37c2bfcd04 delete console log 2023-03-18 14:45:05 +01:00
MathieuG-P e190217390 Merge pull request #185 from Zagrios/hotfix/add-beta-alpha-indicator
[hotfix] add beta alpha indicator
2023-03-18 14:17:21 +01:00
MathieuG-P 5fa7013106 [hotfix] add beta alpha indicator 2023-03-18 14:16:36 +01:00
MathieuG-P abf53489f5 Merge pull request #183 from GaetanGrd/master
Reactivate Support for BSM
2023-03-17 21:13:46 +01:00
Gaëtan Gerard 0db13a8474 enable support button + update support link 2023-03-17 17:44:39 +01:00
Gaëtan Gerard e1229a45a0 Adding Support button 2023-03-17 17:41:47 +01:00
Gaëtan Gerard eafe26507a Merge pull request #1 from Zagrios/master
rebase
2023-03-17 17:40:02 +01:00
MathieuG-P 5c70a7d974 bumb version 2023-03-15 16:24:16 +01:00
MathieuG-P da8bae8582 Merge pull request #182 from Zagrios/hotfix/steamvr-restore-conflict-on-fast-bs-reboot
[hotfix] steamvr restoration conflict on fast bs reboot
2023-03-15 16:23:44 +01:00
MathieuG-P 4cce24e275 [hotfix] clear timeout on steamvr restoration 2023-03-15 16:22:02 +01:00
MathieuG-P 18f2f18e41 Merge pull request #181 from Zagrios/feature/disable-steamvr-when-desktop-mode
Feature/disable steamvr when desktop mode
2023-03-14 00:28:37 +01:00
MathieuG-P ec3c6ce26e fix vbs regidit not find script 2023-03-14 00:26:53 +01:00
MathieuG-P 9862dfa78d force not launch steamvr when desktop mode 2023-03-13 23:55:22 +01:00
MathieuG-P e3f91ea593 Merge pull request #180 from Zagrios/hotfix/backup-userdata-on-link
[hotfix] create backup of userdata folder when linking
2023-03-13 15:34:37 +01:00
MathieuG-P 509b2cd9b9 [hotfix] create backup of userdata folder when linking 2023-03-13 15:33:39 +01:00
MathieuG-P 1b54d86324 bumb version 2023-03-13 01:55:58 +01:00
MathieuG-P 425b2ecdb1 Merge pull request #179 from Zagrios/feature/custom-launch-options/177
feature/custom-launch-options/177
2023-03-13 01:36:22 +01:00
MathieuG-P 3b973e1597 [feature-177] add possibility to add additional arguments 2023-03-13 01:34:51 +01:00
MathieuG-P 86d2781e67 [feature-177] remove useless stuff in settings 2023-03-13 01:33:25 +01:00
MathieuG-P 5d10f139a9 Merge pull request #176 from Zagrios/feature/share-custom-folders/155
feature/share-custom-folders/155
2023-03-12 21:32:34 +01:00
MathieuG-P 9b5a1711ce share custom folder finished 2023-03-12 03:58:51 +01:00
MathieuG-P 646ec820a5 [feature-155] start share folder ui 2023-03-08 01:13:13 +01:00
MathieuG-P a144a308f6 Merge pull request #175 from Zagrios/bugfix/color-selection-overlapp-when-scroll/174
[bugfix-174] pass color chooser form fixed to absolute position
2023-03-06 23:57:47 +01:00
MathieuG-P 07818cf8f2 [bugfix-174] pass color chooser form fixed to absolute position 2023-03-06 23:55:24 +01:00
MathieuG-P ccbcc8296d change oculus mode description 2023-03-04 22:38:58 +01:00
MathieuG-P bea435439e remove console log 2023-03-04 22:17:08 +01:00
MathieuG-P d9ff78c21d Merge pull request #171 from Zagrios/bugfix/light-theme-issues/168
[bugfix-168] fix light theme issues
2023-03-04 22:15:03 +01:00
MathieuG-P 14a4bf3408 [bugfix-168] fix light theme issues 2023-03-04 22:02:58 +01:00
MathieuG-P 172d7e4578 Merge pull request #170 from Zagrios/hotfix/dotnet-notif-not-appear-sometimes
Hotfix/dotnet notif not appear sometimes
2023-03-04 21:48:18 +01:00
MathieuG-P 5986cf7a15 [hotfix] change methode to check dotnet 6 2023-03-04 21:18:51 +01:00
MathieuG-P a5e4b745ef fix dotnet notif not appear sometimes 2023-03-04 19:28:01 +01:00
MathieuG-P 4cd538fe21 Merge pull request #169 from Zagrios/feature/volume-control/154
feature/volume-control/154
2023-03-04 13:42:34 +01:00
MathieuG-P c406dfee79 [feature-154] volume slider finished 2023-03-04 13:41:48 +01:00
MathieuG-P 8a168d20b3 [feature] sound control in title bar 2023-03-03 23:59:57 +01:00
MathieuG-P b16f7150e8 [feature] add volume control 2023-03-03 01:46:28 +01:00
MathieuG-P c4319f1c6c Merge pull request #167 from Zagrios/hotfix/use-apply-translation
[hotfix] use apply translation
2023-03-03 00:17:34 +01:00
MathieuG-P d9003fa07b [hotfix] use apply translation 2023-03-03 00:15:33 +01:00
MathieuG-P eb2235e017 Merge pull request #166 from Zagrios/bugfix/change-oculus-mode-description/162
[bugfix] change oculus mode description
2023-03-02 09:30:16 +01:00
MathieuG-P 1e784c243b [bugfix] change oculus mode description 2023-03-02 09:20:18 +01:00
MathieuG-P 23e9b52af2 [hotfix] we dont remeber steam session anymore 2023-03-02 00:47:16 +01:00
MathieuG-P e42ac4eca3 bumb version 2023-03-02 00:41:32 +01:00
MathieuG-P 622595a7a0 Merge pull request #165 from Zagrios/bugfix/mods-three-dots-menu-glitch-when-no-mods/152
[bugfix] fix mods menu glitch when no mods
2023-03-02 00:38:42 +01:00
MathieuG-P 556ca1b1e6 fix mods menu glitch when no mods 2023-03-02 00:37:47 +01:00
MathieuG-P cef4f22305 Merge pull request #164 from Zagrios/feature/add-credentials-informations
[FEATURE] add credentials informations
2023-03-02 00:20:24 +01:00
MathieuG-P ee1dd7b21f add credentials informations 2023-03-02 00:19:06 +01:00
MathieuG-P 487b73a859 Merge pull request #161 from Zagrios/bugfix/maps-loding-optimization/144
[bugfix] maps loding optimization (partial)
2023-03-01 23:28:49 +01:00
MathieuG-P a56fdde0e7 add log + use allSettled 2023-03-01 23:26:48 +01:00
MathieuG-P 99f91d25c3 Merge branch 'master' of https://github.com/Zagrios/bs-manager 2023-03-01 21:54:45 +01:00
MathieuG-P 8579b0697d nothing 2023-03-01 21:54:41 +01:00
MathieuG-P f0761c8359 Merge pull request #160 from Zagrios/hotfix/pause-song-on-map-preview
[hotfix] pause song on map preview
2023-03-01 21:44:27 +01:00
MathieuG-P b1833721d0 pause song on map preview 2023-03-01 21:43:07 +01:00
MathieuG-P aba099e15a Merge pull request #159 from Zagrios/hotfix/cant-enable-oculus-mode-with-desktop-mode
[hotfix] cant-enable-oculus-mode-with-desktop-mode
2023-03-01 21:34:08 +01:00
MathieuG-P d25c0cced5 [hotfix] cant-enable-oculus-mode-with-desktop-mode 2023-03-01 21:33:09 +01:00
MathieuG-P bc4f6304db Merge pull request #158 from Zagrios/hotfix/output-console-not-show-with-debug-mode
[hotfix] open debug console when launch BS with debug mode
2023-03-01 21:04:26 +01:00
MathieuG-P 4357454b14 [hotfix] open debug console when launch BS with debug mode 2023-03-01 21:02:06 +01:00
MathieuG-P 528abbcaa3 Merge pull request #153 from legoandmars/master
Change 'Mod' -> 'Mode' in english launch options
2023-03-01 13:23:46 +01:00
legoandmars 9bcc605e00 Change 'Mod' -> 'Mode' 2023-02-28 16:43:04 -08:00
MathieuG-P f7e3b9ae9d Merge pull request #151 from Zagrios/bugfix/bug-header-of-maps-tab-not-translated/150
bugfix/fix-shared-maps-page-title-not-translated/150
2023-03-01 01:07:25 +01:00
MathieuG-P 1b963a99c1 fix shared maps page title not translated 2023-03-01 01:05:55 +01:00
MathieuG-P 363cc3cc5e reduce maps loading by 40% from micro optimization 2023-03-01 00:52:42 +01:00
MathieuG-P 8307a975ea bumb version 2023-02-28 23:39:48 +01:00
MathieuG-P f5ecdfca60 Merge pull request #149 from Zagrios/hotfix/error-download-version-space-in-path
[HOTFIX] fix error when space in path when download a version
2023-02-28 23:38:36 +01:00
MathieuG-P 5bb92d804b fix erreur when space in path when download a version 2023-02-28 23:37:40 +01:00
MathieuG-P 5b4b962015 Merge branch 'master' of https://github.com/Zagrios/bs-manager 2023-02-28 19:17:38 +01:00
MathieuG-P b43cfdd70b add 1.28.0 2023-02-28 19:17:35 +01:00
MathieuG-P 77350a823e Merge pull request #146 from Zagrios/feature/readme-update
Feature/readme update
2023-02-28 11:14:08 +01:00
MathieuG-P 5844aea281 Update FUNDING.yml 2023-02-28 11:12:34 +01:00
Gaëtan Gerard 8af5d8c3e4 Remove BSM Support 2023-02-28 09:58:00 +01:00
Gaëtan Gerard f0f3721ec5 Merge pull request #145 from Zagrios/master
rebase
2023-02-28 09:57:24 +01:00
MathieuG-P 5641c25cc1 bumb version 2023-02-24 01:12:46 +01:00
MathieuG-P c1b32c2fc3 Merge pull request #143 from Zagrios/hotfix/little-fix-en-translation
[HOTFIX] fix unlink maps EN translation
2023-02-24 01:10:58 +01:00
MathieuG-P dc70d2889f fix unlink maps EN translation 2023-02-24 01:10:15 +01:00
MathieuG-P 6b2879d9dc bumb version 2023-02-21 01:39:17 +01:00
MathieuG-P 19e842d721 Merge pull request #142 from Zagrios/hotfix/oneclick-map-not-install-map-in-unlinked-versions
hotfix/oneclick-map-not-install-map-in-unlinked-versions
2023-02-21 01:29:43 +01:00
MathieuG-P 8d28c3cfc8 oneclick map not install map in unlinked versions 2023-02-21 01:28:42 +01:00
MathieuG-P baec206bf3 Merge pull request #141 from Zagrios/bugfix/oneclick-not-work-when-no-versions/139
bugfix/oneclick-not-work-when-no-versions/139
2023-02-21 01:03:23 +01:00
MathieuG-P 3aacd7575b fix oneclick map not work when no BS versions intalled 2023-02-21 01:00:39 +01:00
MathieuG-P d739245e70 Merge pull request #140 from Zagrios/bugfix/ram-usage-maps-list/138
bugfix/ram-usage-maps-list/138
2023-02-21 00:43:56 +01:00
MathieuG-P c88d93b0ab maps optimisation finished + new ipc system + maps progress bars now accurate 2023-02-21 00:33:33 +01:00
MathieuG-P 64280509b0 huge maps deletion and export speed improvement + optimize map component update rate 2023-02-17 01:26:16 +01:00
MathieuG-P a7e81cfa8a virtual scroll maps list resize work 2023-02-16 00:30:23 +01:00
MathieuG-P 2620354888 init virtual scroll maps list 2023-02-15 00:50:49 +01:00
MathieuG-P 61a8790448 bumb version 2023-02-06 22:03:34 +01:00
MathieuG-P 5b4af58baa Merge pull request #135 from Zagrios/hotfix/remove-model-downloader-from-default-mods
hotfix/remove-model-download-from-default-mods
2023-02-06 21:43:42 +01:00
MathieuG-P 6cd3c65362 Merge pull request #134 from Zagrios/hotfix/disable-support-button
hotfix/disable-support-button
2023-02-06 21:41:59 +01:00
MathieuG-P 211a3b9a39 disable support button + fix button hightlight even if disabled + fix click exec even if disabled 2023-02-06 21:37:17 +01:00
MathieuG-P a4fd92a014 remove ModelDownload from default mods 2023-02-06 21:14:40 +01:00
Gaëtan Gerard 295d0f90ba Merge pull request #133 from Synaelle/patch-1
Correction d'orthographe
2023-02-02 21:49:29 +01:00
Synaelle 5592242963 Correction d'orthographe
J'ai corrigé la majorité des fautes que j'ai pu trouvé, ainsi que les problèmes de cohérence dans la mention du jeu. C'est à dire que des fois le jeu est appelé BeatSaber et des fois Beat Saber.
2023-02-02 15:12:47 +01:00
MathieuG-P 0212f3ba26 Merge pull request #132 from 0xAuthenticity/master
Update default-configuration.config.ts
2023-01-28 14:55:56 +01:00
0xAuthenticity 36521a2b1b Update default-configuration.config.ts 2023-01-28 02:23:42 -05:00
MathieuG-P 571a4f23ea re-enable web installer 2023-01-26 00:09:30 +01:00
MathieuG-P 2b9829d57a bumb version 2023-01-25 23:46:55 +01:00
MathieuG-P 2f6ea39f79 Merge pull request #131 from Zagrios/hotfix/file-verification-download-a-version
hotfix/file-verification-download-a-version
2023-01-25 23:45:11 +01:00
MathieuG-P 8e33214fd0 re-add file verification 2023-01-25 23:44:38 +01:00
MathieuG-P 310dfb94c2 Merge pull request #130 from Zagrios/hotfix/disable-web-installer-for-update
hotfix/disable-web-installer-for-update
2023-01-25 20:54:13 +01:00
MathieuG-P 39e2a54e1e Merge pull request #129 from Zagrios/bugfix/selected-effect-missing-available-versions/127
bugfix/selected-effect-missing-available-versions/127
2023-01-25 20:51:02 +01:00
MathieuG-P 829cace7b9 add selected in glowEffect condition 2023-01-25 20:29:08 +01:00
MathieuG-P e82afa7e22 disable web installer for auto update 2023-01-25 20:23:52 +01:00
MathieuG-P 5e64ce16f4 add web installer 2023-01-25 00:02:08 +01:00
MathieuG-P 2154d90759 Merge branch 'master' of https://github.com/Zagrios/bs-manager 2023-01-24 23:42:15 +01:00
MathieuG-P d889c85b4a bumb version 2023-01-24 23:42:12 +01:00
MathieuG-P cc4d033db2 Merge pull request #126 from Zagrios/hotfix/no-more-files-verification-from-available-versions-list
hotfix/no-more-files-verification-from-available-versions-list
2023-01-24 22:57:45 +01:00
MathieuG-P 1cfef9f607 no more verification in available versions list 2023-01-24 22:55:25 +01:00
MathieuG-P bbd26d1c12 Merge pull request #125 from Zagrios/hotfix/icon-cuts-white-with-stroke
hotfix/icon-cuts-white-with-stroke
2023-01-24 22:07:31 +01:00
MathieuG-P 72f0c22e88 add stroke to cuts and cuts are always white 2023-01-24 22:06:29 +01:00
Gaëtan Gerard 72daaeee0e Merge pull request #124 from Zagrios/master
Rebase branch
2023-01-24 09:26:10 +01:00
MathieuG-P 26765c45c7 bumb version 2023-01-23 02:21:36 +01:00
MathieuG-P 2afcaa46f9 Merge pull request #122 from Zagrios/feature/import-external-version/121
feature/import-external-version/121
2023-01-23 02:17:42 +01:00
MathieuG-P 3c5b2a2eed add loading maps 2023-01-23 02:15:52 +01:00
MathieuG-P 0ff8e865aa possibility to import version + cpu usage optimization 2023-01-23 00:56:49 +01:00
MathieuG-P 2d60acce51 update readme and add credits 2023-01-21 15:08:35 +01:00
MathieuG-P 53fb197585 Merge pull request #120 from Zagrios/feature/readme-update
Feature/readme update
2023-01-20 01:09:01 +01:00
Gaëtan Gerard 3c11f5a0a1 Update README.md 2023-01-20 00:47:41 +01:00
Gaëtan Gerard bef27b4ac5 Update README.md 2023-01-20 00:39:41 +01:00
Gaëtan Gerard 0d0cfa1b4e Update README.md 2023-01-20 00:35:44 +01:00
Gaëtan Gerard 286f4aa68d Update README.md
Co-authored-by: MathieuG-P <40181755+Zagrios@users.noreply.github.com>
2023-01-20 00:35:16 +01:00
Gaëtan Gerard 58f563ed61 Update README.md
Co-authored-by: MathieuG-P <40181755+Zagrios@users.noreply.github.com>
2023-01-20 00:32:33 +01:00
Gaëtan Gerard 523575e43c Update README.md
Co-authored-by: MathieuG-P <40181755+Zagrios@users.noreply.github.com>
2023-01-20 00:24:54 +01:00
Gaëtan Gerard 414017930e Update README.md
Co-authored-by: MathieuG-P <40181755+Zagrios@users.noreply.github.com>
2023-01-20 00:19:44 +01:00
Gaëtan Gerard 01550557fb Update README.md 2023-01-20 00:15:57 +01:00
Gaëtan Gerard cdfb957203 Update README.md 2023-01-20 00:10:07 +01:00
Shido c647099f60 remove "the tool" 2023-01-19 23:54:43 +01:00
Shido 8899017a37 Update README.md 2023-01-19 23:52:01 +01:00
Gaëtan Gerard c8b983fd76 Update README.md 2023-01-19 21:58:30 +01:00
Gaëtan Gerard 24ad6b6a1d Update README.md 2023-01-19 21:50:24 +01:00
Gaëtan Gerard ee9e23ef2c Update README.md 2023-01-19 21:39:17 +01:00
Gaëtan Gerard 3125009e80 Update README.md 2023-01-19 21:32:24 +01:00
Shido b23e211e11 remove (WIP) 2023-01-19 15:52:53 +01:00
Shido 2cc9b342b7 remove useless file 2023-01-19 15:50:55 +01:00
Shido 085a74a6b3 Merge branch 'feature/readme-update' of https://github.com/Zagrios/bs-manager into feature/readme-update 2023-01-19 15:49:22 +01:00
Shido f6159a863c fix BSM link 2023-01-19 15:49:20 +01:00
Gaëtan Gerard 4430138e77 Update README.md 2023-01-19 15:45:02 +01:00
Gaëtan Gerard 04eca2cbc0 "bot" -> "bottom" 2023-01-19 13:36:47 +01:00
Shido c8d47f8e67 Merge branch 'feature/readme-update' of https://github.com/Zagrios/bs-manager into feature/readme-update 2023-01-19 13:29:09 +01:00
Shido f7da6fdb63 fix link issue 2023-01-19 13:29:07 +01:00
Gaëtan Gerard 2466bb6d4c fix One Click .mov 2023-01-19 12:50:11 +01:00
Gaëtan Gerard 5f293e38b6 adding .mov for OneClick 2023-01-19 11:51:56 +01:00
Gaëtan Gerard 08ce0b1da3 fix .mov name 2023-01-18 22:19:36 +01:00
Gaëtan Gerard e12aa7e695 Adding .MOV 2023-01-18 22:16:35 +01:00
Shido c92a32a503 Improve readme 2023-01-18 22:14:18 +01:00
Shido 56fdfdca49 Merge branch 'feature/readme-update' of https://github.com/Zagrios/bs-manager into feature/readme-update 2023-01-18 02:17:33 +01:00
Shido b2510645e5 Improve readme 2023-01-18 02:17:32 +01:00
MathieuG-P b5a08584a0 bumb version 2023-01-17 23:02:45 +01:00
MathieuG-P 78568cd235 Merge pull request #118 from Zagrios/bugfix/can-clone-with-same-name/113
bugfix/can-clone-with-same-name/113
2023-01-17 22:58:25 +01:00
MathieuG-P 8e86d4a7c5 change versions file system 2023-01-17 22:57:43 +01:00
Gaëtan Gerard 6322ff2dd5 fix .mov 2023-01-17 21:47:26 +01:00
Shido 89c3b93ba6 manageVersions .mov test 2023-01-17 21:45:03 +01:00
Shido 580dea6b44 Update manageVersions preview 2023-01-17 21:39:27 +01:00
Shido b203adc66f fix preview 2023-01-17 21:29:17 +01:00
MathieuG-P 7a2639f772 Merge pull request #117 from Zagrios/bugfix/wrong-placement-tooltip-version/115
bugfix/wrong-placement-tooltip-version/115
2023-01-17 20:28:43 +01:00
MathieuG-P 535430d0c5 better version tooltip 2023-01-17 20:28:14 +01:00
Shido a0c9c88e0e Update preview 2023-01-17 20:13:11 +01:00
Shido 4b7610f39f fix tool name 2023-01-17 18:52:30 +01:00
Shido a06e903c5c adding "Customize your instances" in Table of contents 2023-01-17 00:10:37 +01:00
Shido f79f46269f Adding "One-Click" text 2023-01-17 00:08:53 +01:00
MathieuG-P b82ddc1c59 Merge pull request #110 from Zagrios/hotfix/fix-tab-navigation
hotfix/fix-tab-navigation
2023-01-16 21:24:02 +01:00
MathieuG-P f4dc6ab838 fix tab navigation 2023-01-16 21:23:28 +01:00
MathieuG-P 62dde63206 Merge pull request #109 from Zagrios/hotfix/improve-nav-bar-static-button
hotfix/improve-nav-bar-static-button
2023-01-16 20:58:24 +01:00
MathieuG-P 5c034013fe improve nav-bar static buttons 2023-01-16 20:57:38 +01:00
MathieuG-P 23717c15d1 Create SECURITY.md 2023-01-14 22:15:00 +01:00
MathieuG-P 09acc3ccaa bump version 2023-01-13 03:20:37 +01:00
MathieuG-P 7c3f4f6a64 Merge pull request #106 from Zagrios/hotfix/bsm-icon-black-spark-on-light-theme
hotfix/bsm-icon-black-spark-on-light-theme
2023-01-13 03:03:22 +01:00
MathieuG-P 8dc48b20cb black spark bsm icon on light theme 2023-01-13 03:02:16 +01:00
MathieuG-P 165b17e034 Merge pull request #105 from Zagrios/hotfix/redirect-on-available-versions-on-delete-uninstall-version
hotfix/redirect-on-available-versions-on-delete-uninstall-version
2023-01-13 02:54:29 +01:00
MathieuG-P 4255e2ad85 redirect on available versions page on uninstall last version 2023-01-13 02:54:03 +01:00
MathieuG-P 16b7c1ed76 Merge pull request #104 from Zagrios/bugfix/pending-and-download-button-overlap/99
bugfix/pending-and-download-button-overlap/99
2023-01-13 02:41:09 +01:00
MathieuG-P d179bde348 fix overlapping download button and pending spinner 2023-01-13 02:40:24 +01:00
MathieuG-P e2234b19ea Merge pull request #102 from Zagrios/bugfix/cant-manage-versions/101
fix error libsFolders not iterable
2023-01-13 01:01:12 +01:00
MathieuG-P 45259f304b fix error libsFolders not iterable 2023-01-13 00:59:11 +01:00
MathieuG-P 220c7940a8 Merge pull request #98 from Zagrios/feature/add-info-launch-mod/11
feature/add-info-launch-mod/11
2023-01-11 23:53:19 +01:00
MathieuG-P 9665dbcb4e add info to launch mod 2023-01-11 23:51:40 +01:00
Gaëtan 423a17070c update gif Mods 2023-01-11 20:47:13 +01:00
MathieuG-P 8d88b59e3d bump version 2023-01-10 22:19:24 +01:00
MathieuG-P ae9d1dfc9b Merge pull request #97 from Zagrios/bugfix/unglow-apply-when-no-filter-change/90
bugfix/unglow-apply-when-no-filter-change/90
2023-01-10 22:06:27 +01:00
MathieuG-P 6930df940f compare first and new filter to know if changes 2023-01-10 22:05:25 +01:00
MathieuG-P fd523f4017 Merge pull request #95 from Zagrios/bugfix/error-when-no-internet/87
bugfix/error-when-no-internet/87
2023-01-10 21:38:02 +01:00
MathieuG-P 4c8f903256 handle no internet for mods and maps 2023-01-10 21:37:26 +01:00
MathieuG-P d2ba6aadc1 Merge pull request #94 from Zagrios/bugfix/infinite-map-loading/91
bugfix/infinite-map-loading/91
2023-01-10 20:21:34 +01:00
MathieuG-P 0023066e32 add text when no maps found 2023-01-10 20:21:00 +01:00
MathieuG-P 39bcf63e3c Merge pull request #93 from Zagrios/bugfix/supporter-button-not-work/89
bugfix/supporter-button-not-work/89
2023-01-10 20:05:41 +01:00
MathieuG-P 656f32e755 fix supporters not open + add missing key 2023-01-10 20:05:07 +01:00
MathieuG-P f66279980b Merge pull request #92 from Zagrios/bugfix/map-preview-behind-maps-download/88
bugfix/map-preview-behind-maps-download/88
2023-01-10 19:58:15 +01:00
MathieuG-P 1f65841e62 fix iframe view z index + rename iframe view file 2023-01-10 19:57:39 +01:00
Gaëtan 0422e7fee8 add customize version section 2023-01-10 14:55:12 +01:00
Gaëtan 7fdf165d57 update gif manageVersion 2023-01-10 14:54:56 +01:00
Gaëtan 31d1b8536d test gif 2023-01-10 14:30:28 +01:00
Gaëtan Gerard 20ac0ef7da gif test loading 2023-01-10 14:10:07 +01:00
Gaëtan a72c849693 Update Gif manageVersion 2023-01-10 14:01:19 +01:00
Gaëtan 48f3bf53ca Remove RoadMap 2023-01-10 10:35:50 +01:00
Gaëtan e78a1189b0 Update Badge Shield 2023-01-10 10:35:12 +01:00
MathieuG-P 955d6420b3 bumb version 2023-01-09 20:31:11 +01:00
MathieuG-P f773e419d5 Merge pull request #86 from Zagrios/feature/switch-patreon-to-mee6/83
feature/switch-patreon-to-mee6/83
2023-01-09 20:26:48 +01:00
MathieuG-P 08bceff27a switch patreon to mee6 2023-01-09 20:25:04 +01:00
MathieuG-P aacf09aebc Merge pull request #85 from Zagrios/bugfix/settings-close-button-stuck/84
bugfix/settings-close-button-stuck/84
2023-01-09 19:53:42 +01:00
MathieuG-P 0ad02979e7 fix height 2023-01-09 19:53:03 +01:00
MathieuG-P b33839c7a2 Merge pull request #82 from Zagrios/feature/add-twitter-button/81
feature/add-twitter-button/81
2023-01-09 15:42:05 +01:00
MathieuG-P 4d5fca4b18 add twitter button 2023-01-09 15:37:43 +01:00
MathieuG-P 598049a49f Update CODE_OF_CONDUCT.md 2023-01-08 19:14:56 +01:00
MathieuG-P e0f9b44f4d Update FUNDING.yml 2023-01-08 19:13:11 +01:00
MathieuG-P 13ffd76459 Update CONTRIBUTING.md 2023-01-07 23:42:32 +01:00
MathieuG-P 5eae7eab10 Create CONTRIBUTING.md 2023-01-07 23:38:51 +01:00
MathieuG-P bc855990c8 Create CODE_OF_CONDUCT.md 2023-01-07 23:01:07 +01:00
MathieuG-P 55d643be1c Create pull_request_template.md 2023-01-07 22:40:01 +01:00
MathieuG-P 1e726be44d add funding 2023-01-07 00:54:05 +01:00
MathieuG-P 648ea4be67 Merge pull request #80 from Zagrios/feature/add-map-owned-indicator/34
feature/add-map-owned-indicator/34
2023-01-06 22:46:43 +01:00
MathieuG-P 030d70e5c3 Merge pull request #79 from Zagrios/hotfix/color-customization-not-work
hotfix/color-customization-not-work
2023-01-06 22:45:50 +01:00
MathieuG-P 4a7c47fb5c add owned indicator + remove useless props 2023-01-06 22:44:41 +01:00
MathieuG-P b404122960 repair on change functions 2023-01-06 22:23:01 +01:00
MathieuG-P 9d075d79c8 Merge pull request #78 from Zagrios/hotfix/fix-notification-strange-disappearing
hotfix/fix-notification-strange-disappearing
2023-01-06 18:12:20 +01:00
MathieuG-P 4e1847c12d fix strange disappearing 2023-01-06 18:11:05 +01:00
MathieuG-P de2f7882b3 Merge pull request #77 from Zagrios/feature/enable-all-oneclick-in-once/57
feature/enable-all-oneclicks/57
2023-01-06 16:52:48 +01:00
MathieuG-P 28b6241255 add select all to toogle oneClicks 2023-01-06 16:51:23 +01:00
MathieuG-P 3358efac88 Merge pull request #74 from Zagrios/feature/ux-toogle-oneclick/72
feature/ux-toogle-onclick/72
2023-01-05 22:38:24 +01:00
MathieuG-P c7069494a9 toogle oneclick on click list item 2023-01-05 22:37:38 +01:00
MathieuG-P b98826612b Merge pull request #73 from Zagrios/bugfix/shadow-hidden-notification-still-visible/71
bugfix/shadow-hidden-notification-still-visible/71
2023-01-05 22:07:41 +01:00
MathieuG-P 5ef8443217 shadow no longer visible after exit 2023-01-05 22:06:24 +01:00
MathieuG-P 5e03039633 Merge pull request #70 from Zagrios/hotfix/close-filter-on-apply
hotfix/close-filter-on-apply
2023-01-04 21:55:39 +01:00
MathieuG-P f13375ea40 Merge branch 'master' into hotfix/close-filter-on-apply 2023-01-04 21:55:06 +01:00
MathieuG-P b5d0a9156b Merge pull request #69 from Zagrios/hotfix/missing-translation-filter-panel
hotfix/missing-translation-filter
2023-01-04 21:52:43 +01:00
MathieuG-P 46e79baae6 close filter on apply 2023-01-04 21:47:43 +01:00
MathieuG-P 55e51461a7 add missing translation 2023-01-04 21:24:57 +01:00
MathieuG-P c086b805a9 change version 2023-01-04 20:51:01 +01:00
MathieuG-P ffaef60f9a Merge pull request #68 from Zagrios/hotfix/change-work-in-progress-text
hotfix/change-work-in-progress-text
2023-01-04 20:47:01 +01:00
MathieuG-P 556a217e41 work in progress to coming soon 2023-01-04 20:46:04 +01:00
MathieuG-P a91ccd49db Merge pull request #67 from Zagrios/feature/remember-choice-delete-map-modal/66
feature/remember-choice-delete-map-modal/66
2023-01-04 20:42:27 +01:00
MathieuG-P e42fffbee7 add remember choice option on delete single map 2023-01-04 20:40:41 +01:00
Gaëtan 1209d8e32a raneme tools 2023-01-04 05:17:06 +01:00
Gaëtan b89da81989 Update img and gif 2023-01-04 05:15:38 +01:00
MathieuG-P 171f17a7e0 Merge pull request #65 from Zagrios/bugfix/notification-not-disappear/56
bugfix/notification-not-disappear/56
2023-01-03 23:24:08 +01:00
MathieuG-P 149b5195ca change notification animation 2023-01-03 23:20:31 +01:00
MathieuG-P b10eb982cd Merge pull request #64 from Zagrios/bugfix/notifications-behind-maps-modal/61
bugfix/notifications-behind-maps-modal/61
2023-01-03 22:34:30 +01:00
MathieuG-P f44c4e66a0 change z indexes 2023-01-03 22:33:19 +01:00
MathieuG-P c99bdbb8d0 Merge pull request #63 from Zagrios/bugfix/map-above-filter-panel/60
bugfix/map-above-filter-panel/60
2023-01-03 22:18:20 +01:00
MathieuG-P ccc8c5c7c1 fix z index bug 2023-01-03 22:17:38 +01:00
MathieuG-P 8dbb39a001 Merge pull request #62 from Zagrios/bugfix/filter-too-complex-to-apply/59
bugfix/filter too complex to apply/59
2023-01-03 22:04:49 +01:00
MathieuG-P 80a6a2049e add optionnal apply button 2023-01-03 22:03:27 +01:00
MathieuG-P 9b62c27afa not used here but will be usefull 2023-01-03 22:02:55 +01:00
MathieuG-P 20ffd88a3a change version 2023-01-01 13:07:03 +01:00
MathieuG-P 0f0c114710 Merge pull request #55 from Zagrios/feature/Moving-config-file/27
Feature/moving config file/27
2023-01-01 10:06:30 +01:00
MathieuG-P b922c47fc2 config rework 2022-12-31 22:52:45 +01:00
MathieuG-P f0110dcbb8 remove config changes AND fix bug on clone version with linked maps 2022-12-31 22:51:55 +01:00
MathieuG-P ff0d5f535b Merge branch 'master' into feature/Moving-config-file/27 2022-12-31 20:40:41 +01:00
MathieuG-P 0f5ca9647d Merge pull request #54 from Zagrios/feature/dotnet-alert/53
[Feature] Alert if dotnet is not installed
2022-12-30 23:39:43 +01:00
MathieuG-P 1e26c366f8 too much warnings when connection is unstable 2022-12-30 23:36:02 +01:00
MathieuG-P 74aa8defae little tweak 2022-12-30 23:01:52 +01:00
MathieuG-P d013641e53 alert if dotnet not present 2022-12-30 23:01:32 +01:00
Gaëtan Gerard b0a5cbc74e Merge pull request #52 from Zagrios/master
merge master
2022-12-30 05:42:16 +01:00
Gaëtan a6d8bedde2 Improved consistency of text 2022-12-30 05:41:09 +01:00
Gaëtan e9824e86f4 fix one click 2022-12-30 05:39:05 +01:00
Gaëtan 220837d2fb remove <sumary> 2022-12-30 05:38:29 +01:00
Gaëtan 1bfdcb732a set icon to 250x250 2022-12-30 05:37:34 +01:00
Gaëtan 9865f91b6d fix link table of contents 2022-12-30 05:35:20 +01:00
Gaëtan 838b1b3b93 fix separator 2022-12-30 05:33:43 +01:00
Gaëtan 0f7a30992d Adding "how to install?" 2022-12-30 05:31:16 +01:00
Gaëtan 1c2c997b6b adding "Having problems?" 2022-12-30 05:28:59 +01:00
Gaëtan bbbaeb86d0 Update link + fix text 2022-12-30 05:17:52 +01:00
MathieuG-P 9ca9207e02 Merge pull request #51 from Zagrios/hotfix/remove-uwu-stuff
hotfix/remove useless uwu stuff
2022-12-29 23:53:49 +01:00
MathieuG-P 0ae11ddc8c remove useless uwu stuff 2022-12-29 23:52:59 +01:00
MathieuG-P a13c7313d6 Merge branch 'master' of https://github.com/Zagrios/bs-manager 2022-12-29 23:38:40 +01:00
MathieuG-P 804c2d7c19 add cert sha 2022-12-29 23:38:35 +01:00
MathieuG-P 1a58243141 Merge pull request #50 from Zagrios/feature/mods-disclaimer/44
feature/add-mods-disclaimer/44
2022-12-29 16:53:55 +01:00
MathieuG-P 574b1fe414 add mods disclaimer 2022-12-29 16:53:15 +01:00
MathieuG-P d127f3b6e7 Merge pull request #49 from Zagrios/hotfix/link-maps-by-default
hotfix/link-maps-by-default
2022-12-29 15:13:09 +01:00
MathieuG-P 2b14f52db9 just try to link maps after download a BS version 2022-12-29 15:10:48 +01:00
MathieuG-P 4143912ef2 Merge pull request #48 from Zagrios/feature/notification-enable-oneclick/47
feature/add-notification-to-enable-oneclick-if-not/47
2022-12-29 13:32:50 +01:00
MathieuG-P 45cbecb21e add notification to enable OneClicks if not 2022-12-29 12:22:35 +01:00
MathieuG-P a8189f28b5 Merge pull request #46 from Zagrios/feature/add-discord-button/43
feature/add-dicord-button/43
2022-12-29 11:10:38 +01:00
MathieuG-P d626ed67f9 add discord button in settings 2022-12-29 11:07:10 +01:00
Gaëtan Gerard 34921b166e Merge branch 'master' into Readme-Update 2022-12-29 06:05:15 +01:00
Gaëtan f9b10a1174 Update Discord Link 2022-12-29 06:03:05 +01:00
Gaëtan 6b20fa8f7b fix "roadmap" 2022-12-29 06:00:07 +01:00
Gaëtan bc5fb017cf change "Contributing" emplacement 2022-12-29 05:59:35 +01:00
Gaëtan Gerard ce82f53568 fix "Main Developer" and "Support Developer" 2022-12-29 05:56:31 +01:00
Gaëtan 4f5ef38d1b remove contact 2022-12-29 05:54:03 +01:00
Gaëtan 26e2ed5bbf remove License and acknowledgments 2022-12-29 05:52:45 +01:00
Gaëtan a5d42f3687 Add Contributing 2022-12-29 05:50:06 +01:00
Gaëtan 811e49327a Add Roadmap (wait img) 2022-12-29 05:49:32 +01:00
Gaëtan a8bb34c2d8 Adding all desct usage 2022-12-29 05:48:55 +01:00
Gaëtan 13b426eca6 test multilangue 2022-12-29 05:07:21 +01:00
MathieuG-P b1347b063d Merge pull request #42 from Zagrios/feature/improve-custom-version-design/9
feature/improve-custom-version-nav-bar-ui/9
2022-12-28 23:37:38 +01:00
MathieuG-P caaacf868a improve text sizing AND better tooltip 2022-12-28 23:32:33 +01:00
MathieuG-P 99cf6b8945 Merge pull request #41 from Zagrios/hotfix/light-theme-maps-management
hotfix/light theme maps management
2022-12-28 22:31:19 +01:00
MathieuG-P 2aa9d8afb5 implement light theme for maps-management 2022-12-28 22:30:28 +01:00
MathieuG-P 37dce9769e fix translation 2022-12-28 22:30:11 +01:00
MathieuG-P cdd6d77fc4 deep link enabler light theme 2022-12-28 21:48:27 +01:00
MathieuG-P 0ce21036a7 Merge pull request #40 from Zagrios/feature/swipe-notification-to-close/29
feature/swipe-notification-to-close/29
2022-12-28 21:43:50 +01:00
MathieuG-P f7fd662fef handle swipe to right to close notification 2022-12-28 21:40:55 +01:00
MathieuG-P 46687e5068 Merge pull request #39 from Zagrios/feature/add-splitter-under-versions-list/32
feature/add-splitter-under-versions-list/32
2022-12-28 20:52:42 +01:00
MathieuG-P 9c5cf5160a add spliter under versions and little css styles change 2022-12-28 20:51:12 +01:00
MathieuG-P d391e13f66 Merge pull request #38 from Zagrios/hotfix/install-version-process-was-not-killed
hotfix/fix get main window from windows service
2022-12-28 20:42:49 +01:00
MathieuG-P df166f3dd0 fix get main window from windows service 2022-12-28 20:39:11 +01:00
MathieuG-P 0cc5f8cbb1 Merge pull request #37 from Zagrios/feature/lunch-steam-from-bsm/20
feature/launch-steam-from-bsm/20
2022-12-28 20:31:51 +01:00
MathieuG-P 06622c4088 add button to lunch steam when steam is not running 2022-12-28 20:30:10 +01:00
MathieuG-P a8ca0b26b3 Merge pull request #36 from Zagrios/bugfix/outdated-mod-not-detected-as-outdated/28
bugfix/outdated mod not detected as outdate/28
2022-12-28 19:10:07 +01:00
MathieuG-P c15696a5b8 mod version properly comparated now 2022-12-28 19:05:27 +01:00
MathieuG-P 249caa1a82 Merge pull request #35 from Zagrios/feature/maps-management
feature/maps management
2022-12-28 18:46:37 +01:00
MathieuG-P fab45876bf nothing 2022-12-28 15:35:31 +01:00
MathieuG-P fdb381ca6c Merge branch 'master' into feature/maps-management 2022-12-28 15:34:23 +01:00
MathieuG-P 392d2656a3 fix on play map was selected 2022-12-28 15:06:32 +01:00
MathieuG-P 9ba8af438d fix styles 2022-12-28 14:54:34 +01:00
MathieuG-P 65b2a5c385 download maps button when no maps 2022-12-28 01:38:58 +01:00
MathieuG-P 61a3685d6c sanitize models filename 2022-12-27 00:50:15 +01:00
MathieuG-P a1aeab1d90 remove console logs and useless stuff 2022-12-27 00:11:29 +01:00
MathieuG-P 4cb9482e27 fix fake items in dropdown 2022-12-26 21:50:41 +01:00
MathieuG-P 5d62c6c0e9 download on double click PLUS little fixes 2022-12-26 21:23:10 +01:00
MathieuG-P 6bfe735b60 remove translate todos 2022-12-26 21:04:28 +01:00
MathieuG-P 7d919e9dcf remove force deeplink 2022-12-26 21:03:05 +01:00
MathieuG-P 4293fd9d1b missing return 2022-12-26 21:02:21 +01:00
MathieuG-P af69c821a7 add oneClick system notifications translations 2022-12-26 20:48:36 +01:00
MathieuG-P 36eca807ad add deep link notifications translations 2022-12-26 14:44:04 +01:00
MathieuG-P b217fcf9c0 better handle deep link error 2022-12-26 14:17:27 +01:00
MathieuG-P ef202e33ec add notification and system notification 2022-12-26 00:09:52 +01:00
MathieuG-P 89ac6077be update framer-motion 2022-12-25 22:43:41 +01:00
MathieuG-P 80412e536e no need types for uuid 2022-12-25 22:38:27 +01:00
MathieuG-P c8e4812967 use crypto api for uuid 2022-12-25 22:33:32 +01:00
MathieuG-P b9850effca fix duplicated key 2022-12-25 22:29:58 +01:00
MathieuG-P e9286822ab fix bad indentation 2022-12-25 22:25:06 +01:00
MathieuG-P 9d7cd708c7 deep-links models fully work AND add translations 2022-12-25 22:18:28 +01:00
MathieuG-P c674fce0c0 advancement on onclick install model AND fix circual dependency 2022-12-25 01:04:36 +01:00
MathieuG-P 2aed523480 advancement on oneClick model AND lazy loading react windows 2022-12-24 18:19:59 +01:00
MathieuG-P 7f5a297b87 fix link 2022-12-24 12:59:14 +01:00
MathieuG-P 6c5190eacb initiate model-saber support 2022-12-24 01:18:02 +01:00
MathieuG-P 6f6da723e7 fix delete maps not delete when version is not linked 2022-12-23 22:03:12 +01:00
MathieuG-P b9fda11d34 clean unsubscribe 2022-12-23 21:54:54 +01:00
MathieuG-P 2931b58276 clean 2022-12-23 21:53:07 +01:00
MathieuG-P 68fd4111ad window not closing at the end 2022-12-23 21:52:54 +01:00
MathieuG-P 698eab012f we can now enable deep links for playlists 2022-12-23 21:52:34 +01:00
MathieuG-P e18caca70f one click install playlist working 2022-12-23 00:29:15 +01:00
MathieuG-P d556350eef advencement on oneclick playlists 2022-12-22 00:57:06 +01:00
MathieuG-P 16aa65afed create one click install playlist window 2022-12-20 17:38:45 +01:00
MathieuG-P 7e10d28d28 advence on oneclic playlist 2022-12-20 15:57:26 +01:00
MathieuG-P 58faea04a3 start playlists management 2022-12-20 03:00:51 +01:00
MathieuG-P ee95df202d move maps service 2022-12-20 00:20:37 +01:00
MathieuG-P bd2038cc79 fix warning 2022-12-19 23:58:29 +01:00
MathieuG-P 31183473ab add todo 2022-12-19 23:57:58 +01:00
MathieuG-P 605a383963 fix object desctory when oneClick window close 2022-12-19 03:38:06 +01:00
MathieuG-P 802d0533c8 disable force deep-link 2022-12-19 02:46:23 +01:00
MathieuG-P a886ccb981 tweak log 2022-12-19 02:44:47 +01:00
MathieuG-P b8abe30e39 fix white border AND little tweak 2022-12-19 02:41:12 +01:00
MathieuG-P b8e2bb73f5 increase speed fake progress bar 2022-12-19 02:40:11 +01:00
MathieuG-P 714837286f handle deepLink from score saber AND try fix white border 2022-12-19 01:55:20 +01:00
MathieuG-P a786be653c remove console log 2022-12-19 01:54:50 +01:00
MathieuG-P bdfb7a156f oneclick install map from bsv now work 2022-12-18 03:41:53 +01:00
MathieuG-P c626b850c9 handle enable and disable map deep links 2022-12-17 01:24:37 +01:00
Gaëtan 5a5d31f9ac corretif timestamp 2022-12-13 22:25:23 +01:00
Gaëtan 16db775379 github is broken 2022-12-13 22:24:32 +01:00
Gaëtan b2f76d7aaa change and separe data config.json 2022-12-13 22:21:35 +01:00
Gaëtan Gerard 383f065d1b corretif 1.27 2022-12-13 22:19:18 +01:00
Gaëtan Gerard 3216eddde6 add 1.27 2022-12-13 22:18:30 +01:00
Gaëtan 77ab238863 Config congiguration.service.ts 2022-12-13 11:05:12 +01:00
MathieuG-P ca5c86dbf1 create sevice to manage deep links 2022-12-12 23:35:57 +01:00
Gaëtan 9fbf81f8f2 init change 2022-12-12 22:14:06 +01:00
MathieuG-P 0372f7a1d5 remove console log 2022-12-12 22:01:00 +01:00
MathieuG-P 79ecaf3d15 remove dead code 2022-12-12 21:55:26 +01:00
MathieuG-P 31d8925615 move beat-saver service in main 2022-12-12 21:53:43 +01:00
MathieuG-P 9050d84b03 add site icons for OneClick installs 2022-12-12 21:53:03 +01:00
MathieuG-P 4d0cc4a6fe start of oneclick installs 2022-12-12 02:43:23 +01:00
MathieuG-P 91f7179d5e fix github button style 2022-12-12 00:28:35 +01:00
MathieuG-P d22fb0dcf4 fix translation 2022-12-12 00:03:01 +01:00
MathieuG-P 3f0b6c2db7 add little cross on all modals 2022-12-11 23:37:59 +01:00
MathieuG-P 66f113ae45 add proper filter icon 2022-12-11 23:37:41 +01:00
MathieuG-P efe03f41b9 fix translation 2022-12-11 23:37:05 +01:00
MathieuG-P 055d8b2bcc add all translations 2022-12-11 23:11:23 +01:00
MathieuG-P 6b724d8040 uninstall react tooltip 2022-12-11 23:11:05 +01:00
MathieuG-P b983467cfc change add and link button styles 2022-12-11 13:48:45 +01:00
MathieuG-P d378312dbd add some french translations 2022-12-11 02:20:25 +01:00
MathieuG-P 55e7145ba2 lazy load map images 2022-12-10 17:19:46 +01:00
MathieuG-P 77f6db9b6c change add map button style 2022-12-10 17:19:32 +01:00
MathieuG-P 47474f5c11 add comms 2022-12-10 15:50:10 +01:00
MathieuG-P 3db5cb70b7 optimise map filter check 2022-12-10 15:49:26 +01:00
MathieuG-P 87c37b18d3 fix observable never complete if error 2022-12-10 15:39:26 +01:00
MathieuG-P 160efbfafd no add maps button when offline 2022-12-10 15:38:54 +01:00
MathieuG-P 3be2100160 playlist tab wip 2022-12-10 15:29:33 +01:00
MathieuG-P c4d942eb2e search on sort change AND add search text 2022-12-10 01:29:46 +01:00
MathieuG-P 1ca62ba2f5 handle translation AND onChange reture string 2022-12-10 01:29:23 +01:00
MathieuG-P c5f871d810 remove useless import 2022-12-10 01:28:49 +01:00
MathieuG-P e0d70bd882 change import export MapsPage 2022-12-10 00:15:09 +01:00
MathieuG-P 7423df43c5 fix error for shared maps 2022-12-09 23:56:43 +01:00
MathieuG-P 8cb78e8550 fix styles 2022-12-09 23:56:34 +01:00
MathieuG-P 4308ba5125 fix text style 2022-12-09 23:46:20 +01:00
MathieuG-P 02753999f1 fix add map and link buttons AND fix tag filters set undefined 2022-12-09 23:29:09 +01:00
MathieuG-P 702486020f wrong map style and type 2022-12-09 23:25:05 +01:00
MathieuG-P 6b12b7bc74 fix wrong map style and type 2022-12-09 23:23:20 +01:00
MathieuG-P 5bf674d782 we can export all or specific maps 2022-12-08 00:09:59 +01:00
MathieuG-P 6df2c98955 we can now delete mutliple maps at the same time 2022-12-07 23:10:59 +01:00
MathieuG-P 77bc6236f8 create iframe view and fix preview map 2022-12-07 20:58:46 +01:00
MathieuG-P 57e0c73a31 fix rerendering AND fix downloader map folder name 2022-12-07 01:33:24 +01:00
MathieuG-P f038ae79fb maps and playlists panel are always in one block 2022-12-06 23:32:25 +01:00
MathieuG-P 63775a5e99 fix bug 2022-12-06 23:31:50 +01:00
MathieuG-P 8930009398 we can now download maps from bsaver 2022-12-06 00:52:37 +01:00
MathieuG-P 9dce72250e close on escape 2022-12-06 00:52:06 +01:00
MathieuG-P 0ea41da41c we can now see maps from bsaver 2022-12-05 03:19:05 +01:00
MathieuG-P 36c1eb20fc memoize map item 2022-12-05 03:18:33 +01:00
MathieuG-P 341e8aed99 create download maps modal 2022-12-04 01:08:18 +01:00
MathieuG-P abdc05298b prepare for maps downloading 2022-11-30 23:35:02 +01:00
MathieuG-P b7db145517 add cache for maps details 2022-11-30 00:48:55 +01:00
Gaëtan dceb09ec36 Update img 2022-11-28 23:11:43 +01:00
MathieuG-P 57ab0b9ff2 translate map actions modals 2022-11-28 22:40:45 +01:00
Gaëtan Gerard 398494c320 Merge pull request #25 from Zagrios/update-link-feature-and-report-bug
Updated link "report a bug" and "feature request"
2022-11-28 22:21:48 +01:00
Gaëtan Gerard 43e4a0866c Updated link "report a bug" and "feature request" 2022-11-28 22:19:02 +01:00
MathieuG-P 4e64ae93c2 add progress bar for link unlink and delete maps 2022-11-28 21:14:24 +01:00
MathieuG-P eec011d9f0 single maps deletion finished 2022-11-28 21:13:57 +01:00
Gaëtan Gerard 08b0a5c689 Merge pull request #21 from Zagrios/Issue-Templates-Update
Update issue templates
2022-11-28 11:19:56 +01:00
Gaëtan Gerard 21dee2ec57 Update issue templates 2022-11-28 10:48:52 +01:00
MathieuG-P c172b1ed81 add link unlink maps modals AND start maps deletion 2022-11-28 02:30:02 +01:00
MathieuG-P 69918d0f3f npm i 2022-11-27 23:49:53 +01:00
MathieuG-P d390050183 can now link and unlink version maps 2022-11-26 23:29:50 +01:00
MathieuG-P 31f38820d2 delete useless log 2022-11-24 01:18:18 +01:00
MathieuG-P 8372d3bed9 add linked unlinked maps indication 2022-11-24 01:18:08 +01:00
MathieuG-P 46f5f9486c map filter and search works 2022-11-22 00:21:22 +01:00
MathieuG-P 1e6351aaf9 fix label 2022-11-21 22:31:24 +01:00
MathieuG-P f9edf33097 progress on filter panel 2022-11-21 00:05:20 +01:00
MathieuG-P f815695298 add filters panel (partial) 2022-11-20 00:54:30 +01:00
MathieuG-P bbbbf50551 update tailwindcss 2022-11-19 15:31:17 +01:00
MathieuG-P 0c74e9683b npm i 2022-11-19 15:21:51 +01:00
MathieuG-P b1b4d13dfc Merge branch 'master' into feature/maps-management 2022-11-19 15:18:51 +01:00
MathieuG-P 5860ab8eb9 . 2022-11-19 15:12:17 +01:00
MathieuG-P a4af268720 add registry in npm config file 2022-11-19 15:12:02 +01:00
MathieuG-P 092b7fbd77 add 1.26.0 2022-11-18 17:09:56 +01:00
MathieuG-P 58c8c32a58 we are no longer blocked if error occur durring update downloading 2022-11-17 23:50:13 +01:00
MathieuG-P 69c4202899 Merge branch 'master' of https://github.com/Zagrios/bs-manager 2022-11-17 23:42:52 +01:00
MathieuG-P 43cc008011 add version number on log file 2022-11-17 23:42:41 +01:00
MathieuG-P 821e487c93 prototype of maps searchbar 2022-11-17 00:07:46 +01:00
MathieuG-P 42e9c2ed58 remove saturation 2022-11-16 23:32:12 +01:00
MathieuG-P 6ea7f45d40 remove saturation 2022-11-16 23:28:10 +01:00
MathieuG-P 5c2edcf558 no preview available when no mapId 2022-11-16 23:27:41 +01:00
MathieuG-P 3333924511 delete comment 2022-11-16 23:27:24 +01:00
Gaëtan d200444d75 Merge branch 'master' of https://github.com/Zagrios/bs-manager 2022-11-15 22:13:06 +01:00
MathieuG-P 82b33fbf95 maps navbar in panel 2022-11-15 22:11:48 +01:00
MathieuG-P c985fd09bd css fix 2022-11-14 23:04:52 +01:00
MathieuG-P c312b6ede8 only maps and not maps and playlists 2022-11-14 23:04:44 +01:00
MathieuG-P e76adf7a5f stop propagation on click 2022-11-14 23:04:27 +01:00
MathieuG-P 7dae0bf77f create empty maps toolbar 2022-11-14 23:04:14 +01:00
MathieuG-P ed9bc0c3a8 can select maps and fix blur issue on translate 2022-11-14 23:03:19 +01:00
Gaëtan 9d6638c35e add services 2022-11-14 15:27:41 +01:00
MathieuG-P 5ba670505b add info and optimize rendering 2022-11-14 00:24:43 +01:00
MathieuG-P ef000b7eda add maps and playlists list to versions 2022-11-14 00:23:07 +01:00
MathieuG-P cfda3830db fix css issue 2022-11-14 00:22:43 +01:00
MathieuG-P f0cf76a5fe VisibilitySensor was causing unwanted destroy 2022-11-14 00:18:46 +01:00
MathieuG-P ce7438825b Update feature_request.md 2022-11-13 19:43:37 +01:00
MathieuG-P 0d0ed47455 Update bug_report.md 2022-11-13 19:41:13 +01:00
MathieuG-P 8217a577a0 missing icons and add difficulties 2022-11-13 02:14:53 +01:00
MathieuG-P 4c36f2321a npm run audit fix 2022-11-12 14:48:03 +01:00
MathieuG-P 4223a17341 play song and add data to map item 2022-11-11 02:43:30 +01:00
MathieuG-P 6bb99ace5c add bsm icon png 2022-11-10 13:25:15 +01:00
MathieuG-P de86519282 add map data 2022-11-10 00:52:59 +01:00
MathieuG-P 3a30e5fbc9 right type 2022-11-10 00:52:47 +01:00
MathieuG-P 68ee96b8e3 change map item style 2022-11-09 22:55:15 +01:00
MathieuG-P cf78b2b21d add song author 2022-11-09 22:55:07 +01:00
MathieuG-P e89199fec3 Update README.md 2022-11-09 12:37:34 +01:00
MathieuG-P 0a5c158657 get maps details from bsaver api 2022-11-09 00:46:01 +01:00
MathieuG-P 46766ec0ff Merge pull request #18 from Zagrios/Update-Tailwind
Update tailwind setup
2022-11-08 22:49:45 +01:00
MathieuG-P 300fad0010 add type tailwind 2022-11-08 22:41:44 +01:00
MathieuG-P 84450419c1 scroll by mouse position 2022-11-08 22:39:00 +01:00
Gaëtan Gerard fd5c14a1bd Update Tailwind 2022-11-08 16:39:14 +01:00
MathieuG-P cd8dae5976 maps managment advancement 2022-11-07 17:09:19 +01:00
MathieuG-P 5e2dd10035 fully load local maps, and prepare bsaver map infos 2022-11-06 01:38:31 +01:00
MathieuG-P df4df8add1 for system file link protocol 2022-11-06 01:35:58 +01:00
MathieuG-P 4544ee5622 maps nav bar active when on maps page 2022-11-06 01:35:29 +01:00
MathieuG-P dd7bc3556d maps models 2022-11-06 01:33:29 +01:00
MathieuG-P 788b7598b0 add protocol to support system file link 2022-11-06 01:33:03 +01:00
MathieuG-P a4f4eb5558 off some rules 2022-11-06 01:32:35 +01:00
MathieuG-P 43cdcbf765 add maps and playlist slide 2022-11-01 23:04:39 +01:00
MathieuG-P 2a9d7f3a15 maps manager service prototype 2022-11-01 23:04:28 +01:00
MathieuG-P 5c5e6c7439 hover effect more generic 2022-11-01 23:04:13 +01:00
MathieuG-P 322faa6a92 create page of shared maps and playlists 2022-11-01 18:42:15 +01:00
MathieuG-P 701e91462d fix fill-rule 2022-10-31 23:19:29 +01:00
MathieuG-P 2b34d643a9 add missing translations 2022-10-31 23:17:38 +01:00
MathieuG-P 4a7949fd2a modal system lot impoved and simpler to use 2022-10-31 23:04:42 +01:00
MathieuG-P 47fce8a6dd Merge pull request #17 from Zagrios/feature/oculus-installation-detection
Feature/oculus installation detection
2022-10-31 20:46:02 +01:00
MathieuG-P 4d6d3cf4f8 remove useless imports 2022-10-31 20:28:44 +01:00
MathieuG-P 26236ba024 add transltations 2022-10-31 20:26:08 +01:00
MathieuG-P dcb932859b fix steam running check even if it's oculus version 2022-10-31 20:22:28 +01:00
MathieuG-P a9646209e1 oculus detection complete 2022-10-30 22:40:18 +01:00
MathieuG-P 6ce7bc94df update changelog 2022-10-28 14:54:26 +02:00
MathieuG-P 5b82f4c162 detection of oculus beat saber installation 2022-10-26 01:13:12 +02:00
Gaëtan Gerard 1b2136ffb9 Update README.md 2022-10-05 22:16:25 +02:00
Gaëtan Gerard 416cf41841 test 2022-10-05 21:59:57 +02:00
Gaëtan Gerard 3940a0a06c Update README.md 2022-10-05 21:44:47 +02:00
Gaëtan Gerard 6a987126c8 Add files via upload 2022-10-05 21:43:21 +02:00
Gaëtan Gerard a4f68ebc8b correctif shield issue 2022-10-05 15:12:58 +02:00
Gaëtan Gerard b7adfacfd1 begin usage 2022-10-05 15:07:58 +02:00
Gaëtan Gerard ee03a90f02 Built With 2022-10-05 11:52:19 +02:00
Gaëtan Gerard 383d917e25 Built With 2022-10-05 11:51:11 +02:00
Gaëtan Gerard e15d4c45d4 About The Project 2022-10-05 10:53:53 +02:00
Gaëtan Gerard 6077e51203 beginning of About The Project 2022-10-04 16:26:30 +02:00
Gaëtan Gerard 079dc32429 Update README.md 2022-10-04 16:09:04 +02:00
Gaëtan Gerard 01ef77832d Update README.md 2022-10-04 16:05:49 +02:00
Gaëtan Gerard d29e6d39f5 Update README.md 2022-10-04 12:56:12 +02:00
237 changed files with 34477 additions and 4791 deletions
+1
View File
@@ -4,6 +4,7 @@
"global-require": "off",
"import/no-dynamic-require": "off",
"prettier/prettier": 0,
"no-await-in-loop": "off",
"import/prefer-default-export": "off",
"no-empty-function": "off",
"@typescript-eslint/no-empty-function": "off",
+28 -36
View File
@@ -10,6 +10,7 @@ import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
import baseConfig from './webpack.config.base';
import webpackPaths from './webpack.paths';
import checkNodeEnv from '../scripts/check-node-env';
import { AppWindow } from "../../src/shared/models/window-manager/app-window.model"
// When an ESLint server is running, we can't set the NODE_ENV so we'll check if it's
// at the dev webpack config is not accidentally run in a production environment
@@ -39,6 +40,22 @@ if (
execSync('npm run postinstall');
}
const getHtmlPageOptions = (page: AppWindow): HtmlWebpackPlugin.Options => {
return {
filename: path.join(page),
template: path.join(webpackPaths.srcRendererPath, page.replace(".html", ".ejs")),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
},
isBrowser: false,
env: process.env.NODE_ENV,
isDevelopment: process.env.NODE_ENV !== 'production',
nodeModules: webpackPaths.appNodeModulesPath,
}
}
const configuration: webpack.Configuration = {
devtool: 'inline-source-map',
@@ -76,14 +93,6 @@ const configuration: webpack.Configuration = {
},
},
'sass-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [require('tailwindcss'), require('autoprefixer')],
},
},
},
],
include: /\.module\.s?(c|a)ss$/,
},
@@ -96,8 +105,12 @@ const configuration: webpack.Configuration = {
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [require('tailwindcss'), require('autoprefixer')],
postcssOptions: {
plugins:
[
require('tailwindcss'),
require('autoprefixer'),
]
},
},
},
@@ -151,33 +164,12 @@ const configuration: webpack.Configuration = {
new ReactRefreshWebpackPlugin(),
new HtmlWebpackPlugin({
filename: path.join('index.html'),
template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
},
isBrowser: false,
env: process.env.NODE_ENV,
isDevelopment: process.env.NODE_ENV !== 'production',
nodeModules: webpackPaths.appNodeModulesPath,
}),
new HtmlWebpackPlugin(getHtmlPageOptions("index.html")),
new HtmlWebpackPlugin(getHtmlPageOptions("launcher.html")),
new HtmlWebpackPlugin(getHtmlPageOptions("oneclick-download-map.html")),
new HtmlWebpackPlugin(getHtmlPageOptions("oneclick-download-playlist.html")),
new HtmlWebpackPlugin(getHtmlPageOptions("oneclick-download-model.html")),
new HtmlWebpackPlugin({
filename: path.join('launcher.html'),
template: path.join(webpackPaths.srcRendererPath, 'launcher.ejs'),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
},
isBrowser: false,
env: process.env.NODE_ENV,
isDevelopment: process.env.NODE_ENV !== 'production',
nodeModules: webpackPaths.appNodeModulesPath,
})
],
node: {
+29 -32
View File
@@ -14,6 +14,7 @@ import baseConfig from './webpack.config.base';
import webpackPaths from './webpack.paths';
import checkNodeEnv from '../scripts/check-node-env';
import deleteSourceMaps from '../scripts/delete-source-maps';
import { AppWindow } from "../../src/shared/models/window-manager/app-window.model"
checkNodeEnv('production');
deleteSourceMaps();
@@ -25,6 +26,23 @@ const devtoolsConfig =
}
: {};
const getHtmlPageOptions = (page: AppWindow): HtmlWebpackPlugin.Options => {
return {
filename: path.join(page),
template: path.join(webpackPaths.srcRendererPath, page.replace(".html", ".ejs")),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
},
isBrowser: false,
env: process.env.NODE_ENV,
isDevelopment: process.env.NODE_ENV !== 'production',
nodeModules: webpackPaths.appNodeModulesPath,
}
}
const configuration: webpack.Configuration = {
...devtoolsConfig,
@@ -58,14 +76,6 @@ const configuration: webpack.Configuration = {
},
},
'sass-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [require('tailwindcss'), require('autoprefixer')],
},
},
},
],
include: /\.module\.s?(c|a)ss$/,
},
@@ -78,8 +88,12 @@ const configuration: webpack.Configuration = {
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [require('tailwindcss'), require('autoprefixer')],
postcssOptions: {
plugins:
[
require('tailwindcss'),
require('autoprefixer'),
]
},
},
},
@@ -132,29 +146,12 @@ const configuration: webpack.Configuration = {
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
},
isBrowser: false,
isDevelopment: process.env.NODE_ENV !== 'production',
}),
new HtmlWebpackPlugin(getHtmlPageOptions("index.html")),
new HtmlWebpackPlugin(getHtmlPageOptions("launcher.html")),
new HtmlWebpackPlugin(getHtmlPageOptions("oneclick-download-map.html")),
new HtmlWebpackPlugin(getHtmlPageOptions("oneclick-download-playlist.html")),
new HtmlWebpackPlugin(getHtmlPageOptions("oneclick-download-model.html")),
new HtmlWebpackPlugin({
filename: 'launcher.html',
template: path.join(webpackPaths.srcRendererPath, 'launcher.ejs'),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
},
isBrowser: false,
isDevelopment: process.env.NODE_ENV !== 'production',
})
],
};
+6 -1
View File
@@ -10,6 +10,8 @@ module.exports = {
"global-require": 0,
"import/prefer-default-export": "off",
"no-empty-function": "off",
"no-await-in-loop": "off",
"no-continue": "off",
"@typescript-eslint/no-empty-function": "off",
'@typescript-eslint/lines-between-class-members': "off",
"class-methods-use-this": "off",
@@ -30,7 +32,10 @@ module.exports = {
"@typescript-eslint/no-throw-literal": "off",
"@typescript-eslint/no-unused-expressions": "off",
"no-param-reassign": "off",
"no-useless-escape": "off"
"no-useless-escape": "off",
"jsx-a11y/no-noninteractive-element-interactions": "off",
"no-async-promise-executor": "off",
"new-cap": "off"
},
parserOptions: {
ecmaVersion: 2020,
+1 -1
View File
@@ -1 +1 @@
patreon: bsmanager
@@ -1,7 +1,7 @@
---
name: Bug report
name: "[BUG] Bug report"
about: Create a report to help us improve
title: "[BUG]"
title: "[BUG] : "
labels: bug
assignees: Zagrios
@@ -1,7 +1,7 @@
---
name: Feature request
name: "[FEAT.] Feature request"
about: Suggest an idea for this project
title: "[AME]"
title: "[FEAT.] : "
labels: enhancement
assignees: Zagrios
+1
View File
@@ -0,0 +1 @@
registry=https://registry.npmjs.org/
+14 -1
View File
@@ -1,3 +1,16 @@
## [0.2.0](https://github.com/Zagrios/bs-manager/releases/tag/v0.2.0) (October 23, 2022)
### Features
- Mods management fully implementd [5c47897](https://github.com/Zagrios/bs-manager/commit/5c478979e96b14dd54a3889e551c163ece701b4a)
- Add close button in settings page #5
- Add GitHub and contribution actions in settings page #3
### Fixes
- Lunch Beat Saber multiple times #1
- Placeholders and some texts not with light theme #6
- Wrong background color when version is downloading #7
- Add missing translations [5817260](https://github.com/Zagrios/bs-manager/commit/58172606f3f4731c90c9aa838fb89ac95458e032)
- Error when loading downloaded versions when Steam is not installed [6e07adb](https://github.com/Zagrios/bs-manager/commit/6e07adb990f78073dd68c2b9cf6209562bb4bf2b)
## [0.1.0](https://github.com/Zagrios/bs-manager/releases/tag/v0.1.0) (September 19, 2022)
* Initial public release
- Initial public release
+132
View File
@@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at contact@bsmanager.io.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
+32
View File
@@ -0,0 +1,32 @@
## Contributing
[code-of-conduct]: CODE_OF_CONDUCT.md
[fork]: https://github.com/Zagrios/bs-manager/fork
[pr]: https://github.com/Zagrios/bs-manager/compare
[style]: https://github.com/basarat/typescript-book/blob/master/docs/styleguide/styleguide.md
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms.
## Issues and PRs
If you have suggestions for how this project could be improved, or want to report a bug, open an issue! We'd love all and any contributions. If you have questions, too, we'd love to hear them.
We'd also love PRs. If you're thinking of a large PR, we advise opening up an issue first to talk about it, though! Look at the links below if you're not sure how to open a PR.
## Submitting a pull request
1. [Fork][fork] and clone the repository.
1. Configure and install the dependencies: `npm install`.
1. Create a new branch following naming convention: `git checkout -b (feature|bufix|hotfix)/(short-description)(/issue-id)`.
1. Make your change, test, and make sure BSManager work fine.
1. Push to your fork and [submit a pull request][pr].
1. Pat your self on the back and wait for your pull request to be reviewed and merged.
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
- Follow the [style guide][style] which is using standard.
- Keep your changes as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
Work in Progress pull requests are also welcome to get feedback early on, or if there is something blocked you.
+235 -68
View File
@@ -1,76 +1,243 @@
<p align="center">
<a href="https://github.com/RiskiVR/BSLegacyLauncher">
<img src="https://raw.githubusercontent.com/Zagrios/bs-manager/master/resources/readme/icon.svg" alt="logo" width="250px"/>
</a>
<h3 align="center">BSManager</h3>
<p align="center">Simple and fancy tools that alow you to download, launch and manage BeatSaber versions, Maps and Mods easily and quickly.</p>
</p>
<a name="readme-top"></a>
<p align="center">
<img src="https://github.com/Zagrios/bs-manager/blob/master/resources/readme/beat-running.png?raw=true" width="130"/>
</p>
<!-- PROJECT SHIELDS -->
<!--
*** I'm using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
<details open="open">
<summary>
<h2>Table of Contents</h2>
</summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
<ul><li><a href="#built-with">Built With</a></li></ul>
</li>
<li><a href="#how-to-use">How To Use</a></li>
<li><a href="#having-problems">Having problems?</a></li>
<li><a href="#acknowledgements">Acknowledgements</a></li>
</ol>
</details>
<h2 id="about-the-project">About The Project</h2>
<p>
Have you ever wanted to switch between multiple BeatSaber version? To have a specific version for you and your friends, or for personal use and Streaming use? Have you ever wanted to manage easily <b>Maps</b> and <b>Mods</b> between versions? All of that in one place? <b>Then this program is made for you!</b>
<br/><br/>
BSManager is designed to download any BeatSaber version from Steam's depots, and launch it within the same program!<br>
- You can install as many versions as you want, customize them to quickly differentiate them, clone them to separate the additional contents of the same version!<br>
- You can clone and launch your Steam version from the program!<br/><br/>
<b>In the near future</b><br/>
- You can Create a master Maps folder and link it across all versions!<br/>
- You can download Maps with "OneClick"!<br/>
- You can download Maps from BSManager!<br/>
- You can download and manage Mods for each versions!<br/>
- And even more!
</p>
<h3 id="built-with">Built With</h3>
<!-- TITLE -->
<div align="center">
<a href="https://github.com/Zagrios/bs-manager">
<img src="resources/readme/icon.svg" alt="Logo" width="250" height="250">
</a>
<br><br>
<h2><b>BSManager</b></h2>
<i>(Beat Saber Manager)</i>
<br><br>
<span>
Download, manage and customize your versions of Beat Saber with a simple click!
</span>
<br>
<span>
<a href="https://github.com/Zagrios/bs-manager/issues/new?assignees=Zagrios&labels=bug&template=-bug--bug-report.md&title=%5BBUG%5D+%3A+">Report Bug</a>
·
<a href="https://github.com/Zagrios/bs-manager/issues/new?assignees=Zagrios&labels=enhancement&template=-feat---feature-request.md&title=%5BFEAT.%5D+%3A+">Request Feature</a>
·
<a href="https://github.com/Zagrios/bs-manager/security/policy">Report a security vulnerability</a>
</span>
</div>
<!-- BADGES -->
---
<br>
<div align="center" >
<a href="https://github.com/Zagrios/bs-manager/stargazers"><img src ="https://img.shields.io/github/stars/Zagrios/bs-manager?style=for-the-badge" alt="Stargazers"/></a>
<a href="https://github.com/Zagrios/bs-manager/network/members"><img src ="https://img.shields.io/github/forks/Zagrios/bs-manager?style=for-the-badge" alt="Forks"/></a>
<a href="https://github.com/Zagrios/bs-manager/blob/master/LICENSE"><img src ="https://img.shields.io/github/license/Zagrios/bs-manager?style=for-the-badge" alt="License"/></a>
<a href="https://github.com/Zagrios/bs-manager/graphs/contributors"><img src ="https://img.shields.io/github/contributors/Zagrios/bs-manager?style=for-the-badge" alt="Contributors"/></a>
<a href="https://github.com/Zagrios/bs-manager/issues"><img alt="GitHub issues" src="https://img.shields.io/github/issues/Zagrios/bs-manager?style=for-the-badge"></a>
<br>
<a href="https://discord.gg/uSqbHVpKdV"><img src ="https://img.shields.io/badge/-DISCORD-5865f2?style=for-the-badge&logo=discord&logoColor=ffffff" alt="discord"/></a>
<a href="https://www.patreon.com/bsmanager"><img src ="https://img.shields.io/badge/-🥰%20Support%20BSM-EC4546?style=for-the-badge" alt="Donation"/></a>
<a href="https://twitter.com/BSManager_"><img src ="https://img.shields.io/badge/-Twitter-F5F8FA?style=for-the-badge&logo=Twitter" alt="Twitter"/></a>
<br>
[<a href="#readme-bot">Go to bottom</a>]
</div>
---
<!-- TABLE OF CONTENTS -->
<b>Table of Contents</b>
<ul>
<li>
<a href="https://github.com/electron-react-boilerplate/electron-react-boilerplate">Electron React Boilerplate</a>
</li>
<li>
<a href="https://github.com/SteamRE/DepotDownloader">DepotDownloader</a>
</li>
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#built-with">Built With</a></li>
</ul>
</li>
<li><a href="#usage">Usage</a></li>
<ul>
<li><a href="#how-to-install">How to install?</a></li>
<li><a href="#manage-versions">Manage Versions</a></li>
<li><a href="#customize-your-versions">Customize your versions</a></li>
<li><a href="#install-mods">Install Mods</a></li>
<li><a href="#install-maps">Install Maps</a></li>
<li><a href="#one-click">One Click</a></li>
<li><a href="#having-problems">Having problems?</a></li>
</ul>
<li><a href="#credits">Credits</a></li>
<li><a href="#contributing">Contributing</a></li>
</ul>
<h2 id="how-to-use">How To Use</h2>
<ul>
<li>
Download the latest release from <a href="https://github.com/Zagrios/bs-manager/releases">Releases</a>.
</li>
<li>Execute the installer and BSManager will start itself.</li>
<li>Once its done if you want to download a version, select a version and download it!</li>
<li>From the version page you can choose launch options, launch the version, and more from the dropdown menu!</li>
</ul>
<!-- ABOUT THE PROJECT -->
<div align="center">
<h1> </h1>
<h1><b>About The Project</b></h1>
</div>
<div>
<a href="https://github.com/Zagrios/bs-manager">BSManager</a> was created to unify and improve the two most used Apps in the community (<a href="https://github.com/RiskiVR/BSLegacyLauncher">BS legacy launcher</a> and <a href="https://github.com/Assistant/ModAssistant">Mod Assistant</a>).
<br><br>
<h4><a href="https://github.com/Zagrios/bs-manager">BSManager</a> will allow you to:</h4>
<ul>
<li><b>Manage multiple BeatSaber versions</b>, designed for people who need to play on different versions or have multiple profiles for the same version.</li>
<li><b>Download your maps in the same way</b>, in addition to that, depending on your choice, maps are not version dependent. so you will be able to find your maps whatever version you are using without having to transfer them.</li>
<li><b>Install your mods in one click</b>, just like <a href="https://github.com/Assistant/ModAssistant">Mod Assistant</a>, <a href="https://github.com/Zagrios/bs-manager">BSManager</a> will allow you to install your mods quickly and securely depending on the version you choose.</li>
<li><b>Customize your interface</b>, we know that some of you like to customize your interfaces to the maximum. That's why <a href="https://github.com/Zagrios/bs-manager">BSManager</a> brings you peace of mind on this point, you can change the name of the versions, their color, and you can even change the color of the logo! Of course, a dark theme has been added to protect your eyes at night.</li>
</ul>
</div>
<br>
<div align="center">
<img src="resources/readme/preview.png" alt="preview">
</div>
<br>
<h2 id="having-problems">Having problems?</h2>
<p>
See the <a href="https://github.com/Zagrios/bs-manager/issues">open issues</a> for a list of known issues, from there you can create a new issue for the problem you have!
Otherwise you can add on to existing issues if one matches what you're encountering.
</p>
<h2 id="acknowledgements">Acknowledgement</h2>
<ul>
<li><a href="https://github.com/Zagrios">Zagrios</a> - Founder, Lead Developer & Project Lead</li>
<li><a href="https://github.com/Iluhadesu">Iluhadesu</a> - Custom DepotDownloader Developer</li>
<li><a href="https://github.com/GaetanGrd">Gaëtan Gerard</a> - Main Alpha Tester</li>
</ul>
<p align="center">
<img src="https://github.com/Zagrios/bs-manager/blob/master/resources/readme/beat-conflict.png?raw=true" width="130"/>
</p>
<!--BUILT WITH-->
<div>
<h2><b>Built With</b></h2>
<ul>
<li>
<a href="https://electron-react-boilerplate.js.org/"><img src="https://img.shields.io/badge/-Electron%20React%20Boilerplate-black?style=for-the-badge&logo=Electron" alt="Electron React Boilerplate"></a>
</li>
<li>
<a href="https://github.com/SteamRE/DepotDownloader"><img src="https://img.shields.io/badge/-Depot%20Downloader-2a475e?style=for-the-badge&logo=steam" alt="Depot Downloader"></a>
</li>
<li>
<a href="https://rxjs.dev/"><img src="https://img.shields.io/badge/-RxJs-purple?style=for-the-badge&logo=ReactiveX" alt="RxJs"></a>
</li>
<li>
<a href="https://tailwindcss.com/"><img src="https://img.shields.io/badge/-Tailwind%20CSS-white?style=for-the-badge&logo=Tailwind%20CSS" alt="TailWind CSS"></a>
</li>
</ul>
</div>
<br>
<!--USAGE-->
<div align="center">
<h1> </h1>
<h1><b>Usage</b></h1>
</div>
<!--HOW TO INSTALL?-->
<div>
<h2><b>How to install?</b></h2>
<ul>
<li>Download the <a href="https://github.com/Zagrios/bs-manager/releases/latest">latest release</a> from <a href="https://github.com/Zagrios/bs-manager/releases">Releases</a>.</li>
<li>Execute the installer and <a href="../..">BSManager</a> will start itself.</li>
<li>Once its done if you want to download a version, select a version and download it! </li>
<li>From the version page you can choose options, launch the version, and more!</li>
</div>
<br>
<!--MANAGE VERSIONS-->
<div>
<h2><b>Manage Versions</b></h2>
<span>
<a href="https://github.com/Zagrios/bs-manager">BSManager</a> allows you to manage your versions of Beat Saber. It gives you the ability to download any version of Beat Saber as long as you have a Steam account that already owns the game. Using <a href="https://github.com/Zagrios/bs-manager">BSManager</a>, you can easily manage and update your collection of Beat Saber versions.
</span>
</div>
<br>
<div align="center">
https://user-images.githubusercontent.com/40648115/213008824-25cfdda3-6350-42dc-aa53-2132b4b8e838.mov
</div>
<!--CUSTOM UR VERSIONS-->
<div>
<h2><b>Customize your versions</b></h2>
<span>
<a href="https://github.com/Zagrios/bs-manager">BSManager</a> will allow you to completely customize each of your downloaded versions, you can change the color of the icon, choose a name for the version and finally install your mods,maps and other contents according to the Beat Saber version!
</span>
</div>
<br>
<div align="center">
https://user-images.githubusercontent.com/40648115/213296794-74a1e20b-12dc-44ec-a67f-e25d7010bd3d.mov
</div>
<!--INSTALL MODS-->
<div>
<h2><b>Install Mods</b></h2>
<span>
<a href="https://github.com/Zagrios/bs-manager">BSManager</a> allows you to manage Beat Saber mods in a quick and easy way. It uses the <a href="https://beatmods.com/#/">BeatMod API</a> to allow you to install, update or uninstall mods for each version of your collection. So the app can help you manage them efficiently.
</span>
</div>
<br>
<div align="center">
https://user-images.githubusercontent.com/40648115/213296816-bdaafc90-da76-4835-8d83-9ac6a4e1c549.mov
</div>
<!--INSTALL MAPS-->
<div>
<h2><b>Install Maps</b></h2>
<span>
In addition to managing mods, <a href="https://github.com/Zagrios/bs-manager">BSManager</a> allows you to manage and organize custom beatmaps existing on <a href="https://beatsaver.com">Beat Saver</a>, a popular site for sharing custom beatmaps for beat Saber. Moreover the app allow you to share your maps across all your versions.
</span>
</div>
<br>
<div align="center">
https://user-images.githubusercontent.com/40648115/213296838-f775fe83-866d-4764-a7d0-648dbb8ec983.mov
</div>
<!--ONE CLICK-->
<div>
<h2><b>One Click</b></h2>
<span>
The "One-Click" feature of <a href="https://github.com/Zagrios/bs-manager">BSManager</a> is an incredibly convenient feature for Beat Saber users. It allows easy and quick installation of models, maps and playlists for all versions of Beat Saber you own.
</span>
</div>
<br>
<div align="center">
https://user-images.githubusercontent.com/40648115/213435051-7feb815d-f32b-4135-b095-ef49726a836c.mov
</div>
<!--HAVING PROBLEMS?-->
<div>
<h2><b>Having problems?</b></h2>
<span>
See the <a href="https://github.com/Zagrios/bs-manager/issues">open issues</a> to show the list of known issues, from there you can create a new issue for your problem!
</span>
</div>
<br><br><br>
<!-- Credits -->
<div>
<h1><b>Credits</b></h1>
<ul>
<li><a href="https://github.com/Zagrios">Zagrios</a> - Founder & Lead Developer</li>
<li><a href="https://github.com/Iluhadesu">Iluhadesu</a> - Project Team & Developpement help</li>
<li><a href="https://github.com/GaetanGrd">GaetanGrd</a> - Project Team & Developpement help</li>
<li><a href="https://github.com/cheddZy">cheddZy</a> - Icon creator</li>
</ul>
</div>
<!-- Contributing -->
<br>
<!--CONTRIBUTING-->
<div>
<h1><b>Contributing</b></h1>
<p>
If you'd like to contribute, check out the <a href="https://github.com/Zagrios/bs-manager/blob/master/CONTRIBUTING.md">contributing guide</a>
</p>
<p>Thank you to all the people who already contributed to BSManager!</p>
<div>
<a href="https://github.com/Zagrios/bs-manager/graphs/contributors">
<img src="https://contrib.rocks/image?repo=Zagrios/bs-manager" />
</a>
</div>
</div>
<br>
<div align="right">
[<a href="#readme-top">Return to top</a>]
</div>
<h1> </h1>
<a name="readme-bot"></a>
+9
View File
@@ -0,0 +1,9 @@
# Reporting Security Issues
If you discover a security issue in BSManager, please report it by sending an
email to [contact@bsmanager.io](mailto:contact@bsmanager.io).
This will allow us to assess the risk, and make a fix available before we add a
bug report to the GitHub repository.
Thanks for helping make BSManager safe for everyone.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" version="1.1" viewBox="0 0 717.2 717.2" xml:space="preserve">
<style type="text/css">
.st0{fill:url(#SVGID_1_);}
</style>
<linearGradient id="SVGID_1_" x1="61.604" x2="647.04" y1="373.65" y2="373.06" gradientTransform="matrix(1 .0010142 -.0010142 1 4.6349 -15.227)" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#DC2DE2" offset=".010541"/>
<stop style="stop-color:#972DE2" offset=".3269"/>
<stop style="stop-color:#8F28E2" offset=".4648"/>
<stop style="stop-color:#7A1BE1" offset=".6756"/>
<stop style="stop-color:#5706E0" offset=".9318"/>
<stop style="stop-color:#4D00E0" offset="1"/>
</linearGradient>
<path class="st0" d="m565.85 141.83c-19.8 11.3-37 22.3-55.2 31.1-14.1 6.8-28.8 4.5-42.4-3.6-29.4-17.4-58.9-34.5-88.2-52-12.9-7.7-25.7-9.5-39-1.9-50.3 28.9-100.6 58-150.8 87.1-8.8 5.1-9.2 10 0 15.3 52 30.2 103.9 60.4 155.7 91 10.9 6.4 20.4 4.2 30.2-1.5 68.7-39.9 137.4-79.8 206.1-119.7 5.3-3.1 10.5-6.2 16-9 19.3-9.8 25.3-10.1 36.2 8.3 8.5 14.2 15.2 31.8 15.7 48.1 1.8 64.6 1.1 129.3 1 193.9 0 22.4-0.1 44.8-1.5 67.1-1 20.4-12.2 38.9-29.8 49.2-55.9 33.5-112.6 65.7-169 98.3-2.8 0.9-5.8 1.6-8.7 2 1-24.6 0.4-47.9 4.3-70.5 1.6-9.2 12-18.8 20.8-24.3 31.5-19.8 63.8-38.3 96.3-56.3 11.3-6.3 15-13.9 14.9-26.8-0.7-58-0.2-116-0.2-174 0-12.7-5.1-16.3-16.2-10-52.1 29.9-104.2 59.9-155.7 90.9-5.5 3.3-9.9 13.4-9.9 20.3-0.6 65.7 0.2 131.4 0.4 197.2 0.1 22.9-0.1 45.8-0.4 68.7-0.1 11.5-4.9 19.4-17 21.9-20.7 4.3-40.3 3-59-8-67.7-39.5-134.6-79.5-202.9-117.2-35.7-19.7-52.4-47.2-51.7-87.8 0.9-58 0.4-116.1 0.5-174.2-0.2-1.9 0.5-3.8 1.4-10.2 25.3 21 61.8 24.5 70.5 60.3 3.8 15.4 1.4 32.4 1.6 48.7 0.3 26 0 52 1.3 77.9 0.3 6.1 4 14.8 8.8 17.7 52.9 31.5 106.6 62.1 159.9 92.9 3.5 1.3 7.1 2.3 10.8 2.9 0.6-17.9 1.4-34.4 1.5-50.9 0.1-47.4 0.4-94.7-0.7-142.1-1-7.8-5.3-14.8-11.8-19.1-61.5-36.7-123.7-72.6-185.8-108.7-16.2-9.5-33-18.3-48.5-28.9-5-4.2-7.6-10.5-7.2-17 3.7-21.4 16.8-40 35.6-50.8 71.6-41.3 143-82.6 214.4-123.9 27.1-15.7 54.2-16 81.3-0.4 52.5 30.4 104.9 60.9 157.3 91.4 2.1 1.2 4.1 2.9 9.1 6.6z" style="fill:url(#SVGID_1_)"/>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

+24
View File
@@ -493,5 +493,29 @@
"ReleaseImg": "https://cdn.cloudflare.steamstatic.com/steamcommunity/public/images/clans//32055887/52cbd15b5e226f509e051565f6e4935eb0e44e2c.png",
"ReleaseDate": "1665673269",
"year": "2022"
},
{
"BSVersion": "1.26.0",
"BSManifest": "3634450655207470002",
"ReleaseURL": "https://steamcommunity.com/games/620980/announcements/detail/3414318646334948892",
"ReleaseImg": "https://cdn.akamai.steamstatic.com/steamcommunity/public/images/clans//32055887/d18ad9d7f45a5cc2a467d75f0bdf9d32b9141b14.png",
"ReleaseDate": "1667923560",
"year": "2022"
},
{
"BSVersion": "1.27.0",
"BSManifest": "3485516174915301618",
"ReleaseURL": "https://steamcommunity.com/games/620980/announcements/detail/3629368753553708497",
"ReleaseImg": "https://cdn.akamai.steamstatic.com/steamcommunity/public/images/clans//32055887/d9ed8771498be7fc83721aaaaa5b15a08fbeadb1.png",
"ReleaseDate": "1670943003",
"year": "2022"
},
{
"BSVersion": "1.28.0",
"BSManifest": "7463243155526905423",
"ReleaseURL": "https://steamcommunity.com/games/620980/announcements/detail/3666530358620442392",
"ReleaseImg": "https://cdn.akamai.steamstatic.com/steamcommunity/public/images/clans//32055887/8f978bbf292810004bca12523e76be8a7eec8c4e.png",
"ReleaseDate": "1677593822",
"year": "2023"
}
]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+22554 -2653
View File
File diff suppressed because it is too large Load Diff
+24 -11
View File
@@ -74,9 +74,11 @@
},
"win": {
"target": [
"nsis"
"nsis",
"nsis-web"
],
"icon": "assets/favicon.ico"
"icon": "assets/favicon.ico",
"certificateSha1": "f3363a89b084f8f6b616babea3c91f9d79e15000"
},
"linux": {
"target": [
@@ -153,12 +155,11 @@
"@types/jest": "^27.5.2",
"@types/node": "17.0.23",
"@types/react": "^17.0.48",
"@types/react-dom": "^17.0.17",
"@types/react-dom": "^18.0.10",
"@types/react-outside-click-handler": "^1.3.1",
"@types/react-test-renderer": "^17.0.2",
"@types/terser-webpack-plugin": "^5.0.4",
"@types/use-double-click": "^1.0.1",
"@types/uuid": "^8.3.4",
"@types/webpack-bundle-analyzer": "^4.4.2",
"@types/webpack-env": "^1.18.0",
"@typescript-eslint/eslint-plugin": "^5.34.0",
@@ -173,7 +174,7 @@
"css-minimizer-webpack-plugin": "^4.1.0",
"detect-port": "^1.3.0",
"electron": "^20.0.3",
"electron-builder": "^23.3.3",
"electron-builder": "^23.6.0",
"electron-devtools-installer": "^3.2.0",
"electron-notarize": "^1.2.1",
"electron-rebuild": "^3.2.9",
@@ -200,6 +201,7 @@
"postcss": "^8.4.16",
"postcss-loader": "^6.2.1",
"prettier": "^2.7.1",
"ps-scrollbar-tailwind": "0.0.1",
"react-refresh": "^0.12.0",
"react-refresh-typescript": "^2.0.7",
"react-test-renderer": "^18.2.0",
@@ -208,7 +210,7 @@
"sass-loader": "^12.6.0",
"style-loader": "^3.3.1",
"tailwind-scrollbar": "^2.0.1",
"tailwindcss": "^3.1.8",
"tailwindcss": "^3.2.4",
"terser-webpack-plugin": "^5.3.5",
"ts-jest": "^27.1.5",
"ts-loader": "^9.3.0",
@@ -223,6 +225,10 @@
},
"dependencies": {
"@node-steam/vdf": "^2.2.0",
"@tippyjs/react": "^4.2.6",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/recursive-readdir": "^2.2.1",
"archiver": "^5.3.1",
"dateformat": "^5.0.3",
"dot-prop": "^7.2.0",
@@ -230,25 +236,32 @@
"electron-log": "^4.4.8",
"electron-store": "^8.1.0",
"electron-updater": "^5.2.4",
"framer-motion": "^7.2.1",
"fast-deep-equal": "^3.1.3",
"framer-motion": "^8.0.2",
"fs-extra": "^10.1.0",
"history": "^5.3.0",
"is-online": "^9.0.1",
"md5-file": "^5.0.0",
"node-fetch": "^3.3.0",
"node-stream-zip": "^1.15.0",
"react": "^18.2.0",
"react-colorful": "^5.6.1",
"react-dom": "^18.2.0",
"react-fitty": "^1.0.1",
"react-outside-click-handler": "^1.3.0",
"react-range": "^1.8.14",
"react-router-dom": "^6.3.0",
"react-visibility-sensor": "^5.1.1",
"react-virtualized-auto-sizer": "^1.0.7",
"react-window": "^1.8.8",
"recursive-readdir": "^2.2.3",
"regedit": "^5.1.1",
"rfdc": "^1.3.0",
"rxjs": "^7.5.6",
"sanitize-filename": "^1.6.3",
"semver": "^7.3.8",
"tailwind-scrollbar-hide": "^1.1.7",
"tailwindcss-scoped-groups": "^2.0.0",
"use-delayed-state": "^1.2.0",
"use-double-click": "^1.0.5",
"uuid": "^9.0.0"
"use-fit-text": "^2.4.0"
},
"devEngines": {
"node": ">=14.x",
+6
View File
@@ -0,0 +1,6 @@
const tailwindcss = require("tailwindcss");
const autoprefixer = require("autoprefixer");
module.exports = {
plugins: [tailwindcss, autoprefixer],
};
+60
View File
@@ -0,0 +1,60 @@
<!--
Please use the content below as a template for your pull request.
Feel free to remove sections which do not make sense.
-->
## Scope
<!-- Brief description of WHAT youre doing and WHY. -->
[closes TICKET-###](https://link-to-your-ticket)
## Implementation
<!--
Some description of HOW you achieved it. Perhaps give a high level description of the program flow. Did you need to refactor something? What tradeoffs did you take? Are there things in here which youd particularly like people to pay close attention to?
-->
## Screenshots
| before | after |
| ------ | ----- |
| | |
## How to Test
<!--
A straightforward scenario of how to test your changes could help colleagues that are not familiar with the part of the code that you are changing but want to see it in action. This section can include a description or step-by-step instructions of how to get to the state of v2 that your change affects.
A "How To Test" section can look something like this:
- Sign in with a user with tracks
- Activate `show_awesome_cat_gifs` feature (add `?feature.show_awesome_cat_gifs=1` to your URL)
- You should see a GIF with cats dancing
-->
## Emoji Guide
**For reviewers: Emojis can be added to comments to call out blocking versus non-blocking feedback.**
E.g: Praise, minor suggestions, or clarifying questions that dont block merging the PR.
> 🟢 Nice refactor!
> 🟡 Why was the default value removed?
E.g: Blocking feedback must be addressed before merging.
> 🔴 This change will break something important
| | | |
| --- | --- | --- |
| Blocking | 🔴 ❌ 🚨 | RED |
| Non-blocking | 🟡 💡 🤔 💭 | Yellow, thinking, etc |
| Praise | 🟢 💚 😍 👍 🙌 | Green, hearts, positive emojis, etc |
+1229 -11
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "bs-manager",
"version": "0.2.0",
"version": "1.1.0",
"description": "A foundation for scalable desktop apps",
"main": "./dist/main/main.js",
"author": {
Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
import '@testing-library/jest-dom';
import { render } from '@testing-library/react';
import App from '../renderer/App';
import App from '../renderer/windows/App';
describe('App', () => {
it('should render', () => {
+4
View File
@@ -1,3 +1,7 @@
export const BS_EXECUTABLE = "Beat Saber.exe";
export const OCULUS_BS_DIR = "hyperbolic-magnetism-beat-saber"
export const BS_APP_ID = "620980";
export const BS_DEPOT = "620981";
export const APP_NAME = "BSManager";
export const STEAMVR_APP_ID = "250820";
+7
View File
@@ -0,0 +1,7 @@
export function splitIntoChunk<T = unknown>(arr: T[], chunkSize: number): T[][] {
const resArr = [];
for(let i = 0; i < arr.length; i += chunkSize){
resArr.push(arr.slice(i, i + chunkSize));
}
return resArr;
}
+110
View File
@@ -0,0 +1,110 @@
import { copyFile, ensureDir, move, symlink } from "fs-extra";
import { access, mkdir, rm, readdir, unlink, lstat, readlink } from "fs/promises";
import path from "path";
import { Observable } from "rxjs";
import log from "electron-log"
export async function pathExist(path: string): Promise<boolean> {
try{
await access(path);
return true;
}catch(e){
return false;
}
}
export async function ensureFolderExist(path: string): Promise<void> {
if(await pathExist(path)){ return Promise.resolve(); }
return mkdir(path, {recursive: true}).catch(log.error).then(() => {});
}
export async function deleteFolder(folderPath: string): Promise<void> {
if(!(await pathExist(folderPath))){ return; }
return rm(folderPath, {recursive: true, force: true});
}
export async function unlinkPath(path: string): Promise<void>{
if(!(await pathExist(path))){ return; }
return unlink(path);
}
export async function getFoldersInFolder(folderPath: string): Promise<string[]> {
if(!(await pathExist(folderPath))){ return []; }
const files = await readdir(folderPath, {withFileTypes: true});
const promises = files.map(async file => {
if(file.isDirectory()){ return path.join(folderPath, file.name); }
if(!file.isSymbolicLink()){ return undefined; }
try{
const targetPath = await readlink(path.join(folderPath, file.name));
return (await lstat(targetPath)).isDirectory() ? path.join(folderPath, file.name) : undefined;
}catch(e){
return undefined;
}
});
return (await Promise.all(promises)).filter(folder => folder);
}
export function moveFolderContent(src: string, dest: string): Observable<Progression>{
const progress: Progression = { current: 0, total: 0 };
return new Observable<Progression>(subscriber => {
subscriber.next(progress);
(async () => {
const srcExist = await pathExist(src);
if(!srcExist){ return subscriber.complete(); }
ensureFolderExist(dest);
const files = await readdir(src, {encoding: "utf-8"});
progress.total = files.length;
const promises = files.map(async file => {
const srcFullPath = path.join(src, file);
const destFullPath = path.join(dest, file);
if(await pathExist(destFullPath)){
progress.current++;
return subscriber.next(progress);
}
await move(srcFullPath, destFullPath);
progress.current++;
subscriber.next(progress);
});
Promise.allSettled(promises).then(() => subscriber.complete());
})();
});
}
export async function copyDirectoryWithJunctions(source: string, destination: string): Promise<void> {
await ensureDir(destination);
const items = await readdir(source);
for (const item of items) {
const sourcePath = path.join(source, item);
const destinationPath = path.join(destination, item);
const stats = await lstat(sourcePath);
if (stats.isDirectory()) {
await copyDirectoryWithJunctions(sourcePath, destinationPath);
} else if (stats.isFile()) {
await copyFile(sourcePath, destinationPath);
} else if (stats.isSymbolicLink()) {
const symlinkTarget = await readlink(sourcePath);
await symlink(symlinkTarget, destinationPath, "junction");
}
}
}
export interface Progression<T = unknown>{
total: number;
current: number;
extra?: T;
}
+9
View File
@@ -0,0 +1,9 @@
export function isValidUrl(url: string): boolean{
try{
new URL(url);
return true;
}
catch(e){
return false;
}
}
+51
View File
@@ -0,0 +1,51 @@
import { ipcMain } from "electron";
import { UtilsService } from "../services/utils.service";
import { IpcRequest } from "shared/models/ipc";
import { SearchParams } from "shared/models/maps/beat-saver.model";
import { BeatSaverService } from "../services/thrid-party/beat-saver/beat-saver.service";
import log from "electron-log";
ipcMain.on("bsv-search-map", async (event, request: IpcRequest<SearchParams>) => {
const utlis = UtilsService.getInstance();
const bsvService = BeatSaverService.getInstance();
bsvService.searchMaps(request.args).then(maps => {
utlis.ipcSend(request.responceChannel, {success: true, data: maps});
}).catch(e => {
utlis.ipcSend(request.responceChannel, {success: false, error: e});
})
});
ipcMain.on("bsv-get-map-details-from-hashs", async (event, request: IpcRequest<string[]>) => {
const utlis = UtilsService.getInstance();
const bsvService = BeatSaverService.getInstance();
bsvService.getMapDetailsFromHashs(request.args).then(maps => {
utlis.ipcSend(request.responceChannel, {success: true, data: maps});
}).catch(e => {
log.error(e);
utlis.ipcSend(request.responceChannel, {success: false, error: e});
})
});
ipcMain.on("bsv-get-map-details-by-id", async (event, request: IpcRequest<string>) => {
const utlis = UtilsService.getInstance();
const bsvService = BeatSaverService.getInstance();
bsvService.getMapDetailsById(request.args).then(maps => {
utlis.ipcSend(request.responceChannel, {success: true, data: maps});
}).catch(e => {
utlis.ipcSend(request.responceChannel, {success: false, error: e});
})
});
ipcMain.on("bsv-get-playlist-details-by-id", async (event, request: IpcRequest<string>) => {
const utlis = UtilsService.getInstance();
const bsvService = BeatSaverService.getInstance();
bsvService.getPlaylistPage(request.args).then(maps => {
utlis.ipcSend(request.responceChannel, {success: true, data: maps});
}).catch(e => {
utlis.ipcSend(request.responceChannel, {success: false, error: e});
})
});
+21 -9
View File
@@ -1,10 +1,10 @@
import { ipcMain } from 'electron';
import { BSVersion } from 'shared/bs-version.interface';
import { BSInstallerService, DownloadEventType } from '../services/bs-installer.service';
import { BSInstallerService, DownloadEventType, DownloadInfo } from '../services/bs-installer.service';
import { IpcRequest } from 'shared/models/ipc';
import { InstallationLocationService } from '../services/installation-location.service';
import { UtilsService } from '../services/utils.service';
import { BsmException } from 'shared/models/bsm-exception.model';
import { LocalMapsManagerService } from '../services/additional-content/local-maps-manager.service';
export interface InitDownloadInfoInterface {
@@ -17,15 +17,17 @@ export interface InitDownloadInfoInterface {
stay: boolean
}
export interface DownloadInfo {
bsVersion: BSVersion,
username: string,
password?: string,
stay?: boolean
}
ipcMain.on('is-dotnet-6-installed', async (event, request: IpcRequest<void>) => {
const installer = BSInstallerService.getInstance();
const utils = UtilsService.getInstance();
installer.isDotNet6Installed().then(installed => {
utils.ipcSend(request.responceChannel, {success: true, data: installed});
});
});
ipcMain.on('bs-download.start', async (event, request: IpcRequest<DownloadInfo>) => {
BSInstallerService.getInstance().downloadBsVersion(request.args).then(res => {
BSInstallerService.getInstance().downloadBsVersion(request.args).then(async res => {
await LocalMapsManagerService.getInstance().linkVersionMaps(request.args.bsVersion, true).catch(e => {});
UtilsService.getInstance().ipcSend(request.responceChannel, {success: true, data: res});
}).catch(e => {
UtilsService.getInstance().ipcSend(request.responceChannel, {success: false, data: e});
@@ -55,4 +57,14 @@ ipcMain.on('bs-download.set-installation-folder', (event, request: IpcRequest<st
});
})
ipcMain.on('bs-download.import-version', (event, request: IpcRequest<string>) => {
const utils = UtilsService.getInstance();
const installer = BSInstallerService.getInstance();
installer.importVersion(request.args).catch(e => {
utils.ipcSend(request.responceChannel, {success: false, error: e});
}).then(() => {
utils.ipcSend(request.responceChannel, {success: true});
});
})
+124
View File
@@ -0,0 +1,124 @@
import { LocalMapsManagerService } from "../services/additional-content/local-maps-manager.service";
import { UtilsService } from "../services/utils.service";
import { BSVersion } from "shared/bs-version.interface";
import { IpcRequest } from "shared/models/ipc";
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface";
import { BsvMapDetail } from "shared/models/maps";
import { IpcService } from "../services/ipc.service";
import { from } from "rxjs";
const ipc = IpcService.getInstance();
ipc.on('load-version-maps', async (request: IpcRequest<BSVersion>, reply) => {
const localMaps = LocalMapsManagerService.getInstance();
reply(localMaps.getMaps(request.args));
});
ipc.on("verion-have-maps-linked", async (request: IpcRequest<BSVersion>) => {
const utils = UtilsService.getInstance();
const maps = LocalMapsManagerService.getInstance();
utils.ipcSend<boolean>(request.responceChannel, {success: true, data: await maps.versionIsLinked(request.args)});
});
ipc.on("link-version-maps", async (request: IpcRequest<{version: BSVersion, keepMaps: boolean}>) => {
const utils = UtilsService.getInstance();
const maps = LocalMapsManagerService.getInstance();
maps.linkVersionMaps(request.args.version, request.args.keepMaps).then(() => {
utils.ipcSend<void>(request.responceChannel, {success: true});
}).catch(err => {
utils.ipcSend<void>(request.responceChannel, {success: true, error: err});
});
});
ipc.on("unlink-version-maps", async (request: IpcRequest<{version: BSVersion, keepMaps: boolean}>) => {
const utils = UtilsService.getInstance();
const maps = LocalMapsManagerService.getInstance();
maps.unlinkVersionMaps(request.args.version, request.args.keepMaps).then(() => {
utils.ipcSend<void>(request.responceChannel, {success: true});
}).catch(err => {
utils.ipcSend<void>(request.responceChannel, {success: true, error: err});
});
});
ipc.on("delete-maps", async (request: IpcRequest<BsmLocalMap[]>, reply) => {
const maps = LocalMapsManagerService.getInstance();
reply(maps.deleteMaps(request.args));
});
ipc.on("export-maps", async (request: IpcRequest<{version: BSVersion, maps: BsmLocalMap[], outPath: string}>, reply) => {
const maps = LocalMapsManagerService.getInstance();
reply(await maps.exportMaps(request.args.version, request.args.maps, request.args.outPath));
});
ipc.on("download-map", async (request: IpcRequest<{map: BsvMapDetail, version: BSVersion}>, reply) => {
const maps = LocalMapsManagerService.getInstance();
reply(from(maps.downloadMap(request.args.map, request.args.version)))
});
ipc.on("one-click-install-map", async (request: IpcRequest<BsvMapDetail>) => {
const utils = UtilsService.getInstance();
const maps = LocalMapsManagerService.getInstance();
maps.oneClickDownloadMap(request.args).then(() => {
utils.ipcSend(request.responceChannel, {success: true});
}).catch(err => {
utils.ipcSend(request.responceChannel, {success: false, error: err});
});
});
ipc.on("register-maps-deep-link", async (request: IpcRequest<void>) => {
const maps = LocalMapsManagerService.getInstance();
const utils = UtilsService.getInstance();
try{
const res = maps.enableDeepLinks();
utils.ipcSend(request.responceChannel, {success: true, data: res});
}
catch(e){
utils.ipcSend(request.responceChannel, {success: false});
}
});
ipc.on("unregister-maps-deep-link", async (request: IpcRequest<void>) => {
const maps = LocalMapsManagerService.getInstance();
const utils = UtilsService.getInstance();
try{
const res = maps.disableDeepLinks();
utils.ipcSend(request.responceChannel, {success: true, data: res});
}
catch(e){
utils.ipcSend(request.responceChannel, {success: false});
}
});
ipc.on("is-map-deep-links-enabled", async (request: IpcRequest<void>) => {
const maps = LocalMapsManagerService.getInstance();
const utils = UtilsService.getInstance();
try{
const res = maps.isDeepLinksEnabled();
utils.ipcSend(request.responceChannel, {success: true, data: res});
}
catch(e){
utils.ipcSend(request.responceChannel, {success: false});
}
});
ipc.on("get-version-maps-path", async (req: IpcRequest<BSVersion>, reply) => {
const maps = LocalMapsManagerService.getInstance();
reply(from(maps.getMapsFolderPath(req.args)));
});
+61
View File
@@ -0,0 +1,61 @@
import { ipcMain } from "electron";
import { UtilsService } from "../services/utils.service";
import { IpcRequest } from "shared/models/ipc";
import { MSModel } from "shared/models/model-saber/model-saber.model";
import { LocalModelsManagerService } from "../services/additional-content/local-models-manager.service";
ipcMain.on("one-click-install-model", async (event, request: IpcRequest<MSModel>) => {
const utils = UtilsService.getInstance();
const models = LocalModelsManagerService.getInstance();
models.oneClickDownloadModel(request.args).then(() => {
utils.ipcSend(request.responceChannel, {success: true});
}).catch(e => {
utils.ipcSend(request.responceChannel, {success: false, error: e});
})
});
ipcMain.on("register-models-deep-link", async (event, request: IpcRequest<void>) => {
const maps = LocalModelsManagerService.getInstance();
const utils = UtilsService.getInstance();
try{
const res = maps.enableDeepLinks();
utils.ipcSend(request.responceChannel, {success: true, data: res});
}
catch(e){
utils.ipcSend(request.responceChannel, {success: false});
}
});
ipcMain.on("unregister-models-deep-link", async (event, request: IpcRequest<void>) => {
const maps = LocalModelsManagerService.getInstance();
const utils = UtilsService.getInstance();
try{
const res = maps.disableDeepLinks();
utils.ipcSend(request.responceChannel, {success: true, data: res});
}
catch(e){
utils.ipcSend(request.responceChannel, {success: false});
}
});
ipcMain.on("is-models-deep-links-enabled", async (event, request: IpcRequest<void>) => {
const maps = LocalModelsManagerService.getInstance();
const utils = UtilsService.getInstance();
try{
const res = maps.isDeepLinksEnabled();
utils.ipcSend(request.responceChannel, {success: true, data: res});
}
catch(e){
utils.ipcSend(request.responceChannel, {success: false});
}
});
+61
View File
@@ -0,0 +1,61 @@
import { ipcMain } from "electron";
import { IpcRequest } from "shared/models/ipc";
import { LocalPlaylistsManagerService } from "../services/additional-content/local-playlists-manager.service";
import { UtilsService } from "../services/utils.service";
ipcMain.on("one-click-install-playlist", async (event, request: IpcRequest<string>) => {
const utils = UtilsService.getInstance();
const playlists = LocalPlaylistsManagerService.getInstance();
playlists.oneClickInstallPlaylist(request.args).then(() => {
utils.ipcSend(request.responceChannel, {success: true});
}).catch(e => {
utils.ipcSend(request.responceChannel, {success: false, error: e});
});
});
ipcMain.on("register-playlists-deep-link", async (event, request: IpcRequest<void>) => {
const maps = LocalPlaylistsManagerService.getInstance();
const utils = UtilsService.getInstance();
try{
const res = maps.enableDeepLinks();
utils.ipcSend(request.responceChannel, {success: true, data: res});
}
catch(e){
utils.ipcSend(request.responceChannel, {success: false});
}
});
ipcMain.on("unregister-playlists-deep-link", async (event, request: IpcRequest<void>) => {
const maps = LocalPlaylistsManagerService.getInstance();
const utils = UtilsService.getInstance();
try{
const res = maps.disableDeepLinks();
utils.ipcSend(request.responceChannel, {success: true, data: res});
}
catch(e){
utils.ipcSend(request.responceChannel, {success: false});
}
});
ipcMain.on("is-playlists-deep-links-enabled", async (event, request: IpcRequest<void>) => {
const maps = LocalPlaylistsManagerService.getInstance();
const utils = UtilsService.getInstance();
try{
const res = maps.isDeepLinksEnabled();
utils.ipcSend(request.responceChannel, {success: true, data: res});
}
catch(e){
utils.ipcSend(request.responceChannel, {success: false});
}
});
+109 -5
View File
@@ -2,14 +2,22 @@ import { ipcMain } from 'electron';
import { UtilsService } from '../services/utils.service';
import { BSVersionLibService } from '../services/bs-version-lib.service'
import { BSVersion } from 'shared/bs-version.interface';
import path from 'path';
import { exec } from 'child_process';
import { SteamService } from '../services/steam.service';
import { BS_APP_ID } from '../constants';
import { IpcRequest } from 'shared/models/ipc';
import { BSLocalVersionService } from '../services/bs-local-version.service';
import { InstallationLocationService } from '../services/installation-location.service';
import { BsmException } from 'shared/models/bsm-exception.model';
import { IpcService } from '../services/ipc.service';
import { from } from 'rxjs';
import path from 'path';
import { pathExist } from '../helpers/fs.helpers';
import { FolderLinkerService, LinkOptions } from '../services/folder-linker.service';
import { LocalMapsManagerService } from '../services/additional-content/local-maps-manager.service';
import { readJSON, writeJSON } from 'fs-extra';
import log from "electron-log"
import { VersionLinkerAction } from 'renderer/services/version-folder-linker.service';
import { VersionFolderLinkerService } from '../services/version-folder-linker.service';
const ipc = IpcService.getInstance();
ipcMain.on('bs-version.get-version-dict', (event, req: IpcRequest<void>) => {
BSVersionLibService.getInstance().getAvailableVersions().then(versions => {
@@ -30,7 +38,7 @@ ipcMain.on('bs-version.installed-versions', async (event, req: IpcRequest<void>)
ipcMain.on("bs-version.open-folder", async (event, req: IpcRequest<BSVersion>) => {
const localVersionService = BSLocalVersionService.getInstance();
const versionFolder = await localVersionService.getVersionPath(req.args);
UtilsService.getInstance().pathExist(versionFolder) && exec(`start "" "${versionFolder}"`);
(await pathExist(versionFolder)) && exec(`start "" "${versionFolder}"`);
});
ipcMain.on("bs-version.edit", async (event, req: IpcRequest<{version: BSVersion, name: string, color: string}>) => {
@@ -48,3 +56,99 @@ ipcMain.on("bs-version.clone", async (event, req: IpcRequest<{version: BSVersion
UtilsService.getInstance().ipcSend(req.responceChannel, {success: false, error});
});
});
ipc.on("get-version-full-path", async (req: IpcRequest<BSVersion>, reply) => {
const localVersions = BSLocalVersionService.getInstance();
reply(from( localVersions.getVersionPath(req.args) ));
});
ipc.on("relative-version-path-to-full", async (req: IpcRequest<{version: BSVersion, relative: string}>, reply) => {
path.isAbsolute(req.args.relative) && reply(from(Promise.resolve(req.args.relative)));
const localVersions = BSLocalVersionService.getInstance();
const promise = localVersions.getVersionPath(req.args.version).catch(() => null).then(versionPath => {
return path.join(versionPath, req.args.relative);
});
reply(from(promise));
});
ipc.on("full-version-path-to-relative", async (req: IpcRequest<{version: BSVersion, fullPath: string}>, reply) => {
const localVersions = BSLocalVersionService.getInstance();
const promise = localVersions.getVersionPath(req.args.version).catch(() => null).then(versionPath => {
return path.relative(versionPath, req.args.fullPath);
});
reply(from(promise));
});
ipc.on("get-linked-folders", async (req: IpcRequest<{version: BSVersion, options?: { relative?: boolean }}>, reply) => {
const versionLinker = VersionFolderLinkerService.getInstance();
reply(from(versionLinker.getLinkedFolders(req.args.version, req.args.options)));
});
ipc.on("link-folder", async (req: IpcRequest<{ folder: string, options?: LinkOptions}>, reply) => {
req.args.options ??= {};
const linker = FolderLinkerService.getInstance();
const relativeMapsFolder = path.join(LocalMapsManagerService.LEVELS_ROOT_FOLDER, LocalMapsManagerService.CUSTOM_LEVELS_FOLDER)
if(req.args.folder.includes(relativeMapsFolder)){
return reply(from(linker.linkFolder(req.args.folder, {keepContents: req.args.options?.keepContents, intermediateFolder: LocalMapsManagerService.SHARED_MAPS_FOLDER})));
}
if(req.args.folder.includes("UserData")){
req.args.options = { ...req.args.options, backup: true };
}
const res = from(linker.linkFolder(req.args.folder, req.args.options));
const jsonIPAPath = path.join(req.args.folder, "Beat Saber IPA.json");
if(!(await pathExist(jsonIPAPath))){ return reply(res); }
await res.toPromise();
try{
const ipaData = (await readJSON(jsonIPAPath)) ?? {} as any;
ipaData["YeetMods"] = false;
await writeJSON(jsonIPAPath, ipaData, {spaces: 4});
}catch(e){
log.error("Disable YeetMods", e);
}
reply(res);
});
ipc.on("link-version-folder-action", async (req: IpcRequest<VersionLinkerAction>, reply) => {
const versionLinker = VersionFolderLinkerService.getInstance();
reply(from(versionLinker.doAction(req.args)));
});
ipc.on("is-version-folder-linked", async (req: IpcRequest<{ version: BSVersion, relativeFolder: string }>, reply) => {
const versionLinker = VersionFolderLinkerService.getInstance();
reply(from(versionLinker.isFolderLinked(req.args.version, req.args.relativeFolder)));
});
ipc.on("unlink-folder", async (req: IpcRequest<{ folder: string, options?: LinkOptions}>, reply) => {
req.args.options ??= {};
const linker = FolderLinkerService.getInstance();
const relativeMapsFolder = path.join(LocalMapsManagerService.LEVELS_ROOT_FOLDER, LocalMapsManagerService.CUSTOM_LEVELS_FOLDER)
if(req.args.folder.includes(relativeMapsFolder)){
return reply(from(linker.unlinkFolder(req.args.folder, {...req.args.options, intermediateFolder: LocalMapsManagerService.SHARED_MAPS_FOLDER})));
}
if(req.args.folder.includes("UserData")){
req.args.options = { ...req.args.options, backup: true };
}
reply(from(linker.unlinkFolder(req.args.folder, req.args.options)));
});
+5 -1
View File
@@ -3,8 +3,12 @@ import './os-controls-ipcs';
import './bs-launcher-ipcs';
import './bs-version-ipcs';
import './bs-uninstall-ipcs';
import './map-ipcs';
import './supporters-ipcs';
import './launcher-ipcs';
import './window-manager-ipcs';
import './bs-mods-ipcs';
import './bs-maps-ipcs';
import './beat-saver-ipcs';
import './bs-playlist-ipcs';
import './model-saber.ipcs';
import './bs-model-ipcs';
-13
View File
@@ -1,13 +0,0 @@
import { ipcMain} from 'electron';
import { MapService } from '../services/map.service';
import { UtilsService } from '../services/utils.service';
import { IpcRequest } from 'shared/models/ipc';
import { ExportVersionMapsOption } from 'shared/models/maps/export-version-maps.model';
ipcMain.on("map.export-version", (event, request: IpcRequest<ExportVersionMapsOption>) => {
const utils = UtilsService.getInstance();
const mapService = MapService.getInstance();
mapService.exportVersionMaps(request.args.version, request.args.path).then(() => {
utils.ipcSend(request.responceChannel, {success: true});
}).catch(() => utils.ipcSend(request.responceChannel, {success: false, error: {title: "", msg: ""}}));
});
+15
View File
@@ -0,0 +1,15 @@
import { ipcMain } from "electron";
import { IpcRequest } from "shared/models/ipc";
import { ModelSaberService } from "../services/thrid-party/model-saber/model-saber.service";
import { UtilsService } from "../services/utils.service";
ipcMain.on("ms-get-model-by-id", async (event, request: IpcRequest<string|number>) => {
const utils = UtilsService.getInstance();
const ms = ModelSaberService.getInstance();
ms.getModelById(request.args).then(model => {
utils.ipcSend(request.responceChannel, {success: true, data: model});
}).catch(e => {
utils.ipcSend(request.responceChannel, {success: false, error: e});
})
});
+35 -9
View File
@@ -1,40 +1,52 @@
import { ipcMain, shell, dialog, app } from 'electron';
import { UtilsService } from '../services/utils.service';
import { IpcRequest } from 'shared/models/ipc';
import { SystemNotificationOptions } from 'shared/models/notification/system-notification.model';
import { NotificationService } from '../services/notification.service';
import { SteamService } from '../services/steam.service';
import { IpcService } from '../services/ipc.service';
import { from } from 'rxjs';
import { fstat, lstat } from 'fs';
import { pathExist } from '../helpers/fs.helpers';
// TODO IMPROVE WINDOW CONTROL BY USING WINDOW SERVICE
const ipc = IpcService.getInstance();
ipcMain.on('window.close', async () => {
const utils = UtilsService.getInstance();
utils.getMainWindow()?.close();
utils.getMainWindows("index.html")?.close();
});
ipcMain.on('window.maximize', async () => {
const utils = UtilsService.getInstance();
utils.getMainWindow()?.maximize();
utils.getMainWindows("index.html")?.maximize();
});
ipcMain.on('window.minimize', async () => {
const utils = UtilsService.getInstance();
utils.getMainWindow()?.minimize();
utils.getMainWindows("index.html")?.minimize();
});
ipcMain.on('window.reset', async () => {
const utils = UtilsService.getInstance();
utils.getMainWindow()?.restore();
utils.getMainWindows("index.html")?.restore();
});
ipcMain.on('new-window', async (event, request: IpcRequest<string>) => {
shell.openExternal(request.args);
});
ipcMain.on('choose-folder', async (event, request: IpcRequest<void>) => {
dialog.showOpenDialog({properties: ['openDirectory']}).then(res => {
UtilsService.getInstance().ipcSend(request.responceChannel, {success: true, data: res});
});
ipc.on('choose-folder', async (req: IpcRequest<string>, reply) => {
reply(
from(dialog.showOpenDialog({properties: ['openDirectory'], defaultPath: req.args ?? ""}))
)
});
ipcMain.on("window.progression", async (event, request: IpcRequest<number>) => {
const utils = UtilsService.getInstance();
utils.getMainWindow().setProgressBar(request.args / 100);
utils.getMainWindows("index.html")?.setProgressBar(request.args / 100);
});
ipcMain.on('save-file', async (event, request: IpcRequest<{filename?: string, filters?: Electron.FileFilter[]}>) => {
@@ -52,3 +64,17 @@ ipcMain.on("current-version", async (event, request: IpcRequest<void>) => {
ipcMain.on("open-logs", async (event, request: IpcRequest<void>) => {
shell.openPath(app.getPath("logs"));
});
ipcMain.on("notify-system", async (event, request: IpcRequest<SystemNotificationOptions>) => {
NotificationService.getInstance().notify(request.args)
});
ipcMain.on("open-steam", async (event, request: IpcRequest<void>) => {
const steam = SteamService.getInstance();
const utils = UtilsService.getInstance();
steam.openSteam().then(res => {
utils.ipcSend(request.responceChannel, {success: true, data: res});
}).catch((e) => {
utils.ipcSend(request.responceChannel, {success: false, error: e});
});
});
+15
View File
@@ -2,6 +2,9 @@ import { ipcMain } from "electron";
import { WindowManagerService } from "../services/window-manager.service";
import { IpcRequest } from "shared/models/ipc";
import { AppWindow } from "shared/models/window-manager/app-window.model";
import { BSLauncherService } from "../services/bs-launcher.service";
const launcher = BSLauncherService.getInstance();
ipcMain.on("open-window-then-close-all", async (event, request: IpcRequest<AppWindow>) => {
const windowManager = WindowManagerService.getInstance();
@@ -9,4 +12,16 @@ ipcMain.on("open-window-then-close-all", async (event, request: IpcRequest<AppWi
windowManager.openWindow(request.args).then(window => {
windowManager.closeAllWindows(request.args);
});
});
ipcMain.on("close-all-windows", async (event, request: IpcRequest<AppWindow>) => {
await launcher.restoreSteamVR();
const windowManager = WindowManagerService.getInstance();
windowManager.closeAllWindows(request.args);
});
ipcMain.on("close-windows", async (event, request: IpcRequest<AppWindow[]>) => {
await launcher.restoreSteamVR();
const windowManager = WindowManagerService.getInstance();
windowManager.close(...request.args);
});
+64 -19
View File
@@ -9,27 +9,30 @@
* `./src/main.js` using webpack. This gives us some performance wins.
*/
import path from 'path';
import { app } from 'electron';
import { app, ipcMain, protocol } from 'electron';
import log from 'electron-log';
import './ipcs';
import { UtilsService } from './services/utils.service';
import { WindowManagerService } from './services/window-manager.service';
export const PRELOAD_PATH = app.isPackaged ? path.join(__dirname, 'preload.js') : path.join(__dirname, '../../.erb/dll/preload.js')
import { DeepLinkService } from './services/deep-link.service';
import { AppWindow } from 'shared/models/window-manager/app-window.model';
import { LocalMapsManagerService } from './services/additional-content/local-maps-manager.service';
import { LocalPlaylistsManagerService } from './services/additional-content/local-playlists-manager.service';
import { LocalModelsManagerService } from './services/additional-content/local-models-manager.service';
import { APP_NAME } from './constants';
import { BSLauncherService } from './services/bs-launcher.service';
import { IpcRequest } from 'shared/models/ipc';
const isDebug = process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true';
log.transports.file.level = 'info';
log.transports.file.resolvePath = (() => {
const now = new Date();
return path.join(app.getPath("logs"), `${now.getFullYear()}-${now.getMonth()+1}-${now.getDate()}.log`);
return path.join(app.getPath("logs"), `${now.getFullYear()}-${now.getMonth()+1}-${now.getDate()}-v${app.getVersion()}.log`);
});
log.catchErrors();
const utilsService = UtilsService.getInstance();
utilsService.setAssetsPath(app.isPackaged ? path.join(process.resourcesPath, 'assets') : path.join(__dirname, '../../assets'));
if (process.env.NODE_ENV === 'production') {
const sourceMapSupport = require('source-map-support');
sourceMapSupport.install();
@@ -47,19 +50,61 @@ const installExtensions = async () => {
return installer.default(extensions.map((name) => installer[name]), forceDownload).catch(console.log);
};
const createWindow = async () => {
const createWindow = async (window: AppWindow = "launcher.html") => {
if(isDebug){ await installExtensions(); }
WindowManagerService.getInstance().openWindow("launcher.html");
WindowManagerService.getInstance().openWindow(window);
};
app.on('window-all-closed', () => {
// Respect the OSX convention of having the application in memory even
// after all windows have been closed
if (process.platform !== 'darwin') {
app.quit();
}
});
const initServicesMustBeInitialized = () => {
LocalMapsManagerService.getInstance();
LocalPlaylistsManagerService.getInstance();
LocalModelsManagerService.getInstance();
// Model
}
app.whenReady().then(() => {
createWindow();
}).catch(log.error);
const gotTheLock = app.requestSingleInstanceLock();
if(!gotTheLock){
app.quit();
}
else{
app.on('second-instance', (e, argv) => {
const deepLink = argv.find(arg => DeepLinkService.getInstance().isDeepLink(arg));
if(!deepLink){ return; }
DeepLinkService.getInstance().dispatchLinkOpened(deepLink);
});
app.whenReady().then(() => {
app.setAppUserModelId(APP_NAME);
initServicesMustBeInitialized();
const deepLink = process.argv.find(arg => DeepLinkService.getInstance().isDeepLink(arg));
if(!deepLink){
createWindow();
}
else{
DeepLinkService.getInstance().dispatchLinkOpened(deepLink);
}
protocol.registerFileProtocol('file', (request, callback) => {
const pathname = decodeURI(request.url.replace('file:///', ''));
callback(pathname);
});
BSLauncherService.getInstance().restoreSteamVR();
// Log renderer errors
ipcMain.on('log-error', (event, args: IpcRequest<any>) => {
log.error(args?.args);
});
}).catch(log.error);
}
+78
View File
@@ -0,0 +1,78 @@
import archiver from "archiver";
import { createWriteStream } from "fs";
import { Observable } from "rxjs";
import recursive from "recursive-readdir";
import { lstatSync } from "fs";
import * as _path from "path";
import { ArchiveProgress } from "shared/models/archive.interface";
export class Archive{
private archive: archiver.Archiver;
private readonly output: string;
private readonly directories: string[] = [];
private readonly files: string[] = [];
constructor(output: string, options?: archiver.ArchiverOptions){
this.output = output;
this.initArchive(options);
}
private initArchive(options?: archiver.ArchiverOptions): void{
const defaultOptions: archiver.ArchiverOptions = {
zlib: {level: 9}
};
this.archive = archiver("zip", {...defaultOptions, ...options});
}
private async loadTotalFiles(): Promise<number>{
let totalFiles = this.files.length;
for(const path of this.directories){
const files = await recursive(path);
totalFiles += files.length;
}
return totalFiles;
}
public addDirectory(path: string, destPath?: string|false): void{
this.directories.push(path);
destPath = destPath === false ? false : _path.basename(path);
this.archive.directory(path, destPath);
}
public addFile(path: string, destPath?: string): void{
this.files.push(path);
destPath = destPath ||= _path.basename(path);
this.archive.file(path, {name: destPath});
}
public finalize(): Observable<ArchiveProgress>{
const progress: ArchiveProgress = {
totalFiles: 0,
prossesedFiles: 0
};
return new Observable<ArchiveProgress>(observer => {
(async () => {
progress.totalFiles = await this.loadTotalFiles();
this.archive.on("entry", e => {
if(e.stats.isDirectory()){ return; }
progress.prossesedFiles++;
observer.next(progress);
});
this.archive.pipe(createWriteStream(this.output));
this.archive.on("error", err => observer.error(err));
this.archive.finalize().then(() => observer.complete());
})();
});
}
}
+7 -5
View File
@@ -1,21 +1,23 @@
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';
export type Channels = any;
import { IpcChannel } from 'shared/models/ipc/ipc-response.interface';
contextBridge.exposeInMainWorld('electron', {
ipcRenderer: {
sendMessage(channel: Channels, args: unknown[]) {
sendMessage(channel: IpcChannel, args: unknown[]) {
ipcRenderer.send(channel, args);
},
on(channel: Channels, func: (...args: unknown[]) => void) {
on(channel: IpcChannel, func: (...args: unknown[]) => void) {
const subscription = (_event: IpcRendererEvent, ...args: unknown[]) =>
func(...args);
ipcRenderer.on(channel, subscription);
return () => ipcRenderer.removeListener(channel, subscription);
},
once(channel: Channels, func: (...args: unknown[]) => void) {
once(channel: IpcChannel, func: (...args: unknown[]) => void) {
ipcRenderer.once(channel, (_event, ...args) => func(...args));
},
removeAllListeners(channel: IpcChannel) {
ipcRenderer.removeAllListeners(channel);
}
},
});
@@ -0,0 +1,297 @@
import path from "path";
import { BSVersion } from "shared/bs-version.interface";
import { BsvMapDetail, RawMapInfoData } from "shared/models/maps";
import { BsmLocalMap, BsmLocalMapsProgress, DeleteMapsProgress } from "shared/models/maps/bsm-local-map.interface";
import { BSLocalVersionService } from "../bs-local-version.service";
import { InstallationLocationService } from "../installation-location.service";
import { UtilsService } from "../utils.service";
import crypto from "crypto";
import { lstatSync, unlinkSync } from "fs";
import { copySync } from "fs-extra";
import StreamZip from "node-stream-zip";
import { RequestService } from "../request.service";
import sanitize from "sanitize-filename";
import { DeepLinkService } from "../deep-link.service";
import log from 'electron-log';
import { WindowManagerService } from "../window-manager.service";
import { ipcMain } from "electron";
import { IpcRequest } from 'shared/models/ipc';
import { Observable } from "rxjs";
import { Archive } from "../../models/archive.class";
import { deleteFolder, ensureFolderExist, getFoldersInFolder, pathExist } from "../../helpers/fs.helpers";
import { readFile } from "fs/promises";
import { FolderLinkerService } from "../folder-linker.service";
export class LocalMapsManagerService {
private static instance: LocalMapsManagerService;
public static getInstance(): LocalMapsManagerService{
if(!LocalMapsManagerService.instance){ LocalMapsManagerService.instance = new LocalMapsManagerService(); }
return LocalMapsManagerService.instance;
}
public static readonly LEVELS_ROOT_FOLDER = "Beat Saber_Data";
public static readonly CUSTOM_LEVELS_FOLDER = "CustomLevels";
public static readonly SHARED_MAPS_FOLDER = "SharedMaps";
private readonly DEEP_LINKS = {
BeatSaver: "beatsaver",
ScoreSaber: "web+bsmap"
};
private readonly localVersion: BSLocalVersionService;
private readonly installLocation: InstallationLocationService;
private readonly utils: UtilsService;
private readonly reqService: RequestService;
private readonly deepLink: DeepLinkService;
private readonly windows: WindowManagerService;
private readonly linker = FolderLinkerService.getInstance();
private constructor(){
this.localVersion = BSLocalVersionService.getInstance();
this.installLocation = InstallationLocationService.getInstance();
this.utils = UtilsService.getInstance();
this.reqService = RequestService.getInstance();
this.deepLink = DeepLinkService.getInstance();
this.windows = WindowManagerService.getInstance();
this.linker = FolderLinkerService.getInstance();
this.deepLink.addLinkOpenedListener(this.DEEP_LINKS.BeatSaver, link => {
log.info("DEEP-LINK RECEIVED FROM", this.DEEP_LINKS.BeatSaver, link);
this.openOneClickDownloadMapWindow(new URL(link).host);
});
this.deepLink.addLinkOpenedListener(this.DEEP_LINKS.ScoreSaber, link => {
log.info("DEEP-LINK RECEIVED FROM", this.DEEP_LINKS.ScoreSaber, link);
this.openOneClickDownloadMapWindow(new URL(link).host, true);
});
}
public async getMapsFolderPath(version?: BSVersion): Promise<string>{
if(version){ return path.join(await this.localVersion.getVersionPath(version), LocalMapsManagerService.LEVELS_ROOT_FOLDER, LocalMapsManagerService.CUSTOM_LEVELS_FOLDER); }
const sharedMapsPath = path.join(this.installLocation.sharedContentPath, LocalMapsManagerService.SHARED_MAPS_FOLDER, LocalMapsManagerService.CUSTOM_LEVELS_FOLDER);
if(!(await pathExist(sharedMapsPath))){
await ensureFolderExist(sharedMapsPath);
}
return sharedMapsPath;
}
private async computeMapHash(mapPath: string, rawInfoString: string): Promise<string>{
const mapRawInfo = JSON.parse(rawInfoString);
const shasum = crypto.createHash("sha1");
shasum.update(rawInfoString);
for(const set of mapRawInfo._difficultyBeatmapSets){
for(const diff of set._difficultyBeatmaps){
const diffFilePath = path.join(mapPath, diff._beatmapFilename);
const diffContent = await readFile(diffFilePath, {encoding: "utf-8"}).catch(() => null);
diffContent && shasum.update(diffContent);
}
}
return shasum.digest("hex");
}
private async loadMapInfoFromPath(mapPath: string): Promise<BsmLocalMap>{
const infoFilePath = path.join(mapPath, "Info.dat");
if(!(await pathExist(infoFilePath))){ return null; }
const rawInfoString = await readFile(infoFilePath, {encoding: "utf-8"});
const rawInfo: RawMapInfoData = JSON.parse(rawInfoString);
const coverUrl = new URL(`file:///${path.join(mapPath, rawInfo._coverImageFilename)}`).href;
const songUrl = new URL(`file:///${path.join(mapPath, rawInfo._songFilename)}`).href;
const hash = await this.computeMapHash(mapPath, rawInfoString);
return {rawInfo, coverUrl, songUrl, hash, path: mapPath};
}
private async downloadMapZip(zipUrl: string): Promise<{zip: StreamZip.StreamZipAsync, zipPath: string}>{
const fileName = path.basename(zipUrl);
const tempPath = this.utils.getTempPath();
await ensureFolderExist(this.utils.getTempPath());
const dest = path.join(tempPath, fileName);
const zipPath = await this.reqService.downloadFile(zipUrl, dest);
const zip = new StreamZip.async({file : zipPath});
return {zip, zipPath};
}
private openOneClickDownloadMapWindow(mapId: string, isHash = false): void{
ipcMain.once("one-click-map-info", async (event, req: IpcRequest<void>) => {
this.utils.ipcSend(req.responceChannel, {success: true, data: {id: mapId, isHash}});
});
this.windows.openWindow("oneclick-download-map.html");
}
public getMaps(version?: BSVersion): Observable<BsmLocalMapsProgress>{
const progression: BsmLocalMapsProgress = {
total: 0,
loaded: 0,
maps: []
};
return new Observable<BsmLocalMapsProgress>(observer => {
(async () => {
const levelsFolder = await this.getMapsFolderPath(version);
const levelsPaths = (await pathExist(levelsFolder)) ? await getFoldersInFolder(levelsFolder) : [];
progression.total = levelsPaths.length;
const promises = levelsPaths.map(async levelPath => {
const mapInfo = await this.loadMapInfoFromPath(levelPath);
if(!mapInfo){ return null; }
progression.loaded++;
observer.next(progression);
return mapInfo;
});
const mapsInfo = (await Promise.allSettled(promises)).reduce((acc, mapInfo) => {
if(mapInfo.status === "fulfilled" && mapInfo.value){
acc.push(mapInfo.value);
}
return acc;
} ,[] as BsmLocalMap[]);
progression.maps = mapsInfo;
observer.next(progression);
observer.complete();
})();
});
}
public async versionIsLinked(version: BSVersion): Promise<boolean>{
const levelsPath = await this.getMapsFolderPath(version);
const isPathExist = await pathExist(levelsPath);
if(!isPathExist){ return false; }
return lstatSync(levelsPath).isSymbolicLink()
}
public async linkVersionMaps(version: BSVersion, keepMaps: boolean): Promise<void>{
const versionMapsPath = await this.getMapsFolderPath(version);
return this.linker.linkFolder(versionMapsPath, {keepContents: keepMaps, intermediateFolder: LocalMapsManagerService.SHARED_MAPS_FOLDER});
}
public async unlinkVersionMaps(version: BSVersion, keepMaps: boolean): Promise<void>{
const versionMapsPath = await this.getMapsFolderPath(version);
return this.linker.unlinkFolder(versionMapsPath, {keepContents: keepMaps, intermediateFolder: LocalMapsManagerService.SHARED_MAPS_FOLDER});
}
public deleteMaps(maps: BsmLocalMap[]): Observable<DeleteMapsProgress>{
const mapsFolders = maps.map(map => map.path);
const mapsHashsToDelete = maps.map(map => map.hash);
return new Observable<DeleteMapsProgress>(observer => {
(async () => {
const progress: DeleteMapsProgress = { total: maps.length, deleted: 0 };
try{
for(const folder of mapsFolders){
const detail = await this.loadMapInfoFromPath(folder);
if(!mapsHashsToDelete.includes(detail?.hash)){ continue; }
await deleteFolder(folder);
progress.deleted++;
observer.next(progress);
}
}catch(e){
observer.error(e);
}
observer.complete();
})();
});
}
public async downloadMap(map: BsvMapDetail, version?: BSVersion): Promise<BsmLocalMap>{
if(!map.versions.at(0).hash){ throw "Cannot download map, no hash found"; }
const zipUrl = map.versions.at(0).downloadURL;
const mapsFolder = await this.getMapsFolderPath(version);
const {zip, zipPath} = await this.downloadMapZip(zipUrl);
const mapFolderName = sanitize(`${map.id}-${map.name}`);
const mapPath = path.join(mapsFolder, mapFolderName);
if(!zip){ throw `Cannot download ${zipUrl}`; }
await ensureFolderExist(mapPath);
await zip.extract(null, mapPath);
await zip.close();
unlinkSync(zipPath);
const localMap = await this.loadMapInfoFromPath(mapPath);
localMap.bsaverInfo = map;
return localMap;
}
public async exportMaps(version: BSVersion, maps: BsmLocalMap[], outPath: string){
const archive = new Archive(outPath);
if(!maps || maps.length === 0){
const mapsFolder = await this.getMapsFolderPath(version);
archive.addDirectory(mapsFolder, false);
}
else{
const mapsFolders = maps.map(map => map.path);
mapsFolders.forEach(maps => archive.addDirectory(maps));
}
return archive.finalize()
}
public async oneClickDownloadMap(map: BsvMapDetail): Promise<void>{
const downloadedMap = await this.downloadMap(map);
const versions = await this.localVersion.getInstalledVersions();
for(const version of versions){
if(await this.versionIsLinked(version)){ continue; }
const versionMapsPath = await this.getMapsFolderPath(version);
await ensureFolderExist(versionMapsPath);
copySync(downloadedMap.path, path.join(versionMapsPath, path.basename(downloadedMap.path)), {overwrite: true});
}
}
public enableDeepLinks(): boolean{
return Array.from(Object.values(this.DEEP_LINKS)).every(link => this.deepLink.registerDeepLink(link));
}
public disableDeepLinks(): boolean{
return Array.from(Object.values(this.DEEP_LINKS)).every(link => this.deepLink.unRegisterDeepLink(link));
}
public isDeepLinksEnabled(): boolean{
return Array.from(Object.values(this.DEEP_LINKS)).every(link => this.deepLink.isDeepLinkRegistred(link));
}
}
@@ -0,0 +1,127 @@
import { DeepLinkService } from "../deep-link.service";
import log from "electron-log"
import { ipcMain } from "electron";
import { IpcRequest } from "shared/models/ipc";
import { UtilsService } from "../utils.service";
import { WindowManagerService } from "../window-manager.service";
import { MSModel, MSModelType } from "shared/models/model-saber/model-saber.model";
import { BSVersion } from "shared/bs-version.interface";
import { BSLocalVersionService } from "../bs-local-version.service";
import path from "path";
import { RequestService } from "../request.service";
import { copyFileSync } from "fs-extra";
import sanitize from "sanitize-filename";
import { ensureFolderExist } from "../../helpers/fs.helpers";
export class LocalModelsManagerService {
private static instance: LocalModelsManagerService;
public static getInstance(): LocalModelsManagerService{
if(!LocalModelsManagerService.instance){ LocalModelsManagerService.instance = new LocalModelsManagerService(); }
return LocalModelsManagerService.instance;
}
private readonly DEEP_LINKS = {
ModelSaber: "modelsaber",
};
private readonly MODEL_TYPE_FOLDER: Record<Exclude<MSModelType, "misc">, string> = {
avatar: "CustomAvatars",
bloq: "CustomNotes",
platform: "CustomPlatforms",
saber: "CustomSabers"
}
private readonly deepLink: DeepLinkService;
private readonly utils: UtilsService;
private readonly windows: WindowManagerService;
private readonly localVersion: BSLocalVersionService;
private readonly request: RequestService;
private constructor(){
this.deepLink = DeepLinkService.getInstance();
this.utils = UtilsService.getInstance();
this.windows = WindowManagerService.getInstance();
this.localVersion = BSLocalVersionService.getInstance();
this.request = RequestService.getInstance();
this.deepLink.addLinkOpenedListener(this.DEEP_LINKS.ModelSaber, (link) => {
log.info("DEEP-LINK RECEIVED FROM", this.DEEP_LINKS.ModelSaber, link);
const url = new URL(link);
const type = url.host
const id = url.pathname.replace("/", '').split("/").at(0);
this.openOneClickDownloadModelWindow(id, type);
});
}
private openOneClickDownloadModelWindow(id: string, type: string){
ipcMain.once("one-click-model-info", async (event, req: IpcRequest<void>) => {
this.utils.ipcSend(req.responceChannel, {success: true, data: {id, type}});
});
this.windows.openWindow("oneclick-download-model.html");
}
private async getModelFolderPath(type: MSModelType, version?: BSVersion): Promise<string>{
if(!version){ throw "will be implemented whith models management" }
if(type === "misc"){ throw "model type not supported"; }
const versionPath = await this.localVersion.getVersionPath(version);
const modelFolderPath = path.join(versionPath, this.MODEL_TYPE_FOLDER[type]);
await ensureFolderExist(modelFolderPath);
return modelFolderPath;
}
public async downloadModel(model: MSModel, version: BSVersion): Promise<string>{
const modelFolder = await this.getModelFolderPath(model.type, version);
const modelDest = path.join(modelFolder, sanitize(path.basename(model.download)));
return this.request.downloadFile(model.download, modelDest);
}
public async oneClickDownloadModel(model: MSModel): Promise<void>{
if(!model){ return; }
const versions = await this.localVersion.getInstalledVersions();
if(versions?.length === 0){ return; }
const fisrtVersion = versions.shift();
const downloaded = await this.downloadModel(model, fisrtVersion);
for(const version of versions){
const modelDest = path.join(await this.getModelFolderPath(model.type, version), path.basename(downloaded));
copyFileSync(downloaded, modelDest);
}
}
public enableDeepLinks(): boolean{
return Array.from(Object.values(this.DEEP_LINKS)).every(link => this.deepLink.registerDeepLink(link));
}
public disableDeepLinks(): boolean{
return Array.from(Object.values(this.DEEP_LINKS)).every(link => this.deepLink.unRegisterDeepLink(link));
}
public isDeepLinksEnabled(): boolean{
return Array.from(Object.values(this.DEEP_LINKS)).every(link => this.deepLink.isDeepLinkRegistred(link));
}
}
@@ -0,0 +1,227 @@
import path from "path";
import { BehaviorSubject, Observable } from "rxjs";
import { BSVersion } from "shared/bs-version.interface";
import { BSLocalVersionService } from "../bs-local-version.service";
import { DeepLinkService } from "../deep-link.service";
import { RequestService } from "../request.service";
import { UtilsService } from "../utils.service";
import { LocalMapsManagerService } from "./local-maps-manager.service";
import log from "electron-log"
import { isValidUrl } from "../../helpers/url.helpers";
import { ipcMain } from "electron";
import { WindowManagerService } from "../window-manager.service";
import { IpcRequest } from "shared/models/ipc";
import { BPList, DownloadPlaylistProgression } from "shared/models/playlists/playlist.interface";
import { copyFileSync, readFileSync } from "fs";
import { BeatSaverService } from "../thrid-party/beat-saver/beat-saver.service";
import { copySync } from "fs-extra";
import { ensureFolderExist, pathExist } from "../../helpers/fs.helpers";
export class LocalPlaylistsManagerService {
private static instance: LocalPlaylistsManagerService
public static getInstance(): LocalPlaylistsManagerService {
if (!LocalPlaylistsManagerService.instance) { LocalPlaylistsManagerService.instance = new LocalPlaylistsManagerService(); }
return LocalPlaylistsManagerService.instance;
}
private readonly PLAYLISTS_FOLDER = "Playlists";
private readonly DEEP_LINKS = {
BeatSaver: "bsplaylist",
};
private readonly versions: BSLocalVersionService;
private readonly maps: LocalMapsManagerService;
private readonly utils: UtilsService;
private readonly request: RequestService;
private readonly deepLink: DeepLinkService;
private readonly windows: WindowManagerService;
private readonly bsaver: BeatSaverService;
private constructor(){
this.maps = LocalMapsManagerService.getInstance();
this.versions = BSLocalVersionService.getInstance();
this.utils = UtilsService.getInstance();
this.request = RequestService.getInstance();
this.deepLink = DeepLinkService.getInstance();
this.windows = WindowManagerService.getInstance();
this.bsaver = BeatSaverService.getInstance();
this.deepLink.addLinkOpenedListener(this.DEEP_LINKS.BeatSaver, link => {
log.info("DEEP-LINK RECEIVED FROM", this.DEEP_LINKS.BeatSaver, link);
const url = new URL(link);
const bplistUrl = url.host === "playlist" ? url.pathname.replace("/", "") : "";
this.openOneClickDownloadPlaylistWindow(bplistUrl);
});
}
private getPlaylistIdFromDownloadUrl(url: string): string{
if(!isValidUrl(url)){ return ""; }
const splited = url.split("/")
const idIndex = splited.indexOf("id");
if(idIndex < 0){ return ""; }
return splited[idIndex + 1];
}
private async getPlaylistsFolder(version?: BSVersion){
if(!version){ throw "Playlists are not available to be linked yet" }
const versionFolder = await this.versions.getVersionPath(version);
const folder = path.join(versionFolder, this.PLAYLISTS_FOLDER);
await ensureFolderExist(folder)
return folder;
}
private async installBPListFile(bpListUrlOrPath: string, version: BSVersion): Promise<string>{
const playlistFolder = await this.getPlaylistsFolder(version);
const bpListDest = path.join(playlistFolder, path.basename(bpListUrlOrPath));
if(await pathExist(bpListUrlOrPath)){
copyFileSync(bpListUrlOrPath, bpListDest);
}
else{
await this.request.downloadFile(bpListUrlOrPath, bpListDest);
}
return bpListDest;
}
private async readPlaylistFile(path: string): Promise<BPList>{
if(!(await pathExist(path))){ throw `bplist file not exist at ${path}`; }
const rawContent = readFileSync(path).toString();
return JSON.parse(rawContent);
}
private openOneClickDownloadPlaylistWindow(downloadUrl: string): void{
ipcMain.once("one-click-playlist-info", async (event, req: IpcRequest<void>) => {
this.utils.ipcSend(req.responceChannel, {success: true, data: {bpListUrl: downloadUrl, id: this.getPlaylistIdFromDownloadUrl(downloadUrl)}});
});
this.windows.openWindow("oneclick-download-playlist.html");
}
public downloadPlaylist(bpListUrl: string, version: BSVersion): Observable<DownloadPlaylistProgression>{
const res = new BehaviorSubject<DownloadPlaylistProgression>({progression: 0, current: null, downloadedMaps: [], mapsPath: [], bpListPath: ""});
const sub = res.subscribe(process => {
this.utils.ipcSend("download-playlist-progress", {success: true, data: process});
}, err => {
this.utils.ipcSend("download-playlist-progress", {success: false, error: err});
});
const observer = async () => {
try{
const bpListPath = await this.installBPListFile(bpListUrl, version);
res.next({...res.value, bpListPath});
const bpList = await this.readPlaylistFile(bpListPath);
for(const song of bpList.songs){
if(!song.key){ continue; }
const map = await this.bsaver.getMapDetailsById(song.key);
res.next({
...res.value,
current: map,
progression: ((res.value.downloadedMaps.length + .5) / bpList.songs.length) * 100
});
const mapPath = await this.maps.downloadMap(map, version);
const progression = ((res.value.downloadedMaps.length + 1) / bpList.songs.length) * 100;
res.next({
...res.value,
current: null,
downloadedMaps: [...res.value.downloadedMaps, map],
mapsPath: [...res.value.mapsPath, mapPath.path],
progression
});
}
}
catch(e){
res.error(e);
}
res.complete();
}
observer().finally(() => sub.unsubscribe());
return res.asObservable();
}
public async oneClickInstallPlaylist(bpListUrl: string): Promise<void>{
const versions = await this.versions.getInstalledVersions();
const firstVersion = versions.shift();
const fistVersionLinked = await this.maps.versionIsLinked(firstVersion);
const {bpListPath, mapsPath} = await this.downloadPlaylist(bpListUrl, firstVersion).toPromise();
for(const version of versions){
await this.installBPListFile(bpListPath, version);
const versionIsLinked = await this.maps.versionIsLinked(version);
if(fistVersionLinked && versionIsLinked){ continue; }
for(const mapPath of mapsPath){
const versionMapsFolder = await this.maps.getMapsFolderPath(version);
const mapDest = path.join(versionMapsFolder, path.basename(mapPath));
copySync(mapPath, mapDest, {overwrite: true});
}
}
}
public enableDeepLinks(): boolean{
return Array.from(Object.values(this.DEEP_LINKS)).every(link => this.deepLink.registerDeepLink(link));
}
public disableDeepLinks(): boolean{
return Array.from(Object.values(this.DEEP_LINKS)).every(link => this.deepLink.unRegisterDeepLink(link));
}
public isDeepLinksEnabled(): boolean{
return Array.from(Object.values(this.DEEP_LINKS)).every(link => this.deepLink.isDeepLinkRegistred(link));
}
}
+81 -9
View File
@@ -1,13 +1,18 @@
/* eslint-disable prefer-promise-reject-errors */
import { BS_APP_ID, BS_DEPOT } from "../constants";
import path from "path";
import { BSVersion } from 'shared/bs-version.interface';
import { BSVersion, PartialBSVersion } from 'shared/bs-version.interface';
import { UtilsService } from "./utils.service";
import { ChildProcessWithoutNullStreams, spawn } from "child_process";
import { ChildProcessWithoutNullStreams, spawn, spawnSync } from "child_process";
import log from "electron-log";
import { InstallationLocationService } from "./installation-location.service";
import { ctrlc } from "ctrlc-windows";
import { BSLocalVersionService } from "./bs-local-version.service";
import isOnline from 'is-online';
import { WindowManagerService } from "./window-manager.service";
import { copy, copySync } from "fs-extra";
import { clean, satisfies } from "semver";
import { ensureFolderExist, pathExist } from "../helpers/fs.helpers";
export class BSInstallerService{
@@ -16,6 +21,7 @@ export class BSInstallerService{
private readonly utils: UtilsService;
private readonly installLocationService: InstallationLocationService;
private readonly localVersionService: BSLocalVersionService;
private readonly windows: WindowManagerService;
private downloadProcess: ChildProcessWithoutNullStreams;
@@ -23,8 +29,9 @@ export class BSInstallerService{
this.utils = UtilsService.getInstance();
this.installLocationService = InstallationLocationService.getInstance();
this.localVersionService = BSLocalVersionService.getInstance();
this.windows = WindowManagerService.getInstance();
this.utils.getMainWindow().on("close", () => {
this.windows.getWindow("index.html")?.on("close", () => {
this.killDownloadProcess();
});
}
@@ -34,8 +41,12 @@ export class BSInstallerService{
return BSInstallerService.instance;
}
private escapeSpaces(path: string): string{
return `\"${path}\"`
}
private getDepotDownloaderExePath(): string{
return path.join(this.utils.getAssetsScriptsPath(), 'depot-downloader', 'DepotDownloader.exe');
return this.escapeSpaces(path.join(this.utils.getAssetsScriptsPath(), 'depot-downloader', 'DepotDownloader.exe'));
}
private removeSpecialSchar(txt: string): string{ return txt.replaceAll(/\[|\]/g, ""); }
@@ -62,6 +73,21 @@ export class BSInstallerService{
});
}
public async isDotNet6Installed(): Promise<boolean>{
try{
const process = spawnSync(this.getDepotDownloaderExePath(), {shell: true});
if(process.stderr.toString()){
log.error("no dotnet", process.stderr.toString());
return false;
}
return true;
}
catch(e){
log.error("Error while checking .NET 6", e);
return false;
}
}
public async downloadBsVersion(downloadInfos: DownloadInfo): Promise<DownloadEvent>{
if(this.downloadProcess && this.downloadProcess.connected){ throw "AlreadyDownloading"; }
@@ -69,7 +95,14 @@ export class BSInstallerService{
if(!bsVersion){ return {type: "[Error]"}; }
if(!(await isOnline({timeout: 1500}))){ throw "no-internet"; }
this.utils.createFolderIfNotExist(this.installLocationService.versionsDirectory);
await ensureFolderExist(this.installLocationService.versionsDirectory);
const versionPath = await this.localVersionService.getVersionPath(bsVersion)
const dest = !downloadInfos.isVerification ? await this.getPathNotAleardyExist(versionPath) : versionPath;
const downloadVersion: BSVersion = {...downloadInfos.bsVersion, ...(path.basename(dest) !== downloadInfos.bsVersion.BSVersion && {name: path.basename(dest)})}
this.downloadProcess = spawn(
this.getDepotDownloaderExePath(),
[
@@ -77,12 +110,13 @@ export class BSInstallerService{
`-depot ${BS_DEPOT}`,
`-manifest ${bsVersion.BSManifest}`,
`-username ${downloadInfos.username}`,
`-dir \"${this.localVersionService.getVersionFolder(bsVersion)}\"`,
(downloadInfos.stay || !downloadInfos.password) && "-remember-password"
`-dir \"${this.localVersionService.getVersionFolder(downloadVersion)}\"`
],
{shell: true, cwd: this.installLocationService.versionsDirectory}
);
this.utils.ipcSend("start-download-version", {success: true, data: downloadVersion});
return new Promise((resolve, reject) => {
this.downloadProcess.stdout.on('data', data => {
@@ -127,16 +161,25 @@ export class BSInstallerService{
this.downloadProcess.stdout.on('error', (err) => {
log.error("BS-DOWNLOAD ERROR", err.toString());
this.killDownloadProcess();
if(err.toString().includes(".NET") || err.toString().includes("dotnet") || err.toString().includes(".dll")){
reject("dotnet");
}
reject();
});
this.downloadProcess.stderr.on('data', (err) => {
log.error("BS-DOWNLOAD ERROR", err.toString());
this.killDownloadProcess();
if(err.toString().includes(".NET") || err.toString().includes("dotnet") || err.toString().includes(".dll")){
reject("dotnet");
}
reject();
});
this.downloadProcess.stderr.on('error', (err) => {
log.error("BS-DOWNLOAD ERROR", err.toString());
this.killDownloadProcess();
if(err.toString().includes(".NET") || err.toString().includes("dotnet") || err.toString().includes(".dll")){
reject("dotnet");
}
reject();
});
@@ -144,6 +187,34 @@ export class BSInstallerService{
})
}
private async getPathNotAleardyExist(path: string): Promise<string>{
let destPath = path;
let folderExist = await pathExist(destPath);
let i = 0;
while(folderExist){
i++;
destPath = `${path} (${i})`;
folderExist = await pathExist(destPath);
}
return destPath
}
public async importVersion(path: string): Promise<PartialBSVersion>{
const rawBsVersion = await this.localVersionService.getVersionOfBSFolder(path);
if(!rawBsVersion){ throw new Error("NOT_BS_FOLDER"); }
const destPath = await this.getPathNotAleardyExist(await this.localVersionService.getVersionPath(rawBsVersion));
await copy(path, destPath, {dereference: true});
return rawBsVersion;
}
}
@@ -153,12 +224,13 @@ export interface DownloadInfo {
bsVersion: BSVersion,
username: string,
password?: string,
stay?: boolean
stay?: boolean,
isVerification: boolean
}
export interface DownloadEvent{
type: DownloadEventType,
data?: unknown,
data?: unknown
}
export type DownloadEventType = "[Password]" | "[Guard]" | "[2FA]" | "[Progress]" | "[Validated]" | "[Finished]" | "[AlreadyDownloading]" | "[Error]" | "[Warning]" | "[SteamID]" | "[Exit]" | "[NoInternet]";
+62 -8
View File
@@ -1,10 +1,15 @@
import path from "path";
import { LaunchResult, LauchOption } from "shared/models/bs-launch";
import { UtilsService } from "./utils.service";
import { BS_EXECUTABLE, BS_APP_ID } from "../constants";
import { BS_EXECUTABLE, BS_APP_ID, STEAMVR_APP_ID } from "../constants";
import { ChildProcessWithoutNullStreams, spawn } from "child_process";
import { SteamService } from "./steam.service";
import { BSLocalVersionService } from "./bs-local-version.service";
import { OculusService } from "./oculus.service";
import { pathExist } from "../helpers/fs.helpers";
import { rename } from "fs/promises";
import log from "electron-log";
import { timer } from "rxjs";
export class BSLauncherService{
@@ -12,6 +17,7 @@ export class BSLauncherService{
private readonly utilsService: UtilsService;
private readonly steamService: SteamService;
private readonly oculusService: OculusService;
private readonly localVersionService: BSLocalVersionService;
private bsProcess: ChildProcessWithoutNullStreams;
@@ -24,29 +30,77 @@ export class BSLauncherService{
private constructor(){
this.utilsService = UtilsService.getInstance();
this.steamService = SteamService.getInstance();
this.oculusService = OculusService.getInstance();
this.localVersionService = BSLocalVersionService.getInstance();
}
private getSteamVRPath(): Promise<string>{
return this.steamService.getGameFolder(STEAMVR_APP_ID, "SteamVR");
}
private async backupSteamVR(): Promise<void>{
const steamVrFolder = await this.getSteamVRPath();
if(!await pathExist(steamVrFolder)){ return; }
return rename(steamVrFolder, steamVrFolder + ".bak").catch(log.error);
}
public async restoreSteamVR(): Promise<void>{
const steamVrFolder = await this.getSteamVRPath();
const steamVrBackup = steamVrFolder + ".bak";
if(!await pathExist(steamVrBackup)){ return; }
return rename(steamVrFolder + ".bak", steamVrFolder).catch(log.error);
}
public isBsRunning(): boolean{
return this.bsProcess?.connected || this.utilsService.taskRunning(BS_EXECUTABLE);
}
public async launch(launchOptions: LauchOption): Promise<LaunchResult>{
if(!this.steamService.steamRunning()){ return "STEAM_NOT_RUNNING" }
if(launchOptions.version.oculus && !this.oculusService.oculusRunning()){ return "OCULUS_NOT_RUNNING" }
if(!launchOptions.version.oculus && !this.steamService.steamRunning()){ return "STEAM_NOT_RUNNING" }
if(this.isBsRunning()){ return "BS_ALREADY_RUNNING" }
const cwd = await this.localVersionService.getVersionPath(launchOptions.version);
const exePath = path.join(cwd, BS_EXECUTABLE);
if(!this.utilsService.pathExist(exePath)){ return "EXE_NOT_FINDED"; }
if(!(await pathExist(exePath))){ return "EXE_NOT_FINDED"; }
const launchMods = [launchOptions.oculus && "-vrmode oculus", launchOptions.desktop && "fpfc", launchOptions.debug && "--verbose"];
let launchArgs = [];
this.bsProcess = spawn(`\"${exePath}\"`, launchMods, {shell: true, cwd: cwd, env: {...process.env, "SteamAppId": BS_APP_ID}});
if(!launchOptions.version.steam && !launchOptions.version.oculus){ launchArgs.push("--no-yeet"); }
if(launchOptions.oculus){ launchArgs.push("-vrmode oculus"); }
if(launchOptions.desktop){ launchArgs.push("fpfc"); }
if(launchOptions.debug){ launchArgs.push("--verbose"); }
if(launchOptions.additionalArgs){ launchArgs.push(...launchOptions.additionalArgs); }
this.bsProcess.on('message', msg => { /** EMIT HERE **/ });
this.bsProcess.on('error', err => { /** EMIT HERE **/ });
this.bsProcess.on('exit', code => this.utilsService.ipcSend("bs-launch.exit", {data: code, success: code === 0}));
launchArgs = Array.from(new Set(launchArgs).values());
let restoreTimout: NodeJS.Timeout;
if(launchArgs.includes("fpfc")){
await this.backupSteamVR().catch(() => {
this.restoreSteamVR();
}).finally(() => {
restoreTimout = setTimeout(() => this.restoreSteamVR(), 35_000);
});
await timer(2_000).toPromise();
}
else{
await this.restoreSteamVR();
}
if(launchOptions.debug){
this.bsProcess = spawn(`\"${exePath}\"`, launchArgs, {shell: true, cwd, env: {...process.env, "SteamAppId": BS_APP_ID}, detached: true, windowsVerbatimArguments: true });
}
else{
this.bsProcess = spawn(`\"${exePath}\"`, launchArgs, {shell: true, cwd, env: {...process.env, "SteamAppId": BS_APP_ID} });
}
this.bsProcess.on('error', err => log.error(err));
this.bsProcess.on('exit', code => {
this.restoreSteamVR().finally(() => clearTimeout(restoreTimout));
this.utilsService.ipcSend("bs-launch.exit", {data: code, success: code === 0})
});
return "LAUNCHED";
}
+125 -67
View File
@@ -1,17 +1,19 @@
import { BSVersionLibService } from "./bs-version-lib.service";
import { BSVersion } from 'shared/bs-version.interface';
import { BSVersion, PartialBSVersion } from 'shared/bs-version.interface';
import { InstallationLocationService } from "./installation-location.service";
import { SteamService } from "./steam.service";
import { UtilsService } from "./utils.service";
import { BS_APP_ID } from "../constants";
import { BS_APP_ID, OCULUS_BS_DIR } from "../constants";
import path from "path";
import { createInterface } from "readline";
import { createReadStream } from "fs";
import fs from "fs-extra";
import { ConfigurationService } from "./configuration.service";
import { rename } from "fs/promises";
import { BsmException } from "shared/models/bsm-exception.model";
import log from "electron-log";
import { OculusService } from "./oculus.service";
import { DownloadLinkType } from "shared/models/mods";
import sanitize from "sanitize-filename";
import { copyDirectoryWithJunctions, deleteFolder, getFoldersInFolder, pathExist } from "../helpers/fs.helpers";
import { FolderLinkerService } from "./folder-linker.service";
export class BSLocalVersionService{
@@ -20,44 +22,57 @@ export class BSLocalVersionService{
private readonly CUSTOM_VERSIONS_KEY = "custom-versions";
private readonly installLocationService: InstallationLocationService;
private readonly utilsService: UtilsService;
private readonly steamService: SteamService;
private readonly oculusService: OculusService;
private readonly remoteVersionService: BSVersionLibService;
private readonly configService: ConfigurationService;
private readonly linker: FolderLinkerService;
public static getInstance(): BSLocalVersionService{
if(!BSLocalVersionService.instance){ BSLocalVersionService.instance = new BSLocalVersionService(); }
return BSLocalVersionService.instance;
}
private constructor(){
this.installLocationService = InstallationLocationService.getInstance();
this.utilsService = UtilsService.getInstance();
this.steamService = SteamService.getInstance();
this.remoteVersionService = BSVersionLibService.getInstance();
this.configService = ConfigurationService.getInstance();
}
private constructor(){
this.installLocationService = InstallationLocationService.getInstance();
this.steamService = SteamService.getInstance();
this.oculusService = OculusService.getInstance();
this.remoteVersionService = BSVersionLibService.getInstance();
this.configService = ConfigurationService.getInstance();
this.linker = FolderLinkerService.getInstance();
}
private async getVersionOfBSFolder(bsPath: string): Promise<string>{
public async getVersionOfBSFolder(bsPath: string): Promise<PartialBSVersion>{
const versionFilePath = path.join(bsPath, 'Beat Saber_Data', 'globalgamemanagers');
if(!this.utilsService.pathExist(versionFilePath)){ return null; }
if(!(await pathExist(versionFilePath))){ return null; }
const versionsAvailable = await this.remoteVersionService.getAvailableVersions();
return new Promise<string>(resolve => {
const readLine = createInterface({ input: createReadStream(versionFilePath) });
let findVersion: string = null;
readLine.on('line', (line) => {
return new Promise<PartialBSVersion>(resolve => {
const stream = createReadStream(versionFilePath);
let findVersion: PartialBSVersion = null;
stream.on('data', (line) => {
line = line.toString();
for(const version of versionsAvailable){
if(line.includes(version.BSVersion)){
findVersion = version.BSVersion;
readLine.close();
if(line.includes(version.BSVersion)){
findVersion = {BSVersion: version.BSVersion};
if(findVersion.BSVersion !== path.basename(bsPath)){
findVersion.name = path.basename(bsPath);
}
stream.close();
stream.destroy();
break;
}
}
});
readLine.on('close', () => {
stream.on('end', () => {
if(findVersion){ resolve(findVersion) }
resolve(findVersion);
});
stream.on('close', () => {
if(findVersion){ resolve(findVersion) }
resolve(findVersion);
})
})
}
@@ -80,6 +95,8 @@ export class BSLocalVersionService{
public async getVersionPath(version: BSVersion): Promise<string>{
if(version.steam){ return this.steamService.getGameFolder(BS_APP_ID, "Beat Saber") }
if(version.oculus){ return this.oculusService.getGameFolder(OCULUS_BS_DIR); }
console.log("getVersionPath", this.getVersionFolder(version), version);
return path.join(
this.installLocationService.versionsDirectory,
this.getVersionFolder(version)
@@ -87,63 +104,89 @@ export class BSLocalVersionService{
}
private removeSpecialChar(seq: string): string{
// eslint-disable-next-line no-useless-escape
return seq.replace( /[<>:"\/\\|?*]+/g, '' );
return sanitize(seq);
}
public getVersionFolder(version: BSVersion){
return version.name ? `${version.BSVersion}-${version.name}` : version.BSVersion;
public getVersionFolder(version: BSVersion): string{
return version.name ?? version.BSVersion;
}
public getVersionType(version: BSVersion): "steam"|"universal"{
public getVersionType(version: BSVersion): DownloadLinkType{
if(version.steam){ return "steam"; }
if(version.oculus){ return "oculus"; }
return "universal"
}
public async getInstalledVersions(): Promise<BSVersion[]>{
const versions: BSVersion[] = [];
const steamBsFolder = await this.steamService.getGameFolder(BS_APP_ID, "Beat Saber");
if(steamBsFolder && this.utilsService.pathExist(steamBsFolder)){
const steamBsVersion = await this.getVersionOfBSFolder(steamBsFolder);
if(steamBsVersion){
const steamVersionDetails = this.remoteVersionService.getVersionDetails(steamBsVersion);
versions.push(steamVersionDetails ? {...steamVersionDetails, steam: true} : {BSVersion: steamBsVersion, steam: true});
}
}
if(!this.utilsService.pathExist(this.installLocationService.versionsDirectory)){ return versions }
private async getSteamVersion(): Promise<BSVersion>{
const steamBsFolder = await this.steamService.getGameFolder(BS_APP_ID, "Beat Saber");
if(!steamBsFolder || !(await pathExist(steamBsFolder))){ return null; }
const steamBsVersion = await this.getVersionOfBSFolder(steamBsFolder);
const folderInInstallation = this.utilsService.listDirsInDir(this.installLocationService.versionsDirectory);
folderInInstallation.forEach(f => {
log.info("try get version from folder", f);
let version = this.remoteVersionService.getVersionDetails(f);
if(version){ version = this.getCustomVersions().find(v => v.BSVersion === version.BSVersion && v.name === version.name) ?? version; }
else { version = this.getCustomVersions().find(v => {
const [version, ...rest] = f.split("-");
if(rest.length < 1){ return false; }
const name = rest.join("-");
return name === v.name && version === v.BSVersion;
})
}
version && versions.push(version);
});
this.setCustomVersions(versions.filter(v => !!v.name || !!v.color));
return versions;
if(!steamBsVersion){ return null; }
const version = await this.remoteVersionService.getVersionDetails(steamBsVersion.BSVersion);
if(!version){ return null; }
return {...version, steam: true};
}
private async getOculusVersion(): Promise<BSVersion>{
const oculusBsFolder = await this.oculusService.getGameFolder(OCULUS_BS_DIR);
if(!oculusBsFolder){ return null; }
const oculusBsVersion = await this.getVersionOfBSFolder(oculusBsFolder);
if(!oculusBsVersion){ return null; }
const version = await this.remoteVersionService.getVersionDetails(oculusBsVersion.BSVersion);
if(!version){ return null; }
return {...version, oculus: true};
}
public async getInstalledVersions(): Promise<BSVersion[]>{
const versions: BSVersion[] = [];
const steamVersion = await this.getSteamVersion();
if(steamVersion){ versions.push(steamVersion); }
const oculusVersion = await this.getOculusVersion();
if(oculusVersion){ versions.push(oculusVersion); }
if(!(await pathExist(this.installLocationService.versionsDirectory))){ return versions }
const folderInInstallation = await getFoldersInFolder(this.installLocationService.versionsDirectory);
for(const f of folderInInstallation){
log.info("try get version from folder", f);
const rawVersion = await this.getVersionOfBSFolder(f);
if(!rawVersion){ continue; }
const bsVersion = {...await this.remoteVersionService.getVersionDetails(rawVersion.BSVersion)};
if(!bsVersion){ continue; }
bsVersion.name = path.basename(f) !== bsVersion.BSVersion ? path.basename(f) : undefined;
const customVersion = this.getCustomVersions().find(custom => custom.BSVersion === bsVersion.BSVersion && custom.name === bsVersion.name);
if(customVersion){
bsVersion.color = customVersion.color;
}
versions.push(bsVersion);
};
this.setCustomVersions(versions.filter(v => !!v.color));
return versions;
}
public async deleteVersion(version: BSVersion): Promise<boolean>{
if(version.steam){ return false; }
if(version.steam || version.oculus){ return false; }
const versionFolder = await this.getVersionPath(version);
if(!this.utilsService.pathExist(versionFolder)){ return true; }
if(!(await pathExist(versionFolder))){ return true; }
return this.utilsService.deleteFolder(versionFolder)
return deleteFolder(versionFolder)
.then(() => { return true; })
.catch(() => { return false; })
}
public async editVersion(version: BSVersion, name: string, color: string): Promise<BSVersion>{
if(version.steam){ throw {title: "CantEditSteam", msg: "CantEditSteam"} as BsmException; }
if(version.steam || version.oculus){ throw {title: "CantEditSteam", msg: "CantEditSteam"} as BsmException; }
const oldPath = await this.getVersionPath(version);
const editedVersion: BSVersion = version.BSVersion === name
const editedVersion: BSVersion = version.BSVersion === name
? {...version, name: undefined, color}
: {...version, name: this.removeSpecialChar(name), color};
const newPath = await this.getVersionPath(editedVersion);
@@ -154,38 +197,53 @@ export class BSLocalVersionService{
return editedVersion;
}
if(this.utilsService.pathExist(newPath)){ throw {title: "VersionAlreadExist"} as BsmException; }
if((await pathExist(newPath)) && newPath === oldPath){ throw {title: "VersionAlreadExist"} as BsmException; }
return rename(oldPath, newPath).then(() => {
this.deleteCustomVersion(version);
this.addCustomVersion(editedVersion);
return editedVersion;
}).catch((err: Error) => {
log.error("edit version error", err, version, name, color);
throw {title: "CantRename", error: err} as BsmException;
});
}
public async cloneVersion(version: BSVersion, name: string, color: string): Promise<BSVersion>{
const originPath = await this.getVersionPath(version);
const cloneVersion: BSVersion = version.BSVersion === name
const cloneVersion: BSVersion = version.BSVersion === name
? {...version, name: undefined, color}
: {...version, name: this.removeSpecialChar(name), color, steam: false};
: {...version, name: this.removeSpecialChar(name), color, steam: false, oculus: false};
const newPath = await this.getVersionPath(cloneVersion);
if(originPath === newPath){
this.deleteCustomVersion(version);
this.addCustomVersion(cloneVersion);
return cloneVersion;
}
if(this.utilsService.pathExist(newPath)){ throw {title: "VersionAlreadExist"} as BsmException; }
if(await pathExist(newPath)){ throw {title: "VersionAlreadExist"} as BsmException; }
return fs.copy(originPath, newPath).then(() => {
return copyDirectoryWithJunctions(originPath, newPath).then(() => {
this.addCustomVersion(cloneVersion);
return cloneVersion;
}).catch((err: Error) => {
log.error("clone version error", err, version, name, color);
throw {title: "CantClone", error: err} as BsmException
})
}
}
public async getLinkedFolders(version: BSVersion): Promise<string[]>{
const versionPath = await this.getVersionPath(version);
const [rootFolders, beatSaberDataFolders] = await Promise.all([
getFoldersInFolder(versionPath),
getFoldersInFolder(path.join(versionPath, "Beat Saber_Data"))
]);
const linkedFolder = Promise.all([...rootFolders, ...beatSaberDataFolders].map(async folder => {
if(!(await this.linker.isFolderSymlink(folder))){ return null; }
return folder;
}));
return (await linkedFolder).filter(folder => folder);
}
}
+16 -16
View File
@@ -1,10 +1,10 @@
import { get } from 'https'
import { UtilsService } from './utils.service';
import path from 'path';
import { writeFileSync } from 'fs';
import { BSVersion } from 'shared/bs-version.interface';
import { RequestService } from "./request.service"
import isOnline from 'is-online';
import { readJSON } from 'fs-extra';
export class BSVersionLibService{
@@ -16,7 +16,7 @@ export class BSVersionLibService{
private utilsService: UtilsService;
private requestService: RequestService
private bsVersions: BSVersion[] = [];
private bsVersions: BSVersion[];
private constructor(){
this.utilsService = UtilsService.getInstance();
@@ -35,8 +35,7 @@ export class BSVersionLibService{
private async getLocalVersions(): Promise<BSVersion[]>{
const localVersionsPath = path.join(this.utilsService.getAssestsJsonsPath(), this.VERSIONS_FILE);
const rawVersion = (await this.utilsService.readFileAsync(localVersionsPath)).toString();
return JSON.parse(rawVersion);
return readJSON(localVersionsPath);
}
private async updateLocalVersions(versions: BSVersion[]): Promise<void>{
@@ -44,25 +43,26 @@ export class BSVersionLibService{
writeFileSync(localVersionsPath, JSON.stringify(versions, null, "\t"), {encoding: 'utf-8', flag: 'w'});
};
private async loadBsVersions(): Promise<BSVersion[]>{
const [localVersions, remoteVersions] = await Promise.all([
this.getLocalVersions(), (await isOnline({timeout: 1500}) && this.getRemoteVersions())
]);
let resVersions = localVersions;
if(remoteVersions && remoteVersions.length){ resVersions = remoteVersions; this.updateLocalVersions(resVersions); }
this.bsVersions = resVersions;
return this.bsVersions;
private async loadBsVersions(): Promise<BSVersion[]>{
if(this.bsVersions){ return this.bsVersions; }
const [localVersions, remoteVersions] = await Promise.all([
this.getLocalVersions(), (await isOnline({timeout: 1500}) && this.getRemoteVersions())
]);
let resVersions = localVersions;
if(remoteVersions && remoteVersions.length){ resVersions = remoteVersions; this.updateLocalVersions(resVersions); }
this.bsVersions = resVersions;
return this.bsVersions;
}
public async getAvailableVersions(): Promise<BSVersion[]>{
if(this.bsVersions && this.bsVersions.length){ return this.bsVersions; }
const bsVersions = await this.loadBsVersions();
if(!bsVersions || !bsVersions.length){ return []; }
return bsVersions;
}
public getVersionDetails(version: string): BSVersion{
return this.bsVersions.find(v => v.BSVersion === version);
}
public async getVersionDetails(version: string): Promise<BSVersion>{
const versions = await this.getAvailableVersions();
return versions.find(v => v.BSVersion === version);
}
}
+20 -6
View File
@@ -1,23 +1,37 @@
import ElectronStore from "electron-store";
import { InstallationLocationService } from "./installation-location.service";
export class ConfigurationService {
private static instance: ConfigurationService;
private readonly _store: ElectronStore;
public static getInstance(): ConfigurationService{
if(!ConfigurationService.instance){ ConfigurationService.instance = new ConfigurationService(); }
return ConfigurationService.instance;
}
private readonly locations: InstallationLocationService;
private store: ElectronStore;
private constructor(){
this._store = new ElectronStore();
this.locations = InstallationLocationService.getInstance();
this.initStore();
this.locations.onInstallLocationUpdate(() => this.initStore());
}
public get store(): ElectronStore{ return this._store; }
private initStore(){
const contentPath = this.locations.installationDirectory;
this.store = new ElectronStore({
cwd: contentPath,
name: "config",
fileExtension: "cfg",
});
}
public set(key: string, value: any): void{
public set(key: string, value: unknown): void{
this.store.set(key, value);
}
@@ -29,4 +43,4 @@ export class ConfigurationService {
this.store.delete(key);
}
}
}
+99
View File
@@ -0,0 +1,99 @@
import { app } from "electron";
import path from "path";
import { URL } from "url";
import log from "electron-log"
export class DeepLinkService {
// See docs : https://www.electronjs.org/docs/latest/tutorial/launch-app-from-url-in-another-app#main-process-mainjs
private static instance: DeepLinkService;
public static getInstance(): DeepLinkService{
if(!DeepLinkService.instance){ DeepLinkService.instance = new DeepLinkService(); }
return DeepLinkService.instance;
}
private readonly listeners = new Map<string, Listerner[]>()
private constructor(){}
public registerDeepLink(protocol: string): boolean{
if(process.defaultApp && process.argv.length >= 2){
return app.setAsDefaultProtocolClient(protocol, process.execPath, [path.resolve(process.argv[1])]);
}
return app.setAsDefaultProtocolClient(protocol);
}
public unRegisterDeepLink(protocol: string): boolean{
if(process.defaultApp && process.argv.length >= 2) {
return app.removeAsDefaultProtocolClient(protocol, process.execPath, [path.resolve(process.argv[1])]);
}
return app.removeAsDefaultProtocolClient(protocol);
}
public isDeepLinkRegistred(protocol: string): boolean{
if(process.defaultApp && process.argv.length >= 2) {
return app.isDefaultProtocolClient(protocol, process.execPath, [path.resolve(process.argv[1])]);
}
return app.isDefaultProtocolClient(protocol);
}
public addLinkOpenedListener(protocol: string, fn: Listerner){
if(!this.listeners.has(protocol)){
this.listeners.set(protocol, [] as Listerner[]);
}
this.listeners.get(protocol).push(fn);
}
public removeLinkOpenedListener(protocol: string, fn: Listerner){
if(!this.listeners.get(protocol)?.length){ return; }
const listeners = this.listeners.get(protocol);
const fnIndex = listeners.findIndex(listener => listener === fn);
if(fnIndex < 0){ return; }
listeners.splice(fnIndex, 1);
}
public dispatchLinkOpened(link: string){
log.info("DEISPATCH", link);
const url = new URL(link);
const protocolListeners = this.listeners.get(url.protocol.replace(":", "")) ?? [];
protocolListeners.forEach(listerner => {
listerner(link);
});
}
public isDeepLink(link: string): boolean{
try{
const url = new URL(link);
const protocol = url.protocol.replace(":", "");
return Array.from(this.listeners.keys()).some(key => key === protocol);
}
catch(e){
return false;
}
}
}
type Listerner = (link: string) => void;
+117
View File
@@ -0,0 +1,117 @@
import { InstallationLocationService } from "./installation-location.service";
import log from "electron-log";
import { deleteFolder, ensureFolderExist, moveFolderContent, pathExist, unlinkPath } from "../helpers/fs.helpers";
import { lstat, symlink } from "fs/promises";
import path from "path";
import { copy } from "fs-extra";
export class FolderLinkerService {
private static instance: FolderLinkerService;
public static getInstance(): FolderLinkerService {
if (!FolderLinkerService.instance) {
FolderLinkerService.instance = new FolderLinkerService();
}
return FolderLinkerService.instance;
}
private readonly installLocationService = InstallationLocationService.getInstance();
private readonly sharedFolder: string;
private constructor(){
this.installLocationService = InstallationLocationService.getInstance();
this.sharedFolder = this.installLocationService.sharedContentPath;
}
private getSharedFolder(folderPath: string, intermediateFolder?: string): string {
return path.join(this.sharedFolder, intermediateFolder ?? "", path.basename(folderPath));
}
private getBackupFolder(folderPath: string): string {
return folderPath + "_backup";
}
private async backupFolder(folderPath: string): Promise<void> {
if(!await pathExist(folderPath)){ return; }
return copy(folderPath, this.getBackupFolder(folderPath), { overwrite: true, errorOnExist: false });
}
private async restoreFolder(folderPath: string): Promise<void> {
if(!await pathExist( this.getBackupFolder(folderPath) )){ return; }
return copy(this.getBackupFolder(folderPath), folderPath, { overwrite: true, errorOnExist: false }).then(() => {
return deleteFolder(this.getBackupFolder(folderPath));
});
}
public async linkFolder(folderPath: string, options?: LinkOptions): Promise<void> {
if(await this.isFolderSymlink(folderPath)){ return; }
const sharedPath = this.getSharedFolder(folderPath, options?.intermediateFolder);
await ensureFolderExist(sharedPath);
if(options?.backup === true){
await this.backupFolder(folderPath);
}
await ensureFolderExist(folderPath);
if(options?.keepContents !== false){
await moveFolderContent(folderPath, sharedPath).toPromise();
}
await deleteFolder(folderPath);
return symlink(sharedPath, folderPath, "junction");
}
public async unlinkFolder(folderPath: string, options?: UnlinkOptions): Promise<void> {
if(!(await this.isFolderSymlink(folderPath))){ return; }
await unlinkPath(folderPath);
const sharedPath = this.getSharedFolder(folderPath, options?.intermediateFolder);
await ensureFolderExist(folderPath);
if(options?.backup === true){
return this.restoreFolder(folderPath);
}
if(options.moveContents === true){
return moveFolderContent(sharedPath, folderPath).toPromise().then(() => {});
}
if(options?.keepContents === false){ return; }
await ensureFolderExist(sharedPath);
return copy(sharedPath, folderPath, { errorOnExist: false, recursive: true });
}
public async isFolderSymlink(folder: string): Promise<boolean> {
try{
if(!(await pathExist(folder))){ return false; }
return lstat(folder).then(stat => stat.isSymbolicLink());
}
catch(e){
log.error(e);
}
return false;
}
}
export interface LinkOptions {
keepContents?: boolean,
intermediateFolder?: string,
backup?: boolean,
}
export interface UnlinkOptions extends LinkOptions {
moveContents?: boolean,
};
@@ -1,59 +1,75 @@
import path from "path";
import { ConfigurationService } from "./configuration.service";
import { UtilsService } from "./utils.service";
import fs from 'fs-extra';
import log from "electron-log";
import { app } from "electron";
import { BsmException } from "shared/models/bsm-exception.model";
import ElectronStore from "electron-store";
import { ensureFolderExist, pathExist } from "../helpers/fs.helpers";
export class InstallationLocationService {
private static instance: InstallationLocationService;
public static getInstance(): InstallationLocationService{
if(!InstallationLocationService.instance){ InstallationLocationService.instance = new InstallationLocationService(); }
return InstallationLocationService.instance;
}
private readonly INSTALLATION_FOLDER = "BSManager";
private readonly VERSIONS_FOLDER = "BSInstances";
private readonly SHARED_CONTENT_FOLDER = "SharedContent";
private readonly STORE_INSTALLATION_PATH_KEY = "installation-folder";
private readonly configService: ConfigurationService;
private readonly utilsService: UtilsService;
private readonly installPathConfig: ElectronStore;
private readonly updateListeners: Set<Listener> = new Set();
private _installationDirectory: string;
public static getInstance(): InstallationLocationService{
if(!InstallationLocationService.instance){ InstallationLocationService.instance = new InstallationLocationService(); }
return InstallationLocationService.instance;
}
private constructor(){
this.configService = ConfigurationService.getInstance();
this.utilsService = UtilsService.getInstance();
this.installPathConfig = new ElectronStore({watch: true});
this.initInstallationLocation();
this.installPathConfig.onDidChange(this.STORE_INSTALLATION_PATH_KEY, () => {
this.triggerListeners();
})
}
private initInstallationLocation(): void{
this._installationDirectory = this.configService.get<string>(this.STORE_INSTALLATION_PATH_KEY) || app.getPath("documents");
this._installationDirectory = this.installPathConfig.get<string>(this.STORE_INSTALLATION_PATH_KEY) as string || app.getPath("documents");
}
public get installationDirectory(): string{ return path.join(this._installationDirectory, this.INSTALLATION_FOLDER); }
public get versionsDirectory(): string { return path.join(this.installationDirectory, this.VERSIONS_FOLDER); }
private triggerListeners(): void{
this.updateListeners.forEach(listener => listener());
}
public setInstallationDirectory(newDir: string): Promise<string>{
const oldDir = this.installationDirectory;
const newDest = path.join(newDir, this.INSTALLATION_FOLDER);
return new Promise<string>((resolve, reject) => {
if(!this.utilsService.pathExist(oldDir)){ this.utilsService.createFolderIfNotExist(oldDir); }
return new Promise<string>(async (resolve, reject) => {
if(!(await pathExist(oldDir))){ ensureFolderExist(oldDir); }
fs.move(oldDir, newDest, { overwrite: true }).then(() => {
this._installationDirectory = newDir;
this.configService.store.set(this.STORE_INSTALLATION_PATH_KEY, newDir);
this.installPathConfig.set(this.STORE_INSTALLATION_PATH_KEY, newDir);
resolve(this.installationDirectory);
}).catch((err: Error) => {
reject({title: "CantMoveFolder", error: err} as BsmException);
log.error(err);
})
})
});
}
}
public onInstallLocationUpdate(fn: Listener){
this.updateListeners.add(fn);
}
public get installationDirectory(): string{ return path.join(this._installationDirectory, this.INSTALLATION_FOLDER); }
public get versionsDirectory(): string { return path.join(this.installationDirectory, this.VERSIONS_FOLDER); }
public get sharedContentPath(): string { return path.join(this.installationDirectory, this.SHARED_CONTENT_FOLDER); }
}
type Listener = () => void;
+66
View File
@@ -0,0 +1,66 @@
import { IpcRequest } from "shared/models/ipc";
import { ipcMain } from "electron";
import { Observable } from "rxjs";
import { IpcChannel, IpcCompleteChannel, IpcErrorChannel } from "shared/models/ipc/ipc-response.interface";
import { AppWindow } from "shared/models/window-manager/app-window.model";
import { WindowManagerService } from "./window-manager.service";
import { IpcReplier } from "shared/models/ipc/ipc-request.interface";
import log from "electron-log";
export class IpcService {
private static instance: IpcService;
public static getInstance(): IpcService {
if (!IpcService.instance) { IpcService.instance = new IpcService(); }
return IpcService.instance;
}
private readonly windows: WindowManagerService;
private constructor() {
this.windows = WindowManagerService.getInstance();
}
private getErrorChannel(channel: IpcChannel): IpcErrorChannel {
return `${channel}_error`;
}
private getCompleteChannel(channel: IpcChannel): IpcCompleteChannel {
return `${channel}_complete`;
}
private buildProxyListener<T>(listener: (req: IpcRequest<T>, replier: IpcReplier) => void) {
return (event: Electron.IpcMainEvent, req: IpcRequest<T>) => {
const window = this.windows.getAppWindowFromWebContents(event.sender);
const replier = (data: Observable<unknown>) => this.connectStream(req.responceChannel, window, data);
listener(req, replier);
}
}
public send<T>(channel: IpcChannel, window: AppWindow, response?: T|Error): void{
this.windows.getWindow(window)?.webContents?.send(channel, response);
}
public connectStream(channel: IpcChannel, window: AppWindow, observable: Observable<unknown>): void{
observable.subscribe(data => {
this.send(channel, window, data);
}, error => {
log.error(error);
this.send(this.getErrorChannel(channel), window, error);
}, () => {
this.send(this.getCompleteChannel(channel), window);
});
}
public on<T>(channel: IpcChannel, listener: (req: IpcRequest<T>, replier: IpcReplier) => void): void{
ipcMain.on(channel, this.buildProxyListener(listener));
}
public once<T>(channel: IpcChannel, listener: (req: IpcRequest<T>, replier: IpcReplier) => void): void{
ipcMain.once(channel, this.buildProxyListener(listener));
}
}
-47
View File
@@ -1,47 +0,0 @@
import path from "path";
import { BSVersion } from "shared/bs-version.interface";
import { BSLocalVersionService } from "./bs-local-version.service";
import archiver from "archiver";
import { createWriteStream } from "fs";
import log from "electron-log";
export class MapService{
private readonly MAP_PATH = path.join("Beat Saber_Data", "CustomLevels");
private static instance: MapService;
private readonly localVersionService: BSLocalVersionService;
public static getInstance(): MapService{
if(!MapService.instance){ MapService.instance = new MapService(); }
return MapService.instance;
}
private constructor(){
this.localVersionService = BSLocalVersionService.getInstance();
}
private getMapsPath(versionPath: string): string{
return path.join(versionPath, this.MAP_PATH);
}
public async exportVersionMaps(version: BSVersion, outputZip: string): Promise<void>{
const versionPath = await this.localVersionService.getVersionPath(version);
const mapsPath = this.getMapsPath(versionPath);
const output = createWriteStream(outputZip);
const archive = archiver("zip", {zlib: {level: 9}});
const promise = new Promise<void>((resolve, reject) => {
archive.pipe(output);
archive.directory(mapsPath, false);
archive.on("error", reject);
output.on("close", resolve);
archive.finalize()
});
return promise;
}
}
@@ -11,6 +11,7 @@ import { RequestService } from "../request.service";
import { spawn } from "child_process";
import { BS_EXECUTABLE } from "../../constants";
import log from "electron-log";
import { deleteFolder, ensureFolderExist, pathExist, unlinkPath } from "../../helpers/fs.helpers";
export class BsModsManagerService {
@@ -60,7 +61,7 @@ export class BsModsManagerService {
private async getModsInDir(version: BSVersion, modsDir: ModsInstallFolder): Promise<Mod[]>{
const bsPath = await this.bsLocalService.getVersionPath(version);
const modsPath = path.join(bsPath, modsDir);
if(!this.utilsService.pathExist(modsPath)){ return []; }
if(!(await pathExist(modsPath))){ return []; }
const files = fs.readdirSync(modsPath);
const promises = files.map(f => {
return (async() => {
@@ -89,7 +90,7 @@ export class BsModsManagerService {
private async getBsipaInstalled(version: BSVersion): Promise<Mod>{
const bsPath = await this.bsLocalService.getVersionPath(version);
const injectorPath = path.join(bsPath, "Beat Saber_Data", "Managed", "IPA.Injector.dll");
if(!this.utilsService.pathExist(injectorPath)){ return undefined; }
if(!(await pathExist(injectorPath))){ return undefined; }
const injectorMd5 = await md5File(injectorPath);
return this.getIpaFromHash(injectorMd5);
}
@@ -98,7 +99,7 @@ export class BsModsManagerService {
zipUrl = path.join(this.beatModsApi.BEAT_MODS_URL, zipUrl);
const fileName = path.basename(zipUrl);
const tempPath = this.utilsService.getTempPath();
this.utilsService.createFolderIfNotExist(this.utilsService.getTempPath());
await ensureFolderExist(this.utilsService.getTempPath());
const dest = path.join(tempPath, fileName);
const zipPath = await this.requestService.downloadFile(zipUrl, dest);
@@ -111,7 +112,7 @@ export class BsModsManagerService {
const versionPath = await this.bsLocalService.getVersionPath(version);
const ipaPath = path.join(versionPath, "IPA.exe");
const bsExePath = path.join(versionPath, BS_EXECUTABLE);
if(!this.utilsService.pathExist(ipaPath) || !this.utilsService.pathExist(bsExePath)){ return false; }
if(!(await pathExist(ipaPath)) || !(await pathExist(bsExePath))){ return false; }
return new Promise<boolean>(resolve => {
const processIPA = spawn(`start /wait /min "" "${ipaPath}" ${args.join(" ")}`, {cwd: versionPath, detached: true, shell: true});
@@ -163,7 +164,7 @@ export class BsModsManagerService {
const extracted = await zip.extract(null, destDir).then(() => true).catch(err => {log.error(err); return false});
await zip.close();
await this.utilsService.unlinkIfExist(zipPath);
await unlinkPath(zipPath);
const res = isBSIPA ? (extracted && (await this.executeBSIPA(version, ["-n"]))) : extracted;
@@ -194,8 +195,8 @@ export class BsModsManagerService {
const download = this.getModDownload(mod, version);
const verionPath = await this.bsLocalService.getVersionPath(version);
const hasIPAExe = this.utilsService.pathExist(path.join(verionPath, "IPA.exe"));
const hasIPADir = this.utilsService.pathExist(path.join(verionPath, "IPA"));
const hasIPAExe = await pathExist(path.join(verionPath, "IPA.exe"));
const hasIPADir = await pathExist(path.join(verionPath, "IPA"));
if(!hasIPADir || !hasIPAExe){ return; }
@@ -203,7 +204,7 @@ export class BsModsManagerService {
const promises = download.hashMd5.map(files => {
const file = files.file.replaceAll("IPA/", "").replaceAll("Data", "Beat Saber_Data");
return this.utilsService.unlinkIfExist(path.join(verionPath, file));
return unlinkPath(path.join(verionPath, file));
})
await Promise.all(promises);
@@ -220,8 +221,10 @@ export class BsModsManagerService {
const versionPath = await this.bsLocalService.getVersionPath(version);
const promises = download.hashMd5.map(async files => {
this.utilsService.unlinkIfExist(path.join(versionPath, files.file));
this.utilsService.unlinkIfExist(path.join(versionPath, "IPA", "Pending", files.file));
return Promise.all([
unlinkPath(path.join(versionPath, files.file)),
unlinkPath(path.join(versionPath, "IPA", "Pending", files.file))
]);
});
await Promise.all(promises);
@@ -306,9 +309,9 @@ export class BsModsManagerService {
const versionPath = await this.bsLocalService.getVersionPath(version);
this.utilsService.rmDirIfExist(path.join(versionPath, ModsInstallFolder.PLUGINS));
this.utilsService.rmDirIfExist(path.join(versionPath, ModsInstallFolder.LIBS));
this.utilsService.rmDirIfExist(path.join(versionPath, ModsInstallFolder.IPA));
await deleteFolder(path.join(versionPath, ModsInstallFolder.PLUGINS));
await deleteFolder(path.join(versionPath, ModsInstallFolder.LIBS));
await deleteFolder(path.join(versionPath, ModsInstallFolder.IPA));
path.resolve
+27
View File
@@ -0,0 +1,27 @@
import { Notification } from "electron";
import { SystemNotificationOptions } from "shared/models/notification/system-notification.model";
import { UtilsService } from "./utils.service";
export class NotificationService {
private static instance: NotificationService;
public static getInstance(): NotificationService{
if(!NotificationService.instance){ NotificationService.instance = new NotificationService(); }
return NotificationService.instance;
}
private readonly APP_ICON: string;
private readonly utils: UtilsService;
private constructor(){
this.utils = UtilsService.getInstance();
this.APP_ICON = this.utils.getAssetsPath("favicon.ico");
}
public notify(options: SystemNotificationOptions){
new Notification({...options, icon: this.APP_ICON}).show();
}
}
+67
View File
@@ -0,0 +1,67 @@
import { UtilsService } from "./utils.service";
import regedit from 'regedit'
import path from "path";
import { pathExist } from "../helpers/fs.helpers";
export class OculusService {
private static instance: OculusService;
private readonly utils: UtilsService;
private oculusPaths: string[];
public static getInstance(): OculusService{
if(!OculusService.instance){ OculusService.instance = new OculusService(); }
return OculusService.instance;
}
private constructor(){
this.utils = UtilsService.getInstance();
}
public oculusRunning(): boolean{
return this.utils.taskRunning("OculusClient.exe");
}
public async getOculusLibsPath(): Promise<string[]>{
if(this.oculusPaths){ return this.oculusPaths; }
const oculusLibsRegKey = "HKCU\\SOFTWARE\\Oculus VR, LLC\\Oculus\\Libraries";
const libsRegData = (await regedit.promisified.list([oculusLibsRegKey]))["HKCU\\SOFTWARE\\Oculus VR, LLC\\Oculus\\Libraries"];
if(!libsRegData.exists || !libsRegData.keys){ return null; }
const libsPath = (await Promise.all(libsRegData.keys.map(async key => {
const originalPath = (await regedit.promisified.list([`${oculusLibsRegKey}\\${key}`]))[`${oculusLibsRegKey}\\${key}`];
if(!originalPath.exists || !libsRegData.values || !originalPath.values["OriginalPath"]){ return null; }
return originalPath.values["OriginalPath"].value as string;
}, []))).filter(path => !!path);
this.oculusPaths = libsPath;
return libsPath;
}
public async getGameFolder(gameFolder: string): Promise<string>{
const libsFolders = await this.getOculusLibsPath();
if(!libsFolders){ return null; }
const rootLibDir = "Software"
for(const lib of libsFolders){
const gameFullPath = path.join(lib, rootLibDir, gameFolder);
if(await pathExist(gameFullPath)){ return gameFullPath; }
}
return null;
}
}
+1
View File
@@ -27,6 +27,7 @@ export class RequestService {
public downloadFile(url: string, dest: string): Promise<string>{
return new Promise((resolve, reject) => {
const file = createWriteStream(dest);
get(url, res => {
res.pipe(file);
+28 -10
View File
@@ -3,6 +3,9 @@ import regedit from 'regedit'
import path from "path";
import { parse } from "@node-steam/vdf";
import { readFile } from "fs/promises";
import { spawn } from "child_process";
import { pathExist } from "../helpers/fs.helpers";
import log from "electron-log";
export class SteamService{
@@ -45,21 +48,36 @@ export class SteamService{
}
public async getGameFolder(gameId: string, gameFolder?: string): Promise<string>{
const steamPath = await this.getSteamPath();
try{
const steamPath = await this.getSteamPath();
let libraryFolders: any = path.join(steamPath, 'steamapps', 'libraryfolders.vdf');
let libraryFolders: any = path.join(steamPath, 'steamapps', 'libraryfolders.vdf');
if(!this.utils.pathExist(libraryFolders)){ return null; }
libraryFolders = parse(await readFile(libraryFolders, {encoding: 'utf-8'}));
if(!(await pathExist(libraryFolders))){ return null; }
libraryFolders = parse(await readFile(libraryFolders, {encoding: 'utf-8'}));
if(!libraryFolders.libraryfolders){ return null; }
libraryFolders = libraryFolders.libraryfolders
if(!libraryFolders.libraryfolders){ return null; }
libraryFolders = libraryFolders.libraryfolders
for(const libKey in Object.keys(libraryFolders)){
if(!libraryFolders[libKey] || !libraryFolders[libKey]["apps"]){ continue; }
if(libraryFolders[libKey]["apps"][gameId]){ return path.join(libraryFolders[libKey]["path"], "steamapps", "common", gameFolder); };
for(const libKey in Object.keys(libraryFolders)){
if(!libraryFolders[libKey] || !libraryFolders[libKey]["apps"]){ continue; }
if(libraryFolders[libKey]["apps"][gameId] != null){ return path.join(libraryFolders[libKey]["path"], "steamapps", "common", gameFolder); };
}
return null;
}
catch(e){
log.error(e);
return null;
}
return null;
}
public openSteam(): Promise<boolean>{
const process = spawn("start", ["steam://open/games"], {shell: true});
return new Promise(resolve => {
process.on("exit", () => resolve(true));
process.on("error", () => resolve(false));
});
}
}
+2 -2
View File
@@ -1,4 +1,5 @@
import { writeFileSync } from "fs";
import { readJSON } from "fs-extra";
import { get } from "https";
import isOnline from "is-online";
import path from "path";
@@ -43,8 +44,7 @@ export class SupportersService {
private async getLocalSupporters(): Promise<Supporter[]>{
const patreonsPath = path.join(this.utilsService.getAssestsJsonsPath(), this.PATREONS_FILE);
const rawPatreons = (await this.utilsService.readFileAsync(patreonsPath)).toString();
return JSON.parse(rawPatreons);
return readJSON(patreonsPath);
}
private async loadSupporters(): Promise<Supporter[]>{
@@ -0,0 +1,130 @@
import { ApiResult } from "renderer/models/api/api.model";
import { BsvMapDetail } from "shared/models/maps";
import { BsvPlaylist, BsvPlaylistPage, MapFilter, SearchParams, SearchResponse } from "shared/models/maps/beat-saver.model";
import fetch from "node-fetch"
export class BeatSaverApiService {
private static instance: BeatSaverApiService;
public static getInstance(): BeatSaverApiService{
if(!BeatSaverApiService.instance){ BeatSaverApiService.instance = new BeatSaverApiService(); }
return BeatSaverApiService.instance;
}
private readonly bsaverApiUrl = "https://beatsaver.com/api"
private constructor(){}
private mapFilterToUrlParams(filter: MapFilter): URLSearchParams{
if(!filter){ return new URLSearchParams(); }
const enbledTagsString = filter.enabledTags ? Array.from(filter.enabledTags) : null;
const excludedTagsString = filter.excludedTags ? Array.from(filter.excludedTags).map(tag => `!${tag}`) : null;
const tags = (enbledTagsString || excludedTagsString) ? [...enbledTagsString, excludedTagsString].join("|") : null;
const params = {
...(filter.automapper && {automapper: String(filter.automapper)}),
...(filter.chroma && {chroma: String(filter.chroma)}),
...(filter.cinema && {cinema: String(filter.cinema)}),
...(filter.me && {me: String(filter.me)}),
...(filter.noodle && {noodle: String(filter.noodle)}),
...(filter.ranked && {ranked: String(filter.ranked)}),
...(filter.verified && {verified: String(filter.verified)}),
...(filter.curated && {curated: String(filter.curated)}),
...(filter.fullSpread && {fullSpread: String(filter.fullSpread)}),
...(filter.from && {from: String(filter.from)}),
...(filter.to && {to: String(filter.to)}),
...(tags && {tags: String(tags)}),
...(filter.minDuration && {minDuration: String(filter.minDuration)}),
...(filter.maxDuration && {maxDuration: String(filter.maxDuration)}),
...(filter.minNps && {minNps: String(filter.minNps)}),
...(filter.maxNps && {maxNps: String(filter.maxNps)})
};
return new URLSearchParams(params);
}
private searchParamsToUrlParams(search: SearchParams): URLSearchParams{
if(!search){ return new URLSearchParams(); }
const searchParams = {
...(search.includeEmpty && {includeEmpty: String(search.includeEmpty)}),
...(search.sortOrder && {sortOrder: search.sortOrder}),
...(search.q && {q: search.q})
};
const filterUrlParms = this.mapFilterToUrlParams(search.filter);
return new URLSearchParams({
...searchParams,
...Object.fromEntries(filterUrlParms)
});
}
public async getMapsDetailsByHashs<T extends string>(hashs: T[]): Promise<ApiResult<Record<Lowercase<T>, BsvMapDetail>>>{
if(hashs.length > 50){ throw "too musch map hashs"; }
const paramsHashs = hashs.join(",");
const resp = await fetch(`${this.bsaverApiUrl}/maps/hash/${paramsHashs}`);
const data = await resp.json() as Record<Lowercase<T>, BsvMapDetail> | BsvMapDetail;
if((data as BsvMapDetail).id){
const key = (data as BsvMapDetail).versions.at(0).hash.toLowerCase();
const parsedData = {
[key]: data as BsvMapDetail
} as Record<Lowercase<T>, BsvMapDetail>;
return {status: resp.status, data: parsedData}
}
return {status: resp.status, data: (data as Record<Lowercase<T>, BsvMapDetail>)};
}
public async getMapDetailsById(id: string): Promise<ApiResult<BsvMapDetail>>{
const res = await fetch(`${this.bsaverApiUrl}/maps/id/${id}`);
const data = await res.json() as BsvMapDetail;
return {status: res.status, data};
}
public async searchMaps(search: SearchParams): Promise<ApiResult<SearchResponse>>{
const url = new URL(`${this.bsaverApiUrl}/search/text/${search?.page ?? 0}`);
url.search = this.searchParamsToUrlParams(search).toString();
const res = await fetch(url.toString());
if(!res.ok){
return {status: res.status, data: null};
}
const data: any = await res.json();
return {status: res.status, data};
}
public async getPlaylistDetails(id: string): Promise<ApiResult<BsvPlaylist>>{
const res = await fetch(`${this.bsaverApiUrl}/playlists/id/${id}/0`);
const data = await res.json() as BsvPlaylistPage;
return {status: res.status, data: data.playlist};
}
}
@@ -0,0 +1,75 @@
import { splitIntoChunk } from "../../../helpers/array.helpers";
import { BsvMapDetail } from "shared/models/maps";
import { BsvPlaylist, SearchParams } from "shared/models/maps/beat-saver.model";
import { BeatSaverApiService } from "./beat-saver-api.service";
export class BeatSaverService {
private static instance: BeatSaverService;
public static getInstance(): BeatSaverService{
if(!BeatSaverService.instance){ BeatSaverService.instance = new BeatSaverService(); }
return BeatSaverService.instance;
}
private readonly bsaverApi: BeatSaverApiService;
private readonly cachedMapsDetails = new Map<string, BsvMapDetail>();
private constructor(){
this.bsaverApi = BeatSaverApiService.getInstance();
}
public async getMapDetailsFromHashs(hashs: string[]): Promise<BsvMapDetail[]>{
const filtredHashs = hashs.map(h => h.toLowerCase()).filter(hash => !Array.from(this.cachedMapsDetails.keys()).includes(hash));
const chunkHash = splitIntoChunk(filtredHashs, 50);
const mapDetails = Array.from(this.cachedMapsDetails.entries()).reduce((res , [hash, details]) => {
if(hashs.includes(hash)){
res.push(details);
}
return res;
}, [] as BsvMapDetail[]);
await Promise.allSettled(chunkHash.map(async hashs => {
const res = await this.bsaverApi.getMapsDetailsByHashs(hashs);
if(res.status === 200){
mapDetails.push(...Object.values<BsvMapDetail>(res.data).filter(detail => !!detail));
mapDetails.forEach(detail => {
this.cachedMapsDetails.set(detail.versions.at(0).hash.toLowerCase(), detail);
});
}
}));
return mapDetails;
}
public async getMapDetailsById(id: string): Promise<BsvMapDetail>{
const res = await this.bsaverApi.getMapDetailsById(id);
return res.data;
}
public searchMaps(search: SearchParams): Promise<BsvMapDetail[]>{
return this.bsaverApi.searchMaps(search).then(res => {
return res.status === 200 ? res.data.docs : [];
}).catch(err => {
return [];
});
}
public async getPlaylistPage(id: string): Promise<BsvPlaylist>{
const res = await this.bsaverApi.getPlaylistDetails(id);
return res.data;
}
}
@@ -0,0 +1,70 @@
import fetch from "node-fetch";
import { ApiResult } from "renderer/models/api/api.model";
import { MSGetQuery, MSGetQueryFilter, MSGetResponse } from "shared/models/model-saber/model-saber.model";
export class ModelSaberApiService {
private static instance: ModelSaberApiService;
public static getInstance(): ModelSaberApiService{
if(!ModelSaberApiService.instance){ ModelSaberApiService.instance = new ModelSaberApiService(); }
return ModelSaberApiService.instance;
}
private readonly API_URL = "https://modelsaber.com/api/v2/";
private readonly ENDPOINTS = {get: "get.php", types: "types.php"};
private constructor(){}
private parseFilters(filters: MSGetQueryFilter[]): string{
if(!filters){ return null; }
const parsed = filters.map(filter => {
const stringFilter = filter.type === "searchName" ? filter.value : `${filter.type}:${filter.value}`;
return filter.isNegative ? `-${stringFilter}` : stringFilter;
});
return parsed.join(",");
}
private buildUrlQuery(query: MSGetQuery): URLSearchParams{
if(!query){ return new URLSearchParams(); }
const filterQuery = this.parseFilters(query.filter);
const searchParams = {
...(query.type && {type: query.type}),
...(query.platform && {platform: query.platform}),
...(query.start && {start: `${query.start}`}),
...(query.end && {end: `${query.end}`}),
...(query.sort && {sort: query.sort}),
...(query.sortDirection && {sortDirection: query.sortDirection}),
...(filterQuery && {filter: filterQuery}),
}
return new URLSearchParams(searchParams);
}
public async searchModel(query: MSGetQuery): Promise<ApiResult<MSGetResponse>>{
const url = new URL(this.ENDPOINTS.get, this.API_URL);
url.search = this.buildUrlQuery(query).toString();
const res = await fetch(url.toString());
if(!res.ok){
return {data: null, status: res.status};
}
const data = await res.json() as MSGetResponse;
return {data, status: res.status};
}
}
@@ -0,0 +1,45 @@
import { MSGetQuery, MSGetQueryFilter, MSModel } from "shared/models/model-saber/model-saber.model";
import { ModelSaberApiService } from "./model-saber-api.service";
export class ModelSaberService {
private static instance: ModelSaberService;
public static getInstance(): ModelSaberService{
if(!ModelSaberService.instance){ ModelSaberService.instance = new ModelSaberService(); }
return ModelSaberService.instance;
}
private readonly modelSaberApi: ModelSaberApiService;
private constructor(){
this.modelSaberApi = ModelSaberApiService.getInstance();
}
public async getModelById(id: number|string): Promise<MSModel>{
const query: MSGetQuery = {
start: 0,
end: 1,
platform: "pc",
filter: [{type: "id", value: id}]
}
try{
const res = await this.modelSaberApi.searchModel(query);
if(res.status !== 200){ return null; }
if(Object.keys(res.data).length === 0){
return null;
}
return res.data[`${id}`];
}
catch(e){
return null;
}
}
}
+9 -49
View File
@@ -1,19 +1,20 @@
import { existsSync, mkdirSync, readdirSync, readFile, unlinkSync } from "fs";
import { spawnSync } from "child_process";
import { homedir } from "os";
import path from "path";
import { app, BrowserWindow } from "electron";
import { rm, unlink } from "fs/promises";
import { IpcResponse } from "shared/models/ipc";
import log from "electron-log";
import { AppWindow } from "shared/models/window-manager/app-window.model";
// TODO : REFACTOR
export class UtilsService{
private static instance: UtilsService;
private assetsPath: string = '';
private assetsPath: string = app.isPackaged ? path.join(process.resourcesPath, 'assets') : path.join(__dirname, '../../../assets');
private mainWindow: BrowserWindow;
private windows: Map<AppWindow, BrowserWindow> = new Map<AppWindow, BrowserWindow>();
private constructor(){}
@@ -29,58 +30,17 @@ export class UtilsService{
public getAssestsJsonsPath(): string { return this.getAssetsPath("jsons"); }
public getTempPath(): string{ return path.join(app.getPath("temp"), app.getName()) }
public setMainWindow(win: BrowserWindow){ this.mainWindow = win; }
public getMainWindow(){ return this.mainWindow; }
public pathExist(path: string): boolean{ return existsSync(path); }
public createFolderIfNotExist(path: string): void{
if(!this.pathExist(path)){ mkdirSync(path, {recursive: true}); }
}
public async unlinkIfExist(pathToFile: string): Promise<void>{
if(!this.pathExist(pathToFile)){ return }
return unlink(pathToFile);
}
public rmDirIfExist(path: string): Promise<void>{
if(!this.pathExist(path)){ return; }
return rm(path, {recursive: true, force: true});
}
public setMainWindows(windows: Map<AppWindow, BrowserWindow>){ this.windows = windows; }
public getMainWindows(win: AppWindow){ return this.windows.get(win); }
public taskRunning(task: string): boolean{
const tasks = spawnSync('tasklist').stdout.toString();
return tasks.includes(task);
}
public getUserFolder(){ return homedir(); }
public getUserDocumentsFolder(): string{
return path.join(this.getUserFolder(), 'Documents');
}
public readFileAsync(path: string){
return new Promise<Buffer>((resolve, reject) => {
readFile(path, (err, data) => {
if(err){ reject(err); }
else{ resolve(data); }
});
});
}
public listDirsInDir(dirPath: string): string[]{
let files = readdirSync(dirPath, { withFileTypes:true});
files = files.filter(f => f.isDirectory())
return files.map(f => f.name);
}
public deleteFolder(folderPath: string): Promise<void>{
return rm(folderPath, {recursive: true});
}
public ipcSend<T = any>(channel: string, response: IpcResponse<T>): void{
try {
this.mainWindow.webContents.send(channel, response);
Array.from(this.windows.values()).forEach(window => window?.webContents?.send(channel, response));
} catch (error) {
log.error(error);
}
@@ -0,0 +1,111 @@
import { getFoldersInFolder, pathExist } from "../helpers/fs.helpers";
import path from "path";
import { VersionLinkerAction, VersionLinkFolderAction, VersionUnlinkFolderAction } from "renderer/services/version-folder-linker.service";
import { BSVersion } from "shared/bs-version.interface";
import { LocalMapsManagerService } from "./additional-content/local-maps-manager.service";
import { BSLocalVersionService } from "./bs-local-version.service";
import { FolderLinkerService, LinkOptions } from "./folder-linker.service";
export class VersionFolderLinkerService {
private static instance: VersionFolderLinkerService;
public static getInstance(): VersionFolderLinkerService{
if(!VersionFolderLinkerService.instance){ VersionFolderLinkerService.instance = new VersionFolderLinkerService() }
return VersionFolderLinkerService.instance;
}
private readonly localVersion: BSLocalVersionService;
private readonly folderLinker: FolderLinkerService;
private constructor(){
this.localVersion = BSLocalVersionService.getInstance();
this.folderLinker = FolderLinkerService.getInstance();
}
private specialFolderOption(relativeFolder: string, options: LinkOptions): LinkOptions{
if(relativeFolder.includes(LocalMapsManagerService.CUSTOM_LEVELS_FOLDER)){
return {...options, intermediateFolder: LocalMapsManagerService.SHARED_MAPS_FOLDER};
}
if(relativeFolder.includes("UserData")){
return { ...options, backup: true };
}
return options ?? {};
}
private async isOtherVersionHaveFolderLinked(relativeFolder: string, ignorePath: string): Promise<boolean>{
const versions = await this.localVersion.getInstalledVersions();
const versionPaths = (await Promise.allSettled(versions.map(version => this.localVersion.getVersionPath(version)))).reduce((acc, res) => {
if(res.status === "fulfilled"){
acc.push(res.value);
}
return acc;
}, [] as string[]);
for(const versionPath of versionPaths){
const folderPath = this.relativeToFullPath(versionPath, relativeFolder);
if(folderPath === ignorePath){ continue; }
if(await this.folderLinker.isFolderSymlink(folderPath)){ console.log(folderPath); return true; }
}
return false;
}
private relativeToFullPath(parentPath: string, relativePath: string): string{
return path.join(parentPath, relativePath);
}
public async linkVersionFolder(action: VersionLinkerAction): Promise<boolean>{
action.options = this.specialFolderOption(action.relativeFolder, action.options);
const versionPath = await this.localVersion.getVersionPath(action.version);
const folderPath = this.relativeToFullPath(versionPath, action.relativeFolder);
return this.folderLinker.linkFolder(folderPath, action.options).catch(() => false).then(() => true)
}
public async unlinkVersionFolder(action: VersionUnlinkFolderAction): Promise<boolean>{
action.options = this.specialFolderOption(action.relativeFolder, action.options);
const versionPath = await this.localVersion.getVersionPath(action.version);
const folderPath = this.relativeToFullPath(versionPath, action.relativeFolder);
action.options.moveContents = !(await this.isOtherVersionHaveFolderLinked(action.relativeFolder, folderPath));
return this.folderLinker.unlinkFolder(folderPath, action.options).catch(() => false).then(() => true);
}
public async doAction(action: VersionLinkerAction): Promise<boolean>{
if(action.type === "link"){
return this.linkVersionFolder(action);
}
return this.unlinkVersionFolder(action as VersionUnlinkFolderAction);
}
public async isFolderLinked(version: BSVersion, relativeFolder: string): Promise<boolean>{
const versionPath = await this.localVersion.getVersionPath(version);
const folderPath = this.relativeToFullPath(versionPath, relativeFolder);
return this.folderLinker.isFolderSymlink(folderPath);
}
public async getLinkedFolders(version: BSVersion, options?: { relative?: boolean }): Promise<string[]>{
const versionPath = await this.localVersion.getVersionPath(version);
const [rootFolders, beatSaberDataFolders] = await Promise.all([
getFoldersInFolder(versionPath),
getFoldersInFolder(path.join(versionPath, "Beat Saber_Data"))
]);
const linkedFolder = await Promise.all([...rootFolders, ...beatSaberDataFolders].map(async folder => {
if(!(await this.folderLinker.isFolderSymlink(folder))){ return null; }
return folder;
}));
if(options?.relative){
return linkedFolder.filter(folder => folder).map(folder => path.relative(versionPath, folder));
}
return linkedFolder.filter(folder => folder);
}
}
+29 -11
View File
@@ -2,25 +2,32 @@ import { app, BrowserWindow, BrowserWindowConstructorOptions } from "electron";
import { resolveHtmlPath } from "../util";
import { UtilsService } from "./utils.service";
import { AppWindow } from "shared/models/window-manager/app-window.model";
import { PRELOAD_PATH } from "../main";
import path from "path";
import { APP_NAME } from "../constants";
export class WindowManagerService{
private static instance: WindowManagerService;
private readonly PRELOAD_PATH = app.isPackaged ? path.join(__dirname, 'preload.js') : path.join(__dirname, '../../../.erb/dll/preload.js')
private readonly utilsService: UtilsService = UtilsService.getInstance();
private readonly appWindowsOptions: Record<AppWindow, BrowserWindowConstructorOptions> = {
"launcher.html": {width: 380, height: 500, minWidth: 380, minHeight: 500, resizable: false},
"index.html": {width: 1080, height: 720, minWidth: 900, minHeight: 500}
"index.html": {width: 1080, height: 720, minWidth: 900, minHeight: 500},
"oneclick-download-map.html": {width: 350, height: 400, minWidth: 350, minHeight: 400, resizable: false},
"oneclick-download-playlist.html": {width: 350, height: 400, minWidth: 350, minHeight: 400, resizable: false},
"oneclick-download-model.html": {width: 350, height: 400, minWidth: 350, minHeight: 400, resizable: false},
}
private readonly baseWindowOption: BrowserWindowConstructorOptions = {
title: APP_NAME,
icon: this.utilsService.getAssetsPath("favicon.ico"),
show: false,
frame: false,
titleBarOverlay: false,
webPreferences: { preload: PRELOAD_PATH }
webPreferences: { preload: this.PRELOAD_PATH, webSecurity: false }
}
private readonly windows: Map<AppWindow, BrowserWindow> = new Map<AppWindow, BrowserWindow>();
@@ -32,15 +39,16 @@ export class WindowManagerService{
private constructor(){}
public openWindow(windowType: AppWindow): Promise<BrowserWindow>{
const window = new BrowserWindow({...this.appWindowsOptions[windowType], ...this.baseWindowOption});
public openWindow(windowType: AppWindow, options?: BrowserWindowConstructorOptions): Promise<BrowserWindow>{
const window = new BrowserWindow({...this.appWindowsOptions[windowType], ...this.baseWindowOption, ...options});
const promise = window.loadURL(resolveHtmlPath(windowType));
window.removeMenu();
window.setMenu(null);
window.once("ready-to-show", () => {
if (!window) { throw new Error('"window" is not defined'); }
return window.show();
window.show();
});
window.once("closed", () => {
@@ -49,15 +57,11 @@ export class WindowManagerService{
});
this.windows.set(windowType, window);
this.utilsService.setMainWindow(window);
this.utilsService.setMainWindows(this.windows);
return promise.then(() => window);
}
public closeWindow(window: AppWindow){
this.windows.get(window).close();
}
public closeAllWindows(except?: AppWindow){
this.windows.forEach((window, key) => {
if(key === except){ return; }
@@ -65,4 +69,18 @@ export class WindowManagerService{
})
}
public close(...win: AppWindow[]){
win.forEach(window => {
this.windows.get(window)?.close();
});
}
public getWindow(window: AppWindow): BrowserWindow{
return this.windows.get(window);
}
public getAppWindowFromWebContents(sender: Electron.WebContents): AppWindow{
return Array.from(this.windows.entries()).find(([key, value]) => value.webContents.id === sender.id)[0];
}
}
-49
View File
@@ -1,49 +0,0 @@
import { NavBar } from "./components/nav-bar/nav-bar.component";
import TitleBar from "./components/title-bar/title-bar.component";
import { Routes, Route, useLocation } from "react-router-dom";
import { AvailableVersionsList } from "./pages/available-versions-list.components";
import { VersionViewer } from "./pages/version-viewer.component";
import { Modal } from "./components/modal/modal.component";
import { SettingsPage } from "./pages/settings-page.component";
import { BsmProgressBar } from "./components/progress-bar/bsm-progress-bar.component";
import { useEffect } from "react";
import { ThemeService } from "./services/theme.service";
import { NotificationOverlay } from "./components/notification/notification-overlay.component";
import { PageStateService } from "./services/page-state.service";
export default function App() {
const themeService = ThemeService.getInstance();
const pageState = PageStateService.getInstance();
const location = useLocation();
pageState.setState(location.state);
useEffect(() => {
themeService.theme$.subscribe(() => {
if(themeService.isDark || (themeService.isOS && window.matchMedia('(prefers-color-scheme: dark)').matches)){ return document.documentElement.classList.add('dark'); }
document.documentElement.classList.remove('dark');
});
}, []);
return (
<div className="relative w-screen h-screen overflow-hidden flex bg-light-main-color-1 dark:bg-main-color-1 z-0 max-w-full">
<Modal/>
<NavBar/>
<NotificationOverlay/>
<div className="relative flex flex-col grow max-w-full min-w-0">
<TitleBar/>
<div className="bg-light-main-color-2 dark:bg-main-color-2 relative rounded-tl-lg grow overflow-hidden max-w-full">
<Routes>
<Route path={"/bs-version/:versionNumber"} element={<VersionViewer/>}/>
<Route path={"/settings"} element={<SettingsPage/>}/>
<Route path="*" element={<AvailableVersionsList/>}/>
</Routes>
<BsmProgressBar/>
</div>
</div>
</div>
);
}
@@ -8,6 +8,8 @@ import { BsmImage } from "../shared/bsm-image.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { BsmIcon } from "../svgs/bsm-icon.component";
import { LinkOpenerService } from 'renderer/services/link-opener.service';
import { motion } from 'framer-motion';
import { GlowEffect } from '../shared/glow-effect.component';
export const AvailableVersionItem = memo(function AvailableVersionItem(props: {version: BSVersion}) {
@@ -15,6 +17,7 @@ export const AvailableVersionItem = memo(function AvailableVersionItem(props: {v
const linkOpener = LinkOpenerService.getInstance();
const [selected, setSelected] = useState(false);
const [hovered, setHovered] = useState(false);
const t = useTranslation();
const formatedDate = (() => { return dateFormat(+props.version.ReleaseDate*1000, "ddd. d mmm yyyy"); })()
@@ -38,8 +41,8 @@ export const AvailableVersionItem = memo(function AvailableVersionItem(props: {v
}, [])
return (
<li className="group relative w-72 h-60 transition-transform active:scale-[.98]" onClick={toggleSelect}>
<span className={`absolute glow-on-hover group-hover:opacity-100 ${selected && "!opacity-100"}`}/>
<motion.li className="group relative w-72 h-60 transition-transform active:scale-[.98]" onClick={toggleSelect} onHoverStart={() => setHovered(true)} onHoverEnd={() => setHovered(false)}>
<GlowEffect visible={hovered || selected} className="absolute"/>
<div className={`relative flex flex-col overflow-hidden rounded-md w-72 h-60 cursor-pointer group-hover:shadow-none duration-300 bg-light-main-color-2 dark:bg-main-color-2 ${!selected && "shadow-lg shadow-gray-900"}`}>
<BsmImage image={props.version.ReleaseImg ? props.version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="absolute top-0 right-0 w-full h-full opacity-40 blur-xl object-cover" loading="lazy"/>
<BsmImage image={props.version.ReleaseImg ? props.version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="bg-black w-full h-3/4 object-cover" loading="lazy"/>
@@ -56,6 +59,6 @@ export const AvailableVersionItem = memo(function AvailableVersionItem(props: {v
)}
</div>
</div>
</li>
</motion.li>
)
})
@@ -1,7 +1,7 @@
import { BSVersion } from 'shared/bs-version.interface';
import { useEffect, useState } from "react"
import { BSVersionManagerService } from "renderer/services/bs-version-manager.service";
import { filter, take } from "rxjs/operators";
import { filter } from "rxjs/operators";
import { AvailableVersionItem } from "./available-version-item.component";
export function AvailableVersionsSlide(props: {year: string}) {
@@ -11,15 +11,11 @@ export function AvailableVersionsSlide(props: {year: string}) {
const versionsService = BSVersionManagerService.getInstance();
useEffect(() => {
versionsService.availableVersions$.pipe(filter(versions => !!versions?.length), take(1)).subscribe(() => {
versionsService.availableVersions$.pipe(filter(versions => !!versions?.length)).subscribe(() => {
setAvailableVersions(versionsService.getAvaibleVersionsOfYear(props.year));
});
}, [])
//w-full max-w-full max-h-full flex items-start justify-center overflow-x-hidden overflow-y-scroll content-start scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900
//relative left-[2px] flex justify-center items-start content-start flex-wrap max-w-6xl
return (
<ol className="w-full flex items-start justify-center gap-6 shrink-0 content-start flex-wrap p-4 overflow-x-hidden overflow-y-scroll scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900">
{availableVersions.map((version, index) =>
@@ -1,32 +1,32 @@
import { useEffect, useState } from "react"
import { BSVersionManagerService } from "../../services/bs-version-manager.service";
import { AvailableVersionsSlide } from "./available-versions-slide.component";
import { filter, take } from "rxjs/operators";
import { filter} from "rxjs/operators";
import { TabNavBar } from "../shared/tab-nav-bar.component";
export function AvailableVersionsSlider() {
const [availableYears, setAvailableYears] = useState([]);
const [yearIndex, setYearIndex] = useState(0);
const versionManagerService = BSVersionManagerService.getInstance();
const versionManagerService = BSVersionManagerService.getInstance();
const [availableYears, setAvailableYears] = useState([]);
const [yearIndex, setYearIndex] = useState(0);
const setSelectedYear = (index: number) => {
setYearIndex(index);
}
const setSelectedYear = (index: number) => {
setYearIndex(index);
}
useEffect(() => {
versionManagerService.availableVersions$.pipe(filter(versions => !!versions?.length), take(1)).subscribe(() => {
setAvailableYears(versionManagerService.getAvailableYears());
});
}, [])
useEffect(() => {
versionManagerService.availableVersions$.pipe(filter(versions => !!versions?.length)).subscribe(() => {
setAvailableYears(versionManagerService.getAvailableYears());
});
}, [])
return (
<div className="w-full h-fit max-h-full flex flex-col items-center grow min-h-0">
<TabNavBar className="mb-3" tabsText={availableYears} onTabChange={setSelectedYear}/>
<div className="w-full h-fit max-h-full flex flex-col items-center grow min-h-0 gap-3">
<TabNavBar tabIndex={yearIndex} tabsText={availableYears} onTabChange={setSelectedYear}/>
<ol className="w-full min-h-0 flex transition-transform duration-300" style={{transform: `translate(${-(yearIndex * 100)}%, 0)`}}>
{ availableYears.map((year, index) =>
<AvailableVersionsSlide key={index} year={year}></AvailableVersionsSlide>
{ availableYears.map(year =>
<AvailableVersionsSlide key={year} year={year}/>
)}
</ol>
</div>
@@ -0,0 +1,224 @@
import { MapFilter, MapSpecificity, MapStyle, MapTag, MapType } from "shared/models/maps/beat-saver.model"
import {motion} from "framer-motion"
import { MutableRefObject, useEffect, useRef, useState} from "react"
import { MAP_TYPES } from "renderer/partials/maps/map-tags/map-types"
import { MAP_STYLES } from "renderer/partials/maps/map-tags/map-styles"
import { BsmCheckbox } from "../shared/bsm-checkbox.component"
import { min_to_s } from "renderer/helpers/time-utils"
import dateFormat from "dateformat"
import { BsmRange } from "../shared/bsm-range.component"
import { useTranslation } from "renderer/hooks/use-translation.hook"
import { MAP_SPECIFICITIES } from "renderer/partials/maps/map-general/map-specificity"
import { MAP_REQUIREMENTS } from "renderer/partials/maps/map-requirements/map-requirements"
import { MAP_DIFFICULTIES_COLORS } from "renderer/partials/maps/map-difficulties/map-difficulties-colors"
import { BsmButton } from "../shared/bsm-button.component"
import equal from "fast-deep-equal/es6";
import clone from "rfdc";
import { GlowEffect } from "../shared/glow-effect.component"
export type Props = {
className?: string,
ref?: MutableRefObject<undefined>
playlist?: boolean,
filter: MapFilter,
onChange?: (filter: MapFilter) => void,
onApply?: (filter: MapFilter) => void,
onClose?: (filter: MapFilter) => void
}
export function FilterPanel({className, ref, playlist = false, filter, onChange, onApply, onClose}: Props) {
const t = useTranslation();
const [haveChanged, setHaveChanged] = useState(false);
const [firstFilter,] = useState(clone()(filter));
const firstRun = useRef(true);
const MIN_NPS = 0;
const MAX_NPS = 17;
const MIN_DURATION = 0;
const MAX_DURATION = min_to_s(30);
const npss = [filter?.minNps || MIN_NPS, filter?.maxNps || MAX_NPS];
const durations = [filter?.minDuration || MIN_DURATION, filter?.maxDuration || MAX_DURATION];
const isTagActivated = (tag: MapTag): boolean => filter?.enabledTags?.has(tag) || filter?.excludedTags?.has(tag);
const isTagExcluded = (tag: MapTag): boolean => filter?.excludedTags?.has(tag);
useEffect(() => {
if(firstRun.current){
firstRun.current = false;
return;
}
setHaveChanged(() => !equal(filter, firstFilter));
}, [filter])
const renderDurationLabel = (sec: number): JSX.Element => {
const textValue = (() => {
if(sec === MIN_DURATION){ return t("maps.map-filter-panel.duration"); }
if(sec === MAX_DURATION){ return "∞"; }
const date = new Date(0);
date.setSeconds(sec);
return sec > 3600 ? dateFormat(date, "h:MM:ss") : dateFormat(date, "MM:ss");
})();
return renderLabel(textValue, sec === MAX_DURATION);
}
const renderNpsLabel = (nps: number): JSX.Element => {
const textValue = (() => {
if(nps === MIN_NPS){ return "NPS"; }
if(nps === MAX_NPS){ return "∞"; }
return nps;
})();
return renderLabel(textValue, nps === MAX_NPS);
}
const renderLabel = (text: unknown, isMax: boolean): JSX.Element => {
return (
<span className={`bg-inherit absolute top-[calc(100%+4px)] h-5 font-bold rounded-md shadow-center shadow-black px-1 flex items-center ${isMax ? "text-lg" : "text-sm"}`}>
{text}
</span>
)
}
const onNpssChange = ([min, max]: number[]) => {
const newFilter: MapFilter = {...filter, minNps: min, maxNps: max};
if(max === MAX_NPS){
delete newFilter["maxNps"];
}
if(min === MIN_NPS){
delete newFilter["minNps"];
}
onChange(newFilter);
}
const onDurationsChange = ([min, max]: number[]) => {
const newFilter: MapFilter = {...filter, minDuration: min, maxDuration: max};
if(max === MAX_DURATION){
delete newFilter["maxDuration"];
}
if(min === MIN_DURATION){
delete newFilter["minDuration"];
}
onChange(newFilter);
}
const handleTagClick = (tag: MapTag) => {
const enabledTags = filter.enabledTags ?? new Set<MapTag>();
const excludedTags = filter.excludedTags ?? new Set<MapTag>();
if(isTagExcluded(tag)){
excludedTags.delete(tag);
}
else if(isTagActivated(tag)){
excludedTags.add(tag);
enabledTags.delete(tag);
}
else{
enabledTags.add(tag);
}
const newFilter = {...filter, enabledTags, excludedTags};
if(newFilter.enabledTags.size === 0){
delete newFilter["enabledTags"];
}
if(newFilter.excludedTags.size === 0){
delete newFilter["excludedTags"];
}
onChange(newFilter);
}
const translateMapType = (type: MapType): string => {
return t(`maps.map-types.${type}`);
}
const translateMapStyle = (style: MapStyle): string => {
return t(`maps.map-styles.${style}`)
}
const translateMapSpecificity = (specificity: MapSpecificity): string => {
return t(`maps.map-specificities.${specificity}`);
}
type BooleanKeys<T> = { [k in keyof T]: T[k] extends boolean ? k : never }[keyof T];
const handleCheckbox = (key: BooleanKeys<MapFilter>) => {
const newFilter = {...(filter ?? {})};
if(newFilter[key] === true){
delete newFilter[key];
}
else{
newFilter[key] = true;
}
onChange(newFilter);
}
const handleApply = () => {
onApply(filter);
setHaveChanged(() => false);
onClose?.(filter);
}
return !playlist ? (
<motion.div ref={ref} className={`${className} bg-light-main-color-2 dark:bg-main-color-3`} initial={{opacity: 0}} animate={{opacity: 1}} exit={{opacity: 0}}>
<div className="w-full h-6 grid grid-cols-2 gap-x-12 px-4 mb-6 pt-2">
<BsmRange min={MIN_NPS} max={MAX_NPS} values={npss} onChange={onNpssChange} renderLabel={renderNpsLabel} step={.1}/>
<BsmRange min={MIN_DURATION} max={MAX_DURATION} values={durations} onChange={onDurationsChange} renderLabel={renderDurationLabel} step={5}/>
</div>
<div className="w-full h-full flex gap-x-2">
<section className="shrink-0">
<h2 className="mb-1 uppercase text-sm">{t("maps.map-filter-panel.specificities")}</h2>
{MAP_SPECIFICITIES.map(specificity => (
<div key={specificity} className="flex justify-start items-center h-[22px] z-20 relative py-0.5 cursor-pointer" onClick={() => handleCheckbox(specificity)}>
<BsmCheckbox className="h-full aspect-square relative bg-inherit mr-1" checked={filter?.[specificity]} onChange={() => handleCheckbox(specificity)}/>
<span className="grow capitalize">{translateMapSpecificity(specificity)}</span>
</div>
))}
<h2 className="my-1 uppercase text-sm">{t("maps.map-filter-panel.requirements")}</h2>
{MAP_REQUIREMENTS.map(requirement => (
<div key={requirement} className="flex justify-start items-center h-[22px] z-20 relative py-0.5 cursor-pointer" onClick={() => handleCheckbox(requirement)}>
<BsmCheckbox className="h-full aspect-square relative bg-inherit mr-1" checked={filter?.[requirement]} onChange={() => handleCheckbox(requirement)}/>
<span className="grow capitalize">{requirement}</span>
</div>
))}
</section>
<section className="grow capitalize">
<h2 className="uppercase text-sm mb-1">{t("maps.map-filter-panel.tags")}</h2>
<div className="w-full flex flex-row flex-wrap items-start justify-start content-start gap-1 mb-2">
{MAP_TYPES.map(tag => (
<span key={tag} onClick={() => handleTagClick(tag)} className={`text-[12.5px] text-black rounded-md px-1 font-bold cursor-pointer ${(!isTagActivated(tag)) && "opacity-40 hover:opacity-90"}`} style={{backgroundColor: isTagExcluded(tag) ? MAP_DIFFICULTIES_COLORS.Expert : MAP_DIFFICULTIES_COLORS.Normal}}>{translateMapType(tag)}</span>
))}
</div>
<div className="w-full flex flex-row flex-wrap items-start justify-start content-start gap-1">
{MAP_STYLES.map(tag => (
<span key={tag} onClick={() => handleTagClick(tag)} className={`text-[12.5px] text-black rounded-md px-1 font-bold cursor-pointer ${(!isTagActivated(tag)) && "opacity-40 hover:opacity-90"}`} style={{backgroundColor: isTagExcluded(tag) ? MAP_DIFFICULTIES_COLORS.Expert : MAP_DIFFICULTIES_COLORS.Easy}}>{translateMapStyle(tag)}</span>
))}
</div>
</section>
</div>
{onApply && (
<div className="inline float-right relative w-fit h-fit mt-2">
<BsmButton className="inline float-right rounded-md font-bold px-1 py-0.5 text-sm" text="misc.apply" typeColor="primary" withBar={false} onClick={handleApply}/>
<GlowEffect visible={haveChanged}/>
</div>
)}
</motion.div>
) : (
<></>
)
}
@@ -0,0 +1,30 @@
import { motion } from "framer-motion"
import { forwardRef } from "react"
import { useThemeColor } from "renderer/hooks/use-theme-color.hook"
import { BsmIcon } from "../svgs/bsm-icon.component"
type Props = {
className?: string,
title?: string,
linked?: boolean
disabled?: boolean,
onClick?: () => void
}
export const LinkButton = motion(forwardRef((props: Props, ref) => {
const color = useThemeColor("first-color");
const linkedColor = (() => {
if(props.disabled){ return "orange"; }
if(props.linked){ return color; }
return "red";
})()
return (
<div ref={ref} className={props.className} title={props.title} onClick={e => {e.preventDefault(); !props.disabled && props.onClick?.()}} style={{pointerEvents: props.disabled ? "none" : "auto"}}>
<span className="absolute top-0 left-0 h-full w-full rounded-full brightness-50 opacity-75 dark:opacity-20 dark:filter-none" style={{backgroundColor: linkedColor}}/>
<BsmIcon className="p-1 absolute top-0 left-0 h-full w-full !bg-transparent -rotate-45 brightness-150" icon={props.linked ? "link" : "unlink"} style={{color: linkedColor}} />
</div>
)
}))
@@ -0,0 +1,335 @@
import { MapsManagerService } from "renderer/services/maps-manager.service"
import { BSVersion } from "shared/bs-version.interface"
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react"
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface"
import { Subscription } from "rxjs"
import { MapFilter } from "shared/models/maps/beat-saver.model"
import { useInView } from "framer-motion"
import { MapsDownloaderService } from "renderer/services/maps-downloader.service"
import { VariableSizeList } from "react-window"
import { MapsRow } from "./maps-row.component"
import { BehaviorSubject } from "rxjs"
import { debounceTime, last, map, mergeMap } from "rxjs/operators"
import { BeatSaverService } from "renderer/services/thrird-partys/beat-saver.service"
import { OsDiagnosticService } from "renderer/services/os-diagnostic.service"
import { useTranslation } from "renderer/hooks/use-translation.hook"
import BeatWaitingImg from "../../../../assets/images/apngs/beat-waiting.png"
import BeatConflict from "../../../../assets/images/apngs/beat-conflict.png"
import { BsmImage } from "../shared/bsm-image.component"
import { BsmButton } from "../shared/bsm-button.component"
import TextProgressBar from "../progress-bar/text-progress-bar.component"
type Props = {
version: BSVersion,
className?: string,
filter?: MapFilter
search?: string,
linked?: boolean
}
export const LocalMapsListPanel = forwardRef(({version, className, filter, search, linked} : Props, forwardRef) => {
const mapsManager = MapsManagerService.getInstance();
const mapsDownloader = MapsDownloaderService.getInstance();
const bsaver = BeatSaverService.getInstance();
const os = OsDiagnosticService.getInstance();
const t = useTranslation();
const ref = useRef(null)
const isVisible = useInView(ref, {once: true, amount: .5});
const [maps, setMaps] = useState<BsmLocalMap[]>(null);
const [subs] = useState<Subscription[]>([]);
const [selectedMaps$] = useState(new BehaviorSubject<BsmLocalMap[]>([]));
const [itemPerRow, setItemPerRow] = useState(2);
const [listHeight, setListHeight] = useState(0);
const [loadPercent$] = useState(new BehaviorSubject(0));
useImperativeHandle(forwardRef ,()=>({
deleteMaps(){
const mapsToDelete = selectedMaps$.value.length === 0 ? maps : selectedMaps$.value;
mapsManager.deleteMaps(mapsToDelete, version).then(res => {
if(!res){ return; }
removeMapsFromList(mapsToDelete);
selectedMaps$.next([]);
});
},
exportMaps(){
mapsManager.exportMaps(version, selectedMaps$.value);
},
getMaps(){
return maps;
}
}), [selectedMaps$.value, maps, version]);
useEffect(() => {
console.log(linked);
if(isVisible){
loadMaps();
mapsDownloader.addOnMapDownloadedListener((map, targerVersion) => {
if(targerVersion !== version){ return; }
setMaps(maps => maps ? [map, ...maps] : [map]);
});
}
return () => {
setMaps(() => null);
loadPercent$.next(0);
subs.forEach(s => s.unsubscribe());
mapsDownloader.removeOnMapDownloadedListener(loadMaps);
}
}, [isVisible, version, linked]);
useEffect(() => {
if(!isVisible){ return () => {}; }
const updateItemPerRow = (listWidth: number) => {
const newPerRow = Math.min(Math.floor(listWidth / 400), 3);
if(newPerRow === itemPerRow){ return; }
setItemPerRow(newPerRow);
};
const heightObserver$ = new BehaviorSubject(0);
const observer = new ResizeObserver(() => {
updateItemPerRow(ref.current?.clientWidth || 0);
heightObserver$.next(ref.current?.clientHeight || 0)
});
observer.observe(ref.current);
const sub = heightObserver$.pipe(debounceTime(100)).subscribe(setListHeight);
return () => {
observer.disconnect();
sub.unsubscribe();
}
}, [isVisible, itemPerRow])
const loadMaps = () => {
setMaps(() => null);
loadPercent$.next(0);
const loadMapsObs$ = mapsManager.getMaps(version);
loadMapsObs$.pipe(map(progess => {
return Math.floor(((progess.loaded / progess.total) * 100));
})).subscribe(percent => loadPercent$.next(percent));
subs.push(loadMapsObs$.pipe(
last(),
mergeMap(async progress => {
if(os.isOffline){ return progress.maps; }
const maps = progress.maps;
const details = await bsaver.getMapDetailsFromHashs(maps.map(map => map.hash));
return maps.map(map => {
map.bsaverInfo = details.find(d => d.versions.at(0).hash === map.hash);
return map;
})
})
).subscribe({
next: maps => setMaps(() => maps),
complete: () => loadPercent$.next(0)
}));
}
const removeMapsFromList = (mapsToRemove: BsmLocalMap[]) => {
const filtredMaps = maps.filter(map => !mapsToRemove.some(toDeleteMaps => map.hash === toDeleteMaps.hash));
setMaps(() => filtredMaps);
};
const handleDelete = useCallback((map: BsmLocalMap) => {
mapsManager.deleteMaps([map], version).then(res => res && removeMapsFromList([map]));
}, [version, maps]);
const onMapSelected = useCallback((map: BsmLocalMap) => {
const mapsCopy = [...selectedMaps$.value];
if(mapsCopy.some(selectedMap => selectedMap.hash === map.hash)){
const i = mapsCopy.findIndex(selectedMap => selectedMap.hash === map.hash);
mapsCopy.splice(i, 1);
}
else{
mapsCopy.push(map);
}
selectedMaps$.next(mapsCopy);
}, [selectedMaps$.value]);
const isMapFitFilter = (map: BsmLocalMap): boolean => {
// Can be more clean and optimized i think
const fitEnabledTags = (() => {
if(!filter?.enabledTags || filter.enabledTags.size === 0){ return true; }
if(!map?.bsaverInfo?.tags){ return false; }
return Array.from(filter.enabledTags.values()).every(tag => map.bsaverInfo.tags.some(mapTag => mapTag === tag));
})();
if(!fitEnabledTags){ return false; }
const fitExcluedTags = (() => {
if(!filter?.excludedTags || filter.excludedTags.size === 0){ return true; }
if(!map?.bsaverInfo?.tags){ return true; }
return !map.bsaverInfo.tags.some(tag => filter.excludedTags.has(tag));
})();
if(!fitExcluedTags){ return false; }
const fitMinNps = (() => {
if(!filter?.minNps){ return true; }
if(!map?.bsaverInfo?.versions?.at(0)){ return false; }
return !map.bsaverInfo.versions.some(version => {
return version.diffs.some(diff => diff.nps < filter.minNps);
});
})();
if(!fitMinNps){ return false; }
const fitMaxNps = (() => {
if(!filter?.maxNps){ return true; }
if(!map?.bsaverInfo?.versions?.at(0)){ return false; }
return !map.bsaverInfo.versions.some(version => {
return version.diffs.some(diff => diff.nps > filter.maxNps);
});
})();
if(!fitMaxNps){ return false; }
const fitMinDuration = (() => {
if(!filter?.minDuration){ return true; }
if(!map?.bsaverInfo?.metadata?.duration){ return false; }
return map.bsaverInfo.metadata.duration >= filter.minDuration;
})();
if(!fitMinDuration){ return false; }
const fitMaxDuration = (() => {
if(!filter?.maxDuration){ return true; }
if(!map?.bsaverInfo?.metadata?.duration){ return false; }
return map.bsaverInfo.metadata.duration <= filter.maxDuration;
})();
if(!fitMaxDuration){ return false; }
const fitNoodle = (() => {
if(!filter?.noodle){ return true; }
if(!map?.bsaverInfo?.versions?.at(0)){ return false; }
return map.bsaverInfo.versions.some(version => version.diffs.some(diff => !!diff.ne));
})();
if(!fitNoodle){ return false; }
const fitMe = (() => {
if(!filter?.me){ return true; }
if(!map?.bsaverInfo?.versions?.at(0)){ return false; }
return map.bsaverInfo.versions.some(version => version.diffs.some(diff => !!diff.me));
})();
if(!fitMe){ return false; }
const fitCinema = (() => {
if(!filter?.cinema){ return true; }
if(!map?.bsaverInfo?.versions?.at(0)){ return false; }
return map.bsaverInfo.versions.some(version => version.diffs.some(diff => !!diff.cinema));
})();
if(!fitCinema){ return false; }
const fitChroma =(() => {
if(!filter?.chroma){ return true; }
if(!map?.bsaverInfo?.versions?.at(0)){ return false; }
return map.bsaverInfo.versions.some(version => version.diffs.some(diff => !!diff.chroma));
})();
if(!fitChroma){ return false; }
const fitFullSpread = (() => {
if(!filter?.fullSpread){ return true; }
if(!map?.bsaverInfo?.versions?.at(0)){ return false; }
return map.bsaverInfo.versions.some(version => version?.diffs?.length >= 5);
})();
if(!fitFullSpread){ return false; }
if(!(filter?.automapper ? map.bsaverInfo?.automapper === filter.automapper : true)){ return false }
if(!(filter?.ranked ? map.bsaverInfo?.ranked === filter.ranked : true)){ return false }
if(!(filter?.curated ? !!map.bsaverInfo?.curatedAt : true)){ return false }
if(!(filter?.verified ? !!map.bsaverInfo?.uploader?.verifiedMapper : true)){ return false }
const searchCheck = (() => {
return (
((map.rawInfo?._songName ?? map.bsaverInfo?.name) || "")?.toLowerCase().includes(search.toLowerCase()) ||
((map.rawInfo?._songAuthorName ?? map.bsaverInfo?.metadata?.songAuthorName) || "")?.toLowerCase().includes(search.toLowerCase()) ||
((map.rawInfo?._levelAuthorName ?? map.bsaverInfo?.metadata?.levelAuthorName) || "")?.toLowerCase().includes(search.toLowerCase()));
})();
if(!searchCheck){ return false };
return true;
}
const preppedMaps: BsmLocalMap[][] = (() => {
if(!maps){ return []; }
const res: BsmLocalMap[][] = [];
let mapsRow: BsmLocalMap[] = []
for(const map of maps){
if(!isMapFitFilter(map)){ continue; }
if(mapsRow.length === itemPerRow){
res.push(mapsRow);
mapsRow = [];
}
mapsRow.push(map);
}
if(mapsRow.length){
res.push(mapsRow);
}
return res;
})();
if(!maps){
return (
<div ref={ref} className={className}>
<div className="h-full flex flex-col items-center justify-center flex-wrap gap-1 text-gray-800 dark:text-gray-200">
<BsmImage className="w-32 h-32 spin-loading" image={BeatWaitingImg}/>
<span className="font-bold">{t("modals.download-maps.loading-maps")}</span>
<TextProgressBar value$={loadPercent$}/>
</div>
</div>
);
}
if(!maps.length){
return (
<div ref={ref} className={className}>
<div className="h-full flex flex-col items-center justify-center flex-wrap gap-1 text-gray-800 dark:text-gray-200">
<BsmImage className="h-32" image={BeatConflict}/>
<span className="font-bold">{t("pages.version-viewer.maps.tabs.maps.empty-maps.text")}</span>
<BsmButton className="font-bold rounded-md p-2" text="pages.version-viewer.maps.tabs.maps.empty-maps.button" typeColor="primary" withBar={false} onClick={e => {e.preventDefault(); mapsDownloader.openDownloadMapModal(version)}}/>
</div>
</div>
);
}
return (
<div ref={ref} className={className}>
<VariableSizeList className="p-0 scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900" width={"100%"} height={listHeight} itemSize={() => 108} itemCount={preppedMaps.length} itemData={preppedMaps} layout="vertical" style={{scrollbarGutter: "stable both-edges"}} itemKey={(i, data) => data[i].map(map => map.hash).join()}>
{(props) => <MapsRow maps={props.data[props.index]} style={props.style} selectedMaps$={selectedMaps$} onMapSelect={onMapSelected} onMapDelete={handleDelete}/>}
</VariableSizeList>
</div>
)
})
@@ -0,0 +1,244 @@
import { BsmImage } from "../shared/bsm-image.component";
import { BsvMapCharacteristic, BsvMapDifficultyType } from "shared/models/maps/beat-saver.model"
import { useThemeColor } from "renderer/hooks/use-theme-color.hook";
import { BsmLink } from "../shared/bsm-link.component";
import { BsmIcon } from "../svgs/bsm-icon.component";
import { BsmButton } from "../shared/bsm-button.component";
import { AnimatePresence, motion } from "framer-motion";
import { useState, Fragment, memo, useRef } from "react";
import { LinkOpenerService } from "renderer/services/link-opener.service";
import dateFormat from "dateformat";
import { AudioPlayerService } from "renderer/services/audio-player.service";
import { useObservable } from "renderer/hooks/use-observable.hook";
import { map } from "rxjs/operators";
import useDelayedState from "use-delayed-state";
import equal from "fast-deep-equal/es6";
import { getMapZipUrlFromHash } from "renderer/helpers/maps-utils";
import { BsmBasicSpinner } from "../shared/bsm-basic-spinner/bsm-basic-spinner.component";
import defaultImage from '../../../../assets/images/default-version-img.jpg'
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { MAP_DIFFICULTIES } from "renderer/partials/maps/map-difficulties/map-difficulties";
import { MAP_DIFFICULTIES_COLORS } from "renderer/partials/maps/map-difficulties/map-difficulties-colors"
import useDoubleClick from "use-double-click";
import { GlowEffect } from "../shared/glow-effect.component";
export type ParsedMapDiff = {type: BsvMapDifficultyType, name: string, stars: number}
export type MapItemProps<T = any> = {
hash: string,
title: string,
autor: string,
songAutor: string,
coverUrl: string,
songUrl: string,
autorId: number,
mapId: string,
diffs: Map<BsvMapCharacteristic, ParsedMapDiff[]>,
ranked: boolean,
bpm: number,
duration: number,
likes: number,
createdAt: string,
selected?: boolean,
downloading?: boolean,
showOwned?: boolean,
callBackParam: T
onDelete?: (param: T) => void,
onDownload?: (param: T) => void,
onSelected?: (param: T) => void,
onCancelDownload?: (param: T) => void,
onDoubleClick?: (param: T) => void
}
export const MapItem = memo(({hash, title, autor, songAutor, coverUrl, songUrl, autorId, mapId, diffs, ranked, bpm, duration, likes, createdAt, selected, downloading, showOwned, callBackParam, onDelete, onDownload, onSelected, onCancelDownload, onDoubleClick}: MapItemProps) => {
const linkOpener = LinkOpenerService.getInstance();
const audioPlayer = AudioPlayerService.getInstance();
const color = useThemeColor("first-color");
const t = useTranslation();
const ref = useRef(null);
const [hovered, setHovered] = useState(false);
const [bottomBarHovered, setBottomBarHovered, cancelBottomBarHovered] = useDelayedState(false);
const [diffsPanelHovered, setDiffsPanelHovered] = useState(false);
useDoubleClick({
ref,
latency: onDoubleClick ? 200 : 0,
onSingleClick: e => onSelected?.(callBackParam),
onDoubleClick: e => onDoubleClick?.(callBackParam)
})
const songPlaying = useObservable(audioPlayer.playing$.pipe(map(playing => playing && audioPlayer.src === songUrl)));
const zipUrl = getMapZipUrlFromHash(hash);
const previewUrl = mapId ? `https://skystudioapps.com/bs-viewer/?url=${zipUrl}` : null;
const mapUrl = mapId ? `https://beatsaver.com/maps/${mapId}` : null;
const authorUrl = autorId ? `https://beatsaver.com/profile/${autorId}` : null;
const createdDate = createdAt ? dateFormat(createdAt, "d mmm yyyy") : null;
const likesText = likes ? Intl.NumberFormat(undefined, {notation: "compact"}).format(likes).split(" ").join("") : null;
const durationText = (() => {
if(!duration){ return null; }
const date = new Date(0);
date.setSeconds(duration);
return duration > 3600 ? dateFormat(date, "h:MM:ss") : dateFormat(date, "MM:ss");
})();
const parseDiffLabel = (diffLabel: string) => {
if(MAP_DIFFICULTIES.includes(diffLabel as BsvMapDifficultyType)){
return t(`maps.difficulties.${diffLabel}`);
}
return diffLabel;
}
const openPreview = () => {
if(audioPlayer.playing){
audioPlayer.pause();
}
linkOpener.open(previewUrl, true);
}
const copyBsr = () => navigator.clipboard.writeText(`!bsr ${mapId}`);
const toogleMusic = () => {
if(songPlaying){
return audioPlayer.pause();
}
if(!audioPlayer.playing && audioPlayer.src === songUrl){
return audioPlayer.resume();
}
audioPlayer.play(songUrl, bpm);
}
const bottomBarHoverStart = () => {
cancelBottomBarHovered();
setBottomBarHovered(true, (diffsPanelHovered || bottomBarHovered) ? 0 : 300);
}
const bottomBarHoverEnd = () => {
cancelBottomBarHovered();
setBottomBarHovered(false, 100);
}
const diffsPanelHoverStart = () => setDiffsPanelHovered(true);
const diffsPanelHoverEnd = () => setDiffsPanelHovered(false);
const renderDiffPreview = () => {
const diffSets = Array.from(diffs.entries());
if(diffSets.length === 1){
const [diffType, diffSet] = diffSets[0];
return (
<>
<BsmIcon className="h-4 w-4 mr-px" icon="bsMapDifficulty"/>
<div className="flex py-[2px] gap-[1px] h-full">
{diffSet.map(diff => (
<span key={crypto.randomUUID()} className="h-full w-[6px] rounded-full" style={{backgroundColor: MAP_DIFFICULTIES_COLORS[diff.type]}}/>
))}
</div>
</>
)
}
if(diffSets.length > 1){
return diffSets.map(([diffType, diffSet]) => (
<Fragment key={crypto.randomUUID()}>
<BsmIcon className="h-full w-fit mr-px" icon={diffType}/>
<span className="mr-2 font-bold text-[15px] h-full flex items-center pb-px">{diffSet.length}</span>
</Fragment>
));
}
}
return (
<motion.li className="relative h-[100px] w-[400px] min-w-[370px] shrink-0 grow basis-0 text-white group cursor-pointer" onHoverStart={() => setHovered(true)} onHoverEnd={() => setHovered(false)} style={{zIndex: hovered && 5, transform: "translateZ(0) scale(1.0, 1.0)", backfaceVisibility: "hidden"}}>
<GlowEffect visible={hovered || selected && !!onSelected}/>
<AnimatePresence>
{(diffsPanelHovered || bottomBarHovered) && (
<motion.ul key={hash} className="absolute top-[calc(100%-10px)] w-full h-fit max-h-[200%] pt-4 pb-2 px-2 overflow-y-scroll bg-light-main-color-3 dark:bg-main-color-3 text-main-color-1 dark:text-current brightness-125 rounded-md flex flex-col gap-3 scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900 shadow-sm shadow-black" initial={{opacity: 0}} animate={{opacity: 1}} exit={{opacity: 0}} transition={{duration: .15}} onHoverStart={diffsPanelHoverStart} onHoverEnd={diffsPanelHoverEnd}>
{Array.from(diffs.entries()).map(([charac, diffSet]) => (
<ol key={crypto.randomUUID()} className="flex flex-col w-full gap-1">
{diffSet.map(({type, name, stars}) => (
<li key={`${type}${name}${stars}`} className="w-full h-4 flex items-center gap-1">
<BsmIcon className="h-full w-fit p-px" icon={charac}/>
<span className="h-full px-2 flex items-center text-xs font-bold bg-current rounded-full" style={{color: MAP_DIFFICULTIES_COLORS[type]}}>
{
stars ? (
<span className="h-full block brightness-[.25]"> {stars}</span>
) : (
<span className="h-full brightness-[.25] leading-4 pb-[2px] capitalize">{parseDiffLabel(type)}</span>
)
}
</span>
<span className="text-sm leading-4 pb-[2px] capitalize">{parseDiffLabel(name)}</span>
</li>
))}
</ol>
))}
</motion.ul>
)}
</AnimatePresence>
<div className="h-full w-full relative pl-[100px] rounded-md overflow-hidden flex flex-row justify-end">
<div className={`absolute top-0 left-0 h-full aspect-square cursor-pointer ${showOwned && "border-l-[5px]"}`} style={{borderColor: showOwned && color}}>
<BsmImage className="w-full h-full object-cover" image={coverUrl} placeholder={defaultImage} errorImage={defaultImage} loading="lazy"/>
<span className="absolute flex justify-center items-center w-full h-full pr-1 bg-transparent top-0 left-0 group-hover:bg-black group-hover:bg-opacity-40" style={{color}} onClick={(e) => {e.stopPropagation(); e.preventDefault(); toogleMusic()}}>
<BsmIcon className="w-full h-full p-7 opacity-0 group-hover:opacity-100 text-white hover:text-current" icon={songPlaying ? "pause" : "play"}/>
</span>
</div>
<div className="relative h-full w-full z-[1] rounded-md overflow-hidden -translate-x-1" ref={ref}>
<BsmImage className="absolute top-0 left-0 w-full h-full -z-[1] object-cover" image={coverUrl} placeholder={defaultImage} errorImage={defaultImage} loading="lazy"/>
<div className="pt-1 pl-2 pr-7 top-0 left-0 w-full h-full bg-gray-600 bg-opacity-80 flex flex-col justify-between group-hover:bg-main-color-1 group-hover:bg-opacity-80">
<h1 className="font-bold whitespace-nowrap text-ellipsis overflow-hidden w-full leading-5 tracking-wide text-lg" title={title}><BsmLink className="hover:underline" href={mapUrl}>{title}</BsmLink></h1>
<h2 className="font-bold whitespace-nowrap text-ellipsis overflow-hidden w-full text-sm mb-[3px]">{songAutor && t("maps.map-item.by", {songAutor})}</h2>
<h3 className="font-bold whitespace-nowrap text-ellipsis overflow-hidden w-full text-xs">{autor && (<> {t("maps.map-item.mapped-by")} <BsmLink href={authorUrl} className="brightness-200 hover:underline" style={{color}}>{autor}</BsmLink></>)}</h3>
<div className="w-full h-4 text-xs gap-2 flex opacity-0 group-hover:opacity-100">
{likesText && (
<div className="h-full flex items-center">
<BsmIcon className="h-full py-[2px] w-fit shrink-0 mr-1" icon="thumbUpFill"/>
<span className="mb-[2px]">{likesText}</span>
</div>
)}
{durationText && (
<div className="h-full flex items-center">
<BsmIcon className="h-full py-[2px] w-fit shrink-0 mr-1" icon="timerFill"/>
<span className="mb-[2px]">{durationText}</span>
</div>
)}
{createdAt && (
<div className="h-full flex items-center">
<BsmIcon className="h-full py-[2px] w-fit shrink-0 mr-1" icon="checkCircleIcon"/>
<time className="mb-[2px]">{createdDate}</time>
</div>
)}
</div>
<motion.div className="w-full h-5 pb-1 pr-7 flex items-center gap-1" onHoverStart={bottomBarHoverStart} onHoverEnd={bottomBarHoverEnd}>
{ranked && (
<div className="text-yellow-300 bg-current rounded-full px-1 h-full flex items-center justify-center">
<span className="uppercase text-xs font-bold tracking-wide brightness-[.25]">{t("maps.map-specificities.ranked")}</span>
</div>
)}
<div className="h-full grow flex items-start content-start">
{renderDiffPreview()}
</div>
</motion.div>
</div>
</div>
<div className="absolute bg-light-main-color-1 dark:bg-main-color-3 top-0 h-full z-[1] w-[30px] -right-5 group-hover:right-0 transition-all">
<span className="absolute w-[10px] h-[10px] top-0 right-full bg-inherit" style={{clipPath: 'path("M11 -1 L11 10 L10 10 A10 10 0 0 0 0 0 L0 -1 Z")'}}/>
<span className="absolute w-[10px] h-[10px] bottom-0 right-full bg-inherit" style={{clipPath: 'path("M11 11 L11 0 L10 0 A10 10 0 0 1 0 10 L 0 11 Z")'}}/>
<div className="flex flex-col justify-center items-center gap-1 w-full h-full overflow-hidden opacity-0 group-hover:opacity-100">
{onDelete && !downloading && <BsmButton className="w-6 h-6 p-[2px] rounded-md !bg-inherit hover:!bg-light-main-color-2 hover:dark:!bg-main-color-2" iconClassName="w-full h-full brightness-75 dark:brightness-200" iconColor={color} icon="trash" withBar={false} onClick={e => {e.stopPropagation(); onDelete(callBackParam)}}/>}
{onDownload && !downloading && <BsmButton className="w-6 h-6 p-[2px] rounded-md !bg-inherit hover:!bg-light-main-color-2 hover:dark:!bg-main-color-2" iconClassName="w-full h-full brightness-75 dark:brightness-200" iconColor={color} icon="download" withBar={false} onClick={e => {e.stopPropagation(); onDownload(callBackParam)}}/>}
{onCancelDownload && !downloading && <BsmButton className="w-6 h-6 p-1 rounded-md !bg-inherit hover:!bg-light-main-color-2 hover:dark:!bg-main-color-2" iconClassName="w-full h-full brightness-75 dark:brightness-200" iconColor="red" icon="cross" withBar={false} onClick={e => {e.stopPropagation(); onCancelDownload(callBackParam)}}/>}
{downloading && <BsmBasicSpinner className="w-6 h-6 p-1 rounded-md !bg-inherit hover:!bg-light-main-color-2 hover:dark:!bg-main-color-2 flex items-center justify-center" spinnerClassName="brightness-75 dark:brightness-200" style={{color}} thikness="3px"/>}
{previewUrl && <BsmButton className="w-6 h-6 p-[2px] rounded-md !bg-inherit hover:!bg-light-main-color-2 hover:dark:!bg-main-color-2" iconClassName="w-full h-full brightness-75 dark:brightness-200" iconColor={color} icon="eye" withBar={false} onClick={e => {e.stopPropagation(); openPreview()}}/>}
{mapId && <BsmButton className="w-6 h-6 p-1 rounded-md !bg-inherit hover:!bg-light-main-color-2 hover:dark:!bg-main-color-2" iconClassName="w-full h-full brightness-75 dark:brightness-200" iconColor={color} icon="twitch" withBar={false} onClick={e => {e.stopPropagation(); copyBsr()}}/>}
</div>
</div>
</div>
</motion.li>
)
}, equal);
@@ -0,0 +1,170 @@
import { DetailedHTMLProps, useEffect, useRef, useState } from "react"
import { BSVersion } from "shared/bs-version.interface"
import { TabNavBar } from "../shared/tab-nav-bar.component"
import { LocalMapsListPanel } from "./local-maps-list-panel.component"
import { BsmDropdownButton, DropDownItem } from "../shared/bsm-dropdown-button.component"
import { FilterPanel } from "./filter-panel.component"
import { MapFilter } from "shared/models/maps/beat-saver.model"
import { useThemeColor } from "renderer/hooks/use-theme-color.hook"
import { MapsManagerService } from "renderer/services/maps-manager.service"
import { motion, Variants } from "framer-motion";
import { MapsDownloaderService } from "renderer/services/maps-downloader.service"
import { BsmImage } from "../shared/bsm-image.component"
import wipGif from "../../../../assets/images/gifs/wip.gif"
import { OsDiagnosticService } from "renderer/services/os-diagnostic.service"
import { useObservable } from "renderer/hooks/use-observable.hook"
import { BsmIcon } from "../svgs/bsm-icon.component"
import { useTranslation } from "renderer/hooks/use-translation.hook"
import { LinkButton } from "./link-button.component"
import { debounceTime } from "rxjs/operators"
import { VersionFolderLinkerService, VersionLinkerActionListener } from "renderer/services/version-folder-linker.service"
type Props = {
version?: BSVersion
}
export function MapsPlaylistsPanel({version}: Props) {
const mapsService = MapsManagerService.getInstance();
const mapsDownloader = MapsDownloaderService.getInstance();
const osDiagnostic = OsDiagnosticService.getInstance();
const linker = VersionFolderLinkerService.getInstance();
const [tabIndex, setTabIndex] = useState(0);
const [mapFilter, setMapFilter] = useState<MapFilter>({});
const [mapSearch, setMapSearch] = useState("");
const [playlistSearch, setPlaylistSearch] = useState("");
const [mapsLinked, setMapsLinked] = useState(false);
const [linkingPending, setLinkingPending] = useState(false);
const isOnline = useObservable(osDiagnostic.isOnline$);
const color = useThemeColor("first-color");
const t = useTranslation();
const mapsRef = useRef<any>();
useEffect(() => {
loadMapIsLinked();
const sub = mapsService.$mapsLinkingPending(version).pipe(debounceTime(50)).subscribe(setLinkingPending);
const onMapsLinked: VersionLinkerActionListener = (action, linked) => {
if(!action.relativeFolder.includes(MapsManagerService.RELATIVE_MAPS_FOLDER)){ return; }
loadMapIsLinked();
}
linker.onVersionFolderLinked(onMapsLinked);
linker.onVersionFolderUnlinked(onMapsLinked);
return () => {
sub.unsubscribe();
linker.removeVersionFolderLinkedListener(onMapsLinked);
linker.removeVersionFolderUnlinkedListener(onMapsLinked);
}
}, [version]);
const loadMapIsLinked = () => {
mapsService.versionHaveMapsLinked(version).then(setMapsLinked);
}
const handleSearch = (value: string) => {
if(tabIndex === 0){
return setMapSearch(() => value);
}
return setPlaylistSearch(() => value);
}
const handleMapsLinkClick = () => {
if(!mapsLinked){
return mapsService.linkVersion(version);
}
return mapsService.unlinkVersion(version);
}
const handleMapsAddClick = () => {
mapsDownloader.openDownloadMapModal(version, mapsRef.current.getMaps?.());
}
const renderTab = (props: DetailedHTMLProps<React.HTMLAttributes<HTMLLIElement>, HTMLLIElement>, text: string, index: number): JSX.Element => {
const onClickLink = (index: number) => {
if(index === 0){ handleMapsLinkClick(); }
}
const onClickAdd = (index: number) => {
if(index === 0){ handleMapsAddClick(); }
}
const variants: Variants = { hover: {rotate: 22.5}, tap: {rotate: 45} };
return (
<li className="relative text-center text-lg font-bold hover:backdrop-brightness-75 flex justify-center items-center content-center" onClick={props.onClick}>
<span className="text-main-color-1 dark:text-gray-200">{text}</span>
{index === 0 &&(
<div className="h-full flex absolute right-0 top-0 gap-1.5 items-center pr-2">
{isOnline && (
<motion.div whileHover="hover" whileTap="tap" className="relative h-[calc(100%-5px)] flex flex-row justify-center items-center shrink-0 rounded-full overflow-hidden pr-2" style={{color}} onClick={e => {e.stopPropagation(); onClickAdd(index)}}>
<span className="absolute top-0 left-0 h-full w-full brightness-50 opacity-75 dark:opacity-20 dark:filter-none" style={{backgroundColor: "currentcolor"}}/>
<motion.div className="h-full p-0.5" variants={variants}>
<BsmIcon className="block h-full aspect-square brightness-150" icon="add"/>
</motion.div>
<span className="text-sm brightness-150">{t("pages.version-viewer.maps.tabs.maps.actions.add-maps.text")}</span>
</motion.div>
)}
{(!!version) && (
<LinkButton
variants={variants}
disabled={linkingPending}
whileHover="hover"
whileTap="tap"
initial={{rotate: 0}}
className="block p-0.5 h-[calc(100%-5px)] aspect-square blur-0 hover:brightness-75"
linked={mapsLinked}
title={t(mapsLinked ? "pages.version-viewer.maps.tabs.maps.actions.link-maps.tooltips.unlink" : "pages.version-viewer.maps.tabs.maps.actions.link-maps.tooltips.link")}
onClick={() => onClickLink(index)}
/>
)}
</div>
)}
</li>
)
}
const dropDownItems = ((): DropDownItem[] => {
if(tabIndex === 1){
return [
]
}
return [
{icon:"export", text: "pages.version-viewer.maps.search-bar.dropdown.export-maps", onClick: () => mapsRef.current.exportMaps?.()},
{icon: "trash", text: "pages.version-viewer.maps.search-bar.dropdown.delete-maps", onClick: () => mapsRef.current.deleteMaps?.()}
]
})()
return (
<div className="w-full h-full flex flex-col items-center justify-center">
<nav className="w-full shrink-0 flex h-9 justify-center px-40 gap-2 mb-3 text-main-color-1 dark:text-white">
<div className="h-full rounded-full bg-light-main-color-2 dark:bg-main-color-2 grow p-[6px]">
<input type="text" className="h-full w-full bg-light-main-color-1 dark:bg-main-color-1 rounded-full px-2" placeholder={t("pages.version-viewer.maps.search-bar.search-placeholder")} value={tabIndex === 0 ? mapSearch : playlistSearch} onChange={e => handleSearch(e.target.value)} tabIndex={-1}/>
</div>
<BsmDropdownButton className="h-full relative z-[1] flex justify-center" buttonClassName="flex items-center justify-center h-full rounded-full px-2 py-1" icon="filter" text="pages.version-viewer.maps.search-bar.filters-btn" withBar={false}>
<FilterPanel className="absolute top-[calc(100%+3px)] origin-top w-[500px] h-fit p-2 rounded-md shadow-md shadow-black" filter={mapFilter} onChange={setMapFilter}/>
</BsmDropdownButton>
<BsmDropdownButton className="h-full flex aspect-square relative rounded-full z-[1] bg-light-main-color-1 dark:bg-main-color-3" buttonClassName="rounded-full h-full w-full p-[6px]" icon="three-dots" withBar={false} items={dropDownItems} menuTranslationY="6px" align="center"/>
</nav>
<div className="w-full h-full flex flex-col bg-light-main-color-3 dark:bg-main-color-2 rounded-md shadow-black shadow-md overflow-hidden">
<TabNavBar className="!rounded-none shadow-sm" tabIndex={tabIndex} tabsText={["misc.maps", "misc.playlists"]} onTabChange={setTabIndex} renderTab={renderTab}/>
<div className="w-full grow min-h-0 flex flex-row items-center transition-transform duration-300" style={{transform: `translate(${-(tabIndex * 100)}%, 0)`}}>
<LocalMapsListPanel ref={mapsRef} className="w-full h-full shrink-0 flex flex-col" version={version} filter={mapFilter} search={mapSearch} linked={mapsLinked}/>
<div className="w-full h-full shrink-0 flex flex-col justify-center items-center content-center gap-2 overflow-hidden text-gray-800 dark:text-gray-200">
<BsmImage className="rounded-md" image={wipGif}/>
<span>Coming soon</span>
</div>
</div>
</div>
</div>
)
}
@@ -0,0 +1,73 @@
import { CSSProperties, memo } from "react"
import { useObservable } from "renderer/hooks/use-observable.hook"
import { distinctUntilChanged, map } from "rxjs/operators"
import { BehaviorSubject } from "rxjs"
import { BsvMapCharacteristic } from "shared/models/maps/beat-saver.model"
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface"
import { ParsedMapDiff, MapItem } from "./map-item.component"
import equal from "fast-deep-equal/es6"
type Props = {
maps: BsmLocalMap[],
style?: CSSProperties,
onMapDelete: (map: BsmLocalMap) => void,
onMapSelect: (map: BsmLocalMap) => void,
selectedMaps$: BehaviorSubject<BsmLocalMap[]>
}
export const MapsRow = memo(({maps, style, selectedMaps$, onMapSelect, onMapDelete}: Props) => {
const selectedMaps = useObservable<BsmLocalMap[]>(selectedMaps$.pipe(
map(selectedMaps => selectedMaps.filter(selected => maps.some(map => map.hash === selected.hash))),
distinctUntilChanged(equal)
), []);
const extractMapDiffs = (map: BsmLocalMap): Map<BsvMapCharacteristic, ParsedMapDiff[]> => {
const res = new Map<BsvMapCharacteristic, ParsedMapDiff[]>();
if(map.bsaverInfo?.versions[0]?.diffs){
map.bsaverInfo.versions[0].diffs.forEach(diff => {
const arr = res.get(diff.characteristic) || [];
const diffName = map.rawInfo._difficultyBeatmapSets.find(set => set._beatmapCharacteristicName === diff.characteristic)._difficultyBeatmaps.find(rawDiff => rawDiff._difficulty === diff.difficulty)?._customData?._difficultyLabel || diff.difficulty
arr.push({name: diffName, type: diff.difficulty, stars: diff.stars});
res.set(diff.characteristic, arr);
});
return res;
}
map.rawInfo._difficultyBeatmapSets.forEach(set => {
set._difficultyBeatmaps.forEach(diff => {
const arr = res.get(set._beatmapCharacteristicName) || [];
arr.push({name: diff._customData?._difficultyLabel || diff._difficulty, type: diff._difficulty, stars: null});
res.set(set._beatmapCharacteristicName, arr);
});
});
return res;
}
const renderMapItem = (map: BsmLocalMap) => {
return <MapItem
key={map.hash}
hash={map.hash}
title={map.rawInfo._songName}
coverUrl={map.coverUrl}
songUrl={map.songUrl}
autor={map.rawInfo._levelAuthorName}
songAutor={map.rawInfo._songAuthorName}
bpm={map.rawInfo._beatsPerMinute}
duration={map.bsaverInfo?.metadata?.duration}
selected={selectedMaps.some(selected => selected.hash === map.hash)}
diffs={extractMapDiffs(map)} mapId={map.bsaverInfo?.id} ranked={map.bsaverInfo?.ranked} autorId={map.bsaverInfo?.uploader?.id} likes={map.bsaverInfo?.stats?.upvotes} createdAt={map.bsaverInfo?.createdAt}
onDelete={onMapDelete}
onSelected={onMapSelect}
callBackParam={map}
/>;
}
return (
<ul className="h-fit w-full flex flex-nowrap basis-0 gap-x-[8px] py-1 px-3" style={style}>
{maps && maps.map(renderMapItem)}
</ul>
)
}, equal);
@@ -0,0 +1,11 @@
type Props = {
className?: string
}
export function MapsToolbar({className}: Props) {
return (
<div className={className}>
</div>
)
}
@@ -0,0 +1,51 @@
import { useEffect, useState } from "react";
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmCheckbox } from "renderer/components/shared/bsm-checkbox.component";
import { BsmImage } from "renderer/components/shared/bsm-image.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { ConfigurationService } from "renderer/services/configuration.service";
import { MapsManagerService } from "renderer/services/maps-manager.service";
import { ModalComponent, ModalExitCode } from "renderer/services/modale.service";
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface";
import BeatConflict from '../../../../../assets/images/apngs/beat-conflict.png'
export const DeleteMapsModal: ModalComponent<void, {linked: boolean, maps: BsmLocalMap[]}> = ({resolver, data:{linked, maps}}) => {
const config = ConfigurationService.getInstance();
const t = useTranslation();
const [remember, setRemember] = useState(false);
useEffect(() => {
const key = MapsManagerService.REMEMBER_CHOICE_DELETE_MAP_KEY;
config.set(key, remember);
}, [remember])
const multiple = maps.length > 1;
const titleText = multiple ? "modals.maps-actions.delete-maps.title.multiple" : "modals.maps-actions.delete-maps.title.single";
const descText = multiple ? "modals.maps-actions.delete-maps.desc.multiple" : "modals.maps-actions.delete-maps.desc.single";
const infoText = multiple ? "modals.maps-actions.delete-maps.info.desc.multiple" : "modals.maps-actions.delete-maps.info.desc.single";
const infoTitleText = multiple ? "modals.maps-actions.delete-maps.info.title.multiple" : "modals.maps-actions.delete-maps.info.title.single";
return (
<form className="text-gray-800 dark:text-gray-200">
<h1 className="text-3xl uppercase tracking-wide w-full text-center">{t(titleText)}</h1>
<BsmImage className="mx-auto h-24" image={BeatConflict} />
<p className="max-w-sm w-full">{t(descText, multiple ? {nb: maps.length.toString()} : {name: maps.at(0).rawInfo._songName})}</p>
{linked && <p className="text-sm italic mt-2 cursor-help w-fit" title={t(infoTitleText)}>{t(infoText)}</p>}
{!multiple && (
<div className="flex items-center relative py-2 gap-1 mt-1">
<BsmCheckbox className="h-5 relative z-[1]" checked={remember} onChange={(val) => setRemember(val)}/>
<span className="italic">{t("modals.misc.remember-my-choice")}</span>
</div>
)}
<div className="grid grid-flow-col grid-cols-2 gap-4 mt-2">
<BsmButton typeColor="cancel" className="rounded-md text-center transition-all" onClick={() => resolver({exitCode: ModalExitCode.CANCELED})} withBar={false} text="misc.cancel"/>
<BsmButton typeColor="primary" className="rounded-md text-center transition-all" onClick={() => resolver({exitCode: ModalExitCode.COMPLETED})} withBar={false} text="misc.delete"/>
</div>
</form>
)
}
@@ -0,0 +1,187 @@
import { motion } from "framer-motion";
import { useCallback, useEffect, useRef, useState } from "react";
import { FilterPanel } from "renderer/components/maps-mangement-components/filter-panel.component";
import { MapItem, ParsedMapDiff } from "renderer/components/maps-mangement-components/map-item.component";
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmDropdownButton } from "renderer/components/shared/bsm-dropdown-button.component";
import { BsmSelect, BsmSelectOption } from "renderer/components/shared/bsm-select.component";
import { useObservable } from "renderer/hooks/use-observable.hook";
import { BSV_SORT_ORDER } from "renderer/partials/beat-saver/sort-order";
import { BeatSaverService } from "renderer/services/thrird-partys/beat-saver.service";
import { MapsDownloaderService } from "renderer/services/maps-downloader.service";
import { MapsManagerService } from "renderer/services/maps-manager.service";
import { ModalComponent } from "renderer/services/modale.service";
import { BSVersion } from "shared/bs-version.interface";
import { BsvMapCharacteristic, BsvMapDetail, MapFilter, SearchOrder, SearchParams } from "shared/models/maps/beat-saver.model";
import BeatWaitingImg from "../../../../../assets/images/apngs/beat-waiting.png";
import BeatConflictImg from "../../../../../assets/images/apngs/beat-conflict.png";
import equal from "fast-deep-equal/es6";
import { ProgressBarService } from "renderer/services/progress-bar.service";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { OsDiagnosticService } from "renderer/services/os-diagnostic.service";
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface";
export const DownloadMapsModal: ModalComponent<void, {version: BSVersion, ownedMaps: BsmLocalMap[]}> = ({resolver, data: { ownedMaps, version }}) => {
const beatSaver = BeatSaverService.getInstance();
const mapsDownloader = MapsDownloaderService.getInstance();
const progressBar = ProgressBarService.getInstance();
const os = OsDiagnosticService.getInstance();
const currentDownload = useObservable(mapsDownloader.currentMapDownload$);
const mapsInQueue = useObservable(mapsDownloader.mapsInQueue$);
const t = useTranslation();
const filterContainerRef = useRef(null);
const [filter, setFilter] = useState<MapFilter>({});
const [query, setQuery] = useState("");
const [maps, setMaps] = useState<BsvMapDetail[]>([]);
const [sortOrder, setSortOrder] = useState<SearchOrder>(BSV_SORT_ORDER.at(0));
const [ownedMapHashs, setOwnedMapHashs] = useState<string[]>(ownedMaps?.map(map => map.hash) ?? []);
const [loading, setLoading] = useState(false);
const isOnline = useObservable(os.isOnline$);
const [searchParams, setSearchParams] = useState<SearchParams>({
sortOrder,
filter,
page: 0,
q: query
});
const loaderRef = useRef(null);
const sortOptions: BsmSelectOption[] = (() => {
return BSV_SORT_ORDER.map(sort => ({text: `beat-saver.maps-sorts.${sort}`, value: sort}));
})();
useEffect(() => {
loadMaps(searchParams);
}, [searchParams]);
useEffect(() => {
const onMapDownloaded = (map: BsmLocalMap, targerVersion: BSVersion) => {
if(!equal(targerVersion, version)){ return; }
const downloadedHash = map.hash;
setOwnedMapHashs((prev) => [...prev, downloadedHash]);
}
mapsDownloader.addOnMapDownloadedListener(onMapDownloaded);
if(mapsDownloader.isDownloading){
progressBar.setStyle(mapsDownloader.progressBarStyle);
}
return () => {
mapsDownloader.removeOnMapDownloadedListener(onMapDownloaded);
progressBar.setStyle(null);
}
}, [])
const loadMaps = (params: SearchParams) => {
setLoading(() => true);
beatSaver.searchMaps(params).then((maps => setMaps(prev => [...prev, ...maps]))).finally(() => setLoading(() => false));
}
const extractMapDiffs = (map: BsvMapDetail): Map<BsvMapCharacteristic, ParsedMapDiff[]> => {
const res = new Map<BsvMapCharacteristic, ParsedMapDiff[]>();
if(map.versions.at(0).diffs){
map.versions.at(0).diffs.forEach(diff => {
const arr = res.get(diff.characteristic) || [];
arr.push({name: diff.difficulty, type: diff.difficulty, stars: diff.stars});
res.set(diff.characteristic, arr);
});
}
return res;
}
const renderMap = (map: BsvMapDetail) => {
const isMapOwned = map.versions.some(version => ownedMapHashs.includes(version.hash));
const isDownloading = map.id === currentDownload?.map?.id;
const inQueue = mapsInQueue.some(toDownload => equal(toDownload.version, version) && toDownload.map.id === map.id);
return (
<MapItem
autor={map.metadata.levelAuthorName}
autorId={map.uploader.id}
bpm={map.metadata.bpm}
coverUrl={map.versions.at(0).coverURL}
createdAt={map.createdAt}
duration={map.metadata.duration}
hash={map.versions.at(0).hash}
likes={map.stats.upvotes}
mapId={map.id}
ranked={map.ranked}
title={map.name}
songAutor={map.metadata.songAuthorName}
diffs={extractMapDiffs(map)}
songUrl={map.versions.at(0).previewURL}
key={map.id}
onDownload={(!isMapOwned && !inQueue) && (handleDownloadMap)}
onDoubleClick={(!isMapOwned && !inQueue) && (handleDownloadMap)}
onCancelDownload={(inQueue && !isDownloading) && (handleCancelDownload)}
downloading={isDownloading}
showOwned={isMapOwned}
callBackParam={map}
/>
)
}
const handleDownloadMap = useCallback((map: BsvMapDetail) => {
mapsDownloader.addMapToDownload({map, version})
}, []);
const handleCancelDownload = useCallback((map: BsvMapDetail) => {
mapsDownloader.removeMapToDownload({map, version});
}, []);
const handleSortChange = (newSort: string) => {
setSortOrder(() => newSort as SearchOrder);
setMaps(() => []);
setSearchParams(() => ({...searchParams, sortOrder: (newSort as SearchOrder)}));
}
const handleSearch = () => {
const searchParams: SearchParams = {
sortOrder,
filter,
q: query.trim(),
page: 0,
};
setMaps(() => []);
setSearchParams(() => searchParams);
}
const handleLoadMore = () => {
setSearchParams((prev) => {
return {...prev, page: prev.page + 1}
});
}
return (
<form className="text-gray-800 dark:text-gray-200 flex flex-col max-w-[95vw] w-[970px] h-[85vh] gap-3" onSubmit={e => {e.preventDefault(); handleSearch()}}>
<div className="flex h-9 gap-2 shrink-0">
<BsmDropdownButton ref={filterContainerRef} className="shrink-0 h-full relative z-[1] flex justify-start" buttonClassName="flex items-center justify-center h-full rounded-full px-2 py-1 !bg-light-main-color-1 dark:!bg-main-color-1" icon="filter" text="pages.version-viewer.maps.search-bar.filters-btn" withBar={false}>
<FilterPanel className="absolute top-[calc(100%+3px)] origin-top w-[450px] h-fit p-2 rounded-md shadow-md shadow-black" filter={filter} onChange={setFilter} onApply={handleSearch} onClose={() => filterContainerRef.current.close()}/>
</BsmDropdownButton>
<input className="h-full bg-light-main-color-1 dark:bg-main-color-1 rounded-full px-2 grow pb-0.5" type="text" name="" id="" placeholder={t("pages.version-viewer.maps.search-bar.search-placeholder")} value={query} onChange={e => setQuery(e.target.value)}/>
<BsmButton className="shrink-0 rounded-full py-1 px-3 !bg-light-main-color-1 dark:!bg-main-color-1 flex justify-center items-center capitalize" icon="search" text="modals.download-maps.search-btn" withBar={false} onClick={e => {e.preventDefault(); handleSearch()}}/>
<BsmSelect className="bg-light-main-color-1 dark:bg-main-color-1 rounded-full px-1 pb-0.5 text-center" options={sortOptions} onChange={handleSortChange}/>
</div>
<ul className="w-full grow flex content-start flex-wrap gap-2 pt-1.5 px-2 overflow-y-scroll overflow-x-hidden scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900 z-0" >
{maps.length === 0 ? (
<div className="w-full h-full flex flex-col items-center justify-center">
<img className={`w-32 h-32 ${loading && "spin-loading"}`} src={loading ? BeatWaitingImg : BeatConflictImg} alt=" "/>
<span className="text-lg">{t(loading ? "modals.download-maps.loading-maps" : isOnline ? "modals.download-maps.no-maps-found" : "modals.download-maps.no-internet")}</span>
</div>
) : (
<>
{maps.map(renderMap)}
<motion.span onViewportEnter={handleLoadMore} ref={loaderRef} className="block w-full h-8"/>
</>
)}
</ul>
</form>
)
}
@@ -5,18 +5,17 @@ import { BsmIcon } from "renderer/components/svgs/bsm-icon.component";
import { DefaultConfigKey } from "renderer/config/default-configuration.config";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { ConfigurationService } from "renderer/services/configuration.service";
import { ModalExitCode, ModalResponse, ModalService } from "renderer/services/modale.service";
import { ModalComponent, ModalExitCode } from "renderer/services/modale.service";
import { BSVersion } from "shared/bs-version.interface";
export function EditVersionModal({resolver, clone = false}: {resolver: (x: ModalResponse<{name: string, color: string}>) => void, clone?: boolean}) {
export const EditVersionModal: ModalComponent<{name: string, color: string}, {version: BSVersion, clone?: boolean}> = ({resolver, data}) => {
const {version, clone} = data;
const configService = ConfigurationService.getInstance();
const modalService = ModalService.getInsance();
const modalData: BSVersion = modalService.getModalData();
const [name, setName] = useState(modalData.name || modalData.BSVersion);
const [color, setColor] = useState(modalData.color ?? configService.get<string>("second-color" as DefaultConfigKey));
const [name, setName] = useState(version.name || version.BSVersion);
const [color, setColor] = useState(version.color ?? configService.get<string>("second-color" as DefaultConfigKey));
const t = useTranslation();
const rename = () => {
@@ -36,11 +35,11 @@ export function EditVersionModal({resolver, clone = false}: {resolver: (x: Modal
<p className="max-w-sm mb-2 text-gray-800 dark:text-gray-200">{t("modals.clone-version.description")}</p>
)}
<div className="mb-3">
<label className="block font-bold cursor-pointer tracking-wide text-gray-800 dark:text-gray-200" htmlFor="name">{t("Nom")}</label>
<input className="w-full bg-light-main-color-1 dark:bg-main-color-1 px-1 py-[2px] rounded-md outline-none" onChange={e => setName(e.target.value)} value={name} type="text" name="name" id="name" minLength={2} maxLength={15} placeholder={t("Nom de la version")}/>
<label className="block font-bold cursor-pointer tracking-wide text-gray-800 dark:text-gray-200" htmlFor="name">{t("modals.clone-version.inputs.name.label")}</label>
<input className="w-full bg-light-main-color-1 dark:bg-main-color-1 px-1 py-[2px] rounded-md outline-none" onChange={e => setName(e.target.value)} value={name} type="text" name="name" id="name" minLength={2} maxLength={15} placeholder={t("modals.clone-version.inputs.name.placeholder")}/>
</div>
<div>
<span className="block font-bold tracking-wide text-gray-800 dark:text-gray-200">Couleur</span>
<span className="block font-bold tracking-wide text-gray-800 dark:text-gray-200">{t("modals.clone-version.inputs.color.label")}</span>
<div className="relative w-full h-7 mb-4 bg-light-main-color-1 dark:bg-main-color-1 flex justify-center rounded-md py-1 z-[1]">
<SettingColorChooser color={color} onChange={setColor} pickerClassName="!h-32 !w-32"/>
<div className="absolute right-2 top-0 h-full flex items-center">
@@ -1,11 +1,11 @@
import { ModalExitCode, ModalResponse } from "../../../services/modale.service";
import { ModalComponent, ModalExitCode } from "../../../services/modale.service";
import { useState } from "react";
import BeatConflict from "../../../../../assets/images/apngs/beat-conflict.png"
import { BsmImage } from "renderer/components/shared/bsm-image.component";
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
export function GuardModal({resolver}: {resolver: (x: ModalResponse<string>) => void}) {
export const GuardModal: ModalComponent<string> = ({resolver}) => {
const [guardCode, setGuardCode] = useState('');
const t = useTranslation();
@@ -0,0 +1,22 @@
import { BsmButton } from 'renderer/components/shared/bsm-button.component'
import { BsmImage } from 'renderer/components/shared/bsm-image.component'
import { useTranslation } from 'renderer/hooks/use-translation.hook'
import { ModalComponent, ModalExitCode } from 'renderer/services/modale.service'
import BeatImpatient from "../../../../../assets/images/apngs/beat-impatient.png"
export const ImportVersionModal: ModalComponent<void> = ({resolver}) => {
const t = useTranslation();
return (
<form>
<h1 className="text-3xl uppercase tracking-wide w-full text-center text-gray-800 dark:text-gray-200">{t("modals.bs-import-version.title")}</h1>
<BsmImage className="mx-auto h-20" image={BeatImpatient}/>
<p className="max-w-sm text-gray-800 dark:text-gray-200">{t("modals.bs-import-version.description")}</p>
<div className="grid grid-flow-col grid-cols-2 gap-4 mt-4">
<BsmButton typeColor="cancel" className="rounded-md text-center transition-all" onClick={() => resolver({exitCode: ModalExitCode.CANCELED})} withBar={false} text="misc.cancel"/>
<BsmButton typeColor="primary" className="rounded-md text-center transition-all" onClick={() => resolver({exitCode: ModalExitCode.COMPLETED})} withBar={false} text="modals.bs-import-version.buttons.submit"/>
</div>
</form>
)
}
@@ -1,16 +1,15 @@
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmImage } from "renderer/components/shared/bsm-image.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { ModalExitCode, ModalResponse } from "renderer/services/modale.service";
import { ModalComponent, ModalExitCode } from "renderer/services/modale.service";
import BeatConflict from "../../../../../assets/images/apngs/beat-conflict.png"
export function InstallationFolderModal({resolver}: {resolver: (x: ModalResponse) => void}) {
export const InstallationFolderModal: ModalComponent<void> = ({resolver}) => {
const t = useTranslation();
return (
<>
<span className="absolute bg-gradient-to-r from-blue-500 to-red-500 top-0 w-full left-0 h-1"></span>
<form>
<h1 className="text-3xl uppercase tracking-wide w-full text-center text-gray-800 dark:text-gray-200">{t("modals.install-folder.title")}</h1>
<BsmImage className="mx-auto h-24" image={BeatConflict}/>
<p className="max-w-sm text-gray-800 dark:text-gray-200">{t("modals.install-folder.description")}</p>
@@ -18,6 +17,6 @@ export function InstallationFolderModal({resolver}: {resolver: (x: ModalResponse
<BsmButton typeColor="cancel" className="rounded-md text-center transition-all" onClick={() => resolver({exitCode: ModalExitCode.CANCELED})} withBar={false} text="misc.cancel"/>
<BsmButton typeColor="primary" className="rounded-md text-center transition-all" onClick={() => resolver({exitCode: ModalExitCode.COMPLETED})} withBar={false} text="modals.install-folder.buttons.submit"/>
</div>
</>
</form>
)
}
@@ -0,0 +1,30 @@
import { useState } from "react";
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmCheckbox } from "renderer/components/shared/bsm-checkbox.component";
import { BsmImage } from "renderer/components/shared/bsm-image.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { ModalComponent, ModalExitCode } from "renderer/services/modale.service";
import BeatRunning from '../../../../../assets/images/apngs/beat-running.png'
export const LinkMapsModal: ModalComponent<boolean> = ({resolver}) => {
const t = useTranslation();
const [keepMaps, setKeepMaps] = useState(true);
return (
<form className="text-gray-800 dark:text-gray-200">
<h1 className="text-3xl uppercase tracking-wide w-full text-center">{t("modals.maps-actions.link-maps.title")}</h1>
<BsmImage className="mx-auto h-24" image={BeatRunning} />
<p className="max-w-sm w-full">{t("modals.maps-actions.link-maps.desc")}</p>
<p className="max-w-sm w-full text-sm italic mt-2">{t("modals.maps-actions.link-maps.info")}</p>
<div className="relative h-5 flex my-3 items-center">
<BsmCheckbox className="h-full aspect-square relative bg-inherit mr-1.5 z-[1]" checked={keepMaps} onChange={setKeepMaps}/>
<span className="text-sm mb-0.5 cursor-help" title={t("modals.maps-actions.link-maps.keep-maps.title")}>{t("modals.maps-actions.link-maps.keep-maps.label")}</span>
</div>
<div className="grid grid-flow-col grid-cols-2 gap-4 mt-4">
<BsmButton typeColor="cancel" className="rounded-md text-center transition-all" onClick={() => resolver({exitCode: ModalExitCode.CANCELED})} withBar={false} text="misc.cancel"/>
<BsmButton typeColor="primary" className="rounded-md text-center transition-all" onClick={() => resolver({exitCode: ModalExitCode.COMPLETED, data: keepMaps})} withBar={false} text="modals.maps-actions.link-maps.valid-btn"/>
</div>
</form>
)
}
@@ -2,14 +2,17 @@ import { useState } from "react";
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmImage } from "renderer/components/shared/bsm-image.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { ModalExitCode, ModalResponse } from "renderer/services/modale.service";
import { ModalComponent, ModalExitCode, ModalService } from "renderer/services/modale.service";
import BeatImpatient from '../../../../../assets/images/apngs/beat-impatient.png'
import { WhyCredentialsModal } from "./why-credentials-modal.component";
export function LoginModal({resolver}: {resolver: (x: ModalResponse<any>) => void}) {
export const LoginModal: ModalComponent<{username: string, password: string, stay: boolean}> = ({resolver}) => {
const modal = ModalService.getInsance();
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const [stay, setStay] = useState(true);
const [stay, setStay] = useState(false);
const t = useTranslation();
const loggin = () => {
@@ -17,10 +20,15 @@ export function LoginModal({resolver}: {resolver: (x: ModalResponse<any>) => voi
resolver({exitCode: ModalExitCode.COMPLETED, data:{username, password, stay}});
}
const whyCredentials = () => {
modal.openModal(WhyCredentialsModal);
}
return (
<form onSubmit={(e) => {e.preventDefault(); loggin();}}>
<h1 className="text-3xl uppercase tracking-wide w-full text-center text-gray-800 dark:text-gray-200">{t("modals.steam-login.title")}</h1>
<BsmImage className="mx-auto h-20" image={BeatImpatient} />
<div className="mb-2">
<label className="block font-bold cursor-pointer tracking-wide text-gray-800 dark:text-gray-200" htmlFor="username">{t("modals.steam-login.inputs.username.label")}</label>
<input className="w-full bg-light-main-color-1 dark:bg-main-color-1 px-1 py-[2px] rounded-md outline-none" onChange={e => setUsername(e.target.value)} value={username} type="text" name="username" id="username" placeholder={t("modals.steam-login.inputs.username.placeholder")}/>
@@ -29,13 +37,12 @@ export function LoginModal({resolver}: {resolver: (x: ModalResponse<any>) => voi
<label className="block font-bold cursor-pointer tracking-wide text-gray-800 dark:text-gray-200" htmlFor="password">{t("modals.steam-login.inputs.password.label")}</label>
<input className="w-full bg-light-main-color-1 dark:bg-main-color-1 px-1 py-[2px] rounded-md outline-none" onChange={e => setPassword(e.target.value)} value={password} type="password" name="password" id="password" placeholder={t("modals.steam-login.inputs.password.placeholder")}/>
</div>
<div className="flex items-center content-center justify-start mb-3">
<input onChange={e => setStay(e.target.checked)} checked={stay} className="mr-1" type="checkbox" name="stay" id="stay" />
<label className="cursor-pointer text-gray-800 dark:text-gray-200" htmlFor="stay">{t("modals.steam-login.inputs.stay.label")}</label>
</div>
<span onClick={whyCredentials} className="underline my-4 block cursor-pointer">{t("modals.steam-login.why-credentials")}</span>
<div className="grid grid-flow-col grid-cols-2 gap-4">
<BsmButton typeColor="cancel" className="rounded-md text-center transition-all" onClick={() => {resolver({exitCode: ModalExitCode.CANCELED})}} withBar={false} text="misc.cancel"/>
<BsmButton typeColor="primary" className="rounded-md text-center transition-all" type="submit" withBar={false} text={t("modals.steam-login.buttons.submit")}/>
<BsmButton typeColor="primary" className="rounded-md text-center transition-all" type="submit" withBar={false} text="modals.steam-login.buttons.submit"/>
</div>
</form>
)
@@ -0,0 +1,28 @@
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmImage } from "renderer/components/shared/bsm-image.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { ModalComponent, ModalExitCode } from "renderer/services/modale.service";
import BeatConflict from '../../../../../assets/images/apngs/beat-conflict.png'
export const ModsDisclaimerModal: ModalComponent<void, void> = ({resolver}) => {
const t = useTranslation();
return (
<form className="max-w-[800px] text-gray-800 dark:text-gray-200">
<h1 className="text-3xl uppercase tracking-wide w-full text-center text-gray-800 dark:text-gray-200">{t("modals.mods-disclaimer.title")}</h1>
<BsmImage className="mx-auto h-20" image={BeatConflict} />
<p className="mb-1">{t("modals.mods-disclaimer.p-1")}</p>
<ul className="list-disc w-full pl-6">
<li>{t("modals.mods-disclaimer.li-1")}</li>
<li>{t("modals.mods-disclaimer.li-2")}</li>
<li>{t("modals.mods-disclaimer.li-3")}</li>
</ul>
<p className="mt-1">{t("modals.mods-disclaimer.p-2")}</p>
<div className="grid grid-flow-col grid-cols-2 gap-4 pt-3">
<BsmButton typeColor="cancel" className="rounded-md text-center transition-all" onClick={() => {resolver({exitCode: ModalExitCode.CANCELED})}} withBar={false} text="misc.refuse"/>
<BsmButton typeColor="primary" className="rounded-md text-center transition-all" onClick={() => {resolver({exitCode: ModalExitCode.COMPLETED})}} withBar={false} text="misc.accept"/>
</div>
</form>
)
}
@@ -0,0 +1,162 @@
import Tippy from "@tippyjs/react";
import { Variants } from "framer-motion";
import { version } from "os";
import { useEffect, useState } from "react";
import { LinkButton } from "renderer/components/maps-mangement-components/link-button.component";
import { BsmBasicSpinner } from "renderer/components/shared/bsm-basic-spinner/bsm-basic-spinner.component";
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmIcon } from "renderer/components/svgs/bsm-icon.component";
import { useObservable } from "renderer/hooks/use-observable.hook";
import { useThemeColor } from "renderer/hooks/use-theme-color.hook";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { BSVersionManagerService } from "renderer/services/bs-version-manager.service";
import { ConfigurationService } from "renderer/services/configuration.service";
import { IpcService } from "renderer/services/ipc.service";
import { ModalComponent } from "renderer/services/modale.service";
import { VersionFolderLinkerService, VersionLinkerActionType } from "renderer/services/version-folder-linker.service";
import { BSVersion } from "shared/bs-version.interface";
export const ShareFoldersModal: ModalComponent<void, BSVersion> = ({ data }) => {
const SHARED_FOLDERS_KEY = "default-shared-folders";
const config = ConfigurationService.getInstance();
const ipc = IpcService.getInstance();
const linker = VersionFolderLinkerService.getInstance();
const versionManager = BSVersionManagerService.getInstance();
const t = useTranslation();
const [folders, setFolders] = useState<string[]>([]);
useEffect(() => {
setFolders(prev => Array.from(new Set([...prev, ...config.get<string[]>(SHARED_FOLDERS_KEY)]).values()));
linker.getLinkedFolders(data, {relative: true}).toPromise().then(linkedFolders => {
setFolders(prev => Array.from(new Set([...prev, ...linkedFolders]).values()));
});
}, []);
useEffect(() => {
if(!folders?.length){
config.delete(SHARED_FOLDERS_KEY);
return;
}
config.set(SHARED_FOLDERS_KEY, folders);
}, [folders]);
const addFolder = async () => {
const versionPath = await versionManager.getVersionPath(data).toPromise();
const folder = await ipc.sendV2<{canceled: boolean, filePaths: string[]}, string>("choose-folder", {args: versionPath}).toPromise();
if(!folder || folder.canceled || !folder.filePaths?.length){ return; }
const relativeFolder = await ipc.sendV2<string>("full-version-path-to-relative", {args: {version: data, fullPath: folder.filePaths[0]}}).toPromise();
if(folders.includes(relativeFolder)){ return; }
setFolders(pre => [...pre, relativeFolder]);
}
const removeFolder = (index: number) => {
setFolders((prev) => prev.filter((_, i) => i !== index));
}
return (
<form className="w-full max-w-md ">
<h1 className="text-3xl uppercase tracking-wide w-full text-center text-gray-800 dark:text-gray-200">{t("modals.shared-folders.title")}</h1>
<p className="my-3">{t("modals.shared-folders.description")}</p>
<ul className="flex flex-col gap-1 mb-2 h-[300px] max-h-[300px] overflow-scroll scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900 px-1">
{folders.map((folder, index) => (
<FolderItem key={index} version={data} relativeFolder={folder} onDelete={() => {removeFolder(index)}}/>
))}
</ul>
<div className="w-full h-12 rounded-md flex justify-center items-center cursor-pointer bg-light-main-color-1 dark:bg-main-color-1 hover:bg-light-main-color-3 hover:dark:bg-main-color-3" onClick={addFolder}>
<BsmIcon className="aspect-square h-8" icon="add"/>
<span className="font-bold">{t("modals.shared-folders.buttons.add-folder")}</span>
</div>
</form>
)
}
type FolderProps = {
version: BSVersion;
relativeFolder: string;
onDelete?: () => void;
}
const FolderItem = ({version, relativeFolder, onDelete}: FolderProps) => {
const linker = VersionFolderLinkerService.getInstance();
const t = useTranslation();
const name = relativeFolder.split("\\").at(-1);
const color = useThemeColor("first-color");
const variants: Variants = {
hover: {rotate: 22.5},
tap: {rotate: 45}
};
const pending = useObservable(linker.isPending(version, relativeFolder));
const processing = useObservable(linker.isProcessing(version, relativeFolder));
const linkDisabled = pending || processing;
const [linked, setLinked] = useState(false);
useEffect(() => {
loadFolderIsLinked();
}, [version, relativeFolder]);
const loadFolderIsLinked = () => {
linker.isVersionFolderLinked(version, relativeFolder).toPromise().then(setLinked);
}
const onClickLink = () => {
if(linked){
return linker.unlinkVersionFolder({
version,
relativeFolder,
type: VersionLinkerActionType.Unlink,
}).then(loadFolderIsLinked);
}
return linker.linkVersionFolder({
version,
relativeFolder,
type: VersionLinkerActionType.Link,
}).then(loadFolderIsLinked);
}
const cancelLink = () => {
linker.cancelAction(version, relativeFolder);
loadFolderIsLinked();
}
return (
<li className="w-full h-12 rounded-md shrink-0 flex flex-row items-center justify-between px-2 font-bold bg-light-main-color-1 dark:bg-main-color-1">
<span className="cursor-help" title={relativeFolder}>{name}</span>
<div className="flex flex-row gap-1.5">
<Tippy placement="left" content={t(`modals.shared-folders.buttons.${linked ? "unlink-folder" : "link-folder"}`)} arrow={false}>
<LinkButton variants={variants} linked={linked} disabled={linkDisabled} whileHover="hover" whileTap="tap" className="p-0.5 h-7 shrink-0 aspect-square blur-0 cursor-pointer hover:brightness-75" onClick={onClickLink}/>
</Tippy>
{!processing ? (
!pending ? (
<BsmButton className="aspect-square h-7 rounded-md p-1" icon={"trash"} withBar={false} onClick={e => {e.preventDefault(); onDelete?.()}}/>
) : (
<BsmButton className="aspect-square h-7 rounded-md p-1" icon={"cross"} withBar={false} onClick={e => {e.preventDefault(); cancelLink()}}/>
)
) : (
<BsmBasicSpinner className="aspect-square h-7 rounded-md p-1 dark:bg-main-color-2" thikness="3.5px" style={{color}}/>
)}
</div>
</li>
)
}
@@ -1,4 +1,4 @@
import { ModalExitCode, ModalResponse, ModalService } from "../../../services/modale.service";
import { ModalComponent, ModalExitCode } from "../../../services/modale.service";
import BeatConflict from "../../../../../assets/images/apngs/beat-conflict.png"
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmImage } from "renderer/components/shared/bsm-image.component";
@@ -6,9 +6,9 @@ import { useTranslation } from "renderer/hooks/use-translation.hook";
import { BSVersion } from "shared/bs-version.interface";
export function UninstallAllModsModal({resolver}: {resolver: (x: ModalResponse) => void}) {
export const UninstallAllModsModal: ModalComponent<void, BSVersion> = ({resolver, data}) => {
const version = ModalService.getInsance().getModalData<BSVersion>();
const version = data;
const t = useTranslation();
const desc = "modals.uninstall-all-mods.description";
@@ -1,4 +1,4 @@
import { ModalExitCode, ModalResponse, ModalService } from "../../../services/modale.service";
import { ModalComponent, ModalExitCode } from "../../../services/modale.service";
import BeatConflict from "../../../../../assets/images/apngs/beat-conflict.png"
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmImage } from "renderer/components/shared/bsm-image.component";
@@ -6,9 +6,9 @@ import { useTranslation } from "renderer/hooks/use-translation.hook";
import { Mod } from "shared/models/mods/mod.interface";
export function UninstallModModal({resolver}: {resolver: (x: ModalResponse) => void}) {
export const UninstallModModal: ModalComponent<void, Mod> = ({resolver, data}) => {
const mod = ModalService.getInsance().getModalData<Mod>();
const mod = data;
const t = useTranslation();
const desc = mod.name.toLowerCase() === "bsipa" ? "modals.uninstall-mod.description-bsipa" : "modals.uninstall-mod.description";
@@ -1,13 +1,13 @@
import { ModalExitCode, ModalResponse, ModalService } from "../../../services/modale.service";
import { ModalComponent, ModalExitCode } from "../../../services/modale.service";
import BeatConflict from "../../../../../assets/images/apngs/beat-conflict.png"
import { BSVersion } from 'shared/bs-version.interface';
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmImage } from "renderer/components/shared/bsm-image.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
export function UninstallModal({resolver}: {resolver: (x: ModalResponse) => void}) {
export const UninstallModal: ModalComponent<void, BSVersion> = ({resolver, data}) => {
const version = ModalService.getInsance().getModalData<BSVersion>();
const version = data;
const t = useTranslation();
return (
@@ -0,0 +1,29 @@
import { useState } from "react";
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmCheckbox } from "renderer/components/shared/bsm-checkbox.component";
import { BsmImage } from "renderer/components/shared/bsm-image.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { ModalComponent, ModalExitCode } from "renderer/services/modale.service";
import BeatConflict from '../../../../../assets/images/apngs/beat-conflict.png'
export const UnlinkMapsModal: ModalComponent<boolean> = ({resolver}) => {
const t = useTranslation();
const [keepMaps, setKeepMaps] = useState(true);
return (
<form className="text-gray-800 dark:text-gray-200">
<h1 className="text-3xl uppercase tracking-wide w-full text-center">{t("modals.maps-actions.unlink-maps.title")}</h1>
<BsmImage className="mx-auto h-24" image={BeatConflict} />
<p className="max-w-sm w-full">{t("modals.maps-actions.unlink-maps.desc")}</p>
<div className="relative h-5 flex my-3 items-center">
<BsmCheckbox className="h-full aspect-square relative bg-inherit mr-1.5 z-[1]" checked={keepMaps} onChange={setKeepMaps}/>
<span className="text-sm mb-0.5 cursor-help" title={t("modals.maps-actions.unlink-maps.keep-maps.title")}>{t("modals.maps-actions.unlink-maps.keep-maps.label")}</span>
</div>
<div className="grid grid-flow-col grid-cols-2 gap-4 mt-4">
<BsmButton typeColor="cancel" className="rounded-md text-center transition-all" onClick={() => resolver({exitCode: ModalExitCode.CANCELED})} withBar={false} text="misc.cancel"/>
<BsmButton typeColor="error" className="rounded-md text-center transition-all" onClick={() => resolver({exitCode: ModalExitCode.COMPLETED, data: keepMaps})} withBar={false} text="modals.maps-actions.unlink-maps.valid-btn"/>
</div>
</form>
)
}

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