Compare commits

...

109 Commits

Author SHA1 Message Date
MathieuG-P b7ac9901c4 remove console log 2023-04-10 23:29:35 +02:00
MathieuG-P 962f1d8aae Merge pull request #210 from Zagrios/bugfix/move-install-directory-failed/203
[bugfix-203] move install folder more resilant + handle symlinks
2023-04-10 23:23:51 +02:00
MathieuG-P 66b834bd31 [bugfix-203] move install folder more resilant + handle symlinks 2023-04-10 23:23:02 +02:00
MathieuG-P 0214a518ee Merge pull request #209 from Zagrios/hotfix/remove-spaces-guard-code/205
[bugfix-205] remove spaces in guard code
2023-04-09 16:54:59 +02:00
MathieuG-P 40137b15fa [bugfix-205] remove spaces in guard code 2023-04-09 16:51:34 +02:00
MathieuG-P d30e203d29 Merge pull request #208 from Zagrios/hotfix/change-color-diamond-supporter
Hotfix/change color diamond supporter
2023-04-09 16:31:09 +02:00
MathieuG-P 7810b31d13 [hotfix] change color of diamond supporter to match discord role color + add clickable visual indicator 2023-04-09 16:30:03 +02:00
MathieuG-P 9720335adf [hotfix] change color of diamond supporter 2023-04-09 03:12:10 +02:00
MathieuG-P 1af3ef7565 Merge pull request #207 from Zagrios/hotfix/unable-to-open-supporter-link
[hotfix] unable to open supporter link
2023-04-09 03:05:53 +02:00
MathieuG-P 7da09c117f [hotfix] unable to open supporter link 2023-04-09 03:04:58 +02:00
MathieuG-P 9ff47b6895 add supporter 2023-04-09 02:43:47 +02:00
MathieuG-P ed4137949d npm run audit 2023-04-08 01:32:36 +02:00
MathieuG-P f833f28930 update libs 2023-04-08 01:28:12 +02:00
MathieuG-P 97fa44cd5d fix npm package + use our own "useDelayedState" 2023-04-08 00:11:11 +02:00
MathieuG-P 6562f6c764 Merge pull request #204 from Zagrios/feature/add-link-all-folders-button
Feature/add link all folders button
2023-04-07 22:44:08 +02:00
MathieuG-P 1177091cf0 add link all folders button 2023-04-07 22:42:22 +02:00
MathieuG-P a785828a6b fix fill issue with link icon 2023-04-07 22:40:13 +02:00
MathieuG-P 39b4a48fef add secondary color type 2023-04-07 22:39:52 +02:00
MathieuG-P a62038450f use "allSettled" helper everywhere its needed 2023-04-06 00:53:05 +02:00
MathieuG-P 070eb5b796 Merge pull request #202 from Zagrios/hotfix/better-http-requests-errors-handling
[hotfix] better http error handling
2023-04-06 00:29:59 +02:00
MathieuG-P bc1e809545 [hotfix] better http error handling 2023-04-06 00:29:32 +02:00
Iluhadesu dee49c964a Add v1.29.1 to bs_versions.json 2023-04-04 21:55:11 +00:00
MathieuG-P 4aa1521e88 Update FUNDING.yml 2023-04-04 21:16:49 +02:00
MathieuG-P 4a53917f27 Merge pull request #199 from Zagrios/feature/german-translation
Feature add german translation
2023-04-02 00:01:16 +02:00
MathieuG-P 75c849d203 translate languages 2023-04-01 23:59:22 +02:00
Iluhadesu 3e3cffc6bc Merge pull request #198 from XCraftTM/feature/german-translation
Added German Translation
2023-04-01 23:32:53 +02:00
XCraftTM 2d211e3c05 Update de.json 2023-04-01 19:04:28 +02:00
MathieuG-P e5142fe131 [feature] add german translation 2023-04-01 18:10:52 +02:00
MathieuG-P 89312f0bf9 Merge pull request #197 from Zagrios/feature/message-when-no-mods-are-available/194
[feature-194] add message when no mods are available
2023-04-01 16:01:58 +02:00
MathieuG-P f2e6fa486a [feature-194] add message when no mods are available 2023-04-01 15:59:15 +02:00
MathieuG-P 4f0f80bbc2 Merge pull request #193 from Zagrios/bugfix/beatleader-not-in-oneclick/192
bugfix : add beatleader icon in oneclick #192
2023-03-31 15:22:47 +02:00
MathieuG-P 31e5c0ed10 add beatleader icon in oneclick 2023-03-31 15:21:51 +02:00
Iluhadesu 9a2afe6820 Maxwell test 2023-03-31 14:48:36 +02:00
MathieuG-P c93f9a7041 add 1.29.0 2023-03-30 17:55:59 +02:00
MathieuG-P 5401248286 add supporter 2023-03-24 20:38:15 +01:00
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
88 changed files with 3659 additions and 1841 deletions
+1 -1
View File
@@ -1 +1 @@
patreon: bsmanager
+1 -1
View File
@@ -43,7 +43,7 @@
<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://mee6.xyz/fr/m/bsmanager"><img src ="https://img.shields.io/badge/-🥰%20Support%20BSM-EC4546?style=for-the-badge" alt="Donation"/></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>]
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

+24 -8
View File
@@ -510,12 +510,28 @@
"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"
}
{
"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"
},
{
"BSVersion": "1.29.0",
"BSManifest": "3341527958186345367",
"ReleaseURL": "https://steamcommunity.com/games/620980/announcements/detail/6169409105082976092",
"ReleaseImg": "https://cdn.cloudflare.steamstatic.com/steamcommunity/public/images/clans//32055887/255fd49cd96042b97089f754609be291293e783f.png",
"ReleaseDate": "1680188760",
"year": "2023"
},
{
"BSVersion": "1.29.1",
"BSManifest": "886973241045584398",
"ReleaseURL": "https://steamcommunity.com/games/620980/announcements/detail/6169409105101272202",
"ReleaseImg": "https://cdn.akamai.steamstatic.com/steamcommunity/public/images/clans/32055887/c328e407367e9914abaf92f609501877ee5abb63.png",
"ReleaseDate": "1680623885",
"year": "2023"
}
]
+3 -1
View File
@@ -1,3 +1,5 @@
[
{"username": "Shidorien"}
{"username": "Shidorien"},
{"username": "Doloro", "type": "gold"},
{"username": "iPixelGalaxy", "type": "diamond", "link": "https://twitch.tv/ipixelgalaxy"}
]
+741
View File
@@ -0,0 +1,741 @@
{
"misc": {
"download": "Laden",
"verify": "Prüfen",
"launch": "Starten",
"mods": "Mods",
"maps": "Maps",
"playlists": "Playlisten",
"models": "Modelle",
"cancel": "Abbruch",
"delete": "Löschen",
"accept": "Akzeptieren",
"refuse": "Ablehnen",
"apply": "Übernehmen"
},
"nav-bar":{
"add-version": "Version Hinzufügen",
"settings": "Einstellungen"
},
"pages": {
"shared-maps":{
"title": "Geteilte Maps"
},
"version-viewer": {
"launch-mods": {
"oculus": "Oculus Modus",
"oculus-description": "Wenn du Beat Saber über Steam benutzt, es ermöglicht dir Oculus's VR-Composer zu nutzen ohne SteamVR, um bessere Leistung zu erhalten. Dies wird nicht benötigt für Oculus Headsets",
"desktop": "Desktop Modus",
"desktop-description": "Auf diese Weise kannst du WASD und die Maus verwenden, um im Spiel durch das Menü zu navigieren. Dies erleichtert das Testen erheblich, da Du dein Headset nicht aufsetzen musst!",
"debug": "Debug Modus",
"debug-description": "Aktiviert das Ausgabeprotokollfenster für IPA. Dies zeigt die Debug-Konsole, die Mods verwenden.",
"advanced-launch": {
"button": "Erweiterter Start",
"placeholder": "Weitere Argumente Bspw: --revert; --nowait"
}
},
"maps": {
"title": "Geteilte Maps",
"search-bar": {
"search-placeholder": "Suche eine Map",
"filters-btn": "Filter",
"dropdown": {
"export-maps": "Maps Exportieren",
"delete-maps": "Maps Löschen"
}
},
"tabs": {
"maps": {
"actions": {
"add-maps": {
"text": "Hinzufügen"
},
"link-maps": {
"tooltips": {
"link": "Maps Verknüpfen",
"unlink": "Maps Verknüpfung aufheben"
}
}
},
"empty-maps":{
"text":"Keine Maps",
"button":"Maps Herunterladen"
}
}
}
},
"mods": {
"loading-mods": "Lade Mods...",
"no-internet": "Kein Internet",
"mods-not-available": "Für diese Version von Beat Saber sind noch keine Mods verfügbar",
"buttons": {
"more-infos": "Mehr Infos",
"install-or-update": "Installieren oder aktualisieren"
},
"mods-grid": {
"header-bar": {
"name": "Name",
"installed": "Installiert",
"latest": "Neueste",
"description": "Beschreibung",
"dropdown": {
"uninstall-all": "Alle deinstallieren"
}
}
}
},
"dropdown": {
"open-folder": "Ordner Öffnen",
"verify-files": "Daten Prüfen",
"clone": "Klonen",
"edit": "Bearbeiten",
"uninstall": "Entfernen",
"shared-folders": "Geteilte Ordner"
}
},
"available-versions": {
"title": "Wähle eine Version",
"steam-release": "Versions Seite",
"dropdown": {
"refresh": "Liste aktualisieren",
"import-version" :"Importiere eine Version"
}
},
"settings": {
"steam": {
"title": "Steam",
"description": "Wenn Du dich von Steam abmeldest, musst Du dich erneut anmelden, um eine neue Version von Beat Saber herunterzuladen.",
"logout": "Abmelden"
},
"appearance": {
"title": "Aussehen",
"description": "Wähle Zwei von den Hauptfarben von BSManager",
"reset": "Zurücksetzen",
"sub-title": "Design",
"themes": {
"dark": "Dunkel",
"light": "Hell",
"os": "Mit Computer Synchronisieren"
}
},
"installation-folder": {
"title": "Installations Ordner",
"description": "Ändern Sie den Standardordner für Beat Saber-Versionen und andere kommende Funktionen.",
"choose-folder": "Ordner Wählen"
},
"additional-content": {
"title": "Zusätzlicher Inhalt",
"description": "Mit zusätzlichen Inhalten kannst du BeatSaber anpassen!",
"deep-links": {
"sub-title": "OneClick-Installationen"
}
},
"language": {
"title": "Sprache",
"description": "Wähle eine Sprache.",
"languages": {
"en-EN": "English, UK",
"en-US": "English, US",
"fr-FR": "Français",
"es-ES": "Español",
"de-DE": "Deutsch",
"translated": {
"en-EN": "Englisch, Vereinigtes Königreich",
"en-US": "Englisch, USA",
"fr-FR": "Französisch",
"es-ES": "Spanisch",
"de-DE": "Deutsch"
}
}
},
"patreon": {
"title": "BSManager Unterstützen 💖",
"description": "Unterstütze das Projekt und helfe uns, BSManager kontinuierlich zu verbessern.",
"buttons": {
"support": "BSManager Unterstützen 🥰",
"supporters": "Unterstützer 👀"
},
"view": {
"no-supporters": "Noch keine Unterstützer",
"sponsors": "Sponsoren",
"supporters": "Unterstützer"
}
},
"discord": {
"description": "Trete der BSManager-Community bei, indem Du uns in unseren sozialen Medien folgst!"
},
"contribution": {
"description": "Schlage neue Funktionen vor, oder melde einen Fehler und BSManager zu verbessern!",
"buttons": {
"request-features": "Funktion Vorschlagen",
"report-bug": "Fehler melden",
"open-logs": "Protokolle öffnen"
}
}
}
},
"notifications": {
"types": {
"error": "🚨 Fehler",
"warning": "⚠️ Warnung",
"success": "🎉 Erfolg"
},
"common": {
"msg": {
"error-occurred": "Ein Fehler ist aufgetreten"
}
},
"shared": {
"errors": {
"titles": {
"operation-running": "Vorgang läuft",
"no-internet": "Kein Internet"
},
"msg": {
"operation-running": "Warte auf das Ende des Aktuellen Vorgangs und versuche es erneut",
"no-internet": "Überprüfe deine Verbindung und versuche es erneut."
}
}
},
"bs-download": {
"success": {
"titles": {
"download-success": "Erfolgreich Heruntergeladen",
"verification-finished": "Verifikation Erfolgreich"
}
},
"warnings": {
"msg": {
"ManifestChecksum": "Die zuvor heruntergeladene Manifest stimmt nicht mit dem neuen überein 🤔",
"ConnectionTimeout": "Deine Internetverbindung scheint instabil zu sein 🥶",
"ConnectionLost": "Die Verbindung wurde unterbrochen, versuche es erneut...",
"ConnectionError": "Kann keine Verbindung zu Steam herstellen, versuche es erneut...",
"Unknown": "Etwas Seltsames ist passiert 🤔 Deine Verbindung ist wahrscheinlich instabil."
}
},
"errors": {
"titles":{
"dotnet-required": ".NET 6 Benötigt"
},
"msg": {
"401": "Steam scheint uns BeatSaber nicht herunterladen zu lassen 😢",
"404": "Steam-Server können nicht kontaktiert werden.",
"Password": "Passwort ist ungültig.",
"InvalidCredentials": "Deine E-Mail oder Passwort ist ungültig 😴",
"InvalidPassword": "Dein Passwort ist ungültig 😕",
"NoManifest": "Es wurde keine Manifest gefunden",
"DirectoryCreate": "Die erforderlichen Ordner können nicht installiert werden.",
"NotAvailableApp": "Versuchst du, Beat Saber herunterzuladen, wenn Du es nicht hast? 🤣",
"DepotNotFound": "BeatSaber kann nicht heruntergeladen werden 😥 versuche es später noch einmal 😕",
"NotCompleted": "Der Download konnte nicht beendet werden ¯\\_(ツ)_/¯",
"InvalidManifest": "BeatSaber kann nicht heruntergeladen werden 😥 versuche es später noch einmal 😕",
"NoValidKey": "BeatSaber kann nicht heruntergeladen werden 😥 versuche es später noch einmal 😕",
"NoManifestCode": "BeatSaber kann nicht heruntergeladen werden 😥 versuche es später noch einmal 😕",
"Unknown": "Ein Unbekannter Fehler ist aufgetreten ¯\\_(ツ)_/¯",
"NoServer": "Steam-Server können nicht kontaktiert werden.",
"NotAllowed": "Anscheinend darfst Du BeatSaber nicht herunterladen 🥱",
"ConnectionTimeout": "Kann keine Verbindung zu Steam herstellen 😕",
"SteamLib": "Wenn dieser Fehler auftritt, melde den Fehler auf Github mit Protokollen, bitte.",
"ConnectionError": "Kann nach 10 Versuchen keine Verbindung zu Steam herstellen 🤯",
"LicenceError": "Die Liste der Lizenzen kann nicht abgerufen werden.",
"verification-failed": "Verifikation fehlgeschlagen, versuche es später erneut.",
"RateLimitExceeded": "Du hast es zu oft versucht, warte eine Weile und versuche es später erneut.",
"AlreadyDownloading": "Ein Download ist bereits im Gange",
"no-internet": "Keine Internet Verbindung",
"dotnet-required": ".NET 6 Runtime muss installiert sein, um eine Version von BeatSaber herunterzuladen. Lade es herunter, indem Du auf die Schaltfläche unten klickst."
},
"actions":{
"download-dotnet": ".NET 6 Herunterladen"
}
}
},
"bs-import-version":{
"success":{
"start-import": {
"title": "Import im Gange 👌",
"desc": "Der Import kann je nach Konfiguration einige Minuten dauern."
},
"imported": {
"title": "Versionen Importiert 🎉"
}
},
"errors":{
"import-error":{
"desc": "Überprüfe, ob der ausgewählte Ordner eine BeatSaber-Installation ist."
}
}
},
"settings": {
"move-folder": {
"success": {
"titles": {
"transfer-started": "Übertragung läuft",
"transfer-finished": "Transfer abgeschlossen"
},
"descs": {
"transfer-started": "Die Übertragung hat begonnen und kann je nach Konfiguration mehrere Minuten dauern."
}
},
"errors": {
"titles": {
"transfer-failed": "Transfer fehlgeschlagen 😕"
},
"descs": {
"COPY_TO_SUBPATH": "Der Zielordner darf kein Unterordner des Quellordners sein.",
"restore-linked-folders": "Beim Wiederherstellen von freigegebenen Ordnern ist ein Fehler aufgetreten. Sie können sie dennoch manuell über das Menü 'Freigegebene Ordner' auf der Versionsseite wiederherstellen."
}
}
},
"steam": {
"success": {
"titles": {
"logout": "Von Steam getrennt."
}
}
},
"additional-content":{
"deep-link": {
"select-all": "Alle Auswählen",
"activation":{
"success":{
"title":"OneClick aktiviert!",
"description":"OneClick-Installationen wurden aktiviert."
},
"error":{
"description":"OneClick-Installationen konnten nicht aktiviert werden."
}
},
"deactivation":{
"success":{
"title":"OneClick deaktiviert!",
"description":"OneClick-Installationen wurden deaktiviert."
},
"error":{
"description":"Ein Unbekannter Fehler ist aufgetreten."
}
},
"check-all-enabled":{
"title": "OneClick deaktiviert",
"description": "Eine oder mehrere OneClick-Installationen sind deaktiviert. Gehe in die Einstellungen, um sie zu aktivieren.",
"actions":{
"settings": "Einstellungen",
"not-remind": "Erinnere mich nicht"
}
}
}
}
},
"bs-launch": {
"success": {
"titles": {
"launching": "Starte...🚀"
}
},
"errors": {
"titles": {
"UNABLE_TO_LAUNCH": "Start nicht möglich",
"STEAM_NOT_RUNNING": "Steam läuft nicht",
"OCULUS_NOT_RUNNING": "Oculus läuft nicht",
"BS_ALREADY_RUNNING": "BeatSaber läuft bereits",
"EXE_NOT_FINDED": "Dateien Fehlen",
"EXIT": "Abrupter Stop"
},
"msg": {
"STEAM_NOT_RUNNING": "Steam muss laufen, um BeatSaber zu starten.",
"OCULUS_NOT_RUNNING": "Oculus muss ausgeführt werden, um BeatSaber zu starten.",
"BS_ALREADY_RUNNING": "Schließe BeatSaber, bevor Du es erneut startest.",
"EXE_NOT_FINDED": "Einige Dateien scheinen zu fehlen, versuche die Dateien zu überprüfen.",
"EXIT": "BeatSaber stoppte abrupt, versuche die Dateien zu überprüfen."
},
"actions":{
"STEAM_NOT_RUNNING": "Starte Steam"
}
}
},
"steam":{
"steam-launching":{
"title": "Steam startet!",
"description": "Abhängig von deiner Konfiguration kann es einige Zeit dauern, bis Steam gestartet wird."
}
},
"custom-version": {
"errors": {
"titles": {
"CantEditSteam": "Kann nicht bearbeitet werden",
"CantRename": "Umbenennen unmöglich",
"VersionAlreadExist": "Diese Version existiert bereits",
"CantClone": "Klonen unmöglich"
},
"msg": {
"CantEditSteam": "Die Steam-Version kann nicht bearbeitet werden. Du kannst es aber klonen."
}
},
"success": {
"titles": {
"CloningFinished": "Klonen abgeschlossen 🎉"
}
}
},
"mods": {
"install-mods": {
"titles": {
"success": "Mods Installiert 🎉",
"warning": "Mods Installiert 🤔"
},
"msg": {
"success": "Alle Mods wurden installiert.",
"warning": "Eine oder mehr Mods konnten nicht installiert werden.",
"errors": {
"no-mods": "Keine Mods zum installieren.",
"cannot-install-bsipa": "BSIPA installation fehlgeschlagen 😨"
}
}
},
"uninstall-mod": {
"titles": {
"success": "Mod entfernt 🎉"
},
"msg": {
"errors": {
"no-mods": "Diese Mod kann nicht installiert werden 😑"
}
}
},
"uninstall-all-mods": {
"titles": {
"success": "Mods entfernt 🎉"
},
"msg": {
"success": "Alle Mods wurden entfernt.",
"errors": {
"no-mods": "Keine Mods sind in dieser Version installiert 😑"
}
}
}
},
"maps":{
"one-click-install":{
"success":"Map installation abegschlossen",
"error":"Ein Fehler ist aufgetreten während der installation der Map"
}
},
"playlists":{
"one-click-install":{
"success":"Playlist installation abgeschlossen",
"error":"Ein Fehler ist aufgetreten während der installation der Playlist"
}
},
"models":{
"one-click-install":{
"success":"Modell installation abgeschlossen",
"error":"Ein Fehler ist aufgetreten während der installation des Modells"
}
},
"shared-folder": {
"info": {
"userdata-backup-created":{
"title": "Sicherung erstellt",
"msg": "Das Freigeben des Ordners „UserData“ kann zu Fehlern führen. Bei Problemen trenne den Ordner, um die Sicherung wiederherzustellen"
}
}
}
},
"modals": {
"misc":{
"remember-my-choice": "Merke meine Wahl"
},
"guard": {
"title": "Steam Guard",
"inputs": {
"guard-code": {
"label": "Guard-Code",
"placeholder": "Gebe deinen Guard-Code ein"
}
},
"buttons": {
"submit": "Anmelden"
}
},
"steam-login": {
"title": "Steam Login",
"inputs": {
"username": {
"label": "Nutzername",
"placeholder": "Gebe deinen Nutzernamen ein"
},
"password": {
"label": "Passwort",
"placeholder": "Gebe dein Passwort ein"
},
"stay": {
"label": "Verbunden bleiben"
}
},
"why-credentials": "Warum braucht ihr meine Anmeldeinformationen?",
"buttons": {
"submit": "Anmelden"
}
},
"steam-credentials":{
"title": "Steam Anmeldeinformationen",
"p-1": "Die Anmeldeinformationen werden nur zum Herunterladen des Spiels verwendet, da Steam überprüfen muss, ob Du das Spiel bezahlt hast, um es herunterladen zu dürfen. Sie werden nicht gespeichert und direkt an DepotDownloader weitergegeben. Wenn Du deine Anmeldeinformationen nicht eingeben möchtest, kannst Du diesem Tutorial folgen:",
"p-2": "und klicke dann auf das Zahnradsymbol in der oberen rechten Ecke und wähle \"Version importieren\", wähle den Ordner aus, in den Beat Saber heruntergeladen wurde (Wenn Du dem obigen Tutorial folgst, solltest Du den richtigen Speicherort haben)"
},
"bs-import-version":{
"title": "Importiere eine Version",
"description": "Importiert eine Version von BeatSaber zur Verwendung mit BSManager. Der Import kopiert den ausgewählten BeatSaber-Installationsordner in den BSManager-Versionsordner.",
"buttons":{
"submit": "Importiere eine Version"
}
},
"bs-uninstall": {
"title": "Deinstallieren",
"description": "Möchtest du BeatSaber {version} wirklich deinstallieren? Du musst es erneut herunterladen, um es zu spielen.",
"buttons": {
"submit": "Deinstallieren"
}
},
"install-folder": {
"title": "Installation Ordner",
"description": "Das Ändern des Standardinstallationsordners führt dazu, dass alle installierten Daten in den neuen Ordner verschoben werden.",
"buttons": {
"submit": "Ordner Wählen"
}
},
"edit-version": {
"title": "Version ändern",
"buttons": {
"submit": "Ändern"
}
},
"clone-version": {
"title": "Version Klonen",
"description": "Durch das Klonen der Version kannst Du zusätzlichen BeatSaber-Inhalt zwischen zwei Versionen trennen.",
"inputs": {
"name": {
"label": "Name",
"placeholder": "Versions Name"
},
"color": {
"label": "Farbe"
}
},
"buttons": {
"submit": "Klonen"
}
},
"uninstall-mod": {
"title": "Entfernen",
"description": "Bist du sicher das du die Mod {mod} entfernen möchtest? Es könnte dafür sorgen, dass andere installationen nicht mehr richtig funktionieren.",
"description-bsipa": "Bist du sicher, dass du BSIPA entfernen möchtest? Dannach werden deine Mods nicht mehr funktionieren."
},
"uninstall-all-mods": {
"title": "Entferne Alle Mods",
"description": "Bist du sicher das du alle Mods von der Version {version} entfernen möchtest? Diese Aktion kann nicht rückgängig gemacht werden."
},
"maps-actions": {
"delete-maps": {
"title": {
"single": "Map Entfernen?",
"multiple": "Maps Entfernen?"
},
"desc": {
"single": "Bist du sicher das du die Map {name} entfernen willst?",
"multiple": "Bist du sicher das du alle {nb} maps entfernen willst?"
},
"info": {
"desc": {
"single": "Diese Map ist teil der geteilten Maps",
"multiple": "Diese Maps sind teil der geteilten Maps"
},
"title": {
"single": "Diese Map wird auch aus Versionen entfernt, die geteilte Maps verwenden",
"multiple": "Diese Maps werden auch aus Versionen entfernt, die geteilte Maps verwenden"
}
}
},
"link-maps": {
"title": "Maps Verknüpfen",
"desc": "Das Verknüpfen von Maps ermöglicht es, Maps zwischen allen Versionen zu teilen. Nach der Verknüpfung profitiert diese Version von den geteilten Maps",
"info": "Das Hinzufügen und Löschen von Maps wird ebenfalls geteilt",
"keep-maps": {
"label": "Maps behalten",
"title": "Maps behalten verschiebt die Maps der aktuellen Version in den geteilten Maps. Andernfalls gehen sie verloren."
},
"valid-btn": "Maps Verknüpfen"
},
"unlink-maps": {
"title": "Maps Verknüpfung aufheben",
"desc": "Bitte beachte, dass das Aufheben der Verknüpfung von Maps die Verwendung von geteilten Maps für diese Version nicht zulässt.",
"keep-maps": {
"label": "Maps behalten",
"title": "Maps behalten verschiebt die Maps der aktuellen Version in den geteilten Maps. Andernfalls gehen sie verloren."
},
"valid-btn": "Verknüpfung aufheben"
}
},
"download-maps": {
"search-btn": "Suchen",
"loading-maps": "Lade Maps...",
"no-maps-found": "Keine Maps gefunden",
"no-internet": "Kein Internet"
},
"mods-disclaimer":{
"title": "Haftungsausschluss",
"p-1": "Indem Du dich für die Verwendung von Mods entscheiden, verstehst Du Folgendes:",
"li-1": "Möglicherweise treten Probleme auf, die im Vanilla-Spiel nicht vorhanden sind. 99.9% der Fehler, Abstürze und Verzögerungen sind auf Mods zurückzuführen.",
"li-2": "Mods können durch Updates beschädigt werden und das ist normal - sei geduldig und respektvoll, wenn dies passiert, da Modder Freiwillige mit echtem Leben sind.",
"li-3": "Beat Games versuchen nicht absichtlich, Mods kaputt zu machen. Sie möchten an der Codebasis arbeiten und manchmal macht dies Mods kaputt, aber sie sind nicht darauf aus, Mods zu verbieten.",
"p-2": "Greife die Spieleentwickler nicht wegen Problemen im Zusammenhang mit Mods an und umgekehrt - Modder und Spieleentwickler sind zwei getrennte Gruppen. Sei einfach nicht gemein, okay?"
},
"shared-folders":{
"title": "Geteilte Ordner",
"description": "Verknüpfe BeatSaber-Ordner, um ihre Inhalte mit freigegebenen Ordnern in anderen Versionen zu synchronisieren. Beachte, dass auch das Löschen von Inhalten geteilt wird.",
"buttons": {
"add-folder": "Ordner Hinzufügen",
"link-folder": "Ordner Verknüpfen",
"unlink-folder": "Ordner Verknüpfung Aufheben",
"link-all": "Alle verlinken"
}
}
},
"maps": {
"map-filter-panel": {
"duration": "Länge",
"tags": "Stichworte",
"specificities": "Allgemein",
"requirements": "Anforderungen"
},
"map-types": {
"accuracy": "Präzision",
"balanced": "Ausgeglichen",
"challenge": "Herausforderung",
"dancestyle": "Tanz",
"fitness": "Fitness",
"speed": "Geschwindigkeit",
"tech": "Tech"
},
"map-styles": {
"dance": "Tanz",
"swing": "Swing",
"nightcore": "Nightcore",
"folk": "Folk",
"family": "Familie",
"ambient": "umgebung",
"funk": "Funk",
"jazz": "Jazz",
"soul": "Soul",
"speedcore": "Speedcore",
"punk": "Punk",
"rb": "R&B",
"holiday": "Urlaub",
"vocaloid": "Vokaloid",
"jrock": "J-Rock",
"trance": "Trance",
"drumbass": "Basstrommel",
"comedy": "Komödie",
"instrumental": "Instrumental",
"hardcore": "Hardcore",
"kpop": "K-Pop",
"indie": "Indie",
"techno": "Techno",
"house": "House",
"game": "Videospiele",
"film": "Filme",
"alt": "Alternativ",
"dubstep": "Dubstep",
"metal": "Metal",
"anime": "Anime",
"hiphop": "HipHop",
"jpop": "J-Pop",
"rock": "Rock",
"pop": "Pop",
"electronic": "Elektronisch",
"classical-orchestral": "Klassisch & Orchestra"
},
"map-specificities": {
"automapper": "KI",
"ranked": "ranked",
"curated": "curated",
"verified": "verifiziert",
"fullSpread": "full spread"
},
"difficulties": {
"Easy": "einfach",
"Normal": "normal",
"Hard": "hard",
"Expert": "expert",
"ExpertPlus": "expert+"
},
"map-item": {
"by": "Von {songAutor}",
"mapped-by": "Gemapped von"
}
},
"beat-saver": {
"maps-sorts": {
"Latest": "Neueste",
"Relevance": "Relevanz",
"Rating": "Bewertung",
"Curated": "Curated"
}
},
"auto-update": {
"checking": "Prüfe auf Updates",
"downloading": "Lade Updates Herunter"
},
"dateformat": {
"dayNames": [
"So",
"Mo",
"Di",
"Mi",
"Do",
"Fr",
"Sa",
"Sonntag",
"Montag",
"Dienstag",
"Mittwoch",
"Donnerstag",
"Freitag",
"Samstag"
],
"monthNames": [
"Jan",
"Feb",
"Mär",
"Apr",
"Mai",
"Jun",
"Jul",
"Aug",
"Sep",
"Okt",
"Nov",
"Dez",
"Januar",
"Februar",
"März",
"April",
"Mai",
"Juni",
"Juli",
"August",
"September",
"Oktober",
"November",
"Dezember"
],
"timeNames": [
"a",
"p",
"am",
"pm",
"A",
"P",
"AM",
"PM"
]
}
}
+51 -7
View File
@@ -18,16 +18,24 @@
"settings": "Settings"
},
"pages": {
"shared-maps":{
"title": "Shared maps"
},
"version-viewer": {
"launch-mods": {
"oculus": "Oculus Mod",
"oculus-description": "If you are running Beat Saber through Steam, this allows you to play the game on an Oculus headset.",
"desktop": "Desktop Mod",
"oculus": "Oculus Mode",
"oculus-description": "If you are using Beat Saber via Steam, it allows you to use Oculus's VR composer without passing by SteamVR, to gain performances This is not necessary for using Oculus headsets.",
"desktop": "Desktop Mode",
"desktop-description": "This allows you to use WASD and the mouse to navigate around the menu in game. This makes testing much easier, because you don't have to put on your headset!",
"debug": "Debug Mod",
"debug-description": "Enables the output log window for IPA. This will show the debug console that mods use."
"debug": "Debug Mode",
"debug-description": "Enables the output log window for IPA. This will show the debug console that mods use.",
"advanced-launch": {
"button": "Advanced launch",
"placeholder": "Additional arguments ex: --revert; --nowait"
}
},
"maps": {
"title": "Shared maps",
"search-bar": {
"search-placeholder": "Search a map",
"filters-btn": "Filters",
@@ -59,6 +67,7 @@
"mods": {
"loading-mods": "Loading mods...",
"no-internet": "No internet",
"mods-not-available": "No mods are available yet for this version of Beat Saber",
"buttons": {
"more-infos": "More info",
"install-or-update": "Install or update"
@@ -80,7 +89,8 @@
"verify-files": "Verify files",
"clone": "Clone",
"edit": "Edit",
"uninstall": "Uninstall"
"uninstall": "Uninstall",
"shared-folders": "Shared Folders"
}
},
"available-versions": {
@@ -128,11 +138,13 @@
"en-US": "English, US",
"fr-FR": "Français",
"es-ES": "Español",
"de-DE": "Deutsch",
"translated": {
"en-EN": "English, United Kingdom",
"en-US": "English, USA",
"fr-FR": "French",
"es-ES": "Spanish"
"es-ES": "Spanish",
"de-DE": "German"
}
}
},
@@ -257,12 +269,20 @@
"move-folder": {
"success": {
"titles": {
"transfer-started": "Transfer in progress",
"transfer-finished": "Transfer complete"
},
"descs": {
"transfer-started": "The transfer has started and may take several minutes depending on your configuration."
}
},
"errors": {
"titles": {
"transfer-failed": "Transfer failed 😕"
},
"descs": {
"COPY_TO_SUBPATH": "The destination folder cannot be a subfolder of the source folder.",
"restore-linked-folders": "An error occurred while restoring shared folders. You can still manually restore them via the 'Shared Folders' menu on the versions page."
}
}
},
@@ -410,6 +430,14 @@
"success":"Model installation complete",
"error":"An error occurred while installing the model"
}
},
"shared-folder": {
"info": {
"userdata-backup-created":{
"title": "Backup created",
"msg": "Sharing the 'UserData' folder can generate errors, in case of problems unlink the folder to restore the backup"
}
}
}
},
"modals": {
@@ -443,10 +471,16 @@
"label": "Stay connected"
}
},
"why-credentials": "Why do you need my credentials ?",
"buttons": {
"submit": "Login"
}
},
"steam-credentials":{
"title": "Steam Credentials",
"p-1": "The credentials are only used to download the game because steam need to verify that you paid the game in order to be allowed to download it. They aren't saved and directly passed to DepotDownloader. If you don't want to enter your credentials you can follow this tutorial :",
"p-2": "and then click on the gear icon in the top right corner and select \"Import a version\", select the folder where beat saber has been downloaded (If you follow the tutorial above you should have the correct location)"
},
"bs-import-version":{
"title": "Import a version",
"description": "Imports a version of BeatSaber to use with BSManager. The import will copy the selected BeatSaber installation folder to the BSManager versions folder.",
@@ -553,6 +587,16 @@
"li-2": "Mods are subject to being broken by updates and that's normal - be patient and respectful when this happens, as modders are volunteers with real lives.",
"li-3": "Beat Games aren't purposefully trying to break mods. They wish to work on the codebase and sometimes this breaks mods, but they are not out to kill mods.",
"p-2": "Do not attack the game developers for issues related to mods, and vice versa - modders and game developers are two separate groups. Just don't be a jerk ok."
},
"shared-folders":{
"title": "Shared Folders",
"description": "Link BeatSaber folders to synchronize their contents with shared folders in other versions. Note that deleting content will also be shared.",
"buttons": {
"add-folder": "Add Folder",
"link-folder": "Link Folder",
"unlink-folder": "Unlink Folder",
"link-all": "Link all"
}
}
},
"maps": {
+47 -4
View File
@@ -18,14 +18,21 @@
"settings": "Ajustes"
},
"pages": {
"shared-maps":{
"title": "Mapas comunes"
},
"version-viewer": {
"launch-mods": {
"oculus": "Oculus Mod",
"oculus-description": "Si estás ejecutando Beat Saber a través de Steam, esto te permite jugar en un auricular Oculus.",
"oculus-description": "Si estás usando Beat Saber a través de Steam, te permite usar el compositor VR de Oculus sin pasar por SteamVR, para ganar prestaciones. Esto no es necesario para usar auriculares Oculus.",
"desktop": "Desktop Mod",
"desktop-description": "Esto te permite usar WASD y el mouse para navegar por el menú en juego. Esto hace que las pruebas sean mucho más fáciles, ¡porque no tienes que ponerte el auricular!",
"debug": "Debug Mod",
"debug-description": "Habilita la ventana de registro de salida para IPA. Esto mostrará la consola de depuración que usan los mods."
"debug-description": "Habilita la ventana de registro de salida para IPA. Esto mostrará la consola de depuración que usan los mods.",
"advanced-launch": {
"button": "Lanzamiento avanzado",
"placeholder": "Argumentos adicionales ej: --revert; --no-wait"
}
},
"maps": {
"search-bar": {
@@ -59,6 +66,7 @@
"mods": {
"loading-mods": "Cargando mods...",
"no-internet": "Sin internet",
"mods-not-available": "Aún no hay mods disponibles para esta versión de Beat Saber",
"buttons": {
"more-infos": "Más información",
"install-or-update": "Instalar o actualizar"
@@ -80,7 +88,8 @@
"verify-files": "Verificar los archivos",
"clone": "Clonar",
"edit": "Editar",
"uninstall": "Desinstalar"
"uninstall": "Desinstalar",
"shared-folders": "Carpetas Compartidas"
}
},
"available-versions": {
@@ -128,11 +137,13 @@
"en-US": "English, US",
"fr-FR": "Français",
"es-ES": "Español",
"de-DE": "Deutsch",
"translated": {
"en-EN": "Inglés, Reino Unido",
"en-US": "Inglés, Estados Unidos",
"fr-FR": "Francés",
"es-ES": "Español"
"es-ES": "Español",
"de-DE": "Alemán"
}
}
},
@@ -257,12 +268,20 @@
"move-folder": {
"success": {
"titles": {
"transfer-started": "Transferencia en curso",
"transfer-finished": "Transferencia completa"
},
"descs": {
"transfer-started": "La transferencia ha comenzado y puede tomar varios minutos dependiendo de su configuración."
}
},
"errors": {
"titles": {
"transfer-failed": "Transferencia fallida 😕"
},
"descs": {
"COPY_TO_SUBPATH": "La carpeta de destino no puede ser una subcarpeta de la carpeta de origen.",
"restore-linked-folders": "Se produjo un error al restaurar las carpetas compartidas. Aún puede restaurarlas manualmente a través del menú 'Carpetas compartidas' en la página de versiones."
}
}
},
@@ -410,6 +429,14 @@
"success":"Instalación del modelo completada",
"error":"Se produjo un error durante la instalación del modelo"
}
},
"shared-folder": {
"info": {
"userdata-backup-created":{
"title": "Backup creado",
"msg": "Compartir la carpeta 'UserData' puede generar errores, en caso de problemas desvincular la carpeta para restaurar la copia de seguridad"
}
}
}
},
"modals": {
@@ -443,10 +470,16 @@
"label": "Manténgase conectado"
}
},
"why-credentials": "¿Por qué necesitas mis credenciales?",
"buttons": {
"submit": "Inicio de sesión"
}
},
"steam-credentials":{
"title": "Steam Credentials",
"p-1": "Las credenciales sólo se utilizan para descargar el juego porque steam necesita verificar que has pagado el juego para que se te permita descargarlo. No se guardan y se pasan directamente a DepotDownloader. Si no quieres introducir tus credenciales puedes seguir este tutorial :",
"p-2": "y, a continuación, haga clic en el icono de engranaje en la esquina superior derecha y seleccione \"Importar una versión\", seleccione la carpeta donde se ha descargado beat saber (Si usted sigue el tutorial anterior debe tener la ubicación correcta)"
},
"bs-import-version":{
"title": "Importar una versión",
"description": "Importa una versión de BeatSaber para usar con BSManager. La importación copiará la carpeta de instalación seleccionada de BeatSaber en la carpeta de versiones de BSManager.",
@@ -553,6 +586,16 @@
"li-2": "Es probable que los mods dejen de funcionar debido a las actualizaciones y eso es normal. Sé paciente y respetuoso cuando suceda esto, ya que los modders son voluntarios y tienen una vida.",
"li-3": "Beat Games no está intencionalmente tratando de romper los mods. Quieren mejorar el juego base y a veces esto rompe los mods, pero no es su objetivo matar a los mods.",
"p-2": "No ataques a los desarrolladores por problemas relacionados con los mods y viceversa. Los modders y los desarrolladores son dos grupos distintos. No seas tonto, ¿de acuerdo?"
},
"shared-folders":{
"title": "Carpetas Compartidas",
"description": "Enlace las carpetas de BeatSaber para sincronizar su contenido con las carpetas compartidas en otras versiones. Tenga en cuenta que la eliminación de contenido también se compartirá.",
"buttons": {
"add-folder": "Añadir Carpeta",
"link-folder": "Enlazar Carpeta",
"unlink-folder": "Desenlazar Carpeta",
"link-all": "Enlazar todo"
}
}
},
"maps": {
+48 -5
View File
@@ -18,14 +18,21 @@
"settings": "Paramètres"
},
"pages": {
"shared-maps":{
"title": "Maps partagées"
},
"version-viewer": {
"launch-mods": {
"oculus": "Mode Oculus",
"oculus-description": "Si vous exécutez Beat Saber via Steam, cela vous permet de jouer au jeu sur un casque Oculus.",
"oculus-description": "Si vous utilisez Beat Saber via Steam, cela vous permet d'utiliser le compositeur VR d'Oculus sans passer par SteamVR, pour gagner en performances. Ceci n'est pas nécessaire pour utiliser les casques Oculus.",
"desktop": "Mode Bureau",
"desktop-description": "Cela vous permet d'utiliser WASD et la souris pour naviguer dans le menu en jeu. Cela rend les tests beaucoup plus faciles, car vous n'avez pas à mettre votre casque!",
"debug": "Mode Debug",
"debug-description": "Active la fenêtre de log pour IPA. Cela affichera la console de débogage utilisée par les mods."
"debug-description": "Active la fenêtre de log pour IPA. Cela affichera la console de débogage utilisée par les mods.",
"advanced-launch": {
"button": "Lancement avancé",
"placeholder": "Arguments supplémentaires ex: --revert; --nowait"
}
},
"maps": {
"search-bar": {
@@ -59,6 +66,7 @@
"mods": {
"loading-mods": "Chargement des mods...",
"no-internet": "Pas d'internet",
"mods-not-available": "Aucun mod n'est encore disponible pour cette version de Beat Saber",
"buttons": {
"more-infos": "Plus d'infos",
"install-or-update": "Installer ou mettre à jour"
@@ -80,7 +88,8 @@
"verify-files": "Vérifier les fichiers",
"clone": "Cloner",
"edit": "Editer",
"uninstall": "Désinstaller"
"uninstall": "Désinstaller",
"shared-folders": "Dossiers Partagés"
}
},
"available-versions": {
@@ -128,11 +137,13 @@
"en-US": "English, US",
"fr-FR": "Français",
"es-ES": "Español",
"de-DE": "Deutsch",
"translated": {
"en-EN": "Anglais, Royaume-Uni",
"en-US": "Anglais, États-Unis",
"fr-FR": "Français",
"es-ES": "Espagnol"
"es-ES": "Espagnol",
"de-DE": "Allemand"
}
}
},
@@ -257,13 +268,21 @@
"move-folder": {
"success": {
"titles": {
"transfer-started": "Transfert en cours",
"transfer-finished": "Transfert terminé 👌"
},
"descs":{
"transfer-started": "Le transfert a commencé, il peut durer plusieurs minutes selon votre configuration."
}
},
"errors": {
"titles": {
"transfer-failed": "Le transfert a échoué 😕"
}
},
"descs": {
"COPY_TO_SUBPATH": "Le dossier de destination ne peut pas être un sous-dossier du dossier source.",
"restore-linked-folders": "Une erreur s'est produite lors de la restauration des dossiers partagés. Vous pouvez toujours les restaurer manuellement via le menu 'Dossiers partagés' sur la page des versions."
}
}
},
"steam": {
@@ -410,6 +429,14 @@
"success":"Installation du modèle terminée",
"error":"Une erreur s'est produite lors de l'installation du modèle"
}
},
"shared-folder":{
"info": {
"userdata-backup-created":{
"title": "Sauvegarde créée",
"msg": "Le partage du dossier 'UserData' peut générer des erreurs, en cas de soucis déliez le dossier pour restaurer la sauvegarde"
}
}
}
},
"modals": {
@@ -443,10 +470,16 @@
"label": "Rester connecté"
}
},
"why-credentials": "Pourquoi mes identifiants sont nécessaires ?",
"buttons": {
"submit": "Se connecter"
}
},
"steam-credentials":{
"title": "Steam Credentials",
"p-1": "Les informations d'identification ne sont utilisées que pour télécharger le jeu, car Steam doit vérifier que vous avez payé le jeu afin d'être autorisé à le télécharger. Ils ne sont pas sauvegardés et transmis directement à DepotDownloader. Si vous ne voulez pas entrer vos informations d'identification, vous pouvez suivre ce tutoriel :",
"p-2": "puis cliquez sur l'icône de l'engrenage dans le coin supérieur droit et sélectionnez \"Importer une version\", sélectionnez le dossier où beat saber a été téléchargé (Si vous suivez le tutoriel ci-dessus, vous devriez avoir le bon emplacement)."
},
"bs-import-version":{
"title": "Importer une version",
"description": "Importe une version de BeatSaber pour profiter des fonctionnalités de BSManager. L'importation copiera le dossier d'installation de BeatSaber sélectionné dans le dossier de versions de BSManager.",
@@ -553,6 +586,16 @@
"li-2": "Les mods sont susceptibles de ne plus fonctionner à cause des mises à jour et c'est normal - soyez patient et respectueux lorsque cela se produit, parce que les moddeurs sont bénévoles et ont une vie.",
"li-3": "Beat Games ne cherche pas volontairement à casser les mods. Ils souhaitent améliorer la base du jeu et parfois cela casse les mods, mais ce n'est pas dans leur objectif de tuer les mods.",
"p-2": "N'attaquez pas les développeurs pour des problèmes relatifs aux mods, et inversement - les moddeurs et les développeurs sont deux groupes distincts. Ne soyez pas idiots, d'accord ?"
},
"shared-folders":{
"title": "Dossiers Partagés",
"description": "Liez les dossiers de BeatSaber pour synchroniser leurs contenus avec les dossiers partagés des autres versions. Notez que la suppression de contenu sera également partagée.",
"buttons": {
"add-folder": "Ajouter un dossier",
"link-folder": "Lier le dossier",
"unlink-folder": "Délier le dossier",
"link-all": "Tout lier"
}
}
},
"maps": {
+1015 -1329
View File
File diff suppressed because it is too large Load Diff
+13 -14
View File
@@ -154,10 +154,13 @@
"@types/dateformat": "^5.0.0",
"@types/jest": "^27.5.2",
"@types/node": "17.0.23",
"@types/react": "^17.0.48",
"@types/react-dom": "^18.0.10",
"@types/react": "^18.0.33",
"@types/react-dom": "^18.0.11",
"@types/react-outside-click-handler": "^1.3.1",
"@types/react-test-renderer": "^17.0.2",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/recursive-readdir": "^2.2.1",
"@types/terser-webpack-plugin": "^5.0.4",
"@types/use-double-click": "^1.0.1",
"@types/webpack-bundle-analyzer": "^4.4.2",
@@ -173,7 +176,7 @@
"css-loader": "^6.7.1",
"css-minimizer-webpack-plugin": "^4.1.0",
"detect-port": "^1.3.0",
"electron": "^20.0.3",
"electron": "^24.0.0",
"electron-builder": "^23.6.0",
"electron-devtools-installer": "^3.2.0",
"electron-notarize": "^1.2.1",
@@ -210,7 +213,7 @@
"sass-loader": "^12.6.0",
"style-loader": "^3.3.1",
"tailwind-scrollbar": "^2.0.1",
"tailwindcss": "^3.2.4",
"tailwindcss": "^3.3.1",
"terser-webpack-plugin": "^5.3.5",
"ts-jest": "^27.1.5",
"ts-loader": "^9.3.0",
@@ -226,19 +229,16 @@
"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",
"electron-debug": "^3.2.0",
"electron-log": "^4.4.8",
"electron-store": "^8.1.0",
"electron-updater": "^5.2.4",
"electron-updater": "^6.0.3",
"fast-deep-equal": "^3.1.3",
"framer-motion": "^8.0.2",
"fs-extra": "^10.1.0",
"framer-motion": "^10.11.2",
"fs-extra": "^11.1.1",
"history": "^5.3.0",
"is-online": "^9.0.1",
"md5-file": "^5.0.0",
@@ -249,17 +249,16 @@
"react-dom": "^18.2.0",
"react-range": "^1.8.14",
"react-router-dom": "^6.3.0",
"react-virtualized-auto-sizer": "^1.0.7",
"react-virtualized-auto-sizer": "^1.0.12",
"react-window": "^1.8.8",
"recursive-readdir": "^2.2.3",
"regedit": "^5.1.1",
"regedit": "^5.1.2",
"rfdc": "^1.3.0",
"rxjs": "^7.5.6",
"rxjs": "^7.8.0",
"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",
"use-fit-text": "^2.4.0"
},
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "bs-manager",
"version": "1.0.1",
"version": "1.1.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "bs-manager",
"version": "1.0.1",
"version": "1.1.0",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "bs-manager",
"version": "1.0.3",
"version": "1.1.0",
"description": "A foundation for scalable desktop apps",
"main": "./dist/main/main.js",
"author": {
+2
View File
@@ -3,3 +3,5 @@ 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";
+135
View File
@@ -0,0 +1,135 @@
import { CopyOptions, copy, 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"
import { BsmException } from "shared/models/bsm-exception.model";
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, opts?: {ignoreSymlinkTargetError?: boolean}): 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: any){
if(e.code === "ENOENT" && opts?.ignoreSymlinkTargetError === true && !path.extname(file.name)){
return path.join(folderPath, file.name);
}
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 function isSubdirectory(parent: string, child: string): boolean {
const parentNormalized = path.resolve(parent);
const childNormalized = path.resolve(child);
if (parentNormalized === childNormalized) { return false; }
const relativePath = path.relative(parentNormalized, childNormalized);
if (path.parse(parentNormalized).root !== path.parse(childNormalized).root) { return false; }
return relativePath && !relativePath.startsWith('..') && !path.isAbsolute(relativePath);
}
export async function copyDirectoryWithJunctions(src: string, dest: string, options?: CopyOptions): Promise<void> {
if(isSubdirectory(src, dest)){
throw {message: `Cannot copy directory '${src}' into itself '${dest}'.`, code: "COPY_TO_SUBPATH"} as BsmException;
}
await ensureDir(dest);
const items = await readdir(src, { withFileTypes: true });
for (const item of items) {
const sourcePath = path.join(src, item.name);
const destinationPath = path.join(dest, item.name);
if (item.isDirectory()) {
await copyDirectoryWithJunctions(sourcePath, destinationPath, options);
} else if (item.isFile()) {
await copy(sourcePath, destinationPath, options);
} else if (item.isSymbolicLink()) {
if(options?.overwrite){
await unlinkPath(destinationPath);
}
const symlinkTarget = await readlink(sourcePath);
const relativePath = path.relative(src, symlinkTarget);
const newTarget = path.join(dest, relativePath);
await symlink(newTarget, destinationPath, 'junction');
}
}
}
export interface Progression<T = unknown>{
total: number;
current: number;
extra?: T;
}
+19
View File
@@ -0,0 +1,19 @@
export type AllSettledHelperOptions = {
keepStructure?: boolean;
removeFalsy?: boolean;
}
export async function allSettled<T>(promises: Promise<T>[], options?: AllSettledHelperOptions): Promise<T[]> {
const settledPromises = await Promise.allSettled(promises);
if(options?.keepStructure){
return settledPromises.map(p => p.status === 'fulfilled' ? p.value : null);
}
return settledPromises.reduce((acc, p) => {
if(p.status === 'fulfilled'){
if(options?.removeFalsy && !p.value){ return acc; }
acc.push(p.value);
}
return acc;
}, []);
}
+2
View File
@@ -3,6 +3,7 @@ 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();
@@ -22,6 +23,7 @@ ipcMain.on("bsv-get-map-details-from-hashs", async (event, request: IpcRequest<s
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});
})
});
+5
View File
@@ -116,4 +116,9 @@ ipc.on("is-map-deep-links-enabled", async (request: IpcRequest<void>) => {
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)));
});
+114 -1
View File
@@ -6,6 +6,18 @@ import { exec } from 'child_process';
import { IpcRequest } from 'shared/models/ipc';
import { BSLocalVersionService } from '../services/bs-local-version.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 => {
@@ -26,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}>) => {
@@ -44,3 +56,104 @@ 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)));
});
ipc.on("relink-all-versions-folders", async (req: IpcRequest<void>, reply) => {
const versionLinker = VersionFolderLinkerService.getInstance();
reply(from(versionLinker.relinkAllVersionsFolders()));
});
+10 -4
View File
@@ -4,10 +4,16 @@ 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.getMainWindows("index.html")?.close();
@@ -32,10 +38,10 @@ 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>) => {
+5
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();
@@ -12,11 +15,13 @@ ipcMain.on("open-window-then-close-all", async (event, request: IpcRequest<AppWi
});
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);
});
+10 -12
View File
@@ -9,7 +9,7 @@
* `./src/main.js` using webpack. This gives us some performance wins.
*/
import path from 'path';
import { app, protocol } from 'electron';
import { app, ipcMain, protocol } from 'electron';
import log from 'electron-log';
import './ipcs';
import { UtilsService } from './services/utils.service';
@@ -20,6 +20,8 @@ import { LocalMapsManagerService } from './services/additional-content/local-map
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';
@@ -31,9 +33,6 @@ log.transports.file.resolvePath = (() => {
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();
@@ -63,14 +62,6 @@ const initServicesMustBeInitialized = () => {
// Model
}
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 gotTheLock = app.requestSingleInstanceLock();
if(!gotTheLock){
@@ -108,5 +99,12 @@ else{
callback(pathname);
});
BSLauncherService.getInstance().restoreSteamVR();
// Log renderer errors
ipcMain.on('log-error', (event, args: IpcRequest<any>) => {
log.error(args?.args);
});
}).catch(log.error);
}
@@ -6,20 +6,22 @@ import { BSLocalVersionService } from "../bs-local-version.service";
import { InstallationLocationService } from "../installation-location.service";
import { UtilsService } from "../utils.service";
import crypto from "crypto";
import { lstatSync, symlinkSync, unlinkSync, readdirSync, createWriteStream } from "fs";
import { copy, copySync } from "fs-extra";
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 archiver from "archiver";
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 { defer } 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";
import { allSettled } from "../../helpers/promise.helpers";
export class LocalMapsManagerService {
@@ -30,8 +32,9 @@ export class LocalMapsManagerService {
return LocalMapsManagerService.instance;
}
private readonly LEVELS_ROOT_FOLDER = "Beat Saber_Data";
private readonly CUSTOM_LEVELS_FOLDER = "CustomLevels";
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",
@@ -44,6 +47,7 @@ export class LocalMapsManagerService {
private readonly reqService: RequestService;
private readonly deepLink: DeepLinkService;
private readonly windows: WindowManagerService;
private readonly linker = FolderLinkerService.getInstance();
private constructor(){
this.localVersion = BSLocalVersionService.getInstance();
@@ -52,13 +56,14 @@ export class LocalMapsManagerService {
this.reqService = RequestService.getInstance();
this.deepLink = DeepLinkService.getInstance();
this.windows = WindowManagerService.getInstance();
this.linker = FolderLinkerService.getInstance();
this.deepLink.addLinkOpenedListener(this.DEEP_LINKS.BeatSaver, (link) => {
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) => {
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);
});
@@ -66,37 +71,35 @@ export class LocalMapsManagerService {
public async getMapsFolderPath(version?: BSVersion): Promise<string>{
if(version){ return path.join(await this.localVersion.getVersionPath(version), this.LEVELS_ROOT_FOLDER, this.CUSTOM_LEVELS_FOLDER); }
const sharedMapsPath = path.join(this.installLocation.sharedMapsPath, this.CUSTOM_LEVELS_FOLDER);
if(!(await this.utils.pathExist(sharedMapsPath))){
this.utils.createFolderIfNotExist(sharedMapsPath);
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);
let content = 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);
if(!await this.utils.pathExist(diffFilePath)){ continue; }
const diffContent = (await this.utils.readFileAsync(diffFilePath)).toString();
content += diffContent;
const diffContent = await readFile(diffFilePath, {encoding: "utf-8"}).catch(() => null);
diffContent && shasum.update(diffContent);
}
}
const shasum = crypto.createHash("sha1");
shasum.update(content);
return shasum.digest("hex");
}
private async loadMapInfoFromPath(mapPath: string): Promise<BsmLocalMap>{
const infoFilePath = path.join(mapPath, "Info.dat");
if(!(await this.utils.pathExist(infoFilePath))){ return null; }
if(!(await pathExist(infoFilePath))){ return null; }
const rawInfoString = await (await (this.utils.readFileAsync(infoFilePath))).toString();
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;
@@ -110,7 +113,7 @@ export class LocalMapsManagerService {
private async downloadMapZip(zipUrl: string): Promise<{zip: StreamZip.StreamZipAsync, zipPath: string}>{
const fileName = path.basename(zipUrl);
const tempPath = this.utils.getTempPath();
this.utils.createFolderIfNotExist(this.utils.getTempPath());
await ensureFolderExist(this.utils.getTempPath());
const dest = path.join(tempPath, fileName);
const zipPath = await this.reqService.downloadFile(zipUrl, dest);
@@ -141,18 +144,21 @@ export class LocalMapsManagerService {
(async () => {
const levelsFolder = await this.getMapsFolderPath(version);
const levelsPaths = (await this.utils.pathExist(levelsFolder)) ? this.utils.listDirsInDir(levelsFolder, true) : [];
const levelsPaths = (await pathExist(levelsFolder)) ? await getFoldersInFolder(levelsFolder) : [];
progression.total = levelsPaths.length;
for(const levelPath of levelsPaths){
const promises = levelsPaths.map(async levelPath => {
const mapInfo = await this.loadMapInfoFromPath(levelPath);
if(mapInfo){
progression.maps.push(mapInfo);
progression.loaded = progression.maps.length;
observer.next({...progression, maps: []});
}
}
if(!mapInfo){ return null; }
progression.loaded++;
observer.next(progression);
return mapInfo;
});
const mapsInfo = await allSettled(promises, {removeFalsy: true});
progression.maps = mapsInfo;
observer.next(progression);
@@ -165,7 +171,7 @@ export class LocalMapsManagerService {
const levelsPath = await this.getMapsFolderPath(version);
const isPathExist = await this.utils.pathExist(levelsPath);
const isPathExist = await pathExist(levelsPath);
if(!isPathExist){ return false; }
@@ -173,36 +179,13 @@ export class LocalMapsManagerService {
}
public async linkVersionMaps(version: BSVersion, keepMaps: boolean): Promise<void>{
if(await this.versionIsLinked(version)){ return; }
const sharedMapsPath = await this.getMapsFolderPath();
const versionMapsPath = await this.getMapsFolderPath(version);
if(keepMaps){
await this.utils.moveDirContent(versionMapsPath, sharedMapsPath);
}
await this.utils.deleteFolder(versionMapsPath);
symlinkSync(sharedMapsPath, versionMapsPath, "junction");
return this.linker.linkFolder(versionMapsPath, {keepContents: keepMaps, intermediateFolder: LocalMapsManagerService.SHARED_MAPS_FOLDER});
}
public async unlinkVersionMaps(version: BSVersion, keepMaps: boolean): Promise<void>{
const sharedMapsPath = await this.getMapsFolderPath();
const versionMapsPath = await this.getMapsFolderPath(version);
if(await this.versionIsLinked(version)){
unlinkSync(versionMapsPath);
}
this.utils.createFolderIfNotExist(versionMapsPath);
if(keepMaps){
await copy(sharedMapsPath, versionMapsPath);
}
return this.linker.unlinkFolder(versionMapsPath, {keepContents: keepMaps, intermediateFolder: LocalMapsManagerService.SHARED_MAPS_FOLDER});
}
public deleteMaps(maps: BsmLocalMap[]): Observable<DeleteMapsProgress>{
@@ -217,12 +200,11 @@ export class LocalMapsManagerService {
for(const folder of mapsFolders){
const detail = await this.loadMapInfoFromPath(folder);
if(!mapsHashsToDelete.includes(detail?.hash)){ continue; }
await this.utils.deleteFolder(folder);
await deleteFolder(folder);
progress.deleted++;
observer.next(progress);
}
}catch(e){
console.log(e);
observer.error(e);
}
observer.complete();
@@ -246,7 +228,7 @@ export class LocalMapsManagerService {
if(!zip){ throw `Cannot download ${zipUrl}`; }
this.utils.createFolderIfNotExist(mapPath);
await ensureFolderExist(mapPath);
await zip.extract(null, mapPath);
await zip.close();
@@ -288,7 +270,7 @@ export class LocalMapsManagerService {
const versionMapsPath = await this.getMapsFolderPath(version);
this.utils.createFolderIfNotExist(versionMapsPath);
await ensureFolderExist(versionMapsPath);
copySync(downloadedMap.path, path.join(versionMapsPath, path.basename(downloadedMap.path)), {overwrite: true});
@@ -308,6 +290,4 @@ export class LocalMapsManagerService {
return Array.from(Object.values(this.DEEP_LINKS)).every(link => this.deepLink.isDeepLinkRegistred(link));
}
}
@@ -11,6 +11,7 @@ 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 {
@@ -74,7 +75,7 @@ export class LocalModelsManagerService {
const versionPath = await this.localVersion.getVersionPath(version);
const modelFolderPath = path.join(versionPath, this.MODEL_TYPE_FOLDER[type]);
this.utils.createFolderIfNotExist(modelFolderPath);
await ensureFolderExist(modelFolderPath);
return modelFolderPath;
@@ -15,6 +15,7 @@ import { BPList, DownloadPlaylistProgression } from "shared/models/playlists/pla
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 {
@@ -80,7 +81,7 @@ export class LocalPlaylistsManagerService {
const folder = path.join(versionFolder, this.PLAYLISTS_FOLDER);
await this.utils.createFolderIfNotExist(folder)
await ensureFolderExist(folder)
return folder;
@@ -92,7 +93,7 @@ export class LocalPlaylistsManagerService {
const bpListDest = path.join(playlistFolder, path.basename(bpListUrlOrPath));
if(this.utils.pathExist(bpListUrlOrPath)){
if(await pathExist(bpListUrlOrPath)){
copyFileSync(bpListUrlOrPath, bpListDest);
}
else{
@@ -105,7 +106,7 @@ export class LocalPlaylistsManagerService {
private async readPlaylistFile(path: string): Promise<BPList>{
if(!this.utils.pathExist(path)){ throw `bplist file not exist at ${path}`; }
if(!(await pathExist(path))){ throw `bplist file not exist at ${path}`; }
const rawContent = readFileSync(path).toString();
+26 -12
View File
@@ -1,3 +1,4 @@
/* eslint-disable prefer-promise-reject-errors */
import { BS_APP_ID, BS_DEPOT } from "../constants";
import path from "path";
import { BSVersion, PartialBSVersion } from 'shared/bs-version.interface';
@@ -10,6 +11,8 @@ 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{
@@ -70,16 +73,19 @@ export class BSInstallerService{
});
}
public async isDotNet6Installed(): Promise<boolean>{
public async isDotNet6Installed(): Promise<boolean>{
try{
const process = spawnSync(this.getDepotDownloaderExePath(), {shell: true});
const out = process.output.toString();
if(out.includes(".NET runtime can be found at")){ return false; }
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>{
@@ -89,11 +95,11 @@ 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 ? this.getPathNotAleardyExist(versionPath) : versionPath;
const dest = !downloadInfos.isVerification ? await this.getPathNotAleardyExist(versionPath) : versionPath;
const downloadVersion: BSVersion = {...downloadInfos.bsVersion, ...(path.basename(dest) !== downloadInfos.bsVersion.BSVersion && {name: path.basename(dest)})}
@@ -104,8 +110,7 @@ export class BSInstallerService{
`-depot ${BS_DEPOT}`,
`-manifest ${bsVersion.BSManifest}`,
`-username ${downloadInfos.username}`,
`-dir \"${this.localVersionService.getVersionFolder(downloadVersion)}\"`,
(downloadInfos.stay || !downloadInfos.password) && "-remember-password"
`-dir \"${this.localVersionService.getVersionFolder(downloadVersion)}\"`
],
{shell: true, cwd: this.installLocationService.versionsDirectory}
);
@@ -156,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();
});
@@ -173,15 +187,15 @@ export class BSInstallerService{
})
}
private getPathNotAleardyExist(path: string): string{
private async getPathNotAleardyExist(path: string): Promise<string>{
let destPath = path;
let folderExist = this.utils.pathExist(destPath);
let folderExist = await pathExist(destPath);
let i = 0;
while(folderExist){
i++;
destPath = `${path} (${i})`;
folderExist = this.utils.pathExist(destPath);
folderExist = await pathExist(destPath);
}
return destPath
@@ -193,7 +207,7 @@ export class BSInstallerService{
if(!rawBsVersion){ throw new Error("NOT_BS_FOLDER"); }
const destPath = this.getPathNotAleardyExist(await this.localVersionService.getVersionPath(rawBsVersion));
const destPath = await this.getPathNotAleardyExist(await this.localVersionService.getVersionPath(rawBsVersion));
await copy(path, destPath, {dereference: true});
+57 -7
View File
@@ -1,11 +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{
@@ -30,6 +34,23 @@ export class BSLauncherService{
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);
}
@@ -42,15 +63,44 @@ export class BSLauncherService{
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, 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";
}
+31 -18
View File
@@ -2,11 +2,9 @@ import { BSVersionLibService } from "./bs-version-lib.service";
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, OCULUS_BS_DIR } from "../constants";
import path from "path";
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";
@@ -14,6 +12,8 @@ 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{
@@ -22,11 +22,11 @@ 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(); }
@@ -35,18 +35,18 @@ export class BSLocalVersionService{
private constructor(){
this.installLocationService = InstallationLocationService.getInstance();
this.utilsService = UtilsService.getInstance();
this.steamService = SteamService.getInstance();
this.oculusService = OculusService.getInstance();
this.remoteVersionService = BSVersionLibService.getInstance();
this.configService = ConfigurationService.getInstance();
this.linker = FolderLinkerService.getInstance();
}
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<PartialBSVersion>(resolve => {
const stream = createReadStream(versionFilePath);
@@ -118,8 +118,7 @@ export class BSLocalVersionService{
private async getSteamVersion(): Promise<BSVersion>{
const steamBsFolder = await this.steamService.getGameFolder(BS_APP_ID, "Beat Saber");
if(!steamBsFolder || !this.utilsService.pathExist(steamBsFolder)){ return null; }
if(!steamBsFolder || !(await pathExist(steamBsFolder))){ return null; }
const steamBsVersion = await this.getVersionOfBSFolder(steamBsFolder);
if(!steamBsVersion){ return null; }
@@ -146,11 +145,11 @@ export class BSLocalVersionService{
if(steamVersion){ versions.push(steamVersion); }
const oculusVersion = await this.getOculusVersion();
if(oculusVersion){ versions.push(oculusVersion); }
if(oculusVersion){ versions.push(oculusVersion); }
if(!this.utilsService.pathExist(this.installLocationService.versionsDirectory)){ return versions }
if(!(await pathExist(this.installLocationService.versionsDirectory))){ return versions }
const folderInInstallation = this.utilsService.listDirsInDir(this.installLocationService.versionsDirectory, true);
const folderInInstallation = await getFoldersInFolder(this.installLocationService.versionsDirectory);
for(const f of folderInInstallation){
log.info("try get version from folder", f);
@@ -176,15 +175,15 @@ export class BSLocalVersionService{
public async deleteVersion(version: BSVersion): Promise<boolean>{
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 || version.oculus){ throw {title: "CantEditSteam", msg: "CantEditSteam"} as BsmException; }
if(version.steam || version.oculus){ throw {title: "CantEditSteam", message: "CantEditSteam"} as BsmException; }
const oldPath = await this.getVersionPath(version);
const editedVersion: BSVersion = version.BSVersion === name
? {...version, name: undefined, color}
@@ -197,7 +196,7 @@ export class BSLocalVersionService{
return editedVersion;
}
if(this.utilsService.pathExist(newPath) && newPath === oldPath){ throw {title: "VersionAlreadExist"} as BsmException; }
if((await pathExist(newPath)) && newPath === oldPath){ throw {title: "VersionAlreadExist"} as BsmException; }
return rename(oldPath, newPath).then(() => {
this.deleteCustomVersion(version);
@@ -205,7 +204,7 @@ export class BSLocalVersionService{
return editedVersion;
}).catch((err: Error) => {
log.error("edit version error", err, version, name, color);
throw {title: "CantRename", error: err} as BsmException;
throw {title: "CantRename", ...err} as BsmException;
});
}
@@ -221,15 +220,29 @@ export class BSLocalVersionService{
this.addCustomVersion(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, {dereference: true}).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
throw {title: "CantClone", ...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 -14
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';
import { allSettled } from '../helpers/promise.helpers';
export class BSVersionLibService{
@@ -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,16 +43,19 @@ export class BSVersionLibService{
writeFileSync(localVersionsPath, JSON.stringify(versions, null, "\t"), {encoding: 'utf-8', flag: 'w'});
};
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;
}
private async loadBsVersions(): Promise<BSVersion[]>{
if(this.bsVersions){ return this.bsVersions; }
const [localVersions, remoteVersions] = await allSettled([
this.getLocalVersions(), this.getRemoteVersions()
], {keepStructure: true});
let resVersions = localVersions;
if(remoteVersions && remoteVersions.length){ resVersions = remoteVersions; this.updateLocalVersions(resVersions); }
this.bsVersions = resVersions;
return this.bsVersions;
}
public async getAvailableVersions(): Promise<BSVersion[]>{
const bsVersions = await this.loadBsVersions();
+122
View File
@@ -0,0 +1,122 @@
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, readlink } 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 constructor(){
this.installLocationService = InstallationLocationService.getInstance();
}
private get sharedFolder(): string{
return 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> {
const sharedPath = this.getSharedFolder(folderPath, options?.intermediateFolder);
if(await this.isFolderSymlink(folderPath)){
const isTargetedToSharedPath = await readlink(folderPath).then(target => target === sharedPath).catch(() => false);
if(isTargetedToSharedPath){ return; }
await unlinkPath(folderPath);
return symlink(sharedPath, folderPath, "junction");
}
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,10 +1,8 @@
import path from "path";
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 { copyDirectoryWithJunctions, deleteFolder, ensureFolderExist } from "../helpers/fs.helpers";
export class InstallationLocationService {
@@ -19,10 +17,8 @@ export class InstallationLocationService {
private readonly VERSIONS_FOLDER = "BSInstances";
private readonly SHARED_CONTENT_FOLDER = "SharedContent";
private readonly SHARED_MAPS_FOLDER = "SharedMaps";
private readonly STORE_INSTALLATION_PATH_KEY = "installation-folder";
private readonly utilsService: UtilsService;
private readonly installPathConfig: ElectronStore;
private readonly updateListeners: Set<Listener> = new Set();
@@ -31,7 +27,6 @@ export class InstallationLocationService {
private constructor(){
this.installPathConfig = new ElectronStore({watch: true});
this.utilsService = UtilsService.getInstance();
this.initInstallationLocation();
this.installPathConfig.onDidChange(this.STORE_INSTALLATION_PATH_KEY, () => {
@@ -50,16 +45,25 @@ export class InstallationLocationService {
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); }
fs.move(oldDir, newDest, { overwrite: true }).then(() => {
return new Promise<string>(async (resolve, reject) => {
await ensureFolderExist(oldDir);
try{
await copyDirectoryWithJunctions(oldDir, newDest, {overwrite: true});
this._installationDirectory = newDir;
this.installPathConfig.set(this.STORE_INSTALLATION_PATH_KEY, newDir);
resolve(this.installationDirectory);
}).catch((err: Error) => {
reject({title: "CantMoveFolder", error: err} as BsmException);
deleteFolder(oldDir);
return resolve(this.installationDirectory);
}
catch(err){
log.error(err);
})
reject(err);
}
});
}
@@ -72,7 +76,6 @@ export class InstallationLocationService {
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); }
public get sharedMapsPath(): string { return path.join(this.sharedContentPath, this.SHARED_MAPS_FOLDER); }
}
+4 -3
View File
@@ -1,10 +1,11 @@
import { IpcResponse, IpcRequest } from "shared/models/ipc";
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 {
@@ -40,14 +41,14 @@ export class IpcService {
}
public send<T>(channel: IpcChannel, window: AppWindow, response?: T|Error): void{
this.windows.getWindow(window).webContents.send(channel, response);
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 => {
console.log("LAAAA 2", error);
log.error(error);
this.send(this.getErrorChannel(channel), window, error);
}, () => {
this.send(this.getCompleteChannel(channel), window);
@@ -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
+2 -1
View File
@@ -1,6 +1,7 @@
import { UtilsService } from "./utils.service";
import regedit from 'regedit'
import path from "path";
import { pathExist } from "../helpers/fs.helpers";
export class OculusService {
@@ -57,7 +58,7 @@ export class OculusService {
for(const lib of libsFolders){
const gameFullPath = path.join(lib, rootLibDir, gameFolder);
if(this.utils.pathExist(gameFullPath)){ return gameFullPath; }
if(await pathExist(gameFullPath)){ return gameFullPath; }
}
return null;
+1 -1
View File
@@ -21,7 +21,7 @@ export class RequestService {
resolve(JSON.parse(body));
});
res.on('error', (err) => reject(err))
});
}).on("error", err => reject(err));
});
}
+18 -10
View File
@@ -4,6 +4,8 @@ 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{
@@ -46,21 +48,27 @@ 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>{
+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[]>{
@@ -1,4 +1,4 @@
import { splitIntoChunk } from "../../../helpers/array-tools";
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";
@@ -32,7 +32,7 @@ export class BeatSaverService {
return res;
}, [] as BsvMapDetail[]);
await Promise.all(chunkHash.map(async hashs => {
await Promise.allSettled(chunkHash.map(async hashs => {
const res = await this.bsaverApi.getMapsDetailsByHashs(hashs);
if(res.status === 200){
+3 -61
View File
@@ -1,21 +1,18 @@
import { existsSync, mkdirSync, readdirSync, readFile, rmSync } from "fs";
import { moveSync } from "fs-extra"
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 windows: Map<AppWindow, BrowserWindow> = new Map<AppWindow, BrowserWindow>();
@@ -36,69 +33,14 @@ export class UtilsService{
public setMainWindows(windows: Map<AppWindow, BrowserWindow>){ this.windows = windows; }
public getMainWindows(win: AppWindow){ return this.windows.get(win); }
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 async rmDirIfExist(path: string): Promise<void>{
if(!this.pathExist(path)){ return; }
return rm(path, {recursive: true, force: true});
}
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, fullPath = false): string[]{
let files = readdirSync(dirPath, { withFileTypes:true});
files = files.filter(f => f.isDirectory())
return files.map(f => fullPath ? path.join(dirPath, f.name) : f.name);
}
public async deleteFolder(folderPath: string): Promise<void>{
const folderExist = this.pathExist(folderPath);
if(!folderExist){ return; }
return rmSync(folderPath, {recursive: true});
}
public async moveDirContent(src: string, dest: string, overwrite = false): Promise<void>{
const [srcExist, destExist] = await Promise.all([this.pathExist(src), this.pathExist(dest)]);
if(!srcExist){ return; }
if(!destExist){ await this.createFolderIfNotExist(dest); }
readdirSync(src, {encoding: "utf-8"}).forEach(file => {
const srcFullPath = path.join(src, file);
const destFullPath = path.join(dest, file);
if(!overwrite && this.pathExist(destFullPath)){ return; }
moveSync(srcFullPath, destFullPath, {overwrite});
});
}
public ipcSend<T = any>(channel: string, response: IpcResponse<T>): void{
try {
Array.from(this.windows.values()).forEach(window => window.webContents.send(channel, response));
Array.from(this.windows.values()).forEach(window => window?.webContents?.send(channel, response));
} catch (error) {
log.error(error);
}
@@ -0,0 +1,117 @@
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";
import { allSettled } from "../helpers/promise.helpers";
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 allSettled(versions.map(version => this.localVersion.getVersionPath(version)));
for(const versionPath of versionPaths){
const folderPath = this.relativeToFullPath(versionPath, relativeFolder);
if(folderPath === ignorePath){ continue; }
if(await this.folderLinker.isFolderSymlink(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, ignoreSymlinkTargetError?: boolean }): Promise<string[]>{
const versionPath = await this.localVersion.getVersionPath(version);
const [rootFolders, beatSaberDataFolders] = await Promise.all([
getFoldersInFolder(versionPath, {ignoreSymlinkTargetError: options?.ignoreSymlinkTargetError}),
getFoldersInFolder(path.join(versionPath, "Beat Saber_Data"), {ignoreSymlinkTargetError: options?.ignoreSymlinkTargetError})
]);
const linkedFolders = await Promise.all([...rootFolders, ...beatSaberDataFolders].map(async folder => {
if(!(await this.folderLinker.isFolderSymlink(folder))){ return null; }
return folder;
}));
if(options?.relative){
return linkedFolders.filter(folder => folder).map(folder => path.relative(versionPath, folder));
}
return linkedFolders.filter(folder => folder);
}
public async relinkAllVersionsFolders(): Promise<void>{
const versions = await this.localVersion.getInstalledVersions();
for(const version of versions){
const linkedFolders = await this.getLinkedFolders(version, { relative: true, ignoreSymlinkTargetError: true });
const actions = linkedFolders.map(folder => ({ type: "link", version, relativeFolder: folder } as VersionLinkFolderAction));
await Promise.all(actions.map(action => this.doAction(action)));
}
}
}
@@ -51,7 +51,6 @@ export function FilterPanel({className, ref, playlist = false, filter, onChange,
firstRun.current = false;
return;
}
console.log(filter, firstFilter);
setHaveChanged(() => !equal(filter, firstFilter));
}, [filter])
@@ -214,7 +213,7 @@ export function FilterPanel({className, ref, playlist = false, filter, onChange,
</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="Appliquer" typeColor="primary" withBar={false} onClick={handleApply}/>
<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>
)}
@@ -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>
)
}))
@@ -9,7 +9,7 @@ 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, throttleTime } from "rxjs/operators"
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"
@@ -24,9 +24,10 @@ type Props = {
className?: string,
filter?: MapFilter
search?: string,
linked?: boolean
}
export const LocalMapsListPanel = forwardRef(({version, className, filter, search} : Props, forwardRef) => {
export const LocalMapsListPanel = forwardRef(({version, className, filter, search, linked} : Props, forwardRef) => {
const mapsManager = MapsManagerService.getInstance();
const mapsDownloader = MapsDownloaderService.getInstance();
@@ -35,7 +36,7 @@ export const LocalMapsListPanel = forwardRef(({version, className, filter, searc
const t = useTranslation();
const ref = useRef(null)
const isVisible = useInView(ref, {once: true});
const isVisible = useInView(ref, {once: true, amount: .5});
const [maps, setMaps] = useState<BsmLocalMap[]>(null);
const [subs] = useState<Subscription[]>([]);
const [selectedMaps$] = useState(new BehaviorSubject<BsmLocalMap[]>([]));
@@ -65,8 +66,6 @@ export const LocalMapsListPanel = forwardRef(({version, className, filter, searc
if(isVisible){
loadMaps();
subs.push(mapsManager.versionLinked$.subscribe(loadMaps));
subs.push(mapsManager.versionUnlinked$.subscribe(loadMaps));
mapsDownloader.addOnMapDownloadedListener((map, targerVersion) => {
if(targerVersion !== version){ return; }
setMaps(maps => maps ? [map, ...maps] : [map]);
@@ -79,7 +78,7 @@ export const LocalMapsListPanel = forwardRef(({version, className, filter, searc
subs.forEach(s => s.unsubscribe());
mapsDownloader.removeOnMapDownloadedListener(loadMaps);
}
}, [isVisible, version]);
}, [isVisible, version, linked]);
useEffect(() => {
@@ -117,7 +116,6 @@ export const LocalMapsListPanel = forwardRef(({version, className, filter, searc
const loadMapsObs$ = mapsManager.getMaps(version);
loadMapsObs$.pipe(map(progess => {
console.log(progess);
return Math.floor(((progess.loaded / progess.total) * 100));
})).subscribe(percent => loadPercent$.next(percent));
@@ -304,7 +302,7 @@ export const LocalMapsListPanel = forwardRef(({version, className, filter, searc
if(!maps){
return (
<div ref={ref} className={className}>
<div className="h-full flex flex-col items-center justify-center flex-wrap gap-1">
<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$}/>
@@ -316,7 +314,7 @@ export const LocalMapsListPanel = forwardRef(({version, className, filter, searc
if(!maps.length){
return (
<div ref={ref} className={className}>
<div className="h-full flex flex-col items-center justify-center flex-wrap gap-1">
<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)}}/>
@@ -11,7 +11,6 @@ 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";
@@ -21,6 +20,7 @@ import { MAP_DIFFICULTIES } from "renderer/partials/maps/map-difficulties/map-di
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";
import { useDelayedState } from "renderer/hooks/use-delayed-state.hook";
export type ParsedMapDiff = {type: BsvMapDifficultyType, name: string, stars: number}
@@ -93,7 +93,12 @@ export const MapItem = memo(({hash, title, autor, songAutor, coverUrl, songUrl,
return diffLabel;
}
const openPreview = () => linkOpener.open(previewUrl, true);
const openPreview = () => {
if(audioPlayer.playing){
audioPlayer.pause();
}
linkOpener.open(previewUrl, true);
}
const copyBsr = () => navigator.clipboard.writeText(`!bsr ${mapId}`);
const toogleMusic = () => {
if(songPlaying){
@@ -225,12 +230,12 @@ export const MapItem = memo(({hash, title, autor, songAutor, coverUrl, songUrl,
<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-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-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-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-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-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-200" iconColor={color} icon="twitch" withBar={false} onClick={e => {e.stopPropagation(); copyBsr()}}/>}
{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>
@@ -15,6 +15,10 @@ 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
@@ -25,12 +29,14 @@ 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();
@@ -38,6 +44,23 @@ export function MapsPlaylistsPanel({version}: Props) {
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 = () => {
@@ -53,9 +76,9 @@ export function MapsPlaylistsPanel({version}: Props) {
const handleMapsLinkClick = () => {
if(!mapsLinked){
return mapsService.linkVersion(version).then(loadMapIsLinked);
return mapsService.linkVersion(version);
}
return mapsService.unlinkVersion(version).then(loadMapIsLinked);
return mapsService.unlinkVersion(version);
}
const handleMapsAddClick = () => {
@@ -64,8 +87,6 @@ export function MapsPlaylistsPanel({version}: Props) {
const renderTab = (props: DetailedHTMLProps<React.HTMLAttributes<HTMLLIElement>, HTMLLIElement>, text: string, index: number): JSX.Element => {
const linkedColor = mapsLinked ? color : "red";
const onClickLink = (index: number) => {
if(index === 0){ handleMapsLinkClick(); }
}
@@ -91,10 +112,17 @@ export function MapsPlaylistsPanel({version}: Props) {
</motion.div>
)}
{(!!version) && (
<motion.div variants={variants} whileHover="hover" whileTap="tap" initial={{rotate: 0}} className="block p-0.5 h-[calc(100%-5px)] aspect-square blur-0 hover:brightness-75" 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={e => {e.stopPropagation(); onClickLink(index)}}>
<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={mapsLinked ? "link" : "unlink"} style={{color: linkedColor}} />
</motion.div>
<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>
)}
@@ -130,8 +158,8 @@ export function MapsPlaylistsPanel({version}: Props) {
<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}/>
<div className="w-full h-full shrink-0 flex flex-col justify-center items-center content-center gap-2 overflow-hidden">
<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>
@@ -21,7 +21,7 @@ export const GuardModal: ModalComponent<string> = ({resolver}) => {
<BsmImage className="mx-auto h-24" image={BeatConflict}/>
<div className="mb-4">
<label className="block font-bold tracking-wide text-gray-800 dark:text-gray-200" htmlFor="guard">{t("modals.guard.inputs.guard-code.label")}</label>
<input className="w-full bg-light-main-color-1 dark:bg-main-color-1 px-2 rounded-md py-[2px]" onChange={e => setGuardCode(e.target.value.toUpperCase())} value={guardCode} type="guard" name="guard" id="guard" placeholder={t("modals.guard.inputs.guard-code.placeholder")}/>
<input className="w-full bg-light-main-color-1 dark:bg-main-color-1 px-2 rounded-md py-[2px]" onChange={e => setGuardCode(e.target.value.toUpperCase().replaceAll(" ", ""))} value={guardCode} type="guard" name="guard" id="guard" placeholder={t("modals.guard.inputs.guard-code.placeholder")}/>
</div>
<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"/>
@@ -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 { ModalComponent, ModalExitCode } 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 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 const LoginModal: ModalComponent<{username: string, password: string, sta
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,10 +37,9 @@ export const LoginModal: ModalComponent<{username: string, password: string, sta
<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="modals.steam-login.buttons.submit"/>
@@ -0,0 +1,170 @@
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));
}
const linkAll = () => {
folders.forEach(relativeFolder => linker.linkVersionFolder({ version: data, relativeFolder, type: VersionLinkerActionType.Link }))
}
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="grid grid-flow-col gap-3 grid-cols-2">
<BsmButton icon="add" className="h-8 rounded-md flex justify-center items-center font-bold bg-light-main-color-1 dark:bg-main-color-1" iconClassName="h-6 aspect-square text-current" onClick={addFolder} withBar={false} text="modals.shared-folders.buttons.add-folder"/>
<BsmButton icon="link" className="h-8 rounded-md flex justify-center items-center font-bold" typeColor="primary" iconClassName="h-6 aspect-square text-current -rotate-45" onClick={linkAll} withBar={false} text="modals.shared-folders.buttons.link-all"/>
</div>
</form>
)
}
// -------- FOLDER ITEM --------
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(() => {
if(pending){ return; }
loadFolderIsLinked();
}, [version, relativeFolder, pending]);
const loadFolderIsLinked = () => {
linker.isVersionFolderLinked(version, relativeFolder).toPromise().then(setLinked);
}
const onClickLink = () => {
if(linked){
return linker.unlinkVersionFolder({
version,
relativeFolder,
type: VersionLinkerActionType.Unlink,
})
}
return linker.linkVersionFolder({
version,
relativeFolder,
type: VersionLinkerActionType.Link,
})
}
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>
)
}
@@ -0,0 +1,26 @@
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { LinkOpenerService } from "renderer/services/link-opener.service";
import { ModalComponent, ModalExitCode } from "renderer/services/modale.service"
export const WhyCredentialsModal: ModalComponent<void> = ({resolver}) => {
const t = useTranslation();
const linkOpener = LinkOpenerService.getInstance();
const openTutorial = () => {
linkOpener.open("https://steamcommunity.com/sharedfiles/filedetails/?id=1805934840");
}
return (
<form className="w-min">
<h1 className="text-3xl mb-2 uppercase tracking-wide w-full text-center text-gray-800 dark:text-gray-200">{t("modals.steam-credentials.title")}</h1>
<p>{t("modals.steam-credentials.p-1")}</p>
<a onClick={e => {e.preventDefault; openTutorial()}} className="underline text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-600 mb-2 block cursor-pointer">
https://steamcommunity.com/sharedfiles/filedetails/?id=1805934840
</a>
<p>{t("modals.steam-credentials.p-2")}</p>
</form>
)
}
@@ -38,7 +38,7 @@ export function Modal() {
return (
<AnimatePresence>
{ModalComponent && (
{ModalComponent && resolver && (
<div className="top-0 absolute w-screen h-screen flex content-center items-center justify-center z-[90]">
<motion.span key="modal-overlay" onClick={() => modalSevice.resolve({exitCode: ModalExitCode.NO_CHOICE})} className="absolute top-0 bottom-0 right-0 left-0 bg-black" initial={{opacity: 0}} animate={{opacity: ModalComponent && .60}} exit={{opacity: 0}} transition={{duration: .2}}/>
<motion.div key="modal" initial={{y: "100vh"}} animate={{y: 0}} exit={{y: "100vh"}}>
@@ -26,8 +26,8 @@ export function NavBar() {
<nav id='nav-bar' className='z-10 flex flex-col h-full max-h-full items-center p-1 bg-light-main-color-1 dark:bg-main-color-1'>
<BsManagerIcon className='relative aspect-square w-16 h-16 mb-3'/>
<ol id='versions' className='w-fit max-w-[120px] relative left-[2px] grow overflow-y-hidden scrollbar-track-transparent scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900 hover:overflow-y-scroll'>
<MapsNavBarItem/>
<NavBarSpliter/>
<MapsNavBarItem/>
<NavBarSpliter/>
{installedVersions && installedVersions.map((version) => <BsVersionItem key={JSON.stringify(version)} version={version}/>)}
</ol>
<NavBarSpliter/>
@@ -16,6 +16,7 @@ export const NotificationItem = forwardRef(({resolver, notification}: {resolver?
const renderImage = (() => {
if(notification.type === NotificationType.SUCCESS){ return BeatRunningImg; }
if(notification.type === NotificationType.WARNING){ return BeatWaitingImg; }
if(notification.type === NotificationType.INFO){ return BeatWaitingImg; }
if(notification.type === NotificationType.ERROR){ return BeatConflictImg; }
return BeatImpatientImg;
})();
@@ -23,6 +24,7 @@ export const NotificationItem = forwardRef(({resolver, notification}: {resolver?
const renderNeonColors = (() => {
if(notification.type === NotificationType.SUCCESS){ return "bg-green-400 shadow-green-400"; }
if(notification.type === NotificationType.WARNING){ return "bg-yellow-400 shadow-yellow-400"; }
if(notification.type === NotificationType.INFO){ return "bg-blue-500 shadow-blue-500"; }
if(notification.type === NotificationType.ERROR){ return "bg-red-500 shadow-red-500"; }
return "bg-gray-800 shadow-gray-800 dark:bg-white dark:shadow-white";
})();
@@ -24,7 +24,7 @@ export function BsmProgressBar() {
return (
<AnimatePresence> { visible &&
<motion.div initial={{y: "120%"}} animate={{y:"0%"}} exit={{y:"120%"}} className="w-full absolute h-14 flex justify-center items-center bottom-2 pointer-events-none" style={style}>
<motion.div initial={{y: "120%"}} animate={{y:"0%"}} exit={{y:"120%"}} className="w-full absolute h-14 flex justify-center items-center bottom-2 pointer-events-none z-10" style={style}>
<div className={`flex items-center content-center justify-center bottom-9 z-10 rounded-full bg-light-main-color-2 dark:bg-main-color-2 shadow-center shadow-black transition-all duration-300 ${!progressValue && "h-14 w-14 "} ${!!progressValue && "h-5 w-3/4 p-[6px]"}`}>
{ !!progressValue && (
<div className="relative h-full w-full rounded-full bg-black">
@@ -14,7 +14,7 @@ export default function SettingColorChooser({color, onChange, pickerClassName}:
<span className="z-[1] block h-full w-full border-2 border-white rounded-full" onClick={() => setColorVisible(!colorVisible)} style={{backgroundColor: color}}/>
<AnimatePresence>
{colorVisible &&
<motion.div initial={{opacity: 0}} animate={{opacity: 1}} transition={{duration: .1}} exit={{opacity: 0}} className="fixed flex items-center justify-center translate-y-9 shadow-lg rounded-lg shadow-black">
<motion.div initial={{opacity: 0}} animate={{opacity: 1}} transition={{duration: .1}} exit={{opacity: 0}} className="absolute flex items-center justify-center translate-y-9 shadow-lg rounded-lg shadow-black">
<div className="absolute w-2/4 aspect-square rotate-45 bg-light-main-color-3 dark:bg-main-color-3 -translate-y-12"/>
<HexColorPicker color={color} onChange={onChange} className={pickerClassName} />
</motion.div>
@@ -15,19 +15,19 @@ export function SupporterItem({supporter, delay}: Props) {
const additionnalStyles: CSSProperties = (() => {
const commonStyles: CSSProperties = {backgroundImage: `url(${txtBg})`, backgroundRepeat: "no-repeat", backgroundPosition: "center"}
if(supporter.type === "gold"){ return {color: "#ffe270", textShadow: "0px 0px 10px #ffdd59", backgroundSize: "70% 15px", ...commonStyles}; }
if(supporter.type === "diamond"){ return {color: "#e574fc", textShadow: "0px 0px 15px #e056fd", backgroundSize: "70% 19px", ...commonStyles}; }
if(supporter.type === "diamond"){ return {color: "#0ef2f8", textShadow: "0px 0px 15px #0ef2f8", backgroundSize: "70% 19px", ...commonStyles}; }
if(supporter.type === "sponsor"){ return {color: "#0be881", textShadow: "0px 0px 15px #0be881", backgroundSize: "70% 19px", ...commonStyles}; }
return {};
})();
const renderSpan = () => {
return <motion.span className="text-2xl font-bold px-3 pb-1" style={additionnalStyles} initial={{y: "100%", opacity: 0}} animate={{y: 0, opacity: 1}} transition={{delay: delay}}>{supporter.username}</motion.span>;
return <motion.span className={`text-2xl font-bold px-3 pb-1 ${supporter.link && "cursor-pointer underline"}`} style={additionnalStyles} onClick={openSupporterLink} initial={{y: "100%", opacity: 0}} animate={{y: 0, opacity: 1}} transition={{delay: delay}}>{supporter.username}</motion.span>;
}
const renderItem = () => {
if(supporter.type !== "sponsor"){ return renderSpan(); }
return (
<motion.div className={`flex flex-col justify-center items-center mx-4 ${supporter.link && "cursor-pointer"}`} onClick={openSupporterLink} initial={{y: "100%", opacity: 0}} animate={{y: 0, opacity: 1}} transition={{delay: delay}}>
<motion.div className={`flex flex-col justify-center items-center mx-4 ${supporter.link && "cursor-pointer underline"}`} onClick={openSupporterLink} initial={{y: "100%", opacity: 0}} animate={{y: 0, opacity: 1}} transition={{delay: delay}}>
<img className="max-w-xs max-h-52 mb-2" src={supporter.img}/>
{renderSpan()}
</motion.div>
@@ -6,7 +6,7 @@ import { useClickOutside } from "renderer/hooks/use-click-outside.hook";
import { useThemeColor } from "renderer/hooks/use-theme-color.hook";
import { getCorrectTextColor } from "renderer/helpers/correct-text-color";
type BsmButtonType = "primary"|"success"|"cancel"|"error";
type BsmButtonType = "primary"|"secondary"|"success"|"cancel"|"error";
type Props = {
className?: string,
@@ -36,7 +36,7 @@ export function BsmButton({className, style, imgClassName, iconClassName, icon,
const ref = useRef(null);
useClickOutside(ref, onClickOutside);
const primaryColor = typeColor === "primary" && useThemeColor("first-color");
const primaryColor = typeColor === "primary" ? useThemeColor("first-color") : typeColor === "secondary" ? secondColor : undefined;
const textColor = (() => {
if(primaryColor){ return getCorrectTextColor(primaryColor); }
@@ -57,7 +57,7 @@ export function BsmButton({className, style, imgClassName, iconClassName, icon,
return (
<div ref={ref} onClick={handleClick} title={t(title)} className={`${className} overflow-hidden cursor-pointer group ${(!withBar && !disabled && (!!typeColor || !!color)) && "hover:brightness-[1.15]"} ${disabled && "brightness-75 cursor-not-allowed"} ${renderTypeColor}`} style={{...style, backgroundColor: primaryColor || color}}>
{ image && <BsmImage image={image} className={imgClassName}/> }
{ icon && <BsmIcon icon={icon} className={iconClassName ?? "h-full w-full text-gray-800 dark:text-white"} style={{color: iconColor}}/> }
{ icon && <BsmIcon icon={icon} className={iconClassName ?? "h-full w-full text-gray-800 dark:text-white"} style={{color: iconColor || textColor}}/> }
{text && (type === "submit" ? <button type="submit" className={textClassName || "h-full w-full"} style={{...(!!textColor && {color: textColor})}}>{t(text)}</button> : <span className={textClassName} style={{...(!!textColor && {color: `${textColor}`})}}>{t(text)}</span>)}
{ withBar && (
<div className="absolute bottom-0 left-0 w-full h-1 bg-current" style={{color: secondColor}}>
@@ -11,9 +11,10 @@ type Props = {
max: number,
step?: number,
renderLabel?: (value: number) => JSX.Element,
colors?: string[]
}
export function BsmRange({colorType = "first-color", values, onChange, onFinalChange, min, max, renderLabel, step = 1} : Props) {
export function BsmRange({colorType = "first-color", values, onChange, onFinalChange, min, max, renderLabel, step = 1, colors} : Props) {
const color = useThemeColor(colorType);
const labelTextColor = getCorrectTextColor(color);
@@ -35,10 +36,10 @@ export function BsmRange({colorType = "first-color", values, onChange, onFinalCh
style={{
...props.style,
background: getTrackBackground({
values: values,
colors: ["#ccc", color, "#ccc"],
min: min,
max: max
values,
colors: colors ?? ["#ccc", color, "#ccc"],
min,
max
}),
}}
>
@@ -48,12 +48,16 @@ import { TwitterIcon } from "./icons/twitter-icon.component";
import { Mee6Icon } from "./icons/mee6-icon.component";
import { InfoIcon } from "./icons/info-icon.component";
import { SyncIcon } from "./icons/sync-icon.component";
import { VolumeUpIcon } from "./icons/volume-up-icon.component";
import { VolumeOffIcon } from "./icons/volume-off-icon.component";
import { VolumeDownIcon } from "./icons/volume-down-icon.component";
import { GermanIcon } from "./flags/german-icon.component";
export type BsmIconType = BsvMapCharacteristic | (
"settings"|"trash"|"favorite"|"folder"|"bsNote"|"check"|"three-dots"|"twitch"|"eye"|"play"|"checkCircleIcon"|"discord"|"info"|
"terminal"|"desktop"|"oculus"|"add"|"cross"|"task"|"github"|"close"|"thumbUpFill"|"timerFill"|"pause"|"twitter"|"sync"|
"copy"|"steam"|"edit"|"export"|"patreon"|"search"|"bsMapDifficulty"|"link"|"unlink"|"download"|"filter"|"mee6"|
"fr-FR-flag"|"es-ES-flag"|"en-US-flag"|"en-EN-flag"
"copy"|"steam"|"edit"|"export"|"patreon"|"search"|"bsMapDifficulty"|"link"|"unlink"|"download"|"filter"|"mee6"|"volume-up"|"volume-off"|"volume-down"|
"fr-FR-flag"|"es-ES-flag"|"en-US-flag"|"en-EN-flag"|"de-DE-flag"
);
export const BsmIcon = memo(({className, icon, style}: {className?: string, icon: BsmIconType, style?: CSSProperties}) => {
@@ -73,6 +77,7 @@ export const BsmIcon = memo(({className, icon, style}: {className?: string, icon
if(icon === "es-ES-flag"){ return <SpainIcon className={className} style={style}/> }
if(icon === "en-US-flag"){ return <UsaIcon className={className} style={style}/> }
if(icon === "en-EN-flag"){ return <UkIcon className={className} style={style}/> }
if(icon === "de-DE-flag"){ return <GermanIcon className={className} style={style}/> }
if(icon === "task"){ return <TaskIcon className={className} style={style}/> }
if(icon === "copy"){ return <CopyIcon className={className} style={style}/> }
if(icon === "steam"){ return <SteamIcon className={className} style={style}/> }
@@ -107,6 +112,9 @@ export const BsmIcon = memo(({className, icon, style}: {className?: string, icon
if(icon === "mee6"){ return <Mee6Icon className={className} style={style}/> }
if(icon === "info"){ return <InfoIcon className={className} style={style}/> }
if(icon === "sync"){ return <SyncIcon className={className} style={style}/> }
if(icon === "volume-up"){ return <VolumeUpIcon className={className} style={style}/> }
if(icon === "volume-down"){ return <VolumeDownIcon className={className} style={style}/> }
if(icon === "volume-off"){ return <VolumeOffIcon className={className} style={style}/> }
return <TrashIcon className={className} style={style}/>
}
@@ -0,0 +1,20 @@
import { CSSProperties } from "react";
export function GermanIcon(props: {className?: string, style?: CSSProperties}) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="71px" height="48px" viewBox="0 0 71 48" version="1.1" className={props.className} style={props.style}>
<defs/>
<g id="Flags" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" transform="translate(-239.000000, -805.000000)">
<g transform="translate(70.000000, 70.000000)" fill-rule="nonzero" id="Germany">
<g transform="translate(169.000000, 735.000000)">
<g id="Bolivia-9">
<path d="M0.52,7 L0.52,16 L70.52,16 L70.52,7 C70.52,3.33282926 67.5471707,0.36 63.88,0.36 L7.17,0.36 C5.40723053,0.357345224 3.71575038,1.05574249 2.46834517,2.3012719 C1.22093997,3.54680131 0.519998001,5.23722853 0.52,7 Z" id="Shape" fill="#434A54"/>
<polygon id="Shape" fill="#ED5565" points="0.52 31.74 70.52 31.74 70.52 16.07 0.52 16.07"/>
<path d="M0.52,40.76 C0.52,44.4271707 3.49282926,47.4 7.16,47.4 L63.88,47.4 C67.5471707,47.4 70.52,44.4271707 70.52,40.76 L70.52,31.76 L0.52,31.76 L0.52,40.76 Z" id="Shape" fill="#F6BB42"/>
</g>
</g>
</g>
</g>
</svg>
)
}
@@ -2,7 +2,7 @@ import { CSSProperties } from "react";
export function LinkIcon(props: {className?: string, style?: CSSProperties}) {
return (
<svg className={props.className} style={props.style} stroke="currentColor" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" strokeWidth="48" strokeLinecap="round" strokeLinejoin="round">
<svg className={props.className} style={props.style} stroke="currentColor" fill="none" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg" strokeWidth="48" strokeLinecap="round" strokeLinejoin="round">
<path d="M200.66,352H144a96,96,0,0,1,0-192h55.41"/>
<path d="M312.59,160H368a96,96,0,0,1,0,192H311.34"/>
<line x1="169.07" x2="344.93" y1="256" y2="256"/>
@@ -4,7 +4,7 @@ export function TwitterIcon(props: {className?: string, style?: CSSProperties})
return (
<svg className={props.className} style={props.style} viewBox="0 0 24 24" fill="currentColor">
<g>
<path d="M23.643 4.937c-.835.37-1.732.62-2.675.733.962-.576 1.7-1.49 2.048-2.578-.9.534-1.897.922-2.958 1.13-.85-.904-2.06-1.47-3.4-1.47-2.572 0-4.658 2.086-4.658 4.66 0 .364.042.718.12 1.06-3.873-.195-7.304-2.05-9.602-4.868-.4.69-.63 1.49-.63 2.342 0 1.616.823 3.043 2.072 3.878-.764-.025-1.482-.234-2.11-.583v.06c0 2.257 1.605 4.14 3.737 4.568-.392.106-.803.162-1.227.162-.3 0-.593-.028-.877-.082.593 1.85 2.313 3.198 4.352 3.234-1.595 1.25-3.604 1.995-5.786 1.995-.376 0-.747-.022-1.112-.065 2.062 1.323 4.51 2.093 7.14 2.093 8.57 0 13.255-7.098 13.255-13.254 0-.2-.005-.402-.014-.602.91-.658 1.7-1.477 2.323-2.41z"></path>
<path d="M23.643 4.937c-.835.37-1.732.62-2.675.733.962-.576 1.7-1.49 2.048-2.578-.9.534-1.897.922-2.958 1.13-.85-.904-2.06-1.47-3.4-1.47-2.572 0-4.658 2.086-4.658 4.66 0 .364.042.718.12 1.06-3.873-.195-7.304-2.05-9.602-4.868-.4.69-.63 1.49-.63 2.342 0 1.616.823 3.043 2.072 3.878-.764-.025-1.482-.234-2.11-.583v.06c0 2.257 1.605 4.14 3.737 4.568-.392.106-.803.162-1.227.162-.3 0-.593-.028-.877-.082.593 1.85 2.313 3.198 4.352 3.234-1.595 1.25-3.604 1.995-5.786 1.995-.376 0-.747-.022-1.112-.065 2.062 1.323 4.51 2.093 7.14 2.093 8.57 0 13.255-7.098 13.255-13.254 0-.2-.005-.402-.014-.602.91-.658 1.7-1.477 2.323-2.41z"/>
</g>
</svg>
)
@@ -0,0 +1,9 @@
import { CSSProperties } from "react";
export function VolumeDownIcon(props: {className?: string, style?: CSSProperties}) {
return (
<svg className={props.className} style={props.style} xmlns="http://www.w3.org/2000/svg" viewBox="0 96 960 960" fill="currentColor">
<path d="M251.283 675.999q-13.564 0-22.423-8.859-8.859-8.859-8.859-22.423V507.283q0-13.564 8.859-22.423 8.859-8.859 22.423-8.859h117.179L486.794 357.67q14.769-14.769 33.987-6.91 19.218 7.858 19.218 28.781v392.661q0 21.18-19.218 29.038-19.218 7.859-33.987-6.91L368.462 675.999H251.283Zm374.358 49.949V424.463q43.05 19.102 68.704 60.551 25.654 41.448 25.654 90.986 0 50.205-25.654 90.525-25.654 40.32-68.704 59.423ZM489.744 429.436l-99.129 96.82H270.256v99.488h120.359l99.129 97.23V429.436ZM378.923 576Z"/>
</svg>
)
}
@@ -0,0 +1,9 @@
import { CSSProperties } from "react";
export function VolumeOffIcon(props: {className?: string, style?: CSSProperties}) {
return (
<svg className={props.className} style={props.style} xmlns="http://www.w3.org/2000/svg" viewBox="0 96 960 960" fill="currentColor">
<path d="M770.974 963.435 663.179 855.64q-15.436 9.948-31.423 18.512-15.987 8.564-33.244 15-12.845 4.846-23.909-3.397-11.064-8.243-11.064-22.756 0-6.82 4.013-12.064 4.012-5.243 10.243-7.397 12.872-4.487 25.436-10.41t24-13.692L468.153 659.948v112.254q0 21.18-19.218 29.038-19.217 7.859-33.986-6.91L296.617 675.999H179.438q-13.564 0-22.423-8.859-8.859-8.859-8.859-22.423V507.283q0-13.564 8.859-22.423 8.859-8.859 22.423-8.859H283.54L94.155 286.36q-7.23-7.231-7.218-17.705.013-10.474 7.628-18.089 7.616-7.359 17.692-7.359 10.077 0 17.692 7.359l677.485 677.075q7.231 7.231 7.295 17.705.064 10.474-7.295 18.089-7.615 7.615-18.23 7.615t-18.23-7.615ZM598.512 260.591q97.769 38.231 157.551 123.423Q815.845 469.206 815.845 575q0 51.795-15.449 100.09t-44.398 90.217l-35.819-35.819q22.59-34.026 34-73.193Q765.59 617.129 765.59 575q0-91.743-51.308-165.628-51.308-73.885-136.487-103.321-6.82-2.153-10.538-7.692-3.718-5.538-3.718-12.358 0-14.051 11.269-22.025 11.269-7.974 23.704-3.385ZM376.257 568.718Zm257.28 74.129-69.998-69.999V427.847q40.461 22 62.538 61.961Q648.153 529.77 648.153 576q0 17.693-3.654 34.5-3.654 16.808-10.962 32.347ZM468.153 477.463l-86.306-86.692 33.102-33.101q14.769-14.769 33.986-6.782 19.218 7.987 19.218 28.653v97.922Zm-50.255 247.819V610.359l-84.103-84.103H198.411v99.488H318.36l99.538 99.538Z"/>
</svg>
)
}
@@ -0,0 +1,9 @@
import { CSSProperties } from "react";
export function VolumeUpIcon(props: {className?: string, style?: CSSProperties}) {
return (
<svg className={props.className} style={props.style} xmlns="http://www.w3.org/2000/svg" viewBox="0 96 960 960" fill="currentColor">
<path d="M596.512 889.152q-12.846 4.846-23.91-3.416-11.063-8.263-11.063-22.794 0-6.763 4.012-12.007 4.013-5.243 10.244-7.397 84.769-32 136.282-104.936Q763.589 665.667 763.589 575t-51.512-163.808q-51.513-73.141-136.282-104.73-6.821-2.154-10.539-7.965-3.717-5.812-3.717-12.587 0-13.96 11.268-21.934 11.269-7.974 23.705-3.385 97.64 38.231 157.486 123.339 59.846 85.107 59.846 191.07t-59.846 191.07q-59.846 85.108-157.486 123.082ZM177.438 675.999q-13.468 0-22.375-8.907t-8.907-22.375V507.283q0-13.468 8.907-22.375t22.375-8.907h117.178L412.948 357.67q14.769-14.769 33.987-6.722 19.218 8.047 19.218 28.593v392.661q0 20.803-19.218 28.85t-33.987-6.722L294.616 675.999H177.438Zm374.357 49.949V424.463q43.051 19.102 68.704 60.551 25.654 41.448 25.654 90.986 0 50.205-25.654 90.525-25.653 40.32-68.704 59.423ZM415.898 429.436l-99.128 96.82H196.411v99.488H316.77l99.128 97.23V429.436ZM318.872 576Z"/>
</svg>
)
}
@@ -1,37 +1,62 @@
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { useObservable } from 'renderer/hooks/use-observable.hook';
import { useThemeColor } from 'renderer/hooks/use-theme-color.hook';
import { AudioPlayerService } from 'renderer/services/audio-player.service';
import { IpcService } from 'renderer/services/ipc.service';
import { WindowManagerService } from 'renderer/services/window-manager.service';
import { AppWindow } from 'shared/models/window-manager/app-window.model';
import { BsmButton } from '../shared/bsm-button.component';
import { BsmRange } from '../shared/bsm-range.component';
import { BsmIconType } from '../svgs/bsm-icon.component';
import './title-bar.component.css'
export default function TitleBar({template = "index.html"} : {template: AppWindow}) {
const ipcService = IpcService.getInstance();
const windows = WindowManagerService.getInstance();
const ipcService = IpcService.getInstance();
const windows = WindowManagerService.getInstance();
const audio = AudioPlayerService.getInstance();
const [maximized, setMaximized] = useState(false);
const volume = useObservable(audio.volume$, audio.volume);
const color = useThemeColor("first-color");
const closeWindow = () => {
return windows.close(template);
const [previewVersion, setPreviewVersion] = useState(null);
useEffect(() => {
ipcService.send<string>("current-version").then(res => {
if(res.data.toLocaleLowerCase().includes("alpha")){ return setPreviewVersion("ALPHA"); }
if(res.data.toLocaleLowerCase().includes("beta")){ return setPreviewVersion("BETA"); }
});
})
const [maximized, setMaximized] = useState(false);
const closeWindow = () => {
return windows.close(template);
}
const maximizeWindow = () => {
ipcService.sendLazy('window.maximize');
}
const maximizeWindow = () => {
ipcService.sendLazy('window.maximize');
}
const minimizeWindow = () => {
ipcService.sendLazy('window.minimize');
}
const minimizeWindow = () => {
ipcService.sendLazy('window.minimize');
}
const resetWindow = () => {
ipcService.sendLazy('window.reset');
}
const resetWindow = () => {
ipcService.sendLazy('window.reset');
}
const toogleMaximize = () => {
if(maximized){ resetWindow(); }
else{ maximizeWindow(); }
setMaximized(!maximized);
}
const toogleMaximize = () => {
if(maximized){ resetWindow(); }
else{ maximizeWindow(); }
setMaximized(!maximized);
}
const volumeIcon: BsmIconType = (() => {
if(volume.muted || !volume.volume){ return "volume-off"; }
if(volume.volume < .5){ return "volume-down"; }
return "volume-up";
})()
if(template === "index.html"){
@@ -40,9 +65,16 @@ export default function TitleBar({template = "index.html"} : {template: AppWindo
<div id="drag-region" className='grow basis-0 h-full'>
<div id="window-title" className='pl-1'>
<span className='text-gray-800 dark:text-gray-100 font-bold text-xs italic'>BSManager</span>
{ previewVersion && <span className='bg-main-color-1 text-white dark:text-black dark:bg-white rounded-full ml-1 text-[10px] italic px-1 uppercase h-3.5 font-bold'>{previewVersion}</span> }
</div>
</div>
<div id="window-controls" className="h-full flex shrink-0">
<div id="window-controls" className="h-full flex shrink-0 items-center">
<div className='h-full text-gray-800 dark:text-gray-200 pr-1 cursor-pointer flex flex-row justify-end items-center gap-2 group pl-5'>
<div className='shrink-0 w-0 overflow-hidden transition-all group-hover:w-16 group-hover:overflow-visible group-active:w-16 group-active:overflow-visible text-main-color-3'>
<BsmRange min={0} max={1} step={.01} values={[volume.muted ? 0 : volume.volume]} colors={[color, "currentColor"]} onChange={val => audio.setVolume(val[0])} onFinalChange={val => audio.setFinalVolume(val[0])}/>
</div>
<BsmButton className='shrink-0 h-[23px] w-[23px] aspect-square !bg-transparent flex items-start' iconClassName={volumeIcon === "volume-down" ? "-translate-x-[1.8px]" : null} icon={volumeIcon} withBar={false} onClick={() => audio.toggleMute()}/>
</div>
<div onClick={minimizeWindow} className="text-gray-800 dark:text-gray-200 hover:bg-gray-300 dark:hover:bg-[#4F545C] cursor-pointer w-11 h-full shrink-0 flex justify-center items-center" id="min-button" >
<svg aria-hidden="false" width="12" height="12" viewBox="0 0 12 12"><rect fill="currentColor" width="10" height="1" x="1" y="6"> </rect></svg>
</div>
@@ -1,6 +1,8 @@
import { useState } from "react";
import { motion } from "framer-motion";
import { ChangeEvent, useEffect, useState } from "react";
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { useObservable } from "renderer/hooks/use-observable.hook";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { BSLauncherService, LaunchMods } from "renderer/services/bs-launcher.service";
import { ConfigurationService } from "renderer/services/configuration.service";
import { BSVersion } from "shared/bs-version.interface"
@@ -10,31 +12,42 @@ type Props = {version: BSVersion};
export function LaunchSlide({version}: Props) {
const t = useTranslation();
const configService = ConfigurationService.getInstance();
const bsLauncherService = BSLauncherService.getInstance();
const [oculusMode, setOculusMode] = useState(!!configService.get<boolean>(LaunchMods.OCULUS_MOD));
const [desktopMode, setDesktopMode] = useState(!!configService.get<boolean>(LaunchMods.DESKTOP_MOD));
const [debugMode, setDebugMode] = useState(!!configService.get<boolean>(LaunchMods.DEBUG_MOD));
const [advancedLaunch, setAdvancedLaunch] = useState(false);
const [additionalArgsString, setAdditionalArgsString] = useState<string>(configService.get<string>("additionnal-args") || "");
const launchState = useObservable(bsLauncherService.launchState$);
useEffect(() => {
configService.set("additionnal-args", additionalArgsString);
}, [additionalArgsString]);
const setMode = (mode: LaunchMods, value: boolean) => {
if(mode === LaunchMods.DEBUG_MOD){ setDebugMode(value); }
if(mode === LaunchMods.DEBUG_MOD){
setDebugMode(value);
}
else if(mode === LaunchMods.OCULUS_MOD){
setOculusMode(value);
setDesktopMode(false);
configService.set(LaunchMods.DESKTOP_MOD, false);
setOculusMode(value);
}
else if(mode === LaunchMods.DESKTOP_MOD){
setDesktopMode(value);
setOculusMode(false);
configService.set(LaunchMods.OCULUS_MOD, false);
setDesktopMode(value);
}
configService.set(mode, value);
}
const launch = () => bsLauncherService.launch(version, version.oculus ? false : oculusMode, desktopMode, debugMode)
const handleAdditionalArgsChange = (e: ChangeEvent<HTMLInputElement>) => setAdditionalArgsString(() => e.target.value);
const launch = () => {
const additionalArgs = advancedLaunch ? additionalArgsString.split(";").map(arg => arg.trim()).filter(arg => arg.length > 0) : undefined;
bsLauncherService.launch(version, version.oculus ? false : oculusMode, desktopMode, debugMode, additionalArgs);
}
return (
<div className="w-full shrink-0 items-center relative flex flex-col justify-start">
@@ -43,8 +56,14 @@ export function LaunchSlide({version}: Props) {
<LaunchModToogle infoText="pages.version-viewer.launch-mods.desktop-description" icon='desktop' onClick={() => setMode(LaunchMods.DESKTOP_MOD, !desktopMode)} active={desktopMode} text="pages.version-viewer.launch-mods.desktop"/>
<LaunchModToogle infoText="pages.version-viewer.launch-mods.debug-description" icon='terminal' onClick={() => setMode(LaunchMods.DEBUG_MOD, !debugMode)} active={debugMode} text="pages.version-viewer.launch-mods.debug"/>
</div>
<div className="pt-4 w-2/3 flex flex-col items-center gap-3">
<BsmButton className="rounded-full w-fit text-lg py-1 px-7 shadow-md shadow-black bg-light-main-color-2 dark:bg-main-color-2 text-gray-800 dark:text-white" text="pages.version-viewer.launch-mods.advanced-launch.button" withBar={false} onClick={e => {e.preventDefault(); setAdvancedLaunch(prev => !prev)}}/>
<motion.div className="bg-light-main-color-2 dark:bg-main-color-2 h-9 rounded-full overflow-hidden flex items-center justify-center" initial={{width: "0px"}} animate={{width: advancedLaunch ? "100%" : "0px"}}>
<input className="w-[calc(100%-12px)] h-[calc(100%-12px)] bg-light-main-color-1 dark:bg-main-color-1 text-black dark:text-white rounded-full outline-none text-center" type="text" placeholder={t("pages.version-viewer.launch-mods.advanced-launch.placeholder")} value={additionalArgsString} onChange={handleAdditionalArgsChange}/>
</motion.div>
</div>
<div className='grow flex justify-center items-center'>
<BsmButton onClick={launch} active={JSON.stringify(version) === JSON.stringify(launchState)} className='relative text-5xl text-gray-800 dark:text-gray-200 font-bold tracking-wide pt-1 pb-3 px-7 rounded-lg shadow-md italic shadow-black active:scale-90 transition-transform' text="misc.launch"/>
<BsmButton onClick={launch} active={JSON.stringify(version) === JSON.stringify(launchState)} className='relative -translate-y-1/2 text-5xl text-gray-800 dark:text-gray-200 font-bold tracking-wide pt-1 pb-3 px-7 rounded-lg shadow-md italic shadow-black active:scale-90 transition-transform' text="misc.launch"/>
</div>
</div>
)
@@ -69,16 +69,14 @@ export function ModsGrid({modsMap, installed, modsSelected, onModChange, moreInf
]}/>
</span>
{
Array.from(modsMap.keys()).map(key => modsMap.get(key).some(mod => mod.name.toLowerCase().includes(filter)) && (
{Array.from(modsMap.keys()).map(key => modsMap.get(key).some(mod => mod.name.toLowerCase().includes(filter)) && (
<ul key={key} className="contents">
<h2 className="col-span-full py-1 font-bold pl-3">{key}</h2>
{modsMap.get(key).map(mod => mod.name.toLowerCase().includes(filter) && (
<ModItem key={mod.name} className="contents bg-light-main-color-3 dark:bg-main-color-1 text-main-color-1 dark:text-light-main-color-1 hover:cursor-pointer" mod={mod} installedVersion={installedModVersion(key, mod)} isDependency={isDependency(mod)} isSelected={isSelected(mod)} onChange={(val) => onModChange(val, mod)} onWantInfo={onWantInfos} wantInfo={mod.name === moreInfoMod?.name}/>
))}
</ul>
))
}
))}
</div>
)
}
@@ -17,6 +17,7 @@ import { useInView } from "framer-motion";
import { ModalExitCode, ModalService } from "renderer/services/modale.service";
import { ModsDisclaimerModal } from "renderer/components/modal/modal-types/mods-disclaimer-modal.component";
import { OsDiagnosticService } from "renderer/services/os-diagnostic.service";
import { lt } from "semver";
export function ModsSlide({version, onDisclamerDecline}: {version: BSVersion, onDisclamerDecline: () => void}) {
@@ -68,7 +69,12 @@ export function ModsSlide({version, onDisclamerDecline}: {version: BSVersion, on
const installMods = () => {
if(installing){ return; }
modsManager.installMods(modsSelected, version).then(() => {
const modsToInstall = modsSelected.filter(mod => {
const corespondingMod = modsAvailable.get(mod.category).find(availabeMod => availabeMod._id === mod._id);
if(lt(corespondingMod.version, mod.version)){ return false; }
return true;
})
modsManager.installMods(modsToInstall, version).then(() => {
loadMods();
});
}
@@ -129,32 +135,49 @@ export function ModsSlide({version, onDisclamerDecline}: {version: BSVersion, on
if(modsAvailable){
setDownloadWidth(downloadRef?.current?.offsetWidth)
}
}, [modsAvailable])
}, [modsAvailable]);
const renderContent = () => {
if(!isOnline){ return <ModStatus text="pages.version-viewer.mods.no-internet" image={BeatConflictImg}/> }
if(!modsAvailable){ return <ModStatus text="pages.version-viewer.mods.loading-mods" image={BeatWaitingImg} spin/> }
if(!modsAvailable.size){ return <ModStatus text="pages.version-viewer.mods.mods-not-available" image={BeatConflictImg}/> }
return (
<>
<div className="grow overflow-scroll w-full min-h-0 scrollbar-thin scrollbar-thumb-neutral-900 scrollbar-thumb-rounded-full">
<ModsGrid modsMap={modsAvailable} installed={modsInstalled} modsSelected={modsSelected} onModChange={handleModChange} moreInfoMod={moreInfoMod} onWantInfos={handleMoreInfo}/>
</div>
<div className="h-10 shrink-0 flex items-center justify-between px-3">
<BsmButton className="text-center rounded-md px-2 py-[2px]" text="pages.version-viewer.mods.buttons.more-infos" typeColor="cancel" withBar={false} disabled={!moreInfoMod} onClick={handleOpenMoreInfo} style={{width: downloadWith}}/>
<div ref={downloadRef}>
<BsmButton className="text-center rounded-md px-2 py-[2px]" text="pages.version-viewer.mods.buttons.install-or-update" withBar={false} disabled={installing} typeColor="primary" onClick={installMods}/>
</div>
</div>
</>
)
}
return (
<div ref={ref} className='shrink-0 w-full h-full px-8 pb-7 flex justify-center'>
<div className='relative flex flex-col grow-0 bg-light-main-color-2 dark:bg-main-color-2 h-full w-full rounded-md shadow-black shadow-center overflow-hidden'>
{isOnline && modsAvailable ? (
<>
<div className="overflow-scroll w-full min-h-0 scrollbar-thin scrollbar-thumb-neutral-900 scrollbar-thumb-rounded-full">
<ModsGrid modsMap={modsAvailable} installed={modsInstalled} modsSelected={modsSelected} onModChange={handleModChange} moreInfoMod={moreInfoMod} onWantInfos={handleMoreInfo}/>
</div>
<div className="h-10 shrink-0 flex items-center justify-between px-3">
<BsmButton className="text-center rounded-md px-2 py-[2px]" text="pages.version-viewer.mods.buttons.more-infos" typeColor="cancel" withBar={false} disabled={!moreInfoMod} onClick={handleOpenMoreInfo} style={{width: downloadWith}}/>
<div ref={downloadRef}>
<BsmButton className="text-center rounded-md px-2 py-[2px]" text="pages.version-viewer.mods.buttons.install-or-update" withBar={false} disabled={installing} typeColor="primary" onClick={installMods}/>
</div>
</div>
</>
) : (
<div className="w-full h-full flex flex-col items-center justify-center">
<img className={`w-32 h-32 ${isOnline && "spin-loading"}`} src={isOnline ? BeatWaitingImg : BeatConflictImg} alt=" "/>
<span className="text-xl mt-3 h-0 italic">{t(isOnline ? "pages.version-viewer.mods.loading-mods" : "pages.version-viewer.mods.no-internet")}</span>
</div>
)}
{renderContent()}
</div>
</div>
)
}
function ModStatus({text, image, spin = false}: {text: string, image: string, spin?: boolean}) {
const t = useTranslation();
return (
<div className="w-full h-full flex flex-col items-center justify-center text-gray-800 dark:text-gray-200">
<img className={`w-32 h-32 ${spin ? "spin-loading": ""}`} src={image} alt=" "/>
<span className="text-xl mt-3 h-0 italic">{t(text)}</span>
</div>
)
}
@@ -3,10 +3,15 @@ export const defaultConfiguration: {[key in DefaultConfigKey]: any} = {
"second-color": "#ff4444",
"theme": "os",
"language": window.navigator.language.length <= 2 ? `${window.navigator.language}-${window.navigator.language.toLocaleUpperCase()}` : window.navigator.language,
"supported_languages": ["en-US", "en-EN", "fr-FR", "es-ES"],
"default_mods": ["SongCore", "WhyIsThereNoLeaderboard", "BeatSaverDownloader", "BeatSaverVoting", "PlaylistManager"]
"supported_languages": ["en-US", "en-EN", "fr-FR", "es-ES", "de-DE"],
"default_mods": ["SongCore", "WhyIsThereNoLeaderboard", "BeatSaverDownloader", "BeatSaverVoting", "PlaylistManager"],
"default-shared-folders": [
"Beat Saber_Data\\CustomLevels",
"Beat Saber_Data\\CustomWIPLevels",
"DLC"
]
}
export type DefaultConfigKey = "first-color" | "second-color" | "theme" | "language" | "supported_languages" | "default_mods";
export type DefaultConfigKey = "first-color" | "second-color" | "theme" | "language" | "supported_languages" | "default_mods" | "default-shared-folders";
export type ThemeConfig = "dark" | "light" | "os"
@@ -0,0 +1,39 @@
import { useEffect, useState, useRef } from 'react'
// Code improved from : https://www.npmjs.com/package/use-delayed-state
export function useDelayedState<T = unknown>(initialState: T): [T, (newState: T, delay: number) => void, () => void] {
const [state, setState] = useState(initialState);
const timeoutRef = useRef<NodeJS.Timeout>();
const setStateAfter = (newState: T, delay: number) => {
if (delay === 0 || delay === undefined) {
return setState(newState);
}
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
}
timeoutRef.current = setTimeout(() => {
setState(newState);
timeoutRef.current = null;
}, delay);
}
const cancelSetState = () => {
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
timeoutRef.current = null
}
}
useEffect(() => {
return () => {
if (timeoutRef.current) { clearTimeout(timeoutRef.current); }
}
}, []);
return [state, setStateAfter, cancelSetState]
}
+7
View File
@@ -2,12 +2,19 @@ import { createRoot } from 'react-dom/client';
import { HashRouter } from 'react-router-dom';
import 'tailwindcss/tailwind.css';
import './index.css'
import { IpcService } from './services/ipc.service';
const launcherContainer = document.getElementById('launcher');
const oneclickDownloadMapContainer = document.getElementById('oneclick-download-map');
const oneclickDownloadPlaylistContainer = document.getElementById('oneclick-download-playlist');
const oneclickDownloadModelContainer = document.getElementById('oneclick-download-model');
const ipc = IpcService.getInstance();
window.onerror = (...data) => {
ipc.sendLazy('log-error', {args: data});
}
if(launcherContainer){
import("./windows/Launcher").then(reactWindow => {
createRoot(launcherContainer).render(<reactWindow.default/>);
@@ -54,15 +54,15 @@ export function AvailableVersionsList() {
if(modalRes.exitCode !== ModalExitCode.COMPLETED){ return; }
const folderRes = await ipc.send<{canceled: boolean, filePaths: string[]}>("choose-folder");
const folderRes = await ipc.sendV2<{canceled: boolean, filePaths: string[]}>("choose-folder").toPromise();
if(!folderRes.success || folderRes.data.canceled || !folderRes.data.filePaths?.length){ return; }
if(!folderRes || folderRes.canceled || !folderRes.filePaths?.length){ return; }
notification.notifySuccess({title: "notifications.bs-import-version.success.start-import.title", desc: "notifications.bs-import-version.success.start-import.desc", duration: 6_000});
progressBar.showFake(.008);
const toImport = folderRes.data.filePaths.at(0);
const toImport = folderRes.filePaths.at(0);
const imported = await installer.importVersion(toImport);
+5 -1
View File
@@ -1,11 +1,15 @@
import { MapsPlaylistsPanel } from "renderer/components/maps-mangement-components/maps-playlists-panel.component";
import { Slideshow } from "renderer/components/slideshow/slideshow.component";
import { useTranslation } from "renderer/hooks/use-translation.hook";
export function MapsPage() {
const t = useTranslation();
return (
<div className="w-full h-full flex items-center flex-col pt-2">
<Slideshow className="absolute w-full h-full top-0"/>
<h1 className="text-gray-100 text-2xl z-[1]">Maps partagées</h1>
<h1 className="text-gray-100 text-2xl z-[1]">{t("pages.shared-maps.title")}</h1>
<div className="w-full min-h-0 grow p-10 flex flex-col items-center justify-start text-white relative">
<MapsPlaylistsPanel/>
</div>
+49 -38
View File
@@ -5,9 +5,7 @@ import { RadioItem, SettingRadioArray } from "renderer/components/settings/setti
import { BsmButton } from "renderer/components/shared/bsm-button.component";
import { BsmIconType } from "renderer/components/svgs/bsm-icon.component";
import { DefaultConfigKey, ThemeConfig } from "renderer/config/default-configuration.config";
import { useObservable } from "renderer/hooks/use-observable.hook";
import { useThemeColor } from "renderer/hooks/use-theme-color.hook";
import { AuthUserService } from "renderer/services/auth-user.service";
import { BsDownloaderService } from "renderer/services/bs-downloader.service";
import { ConfigurationService } from "renderer/services/configuration.service"
import { I18nService } from "renderer/services/i18n.service";
@@ -26,11 +24,13 @@ import modelSaberIcon from "../../../assets/images/third-party-icons/model-saber
import beatSaverIcon from "../../../assets/images/third-party-icons/beat-saver.png";
import beastSaberIcon from "../../../assets/images/third-party-icons/beast-saber.png";
import scoreSaberIcon from "../../../assets/images/third-party-icons/score-saber.png";
import beatleaderIcon from "../../../assets/images/third-party-icons/beat-leader.png";
import Tippy from '@tippyjs/react';
import { MapsManagerService } from "renderer/services/maps-manager.service";
import { PlaylistsManagerService } from "renderer/services/playlists-manager.service";
import { ModelsManagerService } from "renderer/services/models-manager.service";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { VersionFolderLinkerService } from "renderer/services/version-folder-linker.service";
export function SettingsPage() {
@@ -40,16 +40,15 @@ export function SettingsPage() {
const modalService: ModalService = ModalService.getInsance();
const downloaderService: BsDownloaderService = BsDownloaderService.getInstance();
const progressBarService: ProgressBarService = ProgressBarService.getInstance();
const authService: AuthUserService = AuthUserService.getInstance();
const notificationService: NotificationService = NotificationService.getInstance();
const i18nService: I18nService = I18nService.getInstance();
const linkOpener: LinkOpenerService = LinkOpenerService.getInstance();
const mapsManager = MapsManagerService.getInstance();
const playlistsManager = PlaylistsManagerService.getInstance();
const modelsManager = ModelsManagerService.getInstance();
const versionLinker = VersionFolderLinkerService.getInstance();
const {firstColor, secondColor} = useThemeColor();
const sessionExist = useObservable(authService.sessionExist$);
const themeItem: RadioItem[] = [
{id: 0, text: "pages.settings.appearance.themes.dark", value: "dark" as ThemeConfig},
@@ -105,45 +104,55 @@ export function SettingsPage() {
setLanguageSelected(languagesItems.find(l => l.value === i18nService.currentLanguage).id);
}
const setDefaultInstallationFolder = () => {
if(!progressBarService.require()){ return; }
const setDefaultInstallationFolder = () => {
if(!progressBarService.require()){ return; }
modalService.openModal(InstallationFolderModal).then(async res => {
if(res.exitCode !== ModalExitCode.COMPLETED){ return; }
const fileChooserRes = await ipcService.send<{canceled: boolean, filePaths: string[]}>("choose-folder");
modalService.openModal(InstallationFolderModal).then(async res => {
if(res.exitCode !== ModalExitCode.COMPLETED){ return; }
if(fileChooserRes.success && !fileChooserRes.data.canceled && fileChooserRes.data.filePaths?.length){
progressBarService.showFake(.008);
downloaderService.setInstallationFolder(fileChooserRes.data.filePaths[0]).then(res => {
setTimeout(() => {
progressBarService.complete();
setTimeout(() => progressBarService.hide(true), 1000);
}, 1000);
if(res.success){
setInstallationFolder(res.data);
notificationService.notifySuccess({title: "notifications.settings.move-folder.success.titles.transfer-finished", duration: 3000});
}
else{
notificationService.notifyError({title: "notifications.settings.move-folder.errors.titles.transfer-failed"});
}
});
}
const fileChooserRes = await ipcService.sendV2<{canceled: boolean, filePaths: string[]}>("choose-folder").toPromise();
});
}
if(!fileChooserRes.canceled && fileChooserRes.filePaths?.length){
progressBarService.showFake(.008);
const deleteSteamSession = () => {
if(!sessionExist){ return; }
authService.deleteSteamSession();
notificationService.notifySuccess({title: "notifications.settings.steam.success.titles.logout", duration: 3000});
};
notificationService.notifySuccess({title: "notifications.settings.move-folder.success.titles.transfer-started", desc: "notifications.settings.move-folder.success.descs.transfer-started"});
downloaderService.setInstallationFolder(fileChooserRes.filePaths[0]).then(async res => {
setTimeout(() => {
progressBarService.complete();
setTimeout(() => progressBarService.hide(true), 1000);
}, 1000);
if(res.success){
setInstallationFolder(res.data);
notificationService.notifySuccess({title: "notifications.settings.move-folder.success.titles.transfer-finished", duration: 3000});
versionLinker.relinkAllVersionsFolders().toPromise().catch(() => {
notificationService.notifyError({title: "notifications.types.error", desc: "notifications.settings.move-folder.errors.descs.restore-linked-folders", duration: 15_000});
});
}
else{
if(res?.error?.code === "COPY_TO_SUBPATH"){
notificationService.notifyError({title: "notifications.settings.move-folder.errors.titles.transfer-failed", desc: "notifications.settings.move-folder.errors.descs.COPY_TO_SUBPATH", duration: 10_000});
return;
}
notificationService.notifyError({title: "notifications.settings.move-folder.errors.titles.transfer-failed"});
}
});
}
});
}
const toogleShowSupporters = () => {
setShowSupporters(show => !show);
}
const openSupportPage = () => linkOpener.open("https://mee6.gg/m/bsmanager");
const openSupportPage = () => linkOpener.open("https://www.patreon.com/bsmanager");
const openGithub = () => linkOpener.open("https://github.com/Zagrios/bs-manager");
const openReportBug = () => linkOpener.open("https://github.com/Zagrios/bs-manager/issues/new?assignees=Zagrios&labels=bug&template=-bug--bug-report.md&title=%5BBUG%5D+%3A+");
const openRequestFeatures = () => linkOpener.open("https://github.com/Zagrios/bs-manager/issues/new?assignees=Zagrios&labels=enhancement&template=-feat---feature-request.md&title=%5BFEAT.%5D+%3A+");
@@ -195,10 +204,6 @@ export function SettingsPage() {
<BsmButton className="inline-block grow-0 bg-transparent sticky h-full w-full top-20 right-20 !m-0 rounded-full p-1" onClick={() => nav(-1)} icon="close" withBar={false}/>
</div>
<SettingContainer title="pages.settings.steam.title" description="pages.settings.steam.description">
<BsmButton onClick={deleteSteamSession} className="w-fit px-3 py-[2px] text-white rounded-md" withBar={false} text="pages.settings.steam.logout" typeColor="error" disabled={!sessionExist}/>
</SettingContainer>
<SettingContainer title="pages.settings.appearance.title" description="pages.settings.appearance.description">
<div className="relative w-full h-8 bg-light-main-color-1 dark:bg-main-color-1 flex justify-center rounded-md py-1">
<SettingColorChooser color={firstColor} onChange={setFirstColorSetting}/>
@@ -237,6 +242,9 @@ export function SettingsPage() {
<Tippy content="ScoreSaber" placement="top" className="font-bold bg-main-color-3" arrow={false} duration={[200, 0]}>
<BsmImage className="h-8 cursor-pointer" image={scoreSaberIcon} onClick={e => {e.stopPropagation(); linkOpener.open("https://scoresaber.com/")}}/>
</Tippy>
<Tippy content="BeatLeader" placement="top" className="font-bold bg-main-color-3" arrow={false} duration={[200, 0]}>
<BsmImage className="h-8 cursor-pointer" image={beatleaderIcon} onClick={e => {e.stopPropagation(); linkOpener.open("https://www.beatleader.xyz/")}}/>
</Tippy>
<Tippy content="ModelSaber" placement="top" className="font-bold bg-main-color-3" arrow={false} duration={[200, 0]}>
<BsmImage className="h-8 cursor-pointer" image={modelSaberIcon} onClick={e => {e.stopPropagation(); linkOpener.open("https://modelsaber.com/")}}/>
</Tippy>
@@ -258,6 +266,9 @@ export function SettingsPage() {
<Tippy content="ScoreSaber" placement="top" className="font-bold bg-main-color-3" arrow={false} duration={[200, 0]}>
<BsmImage className="h-8 cursor-pointer" image={scoreSaberIcon} onClick={e => {e.stopPropagation(); linkOpener.open("https://scoresaber.com/")}}/>
</Tippy>
<Tippy content="BeatLeader" placement="top" className="font-bold bg-main-color-3" arrow={false} duration={[200, 0]}>
<BsmImage className="h-8 cursor-pointer" image={beatleaderIcon} onClick={e => {e.stopPropagation(); linkOpener.open("https://www.beatleader.xyz/")}}/>
</Tippy>
</div>
</li>
<li className="bg-light-main-color-1 dark:bg-main-color-1 rounded-md group-one flex justify-between items-center basis-0 py-2 px-3 cursor-pointer" onClick={() => tooglePlaylistsDeepLinks()}>
@@ -293,7 +304,7 @@ export function SettingsPage() {
<SettingContainer title="pages.settings.patreon.title" description="pages.settings.patreon.description">
<div className="flex gap-2">
<BsmButton disabled color="#ef4444" className="flex w-fit rounded-md h-8 px-2 font-bold py-1 whitespace-nowrap !text-white" text="pages.settings.patreon.buttons.support" withBar={false} onClick={openSupportPage}/>
<BsmButton color="#ef4444" className="flex w-fit rounded-md h-8 px-2 font-bold py-1 whitespace-nowrap !text-white" text="pages.settings.patreon.buttons.support" withBar={false} onClick={openSupportPage}/>
<BsmButton className="flex w-fit rounded-md h-8 px-2 font-bold py-1 !text-white" withBar={false} text="pages.settings.patreon.buttons.supporters" color="#6c5ce7" onClick={toogleShowSupporters}/>
</div>
<SettingContainer className="mt-3" description="pages.settings.discord.description">
@@ -15,6 +15,7 @@ import { LaunchSlide } from 'renderer/components/version-viewer/slides/launch/la
import { ModsSlide } from 'renderer/components/version-viewer/slides/mods/mods-slide.component';
import { UninstallModal } from 'renderer/components/modal/modal-types/uninstall-modal.component';
import { MapsPlaylistsPanel } from 'renderer/components/maps-mangement-components/maps-playlists-panel.component';
import { ShareFoldersModal } from 'renderer/components/modal/modal-types/share-folders-modal.component';
export function VersionViewer() {
@@ -29,7 +30,6 @@ export function VersionViewer() {
const [currentTabIndex, setCurrentTabIndex] = useState(0);
const navigateToVersion = (version?: BSVersion) => {
console.log(version);
if(!version){
return navigate("/available-versions");
}
@@ -67,6 +67,10 @@ export function VersionViewer() {
setCurrentTabIndex(() => 0);
}
const openShareFolderModal = () => {
modalService.openModal(ShareFoldersModal, state);
}
return (
<>
@@ -88,6 +92,7 @@ export function VersionViewer() {
((!state.steam && !state.oculus) && {text: "pages.version-viewer.dropdown.verify-files", icon: "task", onClick: verifyFiles}),
((!state.steam && !state.oculus) && {text: "pages.version-viewer.dropdown.edit", icon: "edit", onClick: edit}),
(!state.oculus && {text: "pages.version-viewer.dropdown.clone", icon: "copy", onClick: clone}),
{text: "pages.version-viewer.dropdown.shared-folders", icon: "link", onClick: openShareFolderModal},
((!state.steam && !state.oculus) && {text: "pages.version-viewer.dropdown.uninstall", icon:"trash", onClick: uninstall})
]}/>
</>
+57 -2
View File
@@ -1,5 +1,5 @@
import { Observable } from "rxjs";
import { BehaviorSubject } from "rxjs";
import { Observable, BehaviorSubject } from "rxjs";
import { ConfigurationService } from "./configuration.service";
export class AudioPlayerService{
@@ -10,18 +10,38 @@ export class AudioPlayerService{
return AudioPlayerService.instance;
}
private readonly config: ConfigurationService;
private readonly player: HTMLAudioElement;
private readonly _src$: BehaviorSubject<string> = new BehaviorSubject("");
private readonly _playing$: BehaviorSubject<boolean> = new BehaviorSubject(false);
private readonly _bpm$: BehaviorSubject<number> = new BehaviorSubject(0);
private readonly _volume$: BehaviorSubject<PlayerVolume>;
private lastVolume: number;
private constructor(){
this.config = ConfigurationService.getInstance();
this._volume$ = new BehaviorSubject(
this.config.get<PlayerVolume>("audio-level") || { volume: 0.5, muted: false }
);
this.lastVolume = this._volume$.value.volume;
this.player = new Audio();
this.player.onplay = () => this._playing$.next(true);
this.player.onpause = () => this._playing$.next(false);
this.player.onended = () => this._playing$.next(false);
this._volume$.subscribe(volume => {
this.player.volume = volume.volume;
this.player.muted = volume.muted;
this.config.set("audio-level", volume);
});
}
public play(src: string, bpm = 0): Promise<void>{
@@ -41,6 +61,31 @@ export class AudioPlayerService{
return this.player.play();
}
public setVolume(volume: number): void{
const playerVolume: PlayerVolume = {muted: volume <= 0, volume};
this._volume$.next(playerVolume);
}
public setFinalVolume(volume: number): void{
if(volume > 0){ this.lastVolume = volume; }
const playerVolume: PlayerVolume = {muted: volume <= 0, volume: this.lastVolume};
this._volume$.next(playerVolume);
}
public mute(): void{
const playerVolume = {...this._volume$.value, muted: true};
this._volume$.next(playerVolume);
}
public unmute(): void{
const playerVolume = {...this._volume$.value, muted: false};
this._volume$.next(playerVolume);
}
public toggleMute(): void{
this.muted ? this.unmute() : this.mute();
}
public get src$(): Observable<string>{
return this._src$.asObservable();
}
@@ -50,9 +95,19 @@ export class AudioPlayerService{
public get bpm$(): Observable<number>{
return this._bpm$.asObservable();
}
public get volume$(): Observable<PlayerVolume>{
return this._volume$.asObservable();
}
public get src(): string{ return this._src$.value; }
public get playing(): boolean{ return this._playing$.value; }
public get bpm(): number{ return this._bpm$.value; }
public get volume(): PlayerVolume{ return this._volume$.value; }
public get muted(): boolean{ return this.player.muted; }
}
interface PlayerVolume{
volume: number;
muted: boolean;
}
+17 -6
View File
@@ -96,11 +96,7 @@ export class BsDownloaderService{
return this.ipcService.send<boolean>("is-dotnet-6-installed").then(res => res.success && res.data)
}
public async download(bsVersion: BSVersion, isVerification?: boolean, isFirstCall = true): Promise<IpcResponse<DownloadEvent>>{
if(isFirstCall && !this.progressBarService.require()){ return {success: false}; }
if(isFirstCall && !(await this.isDotNet6Installed())){
private async showDotNetNotInstalledError(): Promise<void>{
const choice = await this.notificationService.notifyError({
duration: 11_000,
title: "notifications.bs-download.errors.titles.dotnet-required",
@@ -111,7 +107,16 @@ export class BsDownloaderService{
if(choice === "0"){
this.linkOpener.open("https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-6.0.12-windows-x64-installer");
}
}
public async download(bsVersion: BSVersion, isVerification?: boolean, isFirstCall = true): Promise<IpcResponse<DownloadEvent>>{
// TODO : to remake cause we don't need recursion anymore
if(isFirstCall && !this.progressBarService.require()){ return {success: false}; }
if(isFirstCall && !(await this.isDotNet6Installed())){
await this.showDotNetNotInstalledError();
return {success: false};
}
@@ -142,7 +147,13 @@ export class BsDownloaderService{
this.progressBarService.hide(true);
this.resetDownload();
if(res.success && isFirstCall){ this.notificationService.notifySuccess({title: `notifications.bs-download.success.titles.${isVerification ? "verification-finished" : "download-success"}`, duration: 3000}); }
else if(res.data && isFirstCall){ this.notificationService.notifyError({title: `notifications.types.error`, desc: `notifications.bs-download.errors.msg.${res.data}`, duration: 3000}); }
else if(res.data === "dotnet" && isFirstCall){
await this.showDotNetNotInstalledError();
return res;
}
else if(res.data && isFirstCall){
this.notificationService.notifyError({title: `notifications.types.error`, desc: `notifications.bs-download.errors.msg.${res.data}`, duration: 3000});
}
return res;
}
+2 -2
View File
@@ -40,8 +40,8 @@ export class BSLauncherService{
public launch(version: BSVersion, oculus: boolean, desktop: boolean, debug: boolean): Promise<NotificationResult|string>{
const lauchOption: LauchOption = {debug, oculus, desktop, version};
public launch(version: BSVersion, oculus: boolean, desktop: boolean, debug: boolean, additionalArgs?: string[]): Promise<NotificationResult|string>{
const lauchOption: LauchOption = {debug, oculus, desktop, version, additionalArgs};
if(this.launchState$.value){ return this.notificationService.notifyError({title: "notifications.bs-launch.errors.titles.BS_ALREADY_RUNNING"}); }
this.launchState$.next(version);
return this.ipcService.send<LaunchResult>("bs-launch.launch", {args: lauchOption}).then(res => {
@@ -5,6 +5,7 @@ import { ModalExitCode, ModalService } from './modale.service';
import { NotificationService } from './notification.service';
import { ProgressBarService } from './progress-bar.service';
import { EditVersionModal } from 'renderer/components/modal/modal-types/edit-version-modal.component';
import { Observable } from 'rxjs';
export class BSVersionManagerService {
@@ -83,7 +84,7 @@ export class BSVersionManagerService {
if(!res.success){
this.notificationService.notifyError({
title: `notifications.custom-version.errors.titles.${res.error.title}`,
...(res.error.msg && {desc: `notifications.custom-version.errors.msg.${res.error.msg}`})
...(res.error.message && {desc: `notifications.custom-version.errors.msg.${res.error.message}`})
});
return null;
}
@@ -103,7 +104,7 @@ export class BSVersionManagerService {
if(!res.success){
this.notificationService.notifyError({
title: `notifications.custom-version.errors.titles.${res.error.title}`,
...(res.error.msg && {desc: `notifications.custom-version.errors.msg.${res.error.msg}`})
...(res.error.message && {desc: `notifications.custom-version.errors.msg.${res.error.message}`})
});
return null;
}
@@ -113,4 +114,8 @@ export class BSVersionManagerService {
})
}
public getVersionPath(version: BSVersion): Observable<string>{
return this.ipcService.sendV2("get-version-full-path", {args: version});
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ export class IpcService {
public sendV2<T, U = unknown>(channel: string, request?: IpcRequest<U>, defaultValue?: T): Observable<T>{
if(!request){ request = {args: null, responceChannel: null}; }
if(!request.responceChannel){ request.responceChannel = `${channel}_responce_${new Date().getTime()}`; }
if(!request.responceChannel){ request.responceChannel = `${channel}_responce_${crypto.randomUUID()}`; }
const completeChannel = `${request.responceChannel}_complete`;
const errorChannel = `${request.responceChannel}_error`;
+33 -44
View File
@@ -1,6 +1,6 @@
import { LinkMapsModal } from "renderer/components/modal/modal-types/link-maps-modal.component";
import { UnlinkMapsModal } from "renderer/components/modal/modal-types/unlink-maps-modal.component";
import { Subject, Observable } from "rxjs";
import { Subject, Observable, of } from "rxjs";
import { BSVersion } from "shared/bs-version.interface";
import { BsmLocalMapsProgress, BsmLocalMap, DeleteMapsProgress } from "shared/models/maps/bsm-local-map.interface";
import { IpcService } from "./ipc.service";
@@ -11,12 +11,15 @@ import { OpenSaveDialogOption } from "shared/models/ipc";
import { NotificationService } from "./notification.service";
import { ConfigurationService } from "./configuration.service";
import { ArchiveProgress } from "shared/models/archive.interface";
import { map, last, catchError } from "rxjs/operators";
import { of } from "rxjs";
import { map, last, catchError, distinctUntilChanged, mergeMap } from "rxjs/operators";
import { ProgressionInterface } from "shared/models/progress-bar";
import { VersionFolderLinkerService, VersionLinkerActionType } from "./version-folder-linker.service";
import equal from "fast-deep-equal";
export class MapsManagerService {
private static instance: MapsManagerService;
public static getInstance(): MapsManagerService{
@@ -25,12 +28,14 @@ export class MapsManagerService {
}
public static readonly REMEMBER_CHOICE_DELETE_MAP_KEY = "not-confirm-delete-map"
public static readonly RELATIVE_MAPS_FOLDER = "Beat Saber_Data\\CustomLevels";
private readonly ipcService: IpcService;
private readonly modal: ModalService;
private readonly progressBar: ProgressBarService;
private readonly notifications: NotificationService;
private readonly config: ConfigurationService;
private readonly linker: VersionFolderLinkerService;
private readonly lastLinkedVersion$: Subject<BSVersion> = new Subject();
private readonly lastUnlinkedVersion$: Subject<BSVersion> = new Subject();
@@ -41,63 +46,43 @@ export class MapsManagerService {
this.progressBar = ProgressBarService.getInstance();
this.notifications = NotificationService.getInstance();
this.config = ConfigurationService.getInstance();
this.linker = VersionFolderLinkerService.getInstance();
}
public getMaps(version?: BSVersion): Observable<BsmLocalMapsProgress>{
return this.ipcService.sendV2<BsmLocalMapsProgress>("load-version-maps", {args: version}, {loaded: 0, total: 0, maps: []});
}
public versionHaveMapsLinked(version: BSVersion): Promise<boolean>{
return this.ipcService.send<boolean, BSVersion>("verion-have-maps-linked", {args: version}).then(res => {
if(!res.success){ throw "error"; }
return res.data;
})
public async versionHaveMapsLinked(version: BSVersion): Promise<boolean>{
return this.linker.isVersionFolderLinked(version, MapsManagerService.RELATIVE_MAPS_FOLDER).toPromise();
}
public async linkVersion(version: BSVersion): Promise<void>{
public async linkVersion(version: BSVersion): Promise<boolean>{
const modalRes = await this.modal.openModal(LinkMapsModal);
if(modalRes.exitCode !== ModalExitCode.COMPLETED){ return; }
if(modalRes.exitCode !== ModalExitCode.COMPLETED){ return Promise.resolve(false); }
const showProgressBar = this.progressBar.require();
if(showProgressBar){
this.progressBar.showFake(.01);
}
const res = await this.ipcService.send<void, {version: BSVersion, keepMaps: boolean}>("link-version-maps", {args: {version, keepMaps: !!modalRes.data}});
if(showProgressBar){
this.progressBar.hide(true);
}
if(res.success){
this.lastLinkedVersion$.next(version);
}
return this.linker.linkVersionFolder({
version,
type: VersionLinkerActionType.Link,
relativeFolder: MapsManagerService.RELATIVE_MAPS_FOLDER,
options: { keepContents: !!modalRes.data }
});
}
public async unlinkVersion(version: BSVersion): Promise<void>{
public async unlinkVersion(version: BSVersion): Promise<boolean>{
const modalRes = await this.modal.openModal(UnlinkMapsModal);
if(modalRes.exitCode !== ModalExitCode.COMPLETED){ return; }
if(modalRes.exitCode !== ModalExitCode.COMPLETED){ return Promise.resolve(false); }
const showProgressBar = this.progressBar.require();
if(showProgressBar){
this.progressBar.showFake(.01);
}
const res = await this.ipcService.send<void, {version: BSVersion, keepMaps: boolean}>("unlink-version-maps", {args: {version, keepMaps: !!modalRes.data}});
if(showProgressBar){
this.progressBar.hide(true);
}
if(res.success){
this.lastUnlinkedVersion$.next(version);
}
return this.linker.unlinkVersionFolder({
version,
type: VersionLinkerActionType.Unlink,
relativeFolder: MapsManagerService.RELATIVE_MAPS_FOLDER,
options: { keepContents: !!modalRes.data }
});
}
public async deleteMaps(maps: BsmLocalMap[], version?: BSVersion): Promise<boolean>{
@@ -115,8 +100,6 @@ export class MapsManagerService {
const progress$ = this.ipcService.sendV2<DeleteMapsProgress>("delete-maps", {args: maps}).pipe(map(progress => (progress.deleted / progress.total) * 100));
progress$.subscribe(console.log);
showProgressBar && this.progressBar.show(progress$, true);
progress$.toPromise().finally(() => this.progressBar.hide(true));
@@ -175,4 +158,10 @@ export class MapsManagerService {
return this.lastUnlinkedVersion$.asObservable();
}
public $mapsLinkingPending(version: BSVersion): Observable<boolean>{
return this.linker.queue$.pipe(mergeMap(async queue => {
return queue.some(q => q.relativeFolder.includes(MapsManagerService.RELATIVE_MAPS_FOLDER) && equal(q.version, version));
}), distinctUntilChanged());
}
}
+1 -1
View File
@@ -51,7 +51,7 @@ export class ModalService{
}
export type ModalComponent<T = unknown, K = any> = ({resolver, data}: {resolver : (x: ModalResponse<T>) => void, data?: K}) => JSX.Element;
export type ModalComponent<Return = unknown, Receive = any> = ({resolver, data}: {resolver : (x: ModalResponse<Return>) => void, data?: Receive}) => JSX.Element;
export const enum ModalExitCode {
NO_CHOICE = -1,
@@ -53,6 +53,11 @@ export class NotificationService{
return this.notify(notification);
}
public notifyInfo(notification: Notification): Promise<NotificationResult|string>{
notification.type = NotificationType.INFO;
return this.notify(notification);
}
public notifySystem(options: SystemNotificationOptions){
this.ipc.sendLazy<SystemNotificationOptions>("notify-system", {args: options});
}
@@ -71,6 +76,7 @@ export enum NotificationType {
SUCCESS = 0,
WARNING = 1,
ERROR = 2,
INFO = 3,
}
export interface NotificationAction {
@@ -59,12 +59,12 @@ export class ProgressBarService{
this._style$.next(style);
}
public showFake(speed: number, style?: CSSProperties): void{
public showFake(speed: number, style?: CSSProperties, label?: string): void{
const obs: Observable<ProgressionInterface> = timer(1000, 100).pipe(map(val => {
if(this._progression$.value.progression >= 100){ return {progression: 100}; }
if(this._progression$.value.progression >= 100){ return {progression: 100, label}; }
const currentProgress = speed * (val + 1);
const progress = Math.round(Math.atan(currentProgress) / (Math.PI / 2) * 100 * 1000) / 1000;
return {progression: progress} as ProgressionInterface;
return {progression: progress, label} as ProgressionInterface;
}));
this.show(obs, true, style);
}
@@ -0,0 +1,171 @@
import { LinkOptions, UnlinkOptions } from "main/services/folder-linker.service";
import { map, distinctUntilChanged, filter } from "rxjs/operators";
import { BehaviorSubject, Observable } from "rxjs";
import { BSVersion } from "shared/bs-version.interface";
import { IpcService } from "./ipc.service";
import { ProgressBarService } from "./progress-bar.service";
export class VersionFolderLinkerService{
private static instance: VersionFolderLinkerService;
public static getInstance(): VersionFolderLinkerService{
if(!VersionFolderLinkerService.instance){ VersionFolderLinkerService.instance = new VersionFolderLinkerService() }
return VersionFolderLinkerService.instance;
}
private readonly ipcService: IpcService;
private readonly progress: ProgressBarService;
private readonly _queue$ = new BehaviorSubject<VersionLinkerAction[]>([]);
private readonly linkListeners = new Set<VersionLinkerActionListener>();
private readonly unlinkListeners = new Set<VersionLinkerActionListener>();
private constructor(){
this.ipcService = IpcService.getInstance();
this.progress = ProgressBarService.getInstance();
this.currentAction$.pipe(filter(action => !!action)).subscribe(action => this.processAction(action));
}
private async processAction(action: VersionLinkerAction){
let progressOpened = false;
if(!this.progress.isVisible){
this.progress.showFake(.01, null, action.relativeFolder.split("\\").at(-1));
progressOpened = true;
}
const linked = await this.doAction(action).toPromise();
// Spécial notification
if(action.type === VersionLinkerActionType.Link){
this.linkListeners.forEach(listener => listener(action, linked));
}
else{
this.unlinkListeners.forEach(listener => listener(action, linked));
}
if(progressOpened){
this.progress.hide(true);
}
const newArr = [...this._queue$.value];
newArr.shift();
this._queue$.next(newArr);
}
private doAction(action: VersionLinkerAction): Observable<boolean>{
return this.ipcService.sendV2<boolean, VersionLinkerAction>("link-version-folder-action", { args: action });
}
public linkVersionFolder(action: VersionLinkFolderAction): Promise<boolean>{
const promise = new Promise<boolean>((resolve) => {
const callBack: VersionLinkerActionListener = (performedAction, linked) => {
if(performedAction !== action){ return; }
this.removeVersionFolderLinkedListener(callBack);
resolve(linked);
}
this.onVersionFolderLinked(callBack);
});
this._queue$.next([...this._queue$.value, action]);
return promise;
}
public unlinkVersionFolder(action: VersionUnlinkFolderAction): Promise<boolean>{
const promise = new Promise<boolean>((resolve) => {
const callBack: VersionLinkerActionListener = (performedAction, linked) => {
if(performedAction !== action){ return; }
this.removeVersionFolderUnlinkedListener(callBack);
resolve(linked);
}
this.onVersionFolderUnlinked(callBack);
});
this._queue$.next([...this._queue$.value, action]);
return promise;
}
public onVersionFolderLinked(listener: VersionLinkerActionListener): void{
this.linkListeners.add(listener);
}
public removeVersionFolderLinkedListener(listener: VersionLinkerActionListener): void{
this.linkListeners.delete(listener);
}
public onVersionFolderUnlinked(listener: VersionLinkerActionListener): void{
this.unlinkListeners.add(listener);
}
public removeVersionFolderUnlinkedListener(listener: VersionLinkerActionListener): void{
this.unlinkListeners.delete(listener);
}
public cancelAction(version: BSVersion, relativeFolder: string): void{
this._queue$.next(this._queue$.value.filter(a => a.version !== version || a.relativeFolder !== relativeFolder));
}
public isVersionFolderLinked(version: BSVersion, relativeFolder: string): Observable<boolean>{
return this.ipcService.sendV2("is-version-folder-linked", { args: { version, relativeFolder } });
}
public isPending(version: BSVersion, relativeFolder: string): Observable<boolean> {
return this.queue$.pipe(map(queue => queue.length > 0 && queue.some(action => action.version === version && action.relativeFolder === relativeFolder), distinctUntilChanged()));
}
public isProcessing(version: BSVersion, relativeFolder: string): Observable<boolean> {
return this.currentAction$.pipe(map(action => ( action && action.version === version && action.relativeFolder === relativeFolder)));
}
public getLinkedFolders(version: BSVersion, options?: { relative?: boolean }): Observable<string[]>{
return this.ipcService.sendV2("get-linked-folders", { args: { version, options } });
}
public relinkAllVersionsFolders(): Observable<void>{
return this.ipcService.sendV2("relink-all-versions-folders");
}
public get currentAction$(): Observable<VersionLinkerAction>{
return this._queue$.pipe(map(actions => actions.at(0)), distinctUntilChanged());
}
public get queue$(): Observable<VersionLinkerAction[]>{
return this._queue$.asObservable();
}
}
export const enum VersionLinkerActionType {
Link = "link",
Unlink = "unlink"
}
export interface VersionLinkerAction {
version: BSVersion;
relativeFolder: string;
type: VersionLinkerActionType
options?: LinkOptions
}
export interface VersionLinkFolderAction extends VersionLinkerAction {
type: VersionLinkerActionType.Link
}
export interface VersionUnlinkFolderAction extends VersionLinkerAction {
type: VersionLinkerActionType.Unlink
options?: UnlinkOptions
}
export type VersionLinkerActionListener = (action: VersionLinkerAction, linked: boolean) => void;
@@ -1,8 +1,9 @@
import { BSVersion } from "shared/bs-version.interface";
export interface LauchOption {
version: BSVersion,
oculus: boolean,
desktop: boolean,
debug: boolean
version: BSVersion,
oculus: boolean,
desktop: boolean,
debug: boolean,
additionalArgs?: string[]
}
+4 -5
View File
@@ -1,5 +1,4 @@
export interface BsmException {
title: string,
msg?: string,
error?: Error,
}
export interface BsmException extends Readonly<Omit<NodeJS.ErrnoException, "message">>{
readonly title?: string,
readonly message?: string,
};