Compare commits
294 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 769dab2896 | |||
| 8f1f998c5a | |||
| 48d03cccbb | |||
| 7d54ae79f7 | |||
| c46fdd56f6 | |||
| 22dc1ca511 | |||
| 709105b9f4 | |||
| 1c0cfb6b89 | |||
| 7ebc1bff16 | |||
| 0e1cda5050 | |||
| 331626bd1e | |||
| ea62f2443f | |||
| 532ab08e46 | |||
| a6fa55719d | |||
| 163857a14f | |||
| 854e0e2761 | |||
| eba6f916a3 | |||
| 9790f35749 | |||
| 93d3cbc8bf | |||
| 51ea1b130b | |||
| d020b72f20 | |||
| f2ac952cd9 | |||
| 189d2388fb | |||
| 1c989a2402 | |||
| 959e60127d | |||
| 0faa0f1288 | |||
| 5ad25f58d5 | |||
| 8ace5e6a7a | |||
| 185d01e7b4 | |||
| 755e407372 | |||
| 4f123b69ef | |||
| 7e2334f8fc | |||
| 5be533ccfb | |||
| b8eafd5f9b | |||
| 3f3bb959c4 | |||
| f30cad74d7 | |||
| ede82393da | |||
| 9ee468af03 | |||
| c4d5db809b | |||
| 8ecc9d30b3 | |||
| ca722b2a18 | |||
| c219e9655d | |||
| a6c1ba9fee | |||
| 6e9ea1bd9a | |||
| 84f27d571b | |||
| 51549161cd | |||
| 198002238e | |||
| ae0ad4d2f6 | |||
| e470782bea | |||
| b440c1b9e9 | |||
| 163b95ff26 | |||
| 6fa3b95f32 | |||
| 773432a407 | |||
| 45bab6ccce | |||
| 748b75ef3b | |||
| 116e4d77fa | |||
| c1322c4ed7 | |||
| f2ecd34672 | |||
| 657a683d13 | |||
| 0f038ccdc2 | |||
| 6d38985581 | |||
| 0edee845d7 | |||
| 517db1d056 | |||
| 65bf528a11 | |||
| 07e32df91a | |||
| 05a4386479 | |||
| 8c242e607b | |||
| a721c16c85 | |||
| 0957080e22 | |||
| 3427cae437 | |||
| 33be4de2ff | |||
| d83507a865 | |||
| 44c63a63c6 | |||
| d299553d1e | |||
| 415d47a9e5 | |||
| 9b8f1a7c42 | |||
| 12a8a49ccb | |||
| 3cfc59982b | |||
| 5e1a021c3a | |||
| d6ba587db0 | |||
| 4075b2fcde | |||
| b1ee9f054d | |||
| 15ebe8e929 | |||
| 901137ada9 | |||
| ab07334cb8 | |||
| 7407b7dc83 | |||
| 46824eb3ed | |||
| 1c9289f989 | |||
| 64d6aa25e3 | |||
| 126024b70b | |||
| cb08374cbb | |||
| 22a217528c | |||
| e9f297f186 | |||
| 934f857f96 | |||
| 56dbeea691 | |||
| bff5123373 | |||
| a48db98001 | |||
| 850f39339a | |||
| f0cbb066e4 | |||
| 8fefefd5ac | |||
| 365818266c | |||
| 764eeff57a | |||
| e713782b9f | |||
| d8cfad32a6 | |||
| 86c73239c9 | |||
| 9af6c9a94a | |||
| 9ffa0db43e | |||
| 5cf80ec6f2 | |||
| 0ea355d75c | |||
| 044174c711 | |||
| 7562b07832 | |||
| 0196206ec1 | |||
| d54464401f | |||
| 969be1e816 | |||
| d91a95ec0b | |||
| 89066411b1 | |||
| 604dec8540 | |||
| 32f03eaaa2 | |||
| 22769da7c5 | |||
| 69e573a12c | |||
| 7f726537ff | |||
| 40b12c6285 | |||
| 28f0a4d8c6 | |||
| 6e9c6e6c9e | |||
| 281ae0bbc6 | |||
| aad4cb9a2e | |||
| cc0ec76d83 | |||
| 7b7cdd5559 | |||
| 4a2f7697f9 | |||
| cbab039ca4 | |||
| 576cd2dec5 | |||
| c02ac39184 | |||
| 5eda9463c4 | |||
| 41ef0164fd | |||
| c833df9884 | |||
| ba3cca79b4 | |||
| ad6d9b57f8 | |||
| d21271693e | |||
| 589c191ac2 | |||
| 6a326fd584 | |||
| 0f430293a5 | |||
| 61ad8ba75b | |||
| 0cea1cd89f | |||
| 6836f18e89 | |||
| 0093c3970c | |||
| 644a0c4e43 | |||
| c71c7a96e3 | |||
| 0e02e2e2b9 | |||
| 4537cbd539 | |||
| 0c185066f6 | |||
| 5d5985f305 | |||
| 744c3f18c7 | |||
| 2a52ae3644 | |||
| e822738a3b | |||
| d185614d3b | |||
| c1a6a43825 | |||
| b98e1ccdfa | |||
| 4797aab0aa | |||
| 0460a0dab3 | |||
| 9cd5c48831 | |||
| e0f597e252 | |||
| ebbe2963b1 | |||
| 541a14d2a7 | |||
| 169a6e99b0 | |||
| 3da5af354e | |||
| 031c9044a1 | |||
| 6d271d8c48 | |||
| 8bc37ef3f1 | |||
| d7f3936619 | |||
| 49358b7006 | |||
| 067b967da1 | |||
| 88a1691d4b | |||
| cdd25b458c | |||
| 30a53c013f | |||
| 31e1ae2273 | |||
| 7237e49c7f | |||
| 501def3a94 | |||
| f2cd9a1174 | |||
| d0fee6aaca | |||
| 7c034550fb | |||
| 1db3db7bdd | |||
| e0e647b22a | |||
| 69914e3063 | |||
| 0c2624ed37 | |||
| 1e6f051f59 | |||
| 08bdc03745 | |||
| de0575aea4 | |||
| 487d0c1f8b | |||
| ac5a9b16e5 | |||
| e7f5e98fcd | |||
| a36ccb0c13 | |||
| 59b04ee33e | |||
| b42231b134 | |||
| 11661cc1da | |||
| d7c43a2ba9 | |||
| 14a65f1d69 | |||
| bc9ab121b9 | |||
| 0f0f7c1abb | |||
| 1d9a261bc5 | |||
| 9a3ebf2971 | |||
| e51ef0992c | |||
| d9f025e28b | |||
| b4efa9583e | |||
| 1b4b59fbf0 | |||
| 8394581544 | |||
| 159d478e94 | |||
| 90bb8f2c19 | |||
| 097b18e72f | |||
| 9b744fb1e2 | |||
| 31f1ee1549 | |||
| c540308c2c | |||
| 778b4f6ee6 | |||
| df057cf82e | |||
| 5f94190b68 | |||
| 7718d239b2 | |||
| b29c9515d3 | |||
| 535831c03a | |||
| b03b670d56 | |||
| 1fd185fe88 | |||
| 05154f577f | |||
| c62896f078 | |||
| 2403f02851 | |||
| b8262a941d | |||
| 8e8d608120 | |||
| c92ca87c4c | |||
| b02cd7fc77 | |||
| 86c1f5aa7b | |||
| cd5237aff3 | |||
| 5449792294 | |||
| 5c35eae53a | |||
| 61889c0b5b | |||
| 4cf242f683 | |||
| 3217addaa6 | |||
| 76ed1b09a1 | |||
| 9401f1cf4a | |||
| 6b4d919afe | |||
| e92efa0ada | |||
| 99a9f5b1de | |||
| 98bdbba23c | |||
| ddde1f8b8a | |||
| b951be9511 | |||
| b91d74f3a3 | |||
| 002b11d54c | |||
| 4e15d1c1b6 | |||
| 961e629de8 | |||
| 02ad4b9c68 | |||
| a981adede0 | |||
| 33bab3ea0e | |||
| 7dae25ce32 | |||
| 71f317dd37 | |||
| 8333e238a6 | |||
| 39f2a16c96 | |||
| 2c08f1e07c | |||
| f4560b9190 | |||
| f0f83e2b3b | |||
| 0776de8d79 | |||
| 504462258a | |||
| fdef870e83 | |||
| 7d58fec63b | |||
| c77f4a9448 | |||
| 37a3951f7b | |||
| e5599b78d8 | |||
| 2da329367f | |||
| 0b64722092 | |||
| fbec5a0e46 | |||
| e21b731e10 | |||
| 19998facc7 | |||
| c8017939da | |||
| 75100e6919 | |||
| 834dad0cc0 | |||
| f57926e41b | |||
| 57157b4553 | |||
| b2c1338650 | |||
| 1dde1b8916 | |||
| 7e9b8ec86d | |||
| ec0d2fb8c6 | |||
| 214ffc243d | |||
| d243475bf8 | |||
| 9872fcb856 | |||
| 29f7754ba9 | |||
| 9c440a0430 | |||
| aaf75278d0 | |||
| ae2cf08c7d | |||
| 4a0848fb41 | |||
| 76c863608e | |||
| 8963c08e64 | |||
| ba51e76691 | |||
| cb0faad418 | |||
| 00bf26081b | |||
| 385c403bee | |||
| 6c3a241481 | |||
| 34c0ad03d3 | |||
| 8c9846d751 | |||
| 0d7c160b24 |
@@ -40,6 +40,7 @@ const configuration: webpack.Configuration = {
|
||||
},
|
||||
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
parallel: true,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable import/no-import-module-exports */
|
||||
import "webpack-dev-server";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import path from 'path';
|
||||
import { copyFileSync, existsSync, readdirSync } from 'fs-extra';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
const eternalsFolder = path.join(__dirname, '..', '..', 'externals');
|
||||
|
||||
// Get rust project folders from externals
|
||||
const rustProjects = readdirSync(eternalsFolder).filter(folder => existsSync(path.join(eternalsFolder, folder, 'Cargo.toml')));
|
||||
|
||||
// Build each rust project in release mode
|
||||
rustProjects.forEach(project => {
|
||||
console.log(`Building ${project}`);
|
||||
execSync(`cargo build --release`, {
|
||||
cwd: path.join(eternalsFolder, project),
|
||||
stdio: 'inherit',
|
||||
});
|
||||
});
|
||||
|
||||
// Copy the built files exe to the assests/scripts folder
|
||||
rustProjects.forEach(project => {
|
||||
// read the project name from Cargo.toml using toml parser
|
||||
const projectMetadata = execSync('cargo metadata --no-deps --format-version 1', {
|
||||
cwd: path.join(eternalsFolder, project),
|
||||
stdio: 'pipe',
|
||||
});
|
||||
const projectMetadataJson = JSON.parse(projectMetadata);
|
||||
const projectName = projectMetadataJson.packages[0].name;
|
||||
|
||||
const source = path.join(eternalsFolder, project, 'target', 'release', `${projectName}.exe`);
|
||||
const destination = path.join(__dirname, '..', '..', 'assets', 'scripts', `${projectName}.exe`);
|
||||
console.log(`Copying ${source} to ${destination}`);
|
||||
copyFileSync(source, destination);
|
||||
});
|
||||
@@ -1,17 +1,13 @@
|
||||
import rimraf from "rimraf";
|
||||
import process from "process";
|
||||
import webpackPaths from "../configs/webpack.paths";
|
||||
import { rimrafSync } from 'rimraf';
|
||||
import fs from 'fs';
|
||||
import webpackPaths from '../configs/webpack.paths';
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
const commandMap = {
|
||||
dist: webpackPaths.distPath,
|
||||
release: webpackPaths.releasePath,
|
||||
dll: webpackPaths.dllPath,
|
||||
};
|
||||
const foldersToRemove = [
|
||||
webpackPaths.distPath,
|
||||
webpackPaths.buildPath,
|
||||
webpackPaths.dllPath,
|
||||
];
|
||||
|
||||
args.forEach(x => {
|
||||
const pathToRemove = commandMap[x];
|
||||
if (pathToRemove !== undefined) {
|
||||
rimraf.sync(pathToRemove);
|
||||
}
|
||||
foldersToRemove.forEach((folder) => {
|
||||
if (fs.existsSync(folder)) rimrafSync(folder);
|
||||
});
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import path from "path";
|
||||
import rimraf from "rimraf";
|
||||
import webpackPaths from "../configs/webpack.paths";
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { rimrafSync } from 'rimraf';
|
||||
import webpackPaths from '../configs/webpack.paths';
|
||||
|
||||
export default function deleteSourceMaps() {
|
||||
rimraf.sync(path.join(webpackPaths.distMainPath, "*.js.map"));
|
||||
rimraf.sync(path.join(webpackPaths.distRendererPath, "*.js.map"));
|
||||
if (fs.existsSync(webpackPaths.distMainPath))
|
||||
rimrafSync(path.join(webpackPaths.distMainPath, '*.js.map'), {
|
||||
glob: true,
|
||||
});
|
||||
if (fs.existsSync(webpackPaths.distRendererPath))
|
||||
rimrafSync(path.join(webpackPaths.distRendererPath, '*.js.map'), {
|
||||
glob: true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,28 +1,32 @@
|
||||
const { notarize } = require("electron-notarize");
|
||||
const { build } = require("../../package.json");
|
||||
const { notarize } = require('@electron/notarize');
|
||||
const { build } = require('../../package.json');
|
||||
|
||||
exports.default = async function notarizeMacos(context) {
|
||||
const { electronPlatformName, appOutDir } = context;
|
||||
if (electronPlatformName !== "darwin") {
|
||||
return;
|
||||
}
|
||||
const { electronPlatformName, appOutDir } = context;
|
||||
if (electronPlatformName !== 'darwin') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.env.CI !== "true") {
|
||||
console.warn("Skipping notarizing step. Packaging is not running in CI");
|
||||
return;
|
||||
}
|
||||
if (process.env.CI !== 'true') {
|
||||
console.warn('Skipping notarizing step. Packaging is not running in CI');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!("APPLE_ID" in process.env && "APPLE_ID_PASS" in process.env)) {
|
||||
console.warn("Skipping notarizing step. APPLE_ID and APPLE_ID_PASS env variables must be set");
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!('APPLE_ID' in process.env && 'APPLE_APP_SPECIFIC_PASSWORD' in process.env)
|
||||
) {
|
||||
console.warn(
|
||||
'Skipping notarizing step. APPLE_ID and APPLE_APP_SPECIFIC_PASSWORD env variables must be set',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const appName = context.packager.appInfo.productFilename;
|
||||
const appName = context.packager.appInfo.productFilename;
|
||||
|
||||
await notarize({
|
||||
appBundleId: build.appId,
|
||||
appPath: `${appOutDir}/${appName}.app`,
|
||||
appleId: process.env.APPLE_ID,
|
||||
appleIdPassword: process.env.APPLE_ID_PASS,
|
||||
});
|
||||
await notarize({
|
||||
appBundleId: build.appId,
|
||||
appPath: `${appOutDir}/${appName}.app`,
|
||||
appleId: process.env.APPLE_ID,
|
||||
appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -47,19 +47,29 @@ module.exports = {
|
||||
"import/no-cycle": "off",
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"react/jsx-no-target-blank": "off",
|
||||
"@typescript-eslint/ban-types": ["error", {
|
||||
types: {
|
||||
Function: false,
|
||||
}
|
||||
}]
|
||||
"import/extensions": "off",
|
||||
"lines-between-class-members": "off",
|
||||
"no-throw-literal": "warn",
|
||||
"no-use-before-define": "off",
|
||||
"no-useless-constructor": "off",
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": "error",
|
||||
'react/jsx-filename-extension': [2, { 'extensions': ['.js', '.jsx', '.ts', '.tsx'] }],
|
||||
"no-shadow": "off",
|
||||
"react/function-component-definition": "off",
|
||||
"jsx-a11y/control-has-associated-label": "off",
|
||||
"react/button-has-type": "off",
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020,
|
||||
sourceType: "module",
|
||||
project: "./tsconfig.json",
|
||||
tsconfigRootDir: __dirname,
|
||||
createDefaultProgram: true,
|
||||
},
|
||||
globals: {
|
||||
JSX: true,
|
||||
NodeJS: true
|
||||
},
|
||||
settings: {
|
||||
"import/resolver": {
|
||||
// See https://github.com/benmosher/eslint-plugin-import/issues/1396#issuecomment-575727774 for line below
|
||||
@@ -73,4 +83,5 @@ module.exports = {
|
||||
"@typescript-eslint/parser": [".ts", ".tsx"],
|
||||
},
|
||||
},
|
||||
"plugins": ["@typescript-eslint"]
|
||||
};
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# This workflow will...
|
||||
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["master"]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: "npm"
|
||||
- run: npm ci
|
||||
- run: npm run package
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-${{ matrix.os }}
|
||||
path: release
|
||||
@@ -0,0 +1,35 @@
|
||||
# This workflow will...
|
||||
|
||||
name: Realease Linux
|
||||
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
cache: "npm"
|
||||
- run: npm ci
|
||||
- run: npm run publish:linux
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release
|
||||
path: release
|
||||
@@ -57,10 +57,12 @@
|
||||
<a href="https://discord.gg/uSqbHVpKdV"><img
|
||||
src="https://img.shields.io/badge/-DISCORD-5865f2?style=for-the-badge&logo=discord&logoColor=ffffff"
|
||||
alt="discord" /></a>
|
||||
<a href="https://www.patreon.com/bsmanager"><img
|
||||
src="https://img.shields.io/badge/-🥰%20Support%20BSM-EC4546?style=for-the-badge" alt="Donation" /></a>
|
||||
<a href="https://twitter.com/BSManager_"><img
|
||||
src="https://img.shields.io/badge/-Twitter-F5F8FA?style=for-the-badge&logo=Twitter" alt="Twitter" /></a>
|
||||
src="https://img.shields.io/badge/-Twitter-black?style=for-the-badge&logo=X" alt="Twitter" /></a>
|
||||
<a href="https://www.bsmanager.io">
|
||||
<img src="https://img.shields.io/badge/-WebSite-00649c?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiPgogIDxnIGZpbGw9IiMzYjgyZmYiPgogICAgPHBhdGggZD0ibTYyNi43NSA0ODUuOTEgMjAuODIgMzUxLjk0YTM1LjIxIDM1LjIxIDAgMCAxLTE1LjQ5IDMxLjM2bC0xNDQuNzEgOTYuMTRoLS4wNmEzNS41NiAzNS41NiAwIDAgMS0xMS4zMSA0Ljc3IDM0Ljg1IDM0Ljg1IDAgMCAxLTIzLjUxLTIuODdMMTM2LjU4IDgwOS45YTExNS40NSAxMTUuNDUgMCAwIDEtNjMuNzUtOTYuNDlMNTIgMzYxLjQ2YTM1LjI2IDM1LjI2IDAgMCAxIDE1LjIzLTMxLjIxbDE0NS4wNS05Ni4zNmEzNS43MiAzNS43MiAwIDAgMSAxMS4yNy00LjcgMzQuODcgMzQuODcgMCAwIDEgMjMuNTEgMi44N0w1NjMgMzg5LjQyYTExNS40MSAxMTUuNDEgMCAwIDEgNjMuNzUgOTYuNDlaIi8+CiAgICA8cGF0aCBmaWx0ZXI9ImJyaWdodG5lc3MoMzAlKSIgZD0ibTYxMy43OCA0ODYuNjcgMjAuODIgMzUyYTIyLjM0IDIyLjM0IDAgMCAxLTMyLjI2IDIxLjMxTDI4Ni40IDcwMi41N0ExMDIuNDMgMTAyLjQzIDAgMCAxIDIyOS44MyA2MTdMMjA5IDI2NWEyMi4zNSAyMi4zNSAwIDAgMSAzMi4yNi0yMS4zMkw1NTcuMiA0MDEuMDVhMTAyLjQyIDEwMi40MiAwIDAgMSA1Ni41OCA4NS42MloiLz4KICA8L2c+CiAgPHBhdGggZD0iTTcxOC4yOSA3NzYuNDggNzAwIDgwNC4xOGMtNDAuNjMgMzkuNS04Ny4wNiA2Ny4yNS0xMzMuODEgOTAuNzUtODcuMzIgNDMuOS0yMDMuNjcgNzcuMTktMjQ5IDkwLjM0YTQ4IDQ4IDAgMCAxLTI2LjE3LjE2Yy02NC0xNy43Mi0xODguNjItNzItMjM2LjI4LTEyNS40OWE0LjIzIDQuMjMgMCAwIDEgNS4zLTYuNDVjMzUuNjQgMjAuODcgMTExLjIyIDU3LjY0IDE1Ni4zNyA3NC4yMiA0OS4xOCAxOC4wNiA4MS4yOSA4Ljc0IDkyLjI4LTMuMjZhNC43NyA0Ljc3IDAgMCAxIDcuMjQuMjFjMTkuNTEgMjQgMTA3LjI2IDQuNiAxNjYuNjQtMTMgNjQuMzQtMTkgMTg1Ljg1LTc2LjU2IDIzNS43Mi0xMzUuMThabS0xOTYuMiAxNTcuMzMtMTQ3LjQ1IDU1LjY4YTMuOTIgMy45MiAwIDAgMCAxLjQ0IDcuNThsNTQuNjItLjc3YTM1LjYzIDM1LjYzIDAgMCAwIDE5LTUuNzlsNzYtNDkuNTVhNCA0IDAgMCAwLTMuNjEtNy4xNVpNMjE4LjkyIDE5NS41NmMtMjEuMTQuMDctMzMuNTUgMzUuODYtMzMuMTYgODkuMDguMiAyOCAyLjU4IDkyLjc0IDQuNzkgMTQ3LjczLjIzIDUuNzEtOC4xOCA2LjQ4LTkgLjgxbC0zOC40Mi0yNzAuNzFhNC4zOCA0LjM4IDAgMCAxIDcuMTItNCA2My42MyA2My42MyAwIDAgMCAyMS45MyAxMS44NSA0LjYxIDQuNjEgMCAwIDAgNS45LTMuNzJjNC4yLTI3LjcgMTYuNjMtNTguNzQgMzcuMzUtODguNzRhNC4zNiA0LjM2IDAgMCAxIDcuNTYuNjljMTAuODYgMjMuODcgNDkgMTAzLjggOTMuMzQgMTUyLjc5YTQuNjUgNC42NSAwIDAgMS01LjYyIDcuMjJjLTM2LjU3LTE5LjM4LTgzLjAxLTQzLjAyLTkxLjc5LTQzWm0tMTUuNDcgMzg0LjhhNC41MSA0LjUxIDAgMCAxLTQuNDYtMy45MmwtMTMuODItMTA3LjI5YTQuNSA0LjUgMCAwIDEgOC45My0xLjE1bDEzLjgyIDEwNy4yOWE0LjUgNC41IDAgMCAxLTMuODkgNSAzLjg2IDMuODYgMCAwIDEtLjU4LjA3Wk01NzcuMDggNTQuNThjLTQ2Ljc5IDE1Ljg1LTExNS40NSA0MC41Ni0xNTguNzMgNjIuNzlhMzUuNSAzNS41IDAgMCAwLTE4LjU3IDI0LjUzYy0zLjk1IDE5LjQ5LTExIDU2LjA5LTE5IDEwNy4yNi0uNyA0LjQ4LTcuMzYgMy43OC03LjExLS43NWwxMC42Ni0xOTQuNzNhMy43OCAzLjc4IDAgMCAxIDcuNDYtLjY2bDMuNDkgMTQuODVhMi41NyAyLjU3IDAgMCAwIDQuNjkuNzdjNi4xOC0xMCAyMi4zNy0zMi43OSA1Ny4zMi02NWE0LjEzIDQuMTMgMCAwIDEgNi41NiA0LjcybC0zMi41NCA3Mi44OXM3OC43OC0xOS4zNyAxNDQtMzMuMDljNC4xMS0uODcgNS42OSA1LjA4IDEuNzcgNi40MloiIGZpbGw9IiNmZmYiIHN0cm9rZT0iYmxhY2siLz4KICA8ZyBmaWxsPSIjZjQ0Ij4KICAgIDxwYXRoIGZpbHRlcj0iYnJpZ2h0bmVzcyg2MCUpIHNhdHVyYXRlKDEyMCUpIiBkPSJtOTQ3LjA3IDQxMC4zNS01Ny43NSAzNDcuNzlhMzUuMTggMzUuMTggMCAwIDEtMjIuMDYgMjcuMTVsLTE2Mi40MyA2MS42NWgtLjA2YTM1LjUyIDM1LjUyIDAgMCAxLTEyLjA2IDIuMTEgMzQuODMgMzQuODMgMCAwIDEtMjIuMjktOGwtMjczLjE3LTIyMy41YTExNS40MyAxMTUuNDMgMCAwIDEtNDAuNzYtMTA4LjIybDU3Ljc1LTM0Ny44QTM1LjI1IDM1LjI1IDAgMCAxIDQzNiAxMzQuNDdsMTYyLjgzLTYxLjc5YTM1LjUxIDM1LjUxIDAgMCAxIDEyLTIuMDggMzQuODMgMzQuODMgMCAwIDEgMjIuMjkgOGwyNzMuMTkgMjIzLjUyYTExNS4zOCAxMTUuMzggMCAwIDEgNDAuNzYgMTA4LjIzWiIvPgogICAgPHBhdGggZD0iTTkzNC4yNSA0MDguMjIgODc2LjUgNzU2YTIyLjM0IDIyLjM0IDAgMCAxLTM2LjE4IDEzLjYzbC0yNzMuMTctMjIzLjVhMTAyLjQyIDEwMi40MiAwIDAgMS0zNi4xNy05Nmw1Ny43NS0zNDcuODNhMjIuMzQgMjIuMzQgMCAwIDEgMzYuMTgtMTMuNjNsMjczLjE3IDIyMy41MWExMDIuNDIgMTAyLjQyIDAgMCAxIDM2LjE3IDk2LjA0WiIvPgogIDwvZz4KICA8ZWxsaXBzZSBmaWxsPSIjZmZmIiBzdHJva2U9ImJsYWNrIiBjeD0iNzMyLjYxIiBjeT0iNDI5LjE2IiByeD0iNjIuODMiIHJ5PSIxMTAuNzMiIHRyYW5zZm9ybT0icm90YXRlKC0xNS40NSA3MzIuNzAzIDQyOS4xOTkpIi8+Cjwvc3ZnPg==" alt="Website" /></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>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
@@ -287,13 +289,11 @@
|
||||
<div>
|
||||
<ul>
|
||||
<li><strong>via Oculus</strong>: For Oculus users, <a href="https://github.com/Zagrios/bs-manager">BSManager</a>
|
||||
uses authentication directly via the <a href="https://about.meta.com/fr/">META</a> website
|
||||
to retrieve the connection token, ensuring reliable and secure access to your account data.</li>
|
||||
requires you to retrieve a connection token by following the instructions in this guide: <a href="https://github.com/Zagrios/bs-manager/wiki/How-to-obtain-your-Oculus-Token">How to obtain your Oculus Token</a>. Once obtained, please insert it into the form.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
<img height=450 src="https://github.com/Zagrios/bs-manager/assets/40648115/1e4a2f98-af16-45aa-821d-0c4e90e1e54b" />
|
||||
<img height=450 src="https://github.com/Zagrios/bs-manager/assets/40648115/3674e629-542d-4de3-b8db-b248f25126d7" />
|
||||
</div>
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 401 KiB |
@@ -598,8 +598,7 @@
|
||||
"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",
|
||||
"recommended": true
|
||||
"year": "2023"
|
||||
},
|
||||
{
|
||||
"BSVersion": "1.29.4",
|
||||
@@ -699,5 +698,51 @@
|
||||
"ReleaseImg": "https://clan.cloudflare.steamstatic.com/images/32055887/e7c75bdfc76d00713adc3fbdf221c9ce8ab3620d.png",
|
||||
"ReleaseDate": "1708091473",
|
||||
"year": "2024"
|
||||
},
|
||||
{
|
||||
"BSVersion": "1.35.0",
|
||||
"BSManifest": "1490986193481243578",
|
||||
"OculusBinaryId": "6720809361352119",
|
||||
"ReleaseURL": "https://store.steampowered.com/news/app/620980/view/4142820264819707009",
|
||||
"ReleaseImg": "https://clan.cloudflare.steamstatic.com/images//32055887/9a141be5c44ca6fc81551a2c7e7f28407df413ed.png",
|
||||
"ReleaseDate": "1709831174",
|
||||
"year": "2024"
|
||||
},
|
||||
{
|
||||
"BSVersion": "1.36.0",
|
||||
"BSManifest": "8533509040167838423",
|
||||
"OculusBinaryId": "6863072637125790",
|
||||
"ReleaseURL": "https://store.steampowered.com/news/app/620980/view/4205873192610459250",
|
||||
"ReleaseImg": "https://clan.akamai.steamstatic.com/images//32055887/b8bd8a050e2bc3903cf18a277c5489ade01f7e75.png",
|
||||
"ReleaseDate": "1712681263",
|
||||
"year": "2024"
|
||||
},
|
||||
{
|
||||
"BSVersion": "1.36.2",
|
||||
"BSManifest": "4832237377879752064",
|
||||
"OculusBinaryId": "6983660338400352",
|
||||
"ReleaseURL": "https://store.steampowered.com/news/app/620980/view/4181105931135110118",
|
||||
"ReleaseImg": "https://clan.cloudflare.steamstatic.com/images//32055887/74541417f14dee210bcfd89eefeabd7c0cc27c7d.png",
|
||||
"ReleaseDate": "1715008020",
|
||||
"year": "2024"
|
||||
},
|
||||
{
|
||||
"BSVersion": "1.37.0",
|
||||
"BSManifest": "7270690075584855288",
|
||||
"OculusBinaryId": "7062062833893435",
|
||||
"ReleaseURL": "https://store.steampowered.com/news/app/620980/view/4161968170153497460",
|
||||
"ReleaseImg": "https://clan.akamai.steamstatic.com/images//32055887/f82d34c7582137a6748a28c5b02670ff4b235356.png",
|
||||
"ReleaseDate": "1717513346",
|
||||
"year": "2024",
|
||||
"recommended": true
|
||||
},
|
||||
{
|
||||
"BSVersion": "1.37.1",
|
||||
"BSManifest": "9129356330007601179",
|
||||
"OculusBinaryId": "7313068492126200",
|
||||
"ReleaseURL": "https://steamcommunity.com/games/620980/announcements/detail/4253168598913260422",
|
||||
"ReleaseImg": "https://clan.akamai.steamstatic.com/images/32055887/039be718c1494f948257cd5b09f0082986484a58.png",
|
||||
"ReleaseDate": "1720710529",
|
||||
"year": "2024"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"1.5.0-alpha.1":{
|
||||
"htmlBody" :"<strong>BSManager continues to get better, thanks to your continued support and contributions!</strong><center>🎈🎉🎈</center><p>Note: This is an alpha release, encountering bugs is expected. Please file new issues for any bugs you find.</p><h2>Features</h2><ul><li>Added playlist support</li><li>Added Linux support (Thanks to @Insprill)</li><li>Added reset button to reset values when editing a Beat Saber version (Thanks to @Liborsaf)</li><li>Added a changelog modal</li></ul><h2>Fixes</h2><ul><li>Fixed an issue where switching between Beat Saber versions too quickly displayed mods for the wrong version</li><li>Fixed an issue where the launch window from a shortcut would never close</li><li>Advanced launch arguments are used even when the input field is closed</li><li>Fixed an issue where having many maps caused some maps to not have their information loaded</li></ul><h2>Other changes</h2><ul><li>.NET Framework is no longer required</li><li>Clear English translations for the Steam credentials popup (Thanks to @Aeywoo)</li><li>NSFW models are now blurred when browsing for models</li><li>When no mods are available for a Beat Saber version, the version number is now shown</li><li>Mods load faster</li><li>After a first full maps loading, maps load almost instantly</li><li>Improved performance in lists with lot of contents</li></ul>",
|
||||
"title" : "What's new ?",
|
||||
"timestamp" : 1721048400,
|
||||
"version" : "1.5.0-alpha.1"
|
||||
},
|
||||
"1.5.0-alpha.2":{
|
||||
"htmlBody" :"<strong>BSManager continues to get better, thanks to your continued support and contributions!</strong><center>🎈🎉🎈</center><p>Note: This is an alpha release, encountering bugs is expected. Please file new issues for any bugs you find.</p><h4>Alpha changes</h4><ul><li>Fixed an issue where BSIPA could not be installed if the BS version's path contained spaces #523</li><li>Fixed a crash when changing audio volume #518</li><li>Fixed an issue where playlist maps with a malformed hash were not loaded #517</li><li>Improved reliability of reading maps from a playlist file #517</li><li>Playlists in sub-folders are now loaded #514</li><li>Fixed a crash when loading an invalid playlist file #513</li></ul><h2>Features</h2><ul> <li>Added playlist support</li> <li>Added Linux support (Thanks to @Insprill)</li> <li>Added reset button to reset values when editing a Beat Saber version (Thanks to @Liborsaf)</li> <li>Added a changelog modal</li></ul><h3>Fixes</h3><ul><li>Fixed an issue where switching between Beat Saber versions too quickly displayed mods for the wrong version #472</li><li>Fixed an issue where the launch window from a shortcut would never close #485</li><li>Advanced launch arguments are used even when the input field is closed #496</li><li>Fixed an issue where having many maps caused some maps to not have their information loaded #503</li><li>Fixed an issue where downloading maps sometimes resulted in a timeout error #524</li><li>Fixed an issue where the duration of maps could be wrong in some cases #522</li></ul><h2>Other changes</h2><ul> <li>.NET Framework is no longer required</li> <li>Clear English translations for the Steam credentials popup (Thanks to @Aeywoo)</li> <li>NSFW models are now blurred when browsing for models</li> <li>When no mods are available for a Beat Saber version, the version number is now shown</li> <li>Mods load faster</li> <li>After a first full maps loading, maps load almost instantly</li> <li>Improved performance in lists with lot of contents</li></ul>",
|
||||
"title" : "What's new ?",
|
||||
"timestamp" : 1721665382,
|
||||
"version" : "1.5.0-alpha.2"
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,6 @@
|
||||
{
|
||||
"username": "Falmil"
|
||||
},
|
||||
{
|
||||
"username": "K1Lc4m"
|
||||
},
|
||||
{
|
||||
"username": "Anonymously42",
|
||||
"type": "diamond",
|
||||
@@ -30,9 +27,6 @@
|
||||
"username": "Burt",
|
||||
"type": "gold"
|
||||
},
|
||||
{
|
||||
"username": "Ilnahro"
|
||||
},
|
||||
{
|
||||
"username": "Phil",
|
||||
"type": "gold"
|
||||
@@ -41,18 +35,10 @@
|
||||
"username": "Protocrush",
|
||||
"type": "gold"
|
||||
},
|
||||
{
|
||||
"username": "ServerMensch",
|
||||
"type": "gold"
|
||||
},
|
||||
{
|
||||
"username": "Karlito",
|
||||
"type": "gold"
|
||||
},
|
||||
{
|
||||
"username": "Cathery",
|
||||
"type": "gold"
|
||||
},
|
||||
{
|
||||
"username": ".sharkey"
|
||||
},
|
||||
@@ -74,9 +60,6 @@
|
||||
{
|
||||
"username": "Minescence"
|
||||
},
|
||||
{
|
||||
"username": "Finlay"
|
||||
},
|
||||
{
|
||||
"username": "mereknom"
|
||||
},
|
||||
@@ -89,5 +72,32 @@
|
||||
},
|
||||
{
|
||||
"username": "rhythmshade"
|
||||
}
|
||||
},
|
||||
{
|
||||
"username": "liborsaf"
|
||||
},
|
||||
{
|
||||
"username": "aatame3",
|
||||
"type": "gold"
|
||||
},
|
||||
{
|
||||
"username": "Joshua"
|
||||
},
|
||||
{
|
||||
"username": "Stuijvi",
|
||||
"type": "gold"
|
||||
},
|
||||
{
|
||||
"username": "_ monaka"
|
||||
},
|
||||
{
|
||||
"username": "Better_Axel"
|
||||
},
|
||||
{
|
||||
"username": "Riley",
|
||||
"type": "gold"
|
||||
},
|
||||
{
|
||||
"username": "Austin"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -190,6 +190,10 @@
|
||||
"report-bug": "Fehler melden",
|
||||
"open-logs": "Protokolle öffnen"
|
||||
}
|
||||
},
|
||||
"changelogs": {
|
||||
"open" : "🚀 Neues im Changelog entdecken!",
|
||||
"not-founds": "😕 Hoppla, kein Changelog zu sehen!"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -234,9 +238,6 @@
|
||||
}
|
||||
},
|
||||
"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.",
|
||||
@@ -259,11 +260,7 @@
|
||||
"LicenceError": "Die Liste der Lizenzen kann nicht abgerufen werden.",
|
||||
"RateLimitExceeded": "Du hast es zu oft versucht, warte eine Weile und versuche es später erneut.",
|
||||
"TokenRejected": "Ihr Anmeldetoken wurde abgelehnt 😕 Bitte versuchen Sie es erneut.",
|
||||
"AccessDenied": "Der Zugang zu Steam wurde verweigert.",
|
||||
"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"
|
||||
"AccessDenied": "Der Zugang zu Steam wurde verweigert."
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -459,7 +456,7 @@
|
||||
},
|
||||
"maps": {
|
||||
"one-click-install": {
|
||||
"success": "Map installation abegschlossen",
|
||||
"success": "Map installation abgeschlossen",
|
||||
"error": "Ein Fehler ist aufgetreten während der installation der Map"
|
||||
}
|
||||
},
|
||||
@@ -761,13 +758,13 @@
|
||||
"rb": "R&B",
|
||||
"holiday": "Urlaub",
|
||||
"vocaloid": "Vokaloid",
|
||||
"jrock": "J-Rock",
|
||||
"j-rock": "J-Rock",
|
||||
"trance": "Trance",
|
||||
"drumbass": "Basstrommel",
|
||||
"comedy": "Komödie",
|
||||
"instrumental": "Instrumental",
|
||||
"hardcore": "Hardcore",
|
||||
"kpop": "K-Pop",
|
||||
"k-pop": "K-Pop",
|
||||
"indie": "Indie",
|
||||
"techno": "Techno",
|
||||
"house": "House",
|
||||
@@ -778,7 +775,7 @@
|
||||
"metal": "Metal",
|
||||
"anime": "Anime",
|
||||
"hiphop": "HipHop",
|
||||
"jpop": "J-Pop",
|
||||
"j-pop": "J-Pop",
|
||||
"rock": "Rock",
|
||||
"pop": "Pop",
|
||||
"electronic": "Elektronisch",
|
||||
@@ -1001,6 +998,122 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist": {
|
||||
"error-playlist-creation-title": "Fehler beim Erstellen der Playlist",
|
||||
"error-playlist-creation-desc": "Beim Erstellen der Playlist ist ein Fehler aufgetreten.",
|
||||
"playlist-created-title": "Playlist erstellt",
|
||||
"playlist-created-desc": "Die Playlist wurde erfolgreich erstellt. Sie können jetzt ihre Karten synchronisieren!",
|
||||
"download-playlist": "Playlist herunterladen",
|
||||
"synchronize-playlist": "Playlist synchronisieren",
|
||||
"synchronize-maps": "Karten synchronisieren",
|
||||
"error-playlists-synchronization-title": "Fehler bei der Synchronisierung der Playlists",
|
||||
"error-playlists-synchronization-desc": "Bei der Synchronisierung der Playlists ist ein Fehler aufgetreten.",
|
||||
"playlists-synchronized-title": "Playlists synchronisiert!",
|
||||
"playlists-synchronized-desc": "Playlists und ihre Karten wurden heruntergeladen.",
|
||||
"playlists-export-error-title": "Fehler beim Exportieren der Playlists",
|
||||
"playlists-export-error-desc": "Beim Exportieren der Playlists ist ein Fehler aufgetreten.",
|
||||
"playlists-exported-title": "Playlists exportiert!",
|
||||
"playlists-exported-desc": "Playlists wurden erfolgreich exportiert.",
|
||||
"playlists-with-maps-exported-desc": "Playlists und ihre Karten wurden erfolgreich exportiert.",
|
||||
"playlist-delete-error-title": "Fehler beim Löschen der Playlist",
|
||||
"playlist-delete-error-desc": "Beim Löschen der Playlist ist ein Fehler aufgetreten.",
|
||||
"playlists-deleted-title": "Playlists gelöscht!",
|
||||
"playlists-deleted-desc": "Playlists wurden erfolgreich gelöscht.",
|
||||
"edit-playlist": "Playlist bearbeiten",
|
||||
"playlist-edit-error-title": "Fehler beim Bearbeiten der Playlist",
|
||||
"playlist-edit-error-desc": "Beim Bearbeiten der Playlist ist ein Fehler aufgetreten.",
|
||||
"playlist-edited-title": "Playlist bearbeitet!",
|
||||
"playlist-edited-desc": "Die Playlist wurde erfolgreich geändert. Sie können jetzt ihre Karten synchronisieren!",
|
||||
"playlists-loading": "Playlists werden geladen...",
|
||||
"no-playlists": "Keine Playlists",
|
||||
"download-playlists": "Playlists herunterladen",
|
||||
"created-by": "Erstellt von",
|
||||
"stop-download": "Download stoppen",
|
||||
"cancel-download": "Download abbrechen",
|
||||
"open-file": "Datei öffnen",
|
||||
"link-playlists": "Playlists verknüpfen",
|
||||
"link-playlist-desc": "Das Verknüpfen von Playlists ermöglicht das Teilen von Playlists zwischen allen Versionen. Nach der Verknüpfung profitiert diese Version von geteilten Playlists",
|
||||
"link-playlist-info": "Das Hinzufügen und Löschen von Playlists wird ebenfalls geteilt",
|
||||
"keep-playlists": "Playlists behalten",
|
||||
"keep-playlists-tip": "Wenn Sie Playlists behalten, werden die Playlists von der aktuellen Version in den Ordner für geteilte Playlists verschoben. Andernfalls gehen sie verloren",
|
||||
"unlink-playlists": "Playlists trennen",
|
||||
"unlink-playlist-desc": "Achtung, das Trennen von Playlists verhindert die Nutzung geteilter Playlists für diese Version.",
|
||||
"unlink-keep-playlists-tip": "Wenn Sie Playlists behalten, wird eine Kopie der geteilten Playlists für die aktuelle Version erstellt. Andernfalls werden keine Playlists für diese Version behalten.",
|
||||
"delete-playlist-ask": "Playlist löschen?",
|
||||
"delete-playlists-ask": "Playlists löschen?",
|
||||
"delete-playlist-desc": "Sind Sie sicher, dass Sie die Playlist \"{playlistTitle}\" löschen möchten?",
|
||||
"delete-playlists-desc": "Sind Sie sicher, dass Sie {nb} Playlists löschen möchten?",
|
||||
"delete-maps": "Karten löschen",
|
||||
"delete-playlist-maps-tip": "Wenn aktiviert, werden alle Karten in der Playlist gelöscht",
|
||||
"delete-playlists-maps-tip": "Wenn aktiviert, werden alle Karten in den Playlists gelöscht",
|
||||
"export-playlist-ask": "Playlist exportieren?",
|
||||
"export-playlists-ask": "Playlists exportieren?",
|
||||
"export-playlist-desc": "Sind Sie sicher, dass Sie die Playlist \"{playlistTitle}\" exportieren möchten?",
|
||||
"export-playlists-desc": "Sind Sie sicher, dass Sie {nb} Playlists exportieren möchten?",
|
||||
"export-maps": "Karten exportieren",
|
||||
"export-playlist-maps-tip": "Wenn aktiviert, werden auch alle Karten in der Playlist exportiert",
|
||||
"export-playlists-maps-tip": "Wenn aktiviert, werden auch alle Karten in den Playlists exportiert",
|
||||
"export": "Exportieren",
|
||||
"need-clone-title": "Warnung",
|
||||
"need-clone-desc-1": "Diese Playlist wurde von einer externen Seite heruntergeladen und enthält einen Synchronisierungslink.",
|
||||
"need-clone-desc-2": "Um Ihre Änderungen während der Synchronisierung nicht zu verlieren, wird die Playlist dupliziert und ihr Synchronisierungslink entfernt.",
|
||||
"need-clone-desc-3": "Sie können dann, wenn Sie möchten, die ursprüngliche Playlist löschen.",
|
||||
"understood": "Ich verstehe",
|
||||
"synchronize-playlist-ask": "Playlist synchronisieren?",
|
||||
"synchronize-playlists-ask": "Playlists synchronisieren?",
|
||||
"synchronize-playlist-desc": "Sind Sie sicher, dass Sie die Playlist \"{playlistTitle}\" synchronisieren möchten?",
|
||||
"synchronize-playlists-desc": "Sind Sie sicher, dass Sie {nb} Playlists synchronisieren möchten?",
|
||||
"synchronize-playlist-tip": "Diese Aktion aktualisiert Playlists und lädt fehlende Karten herunter; es kann mehrere Minuten dauern.",
|
||||
"synchronize": "Synchronisieren",
|
||||
"curated": "Empfohlen",
|
||||
"verified-mapper": "Verifizierter Mapper",
|
||||
"empty-playlists": "Leere Playlists",
|
||||
"search-playlist": "Nach einer Playlist suchen",
|
||||
"no-playlists-found": "Keine Playlists gefunden",
|
||||
"error-occur-while-loading-playlists": "Beim Laden der Playlists ist ein Fehler aufgetreten",
|
||||
"error-occur-while-loading-playlist": "Beim Laden der Playlist ist ein Fehler aufgetreten",
|
||||
"loading-maps": "Karten werden geladen...",
|
||||
"no-maps-found-for-playlist": "Keine Karten für diese Playlist gefunden",
|
||||
"playlist-contain-no-maps": "Die Playlist enthält keine Karten",
|
||||
"no-map-installed-for-playlist": "Keine Karten für diese Playlist installiert",
|
||||
"playlist-is-waiting-to-download": "Die Playlist wartet auf den Download",
|
||||
"download-maps": "Karten herunterladen",
|
||||
"download-missing-maps": "Fehlende Karten herunterladen",
|
||||
"playlist-is-downloading": "Die Playlist wird heruntergeladen",
|
||||
"some-playlist-maps-are-missing": "Einige Karten in dieser Playlist fehlen",
|
||||
"create-a-playlist": "Eine Playlist erstellen",
|
||||
"synchronize-playlists": "Playlists synchronisieren",
|
||||
"export-playlists": "Playlists exportieren",
|
||||
"delete-playlists": "Playlists löschen",
|
||||
"choose-image": "Bild auswählen",
|
||||
"title": "Titel",
|
||||
"playlist-title": "Playlist-Titel",
|
||||
"description": "Beschreibung",
|
||||
"playlist-description": "Playlist-Beschreibung",
|
||||
"author": "Autor",
|
||||
"playlist-author": "Playlist-Autor",
|
||||
"save": "Speichern",
|
||||
"loading": "Wird geladen...",
|
||||
"installed": "Installiert",
|
||||
"no-map-found": "Keine Karte gefunden",
|
||||
"edit-playlist-shortcuts": "Halten Sie Shift oder Strg gedrückt, um mehrere Karten auszuwählen",
|
||||
"add-to-playlist": "Zur Playlist hinzufügen",
|
||||
"remove-from-playlist": "Aus Playlist entfernen",
|
||||
"playlist-is-empty": "Die Playlist ist leer",
|
||||
"continue": "Fortfahren",
|
||||
"nb-maps": "Anzahl der Karten",
|
||||
"nb-mappers": "Anzahl der Mapper",
|
||||
"duration": "Dauer",
|
||||
"nps": "Noten pro Sekunde",
|
||||
"date-picker": {
|
||||
"start-date-end-date": "Startdatum — Enddatum",
|
||||
"all": "Alle",
|
||||
"last-24h": "Letzte 24h",
|
||||
"last-week": "Letzte Woche",
|
||||
"last-month": "Letzter Monat",
|
||||
"3-last-month": "Letzte 3 Monate"
|
||||
}
|
||||
},
|
||||
"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"],
|
||||
|
||||
@@ -134,6 +134,11 @@
|
||||
"description": "Change the default folder for Beat Saber versions and other upcoming features.",
|
||||
"choose-folder": "Choose folder"
|
||||
},
|
||||
"proton-path": {
|
||||
"title": "Proton path",
|
||||
"description": "Change the path to the Proton binary",
|
||||
"choose-file": "Choose file"
|
||||
},
|
||||
"additional-content": {
|
||||
"title": "Additional content",
|
||||
"description": "Additional content that allows you to customize Beat Saber!",
|
||||
@@ -190,6 +195,10 @@
|
||||
"report-bug": "Report a bug",
|
||||
"open-logs": "Open logs"
|
||||
}
|
||||
},
|
||||
"changelogs": {
|
||||
"open" : "🚀 Check Out the Changelog!",
|
||||
"not-founds": "😕 Oops, No Changelog Here!"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -234,9 +243,6 @@
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"titles": {
|
||||
"dotnet-required": ".NET 6 Required"
|
||||
},
|
||||
"msg": {
|
||||
"401": "Steam doesn't seem to want to let us download Beat Saber 😢",
|
||||
"404": "Unable to contact Steam servers.",
|
||||
@@ -259,11 +265,7 @@
|
||||
"LicenceError": "Unable to get the list of licenses.",
|
||||
"RateLimitExceeded": "You've tried too many times, wait a while and try again later.",
|
||||
"TokenRejected": "Your login token has been rejected 😕 Please try again.",
|
||||
"AccessDenied": "Access to Steam has been denied.",
|
||||
"dotnet-required": ".NET 6 Runtime must be installed in order to download a version of Beat Saber. Download it by clicking the button below."
|
||||
},
|
||||
"actions": {
|
||||
"download-dotnet": "Download .NET 6"
|
||||
"AccessDenied": "Access to Steam has been denied."
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -379,6 +381,7 @@
|
||||
"OCULUS_NOT_RUNNING": "Oculus is not running",
|
||||
"BS_ALREADY_RUNNING": "Beat Saber already running",
|
||||
"EXE_NOT_FINDED": "Missing files",
|
||||
"PROTON_NOT_SET": "Proton path not set",
|
||||
"EXIT": "Abrupt stop",
|
||||
"OCULUS_LIB_NOT_FOUND": "Oculus library not found"
|
||||
},
|
||||
@@ -389,7 +392,8 @@
|
||||
"BS_ALREADY_RUNNING": "Close BeatSaber before launching it again.",
|
||||
"EXE_NOT_FINDED": "Some files seem to be missing, try to verify the files.",
|
||||
"EXIT": "BeatSaber stopped abruptly, tries to check the files.",
|
||||
"OCULUS_LIB_NOT_FOUND": "Check that the Oculus application is properly installed, and that the libraries are correctly defined in Oculus."
|
||||
"OCULUS_LIB_NOT_FOUND": "Check that the Oculus application is properly installed, and that the libraries are correctly defined in Oculus.",
|
||||
"PROTON_NOT_SET": "Set the Proton path in settings"
|
||||
},
|
||||
"actions": {
|
||||
"STEAM_NOT_RUNNING": "Launch Steam"
|
||||
@@ -550,8 +554,8 @@
|
||||
},
|
||||
"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)"
|
||||
"p-1": "Your Steam credentials are only required to download versions of Beat Saber, we use DepotDownloader to achieve this which requires your Steam credentials to verify that you own the game within your library before allowing you to retrieve the game files, your credentials are not stored or saved and are passed directly to DepotDownloader. However, if you don't want to do that, you can follow this tutorial instead: ",
|
||||
"p-2": "Afterwards you can click on the gear icon in the top right corner and select \"Import a version\", then you can select the folder where Beat Saber was downloaded to. (If you followed the tutorial, you will have the right location)"
|
||||
},
|
||||
"bs-import-version": {
|
||||
"title": "Import a version",
|
||||
@@ -761,13 +765,13 @@
|
||||
"rb": "r&b",
|
||||
"holiday": "holiday",
|
||||
"vocaloid": "vocaloid",
|
||||
"jrock": "j-rock",
|
||||
"j-rock": "j-rock",
|
||||
"trance": "trance",
|
||||
"drumbass": "drum & bass",
|
||||
"comedy": "comedy",
|
||||
"instrumental": "instrumental",
|
||||
"hardcore": "hardcore",
|
||||
"kpop": "k-pop",
|
||||
"k-pop": "k-pop",
|
||||
"indie": "indie",
|
||||
"techno": "techno",
|
||||
"house": "house",
|
||||
@@ -778,7 +782,7 @@
|
||||
"metal": "metal",
|
||||
"anime": "anime",
|
||||
"hiphop": "hiphop",
|
||||
"jpop": "j-pop",
|
||||
"j-pop": "j-pop",
|
||||
"rock": "rock",
|
||||
"pop": "pop",
|
||||
"electronic": "electronic",
|
||||
@@ -1001,6 +1005,122 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist": {
|
||||
"error-playlist-creation-title": "Error creating playlist",
|
||||
"error-playlist-creation-desc": "An error occurred while creating the playlist.",
|
||||
"playlist-created-title": "Playlist created",
|
||||
"playlist-created-desc": "The playlist has been successfully created. You can now sync its maps!",
|
||||
"download-playlist": "Download playlist",
|
||||
"synchronize-playlist": "Synchronize playlist",
|
||||
"synchronize-maps": "Synchronize maps",
|
||||
"error-playlists-synchronization-title": "Error synchronizing playlists",
|
||||
"error-playlists-synchronization-desc": "An error occurred while synchronizing playlists.",
|
||||
"playlists-synchronized-title": "Playlists synchronized!",
|
||||
"playlists-synchronized-desc": "Playlists and their maps have been downloaded.",
|
||||
"playlists-export-error-title": "Error exporting playlists",
|
||||
"playlists-export-error-desc": "An error occurred while exporting playlists.",
|
||||
"playlists-exported-title": "Playlists exported!",
|
||||
"playlists-exported-desc": "Playlists have been successfully exported.",
|
||||
"playlists-with-maps-exported-desc": "Playlists and their maps have been successfully exported.",
|
||||
"playlist-delete-error-title": "Error deleting playlist",
|
||||
"playlist-delete-error-desc": "An error occurred while deleting the playlist.",
|
||||
"playlists-deleted-title": "Playlists deleted!",
|
||||
"playlists-deleted-desc": "Playlists have been successfully deleted.",
|
||||
"edit-playlist": "Edit playlist",
|
||||
"playlist-edit-error-title": "Error editing playlist",
|
||||
"playlist-edit-error-desc": "An error occurred while editing the playlist.",
|
||||
"playlist-edited-title": "Playlist edited!",
|
||||
"playlist-edited-desc": "The playlist has been successfully modified. You can now sync its maps!",
|
||||
"playlists-loading": "Loading playlists...",
|
||||
"no-playlists": "No playlists",
|
||||
"download-playlists": "Download playlists",
|
||||
"created-by": "Created by",
|
||||
"stop-download": "Stop download",
|
||||
"cancel-download": "Cancel download",
|
||||
"open-file": "Open file",
|
||||
"link-playlists": "Link playlists",
|
||||
"link-playlist-desc": "Linking playlists allows sharing playlists between all versions. Once linked, this version will benefit from shared playlists",
|
||||
"link-playlist-info": "Adding and deleting playlists will also be shared",
|
||||
"keep-playlists": "Keep playlists",
|
||||
"keep-playlists-tip": "Keeping playlists will move the playlists from the current version to the shared playlists folder. Otherwise, they will be lost",
|
||||
"unlink-playlists": "Unlink playlists",
|
||||
"unlink-playlist-desc": "Warning, unlinking playlists will no longer allow the use of shared playlists for this version.",
|
||||
"unlink-keep-playlists-tip": "Keeping playlists will create a copy of shared playlists for the current version. Otherwise, no playlists will be kept for this version.",
|
||||
"delete-playlist-ask": "Delete playlist?",
|
||||
"delete-playlists-ask": "Delete playlists?",
|
||||
"delete-playlist-desc": "Are you sure you want to delete the playlist \"{playlistTitle}\"?",
|
||||
"delete-playlists-desc": "Are you sure you want to delete {nb} playlists?",
|
||||
"delete-maps": "Delete maps",
|
||||
"delete-playlist-maps-tip": "If enabled, all maps in the playlist will be deleted",
|
||||
"delete-playlists-maps-tip": "If enabled, all maps in the playlists will be deleted",
|
||||
"export-playlist-ask": "Export playlist?",
|
||||
"export-playlists-ask": "Export playlists?",
|
||||
"export-playlist-desc": "Are you sure you want to export the playlist \"{playlistTitle}\"?",
|
||||
"export-playlists-desc": "Are you sure you want to export {nb} playlists?",
|
||||
"export-maps": "Export maps",
|
||||
"export-playlist-maps-tip": "If enabled, all maps in the playlist will also be exported",
|
||||
"export-playlists-maps-tip": "If enabled, all maps in the playlists will also be exported",
|
||||
"export": "Export",
|
||||
"need-clone-title": "Warning",
|
||||
"need-clone-desc-1": "This playlist has been downloaded from an external site and contains a synchronization link.",
|
||||
"need-clone-desc-2": "To avoid losing your changes during synchronization, the playlist will be duplicated and its synchronization link removed.",
|
||||
"need-clone-desc-3": "You can then, if you wish, delete the original playlist.",
|
||||
"understood": "I understand",
|
||||
"synchronize-playlist-ask": "Synchronize playlist?",
|
||||
"synchronize-playlists-ask": "Synchronize playlists?",
|
||||
"synchronize-playlist-desc": "Are you sure you want to synchronize the playlist \"{playlistTitle}\"?",
|
||||
"synchronize-playlists-desc": "Are you sure you want to synchronize {nb} playlists?",
|
||||
"synchronize-playlist-tip": "This action updates playlists and downloads missing maps; it may take several minutes.",
|
||||
"synchronize": "Synchronize",
|
||||
"curated": "Recommended",
|
||||
"verified-mapper": "Verified mapper",
|
||||
"empty-playlists": "Empty playlists",
|
||||
"search-playlist": "Search for a playlist",
|
||||
"no-playlists-found": "No playlists found",
|
||||
"error-occur-while-loading-playlists": "An error occurred while loading playlists",
|
||||
"error-occur-while-loading-playlist": "An error occurred while loading the playlist",
|
||||
"loading-maps": "Loading maps...",
|
||||
"no-maps-found-for-playlist": "No maps found for this playlist",
|
||||
"playlist-contain-no-maps": "The playlist contains no maps",
|
||||
"no-map-installed-for-playlist": "No maps installed for this playlist",
|
||||
"playlist-is-waiting-to-download": "The playlist is waiting to download",
|
||||
"download-maps": "Download maps",
|
||||
"download-missing-maps": "Download missing maps",
|
||||
"playlist-is-downloading": "The playlist is downloading",
|
||||
"some-playlist-maps-are-missing": "Some maps in this playlist are missing",
|
||||
"create-a-playlist": "Create a playlist",
|
||||
"synchronize-playlists": "Synchronize playlists",
|
||||
"export-playlists": "Export playlists",
|
||||
"delete-playlists": "Delete playlists",
|
||||
"choose-image": "Choose an image",
|
||||
"title": "Title",
|
||||
"playlist-title": "Playlist title",
|
||||
"description": "Description",
|
||||
"playlist-description": "Playlist description",
|
||||
"author": "Author",
|
||||
"playlist-author": "Playlist author",
|
||||
"save": "Save",
|
||||
"loading": "Loading...",
|
||||
"installed": "Installed",
|
||||
"no-map-found": "No map found",
|
||||
"edit-playlist-shortcuts": "Hold Shift or Ctrl to select multiple maps",
|
||||
"add-to-playlist": "Add to playlist",
|
||||
"remove-from-playlist": "Remove from playlist",
|
||||
"playlist-is-empty": "The playlist is empty",
|
||||
"continue": "Continue",
|
||||
"nb-maps": "Number of maps",
|
||||
"nb-mappers": "Number of mappers",
|
||||
"duration": "Duration",
|
||||
"nps": "Notes per second",
|
||||
"date-picker": {
|
||||
"start-date-end-date": "Start date — End date",
|
||||
"all": "All",
|
||||
"last-24h": "Last 24h",
|
||||
"last-week": "Last week",
|
||||
"last-month": "Last month",
|
||||
"3-last-month": "Last 3 months"
|
||||
}
|
||||
},
|
||||
"dateformat": {
|
||||
"dayNames": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
||||
"monthNames": ["Jan", "Feb", "Mar", "Apr", "May", "June", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
||||
|
||||
@@ -190,6 +190,10 @@
|
||||
"report-bug": "Informar de un error",
|
||||
"open-logs": "Abrir los registros"
|
||||
}
|
||||
},
|
||||
"changelogs": {
|
||||
"open" : "🚀 ¡Descubre lo nuevo en el Changelog!",
|
||||
"not-founds": "😕 Uy, ¡Changelog no encontrado!"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -234,9 +238,6 @@
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"titles": {
|
||||
"dotnet-required": ".NET 6 Requerido"
|
||||
},
|
||||
"msg": {
|
||||
"401": "Parece que Steam no quiere dejarnos descargar Beat Saber 😢",
|
||||
"404": "No se puede contactar con los servidores de Steam",
|
||||
@@ -259,11 +260,7 @@
|
||||
"LicenceError": "No se puede obtener la lista de licencias.",
|
||||
"RateLimitExceeded": "Lo has intentado demasiadas veces, espera un poco y vuelve a intentarlo más tarde.",
|
||||
"TokenRejected": "Tu token de inicio de sesión ha sido rechazada 😕 Por favor, inténtalo de nuevo.",
|
||||
"AccessDenied": "El acceso a Steam ha sido denegado.",
|
||||
"dotnet-required": "Se debe instalar el tiempo de ejecución de .NET 6 para descargar una versión de Beat Saber. Descárgalo haciendo clic en el botón de abajo."
|
||||
},
|
||||
"actions": {
|
||||
"download-dotnet": "Descargar .NET 6"
|
||||
"AccessDenied": "El acceso a Steam ha sido denegado."
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -761,13 +758,13 @@
|
||||
"rb": "r&b",
|
||||
"holiday": "vacaciones",
|
||||
"vocaloid": "vocaloid",
|
||||
"jrock": "j-rock",
|
||||
"j-rock": "j-rock",
|
||||
"trance": "trance",
|
||||
"drumbass": "drum & bass",
|
||||
"comedy": "comedia",
|
||||
"instrumental": "instrumental",
|
||||
"hardcore": "hardcore",
|
||||
"kpop": "k-pop",
|
||||
"k-pop": "k-pop",
|
||||
"indie": "indie",
|
||||
"techno": "tecno",
|
||||
"house": "house",
|
||||
@@ -778,7 +775,7 @@
|
||||
"metal": "metal",
|
||||
"anime": "anime",
|
||||
"hiphop": "hiphop",
|
||||
"jpop": "j-pop",
|
||||
"j-pop": "j-pop",
|
||||
"rock": "rock",
|
||||
"pop": "pop",
|
||||
"electronic": "electrónico",
|
||||
@@ -1001,6 +998,122 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist": {
|
||||
"error-playlist-creation-title": "Error al crear la lista de reproducción",
|
||||
"error-playlist-creation-desc": "Ocurrió un error al crear la lista de reproducción.",
|
||||
"playlist-created-title": "Lista de reproducción creada",
|
||||
"playlist-created-desc": "La lista de reproducción se ha creado con éxito. ¡Ahora puedes sincronizar sus mapas!",
|
||||
"download-playlist": "Descargar lista de reproducción",
|
||||
"synchronize-playlist": "Sincronizar lista de reproducción",
|
||||
"synchronize-maps": "Sincronizar mapas",
|
||||
"error-playlists-synchronization-title": "Error al sincronizar listas de reproducción",
|
||||
"error-playlists-synchronization-desc": "Ocurrió un error al sincronizar las listas de reproducción.",
|
||||
"playlists-synchronized-title": "¡Listas de reproducción sincronizadas!",
|
||||
"playlists-synchronized-desc": "Las listas de reproducción y sus mapas han sido descargados.",
|
||||
"playlists-export-error-title": "Error al exportar listas de reproducción",
|
||||
"playlists-export-error-desc": "Ocurrió un error al exportar las listas de reproducción.",
|
||||
"playlists-exported-title": "¡Listas de reproducción exportadas!",
|
||||
"playlists-exported-desc": "Las listas de reproducción se han exportado con éxito.",
|
||||
"playlists-with-maps-exported-desc": "Las listas de reproducción y sus mapas se han exportado con éxito.",
|
||||
"playlist-delete-error-title": "Error al eliminar la lista de reproducción",
|
||||
"playlist-delete-error-desc": "Ocurrió un error al eliminar la lista de reproducción.",
|
||||
"playlists-deleted-title": "¡Listas de reproducción eliminadas!",
|
||||
"playlists-deleted-desc": "Las listas de reproducción se han eliminado con éxito.",
|
||||
"edit-playlist": "Editar lista de reproducción",
|
||||
"playlist-edit-error-title": "Error al editar la lista de reproducción",
|
||||
"playlist-edit-error-desc": "Ocurrió un error al editar la lista de reproducción.",
|
||||
"playlist-edited-title": "¡Lista de reproducción editada!",
|
||||
"playlist-edited-desc": "La lista de reproducción se ha modificado con éxito. ¡Ahora puedes sincronizar sus mapas!",
|
||||
"playlists-loading": "Cargando listas de reproducción...",
|
||||
"no-playlists": "No hay listas de reproducción",
|
||||
"download-playlists": "Descargar listas de reproducción",
|
||||
"created-by": "Creado por",
|
||||
"stop-download": "Detener descarga",
|
||||
"cancel-download": "Cancelar descarga",
|
||||
"open-file": "Abrir archivo",
|
||||
"link-playlists": "Vincular listas de reproducción",
|
||||
"link-playlist-desc": "Vincular listas de reproducción permite compartirlas entre todas las versiones. Una vez vinculada, esta versión se beneficiará de las listas de reproducción compartidas",
|
||||
"link-playlist-info": "Añadir y eliminar listas de reproducción también se compartirá",
|
||||
"keep-playlists": "Mantener listas de reproducción",
|
||||
"keep-playlists-tip": "Mantener las listas de reproducción moverá las listas de la versión actual a la carpeta de listas compartidas. De lo contrario, se perderán",
|
||||
"unlink-playlists": "Desvincular listas de reproducción",
|
||||
"unlink-playlist-desc": "Advertencia, desvincular las listas de reproducción ya no permitirá el uso de listas compartidas para esta versión.",
|
||||
"unlink-keep-playlists-tip": "Mantener las listas de reproducción creará una copia de las listas compartidas para la versión actual. De lo contrario, no se mantendrán listas para esta versión.",
|
||||
"delete-playlist-ask": "¿Eliminar lista de reproducción?",
|
||||
"delete-playlists-ask": "¿Eliminar listas de reproducción?",
|
||||
"delete-playlist-desc": "¿Estás seguro de que quieres eliminar la lista de reproducción \"{playlistTitle}\"?",
|
||||
"delete-playlists-desc": "¿Estás seguro de que quieres eliminar {nb} listas de reproducción?",
|
||||
"delete-maps": "Eliminar mapas",
|
||||
"delete-playlist-maps-tip": "Si está activado, se eliminarán todos los mapas de la lista de reproducción",
|
||||
"delete-playlists-maps-tip": "Si está activado, se eliminarán todos los mapas de las listas de reproducción",
|
||||
"export-playlist-ask": "¿Exportar lista de reproducción?",
|
||||
"export-playlists-ask": "¿Exportar listas de reproducción?",
|
||||
"export-playlist-desc": "¿Estás seguro de que quieres exportar la lista de reproducción \"{playlistTitle}\"?",
|
||||
"export-playlists-desc": "¿Estás seguro de que quieres exportar {nb} listas de reproducción?",
|
||||
"export-maps": "Exportar mapas",
|
||||
"export-playlist-maps-tip": "Si está activado, también se exportarán todos los mapas de la lista de reproducción",
|
||||
"export-playlists-maps-tip": "Si está activado, también se exportarán todos los mapas de las listas de reproducción",
|
||||
"export": "Exportar",
|
||||
"need-clone-title": "Advertencia",
|
||||
"need-clone-desc-1": "Esta lista de reproducción se ha descargado de un sitio externo y contiene un enlace de sincronización.",
|
||||
"need-clone-desc-2": "Para evitar perder tus cambios durante la sincronización, la lista de reproducción se duplicará y se eliminará su enlace de sincronización.",
|
||||
"need-clone-desc-3": "Luego puedes, si lo deseas, eliminar la lista de reproducción original.",
|
||||
"understood": "Entendido",
|
||||
"synchronize-playlist-ask": "¿Sincronizar lista de reproducción?",
|
||||
"synchronize-playlists-ask": "¿Sincronizar listas de reproducción?",
|
||||
"synchronize-playlist-desc": "¿Estás seguro de que quieres sincronizar la lista de reproducción \"{playlistTitle}\"?",
|
||||
"synchronize-playlists-desc": "¿Estás seguro de que quieres sincronizar {nb} listas de reproducción?",
|
||||
"synchronize-playlist-tip": "Esta acción actualiza las listas de reproducción y descarga los mapas faltantes; puede tardar varios minutos.",
|
||||
"synchronize": "Sincronizar",
|
||||
"curated": "Recomendado",
|
||||
"verified-mapper": "Mapeador verificado",
|
||||
"empty-playlists": "Listas de reproducción vacías",
|
||||
"search-playlist": "Buscar una lista de reproducción",
|
||||
"no-playlists-found": "No se encontraron listas de reproducción",
|
||||
"error-occur-while-loading-playlists": "Ocurrió un error al cargar las listas de reproducción",
|
||||
"error-occur-while-loading-playlist": "Ocurrió un error al cargar la lista de reproducción",
|
||||
"loading-maps": "Cargando mapas...",
|
||||
"no-maps-found-for-playlist": "No se encontraron mapas para esta lista de reproducción",
|
||||
"playlist-contain-no-maps": "La lista de reproducción no contiene mapas",
|
||||
"no-map-installed-for-playlist": "No hay mapas instalados para esta lista de reproducción",
|
||||
"playlist-is-waiting-to-download": "La lista de reproducción está esperando para descargar",
|
||||
"download-maps": "Descargar mapas",
|
||||
"download-missing-maps": "Descargar mapas faltantes",
|
||||
"playlist-is-downloading": "La lista de reproducción se está descargando",
|
||||
"some-playlist-maps-are-missing": "Faltan algunos mapas en esta lista de reproducción",
|
||||
"create-a-playlist": "Crear una lista de reproducción",
|
||||
"synchronize-playlists": "Sincronizar listas de reproducción",
|
||||
"export-playlists": "Exportar listas de reproducción",
|
||||
"delete-playlists": "Eliminar listas de reproducción",
|
||||
"choose-image": "Elegir una imagen",
|
||||
"title": "Título",
|
||||
"playlist-title": "Título de la lista de reproducción",
|
||||
"description": "Descripción",
|
||||
"playlist-description": "Descripción de la lista de reproducción",
|
||||
"author": "Autor",
|
||||
"playlist-author": "Autor de la lista de reproducción",
|
||||
"save": "Guardar",
|
||||
"loading": "Cargando...",
|
||||
"installed": "Instalado",
|
||||
"no-map-found": "No se encontró ningún mapa",
|
||||
"edit-playlist-shortcuts": "Mantén presionado Shift o Ctrl para seleccionar múltiples mapas",
|
||||
"add-to-playlist": "Añadir a la lista de reproducción",
|
||||
"remove-from-playlist": "Quitar de la lista de reproducción",
|
||||
"playlist-is-empty": "La lista de reproducción está vacía",
|
||||
"continue": "Continuar",
|
||||
"nb-maps": "Número de mapas",
|
||||
"nb-mappers": "Número de mapeadores",
|
||||
"duration": "Duración",
|
||||
"nps": "Notas por segundo",
|
||||
"date-picker": {
|
||||
"start-date-end-date": "Fecha de inicio — Fecha de fin",
|
||||
"all": "Todo",
|
||||
"last-24h": "Últimas 24h",
|
||||
"last-week": "Última semana",
|
||||
"last-month": "Último mes",
|
||||
"3-last-month": "Últimos 3 meses"
|
||||
}
|
||||
},
|
||||
"dateformat": {
|
||||
"dayNames": ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb", "Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
|
||||
"monthNames": ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
|
||||
|
||||
@@ -190,6 +190,10 @@
|
||||
"report-bug": "Signaler un bug",
|
||||
"open-logs": "Ouvrir les logs"
|
||||
}
|
||||
},
|
||||
"changelogs": {
|
||||
"open" : "🚀 Jetez un œil au Changelog !",
|
||||
"not-founds": "😕 Oups, Changelog introuvable !"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -234,9 +238,6 @@
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"titles": {
|
||||
"dotnet-required": ".NET 6 Requis"
|
||||
},
|
||||
"msg": {
|
||||
"401": "Steam ne semble pas vouloir nous laisser télécharger Beat Saber 😢",
|
||||
"404": "Impossible de contacter les serveurs de Steam.",
|
||||
@@ -259,11 +260,7 @@
|
||||
"LicenceError": "Impossible d'obtenir la liste des licences.",
|
||||
"RateLimitExceeded": "Tu as essayé trop de fois attends un peu et recommence plus tard.",
|
||||
"TokenRejected": "Votre token de connexion a été rejeté 😕 Veuillez réessayer.",
|
||||
"AccessDenied": "L'accès à Steam a été refusé.",
|
||||
"dotnet-required": ".NET 6 Runtime doit être installé pour pouvoir télécharger une version de Beat Saber. Télécharge-le en cliquant sur le bouton ci-dessous."
|
||||
},
|
||||
"actions": {
|
||||
"download-dotnet": "Télécharger .NET 6"
|
||||
"AccessDenied": "L'accès à Steam a été refusé."
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -761,13 +758,13 @@
|
||||
"rb": "r&b",
|
||||
"holiday": "vacance",
|
||||
"vocaloid": "vocaloid",
|
||||
"jrock": "j-rock",
|
||||
"j-rock": "j-rock",
|
||||
"trance": "trance",
|
||||
"drumbass": "drum & bass",
|
||||
"comedy": "comédie",
|
||||
"instrumental": "instrumental",
|
||||
"hardcore": "hardcore",
|
||||
"kpop": "k-pop",
|
||||
"k-pop": "k-pop",
|
||||
"indie": "indé",
|
||||
"techno": "techno",
|
||||
"house": "house",
|
||||
@@ -778,7 +775,7 @@
|
||||
"metal": "metal",
|
||||
"anime": "anime",
|
||||
"hiphop": "hiphop",
|
||||
"jpop": "j-pop",
|
||||
"j-pop": "j-pop",
|
||||
"rock": "rock",
|
||||
"pop": "pop",
|
||||
"electronic": "électronique",
|
||||
@@ -809,7 +806,8 @@
|
||||
"bsr-code" : "Code BSR",
|
||||
"download" : "Télécharger la carte",
|
||||
"downloading" :"Téléchargement de la carte",
|
||||
"cancel-download" : "Annuler le téléchargement"
|
||||
"cancel-download" : "Annuler le téléchargement",
|
||||
"hightlight-difficulty" : "Surligner la difficulté"
|
||||
}
|
||||
},
|
||||
"models": {
|
||||
@@ -1001,6 +999,122 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist": {
|
||||
"error-playlist-creation-title": "Erreur lors de la création de la playlist",
|
||||
"error-playlist-creation-desc": "Une erreur est survenue lors de la création de la playlist.",
|
||||
"playlist-created-title": "Playlist créée",
|
||||
"playlist-created-desc": "La playlist a été créée avec succès. Tu peut maintenant synchroniser ses maps !",
|
||||
"download-playlist": "Télécharger la playlist",
|
||||
"synchronize-playlist": "Synchroniser la playlist",
|
||||
"synchronize-maps": "Synchroniser les maps",
|
||||
"error-playlists-synchronization-title": "Erreur lors de la synchronisation des playlists",
|
||||
"error-playlists-synchronization-desc": "Une erreur est survenue lors de la synchronisation des playlists.",
|
||||
"playlists-synchronized-title": "Playlists synchronisées !",
|
||||
"playlists-synchronized-desc": "Les playlists et leurs maps ont été téléchargées.",
|
||||
"playlists-export-error-title": "Erreur lors de l'exportation des playlists",
|
||||
"playlists-export-error-desc": "Une erreur est survenue lors de l'exportation des playlists.",
|
||||
"playlists-exported-title": "Playlists exportées !",
|
||||
"playlists-exported-desc": "Les playlists ont été exportées avec succès.",
|
||||
"playlists-with-maps-exported-desc": "Les playlists et leurs maps ont été exportées avec succès.",
|
||||
"playlist-delete-error-title": "Erreur lors de la suppression de la playlist",
|
||||
"playlist-delete-error-desc": "Une erreur est survenue lors de la suppression de la playlist.",
|
||||
"playlists-deleted-title": "Playlists supprimées !",
|
||||
"playlists-deleted-desc": "Les playlists ont été supprimées avec succès.",
|
||||
"edit-playlist": "Éditer la playlist",
|
||||
"playlist-edit-error-title": "Erreur lors de l'édition de la playlist",
|
||||
"playlist-edit-error-desc": "Une erreur est survenue lors de l'édition de la playlist.",
|
||||
"playlist-edited-title": "Playlist éditée !",
|
||||
"playlist-edited-desc": "La playlist a été modifiée avec succès. Tu peut maintenant synchroniser ses maps !",
|
||||
"playlists-loading": "Chargement des playlist...",
|
||||
"no-playlists": "Aucune playlist",
|
||||
"download-playlists": "Télécharger des playlists",
|
||||
"created-by": "Créée par",
|
||||
"stop-download": "Arrêter le téléchargement",
|
||||
"cancel-download": "Annuler le téléchargement",
|
||||
"open-file": "Ouvrir le fichier",
|
||||
"link-playlists": "Lier les playlists",
|
||||
"link-playlist-desc": "La liaison des playlists permet de partager les playlists entre toute les version. Une fois liée, cette version profitera des playlists partagées",
|
||||
"link-playlist-info": "L'ajout et la suppression de playlists sera également partagé",
|
||||
"keep-playlists": "Conserver les playlists",
|
||||
"keep-playlists-tip": "Conserver les playlists déplacera les playlists de la version actuelle dans le dossier des playlists partagées. Dans le cas contraire elles seront perdues",
|
||||
"unlink-playlists": "Délier les playlists",
|
||||
"unlink-playlist-desc": "Attention, délier les playlists ne permettra plus l'utilisation des playlists paratagées pour cette version.",
|
||||
"unlink-keep-playlists-tip": "Conserver les playlists créera une copie des playlists partagées pour la version actuelle. Dans le cas contraire, aucune playlist ne sera conservée pour cette version.",
|
||||
"delete-playlist-ask": "Supprimer la playlist ?",
|
||||
"delete-playlists-ask": "Supprimer les playlists ?",
|
||||
"delete-playlist-desc": "Es-tu sur de vouloir supprimer la playlist \"{playlistTitle}\" ?",
|
||||
"delete-playlists-desc": "Es-tu sur de vouloir supprimer {nb} playlists ?",
|
||||
"delete-maps": "Supprimer les maps",
|
||||
"delete-playlist-maps-tip": "Si activé, toutes les maps de la playlist seront supprimées",
|
||||
"delete-playlists-maps-tip": "Si activé, toutes les maps des playlists seront supprimées",
|
||||
"export-playlist-ask": "Exporter la playlist ?",
|
||||
"export-playlists-ask": "Exporter les playlists ?",
|
||||
"export-playlist-desc": "Es-tu sur de vouloir exporter la playlist \"{playlistTitle}\" ?",
|
||||
"export-playlists-desc": "Es-tu sur de vouloir exporter les {nb} playlists ?",
|
||||
"export-maps": "Exporter les maps",
|
||||
"export-playlist-maps-tip": "Si activé, toutes les maps de la playlist seront également exportées",
|
||||
"export-playlists-maps-tip": "Si activé, toutes les maps des playlists seront également exportées",
|
||||
"export": "Exporter",
|
||||
"need-clone-title": "Attention",
|
||||
"need-clone-desc-1": "Cette playlist a été téléchargée depuis un site externe et contient un lien de synchronisation.",
|
||||
"need-clone-desc-2": "Pour éviter de perdre vos modifications lors d'une synchronisation, la playlist va être dupliquée et son lien de synchronisation supprimé.",
|
||||
"need-clone-desc-3": "Vous pourrez ensuite, si vous le souhaitez, supprimer la playlist originale.",
|
||||
"understood": "J'ai compris",
|
||||
"synchronize-playlist-ask": "Synchroniser la playlist ?",
|
||||
"synchronize-playlists-ask": "Synchroniser les playlists ?",
|
||||
"synchronize-playlist-desc": "Es-tu sur de vouloir synchroniser la playlist \"{playlistTitle}\" ?",
|
||||
"synchronize-playlists-desc": "Es-tu sur de vouloir synchroniser les {nb} playlists ?",
|
||||
"synchronize-playlist-tip": "Cette action met à jour les playlists et télécharge les maps manquantes; cela peut durer plusieurs minutes.",
|
||||
"synchronize": "Synchroniser",
|
||||
"curated": "Recommandée",
|
||||
"verified-mapper": "Mapper vérifié",
|
||||
"empty-playlists": "Playlists vides",
|
||||
"search-playlist": "Rechercher une playlist",
|
||||
"no-playlists-found": "Aucune playlists trouvées",
|
||||
"error-occur-while-loading-playlists": "Une erreur est survenue lors du chargement des playlists",
|
||||
"error-occur-while-loading-playlist": "Une erreur est survenue lors du chargement de la playlist",
|
||||
"loading-maps":"Chargement des maps...",
|
||||
"no-maps-found-for-playlist":"Aucune map trouvée pour cette playlist",
|
||||
"playlist-contain-no-maps":"La playlist ne contient aucune map",
|
||||
"no-map-installed-for-playlist":"Aucune map installée pour cette playlist",
|
||||
"playlist-is-waiting-to-download":"La playlist est en attente de téléchargment",
|
||||
"download-maps": "Télécharger les maps",
|
||||
"download-missing-maps": "Télécharger les maps manquantes",
|
||||
"playlist-is-downloading":"La playlist est en cours de téléchargement",
|
||||
"some-playlist-maps-are-missing":"Certaines maps de cette playlist sont manquantes",
|
||||
"create-a-playlist": "Créer une playlist",
|
||||
"synchronize-playlists": "Synchroniser les playlists",
|
||||
"export-playlists": "Exporter les playlists",
|
||||
"delete-playlists": "Supprimer les playlists",
|
||||
"choose-image": "Choisir une image",
|
||||
"title": "Titre",
|
||||
"playlist-title": "Titre de la playlist",
|
||||
"description": "Description",
|
||||
"playlist-description": "Description de la playlist",
|
||||
"author": "Auteur",
|
||||
"playlist-author": "Auteur de la playlist",
|
||||
"save": "Enregistrer",
|
||||
"loading": "Chargement...",
|
||||
"installed": "Installée",
|
||||
"no-map-found": "Aucune map trouvée",
|
||||
"edit-playlist-shortcuts": "Maintenez Maj ou Ctrl pour sélectionner plusieurs maps",
|
||||
"add-to-playlist": "Ajouter à la playlist",
|
||||
"remove-from-playlist": "Retirer de la playlist",
|
||||
"playlist-is-empty": "La playlist est vide",
|
||||
"continue": "Continuer",
|
||||
"nb-maps": "Nombre de maps",
|
||||
"nb-mappers": "Nombre de mappers",
|
||||
"duration": "Durée",
|
||||
"nps": "Notes par secondes",
|
||||
"date-picker": {
|
||||
"start-date-end-date": "Date début — Date fin",
|
||||
"all": "Tout",
|
||||
"last-24h": "Dernières 24h",
|
||||
"last-week": "Dernière semaine",
|
||||
"last-month": "Dernier mois",
|
||||
"3-last-month": "3 derniers mois"
|
||||
}
|
||||
},
|
||||
"dateformat": {
|
||||
"dayNames": ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"],
|
||||
"monthNames": ["Jan", "Fév", "Mar", "Avr", "Mai", "Jun", "Juil", "Aou", "Sept", "Oct", "Nov", "Déc", "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"],
|
||||
|
||||
@@ -190,6 +190,10 @@
|
||||
"report-bug": "バグを報告",
|
||||
"open-logs": "ログを表示"
|
||||
}
|
||||
},
|
||||
"changelogs": {
|
||||
"open" : "🚀 チェンジログを覗いてみて!",
|
||||
"not-founds": "😕 あれ、チェンジログが見当たらない!"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -234,9 +238,6 @@
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"titles": {
|
||||
"dotnet-required": ".NET 6が必要です!"
|
||||
},
|
||||
"msg": {
|
||||
"401": "SteamがBeat Saberのダウンロードを許可してくれないようだ。😢",
|
||||
"404": "Steamサーバーに接続できません。",
|
||||
@@ -259,11 +260,7 @@
|
||||
"LicenceError": "ライセンスリストを取得できません。",
|
||||
"RateLimitExceeded": "何度も試しているのでしばらくたって、もう一度お試しください。",
|
||||
"TokenRejected": "ログイントークンが拒否されました 😕 もう一度お試しください。",
|
||||
"AccessDenied": "Steamへのアクセスが拒否されました。",
|
||||
"dotnet-required": "Beat Saberをダウンロードするには、.NET 6 Runtimeがインストールされている必要があります。下のボタンをクリックしてダウンロードしてください。"
|
||||
},
|
||||
"actions": {
|
||||
"download-dotnet": ".NET 6をダウンロード"
|
||||
"AccessDenied": "Steamへのアクセスが拒否されました。"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -761,13 +758,13 @@
|
||||
"rb": "r&b",
|
||||
"holiday": "休日",
|
||||
"vocaloid": "ボーカロイド",
|
||||
"jrock": "j-rock",
|
||||
"j-rock": "j-rock",
|
||||
"trance": "トランス",
|
||||
"drumbass": "ドラムンベース",
|
||||
"comedy": "コメディ",
|
||||
"instrumental": "器楽",
|
||||
"hardcore": "ハードコア",
|
||||
"kpop": "k-pop",
|
||||
"k-pop": "k-pop",
|
||||
"indie": "インディー",
|
||||
"techno": "テクノ",
|
||||
"house": "家",
|
||||
@@ -778,7 +775,7 @@
|
||||
"metal": "メタル",
|
||||
"anime": "アニメ",
|
||||
"hiphop": "ヒップポップ",
|
||||
"jpop": "j-pop",
|
||||
"j-pop": "j-pop",
|
||||
"rock": "ロック",
|
||||
"pop": "ポップ",
|
||||
"electronic": "エレクトロニック",
|
||||
@@ -1001,9 +998,125 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist": {
|
||||
"error-playlist-creation-title": "プレイリストの作成エラー",
|
||||
"error-playlist-creation-desc": "プレイリストの作成中にエラーが発生しました。",
|
||||
"playlist-created-title": "プレイリストが作成されました",
|
||||
"playlist-created-desc": "プレイリストが正常に作成されました。今すぐマップを同期できます!",
|
||||
"download-playlist": "プレイリストをダウンロード",
|
||||
"synchronize-playlist": "プレイリストを同期",
|
||||
"synchronize-maps": "マップを同期",
|
||||
"error-playlists-synchronization-title": "プレイリストの同期エラー",
|
||||
"error-playlists-synchronization-desc": "プレイリストの同期中にエラーが発生しました。",
|
||||
"playlists-synchronized-title": "プレイリストが同期されました!",
|
||||
"playlists-synchronized-desc": "プレイリストとそのマップがダウンロードされました。",
|
||||
"playlists-export-error-title": "プレイリストのエクスポートエラー",
|
||||
"playlists-export-error-desc": "プレイリストのエクスポート中にエラーが発生しました。",
|
||||
"playlists-exported-title": "プレイリストがエクスポートされました!",
|
||||
"playlists-exported-desc": "プレイリストが正常にエクスポートされました。",
|
||||
"playlists-with-maps-exported-desc": "プレイリストとそのマップが正常にエクスポートされました。",
|
||||
"playlist-delete-error-title": "プレイリストの削除エラー",
|
||||
"playlist-delete-error-desc": "プレイリストの削除中にエラーが発生しました。",
|
||||
"playlists-deleted-title": "プレイリストが削除されました!",
|
||||
"playlists-deleted-desc": "プレイリストが正常に削除されました。",
|
||||
"edit-playlist": "プレイリストを編集",
|
||||
"playlist-edit-error-title": "プレイリストの編集エラー",
|
||||
"playlist-edit-error-desc": "プレイリストの編集中にエラーが発生しました。",
|
||||
"playlist-edited-title": "プレイリストが編集されました!",
|
||||
"playlist-edited-desc": "プレイリストが正常に変更されました。今すぐマップを同期できます!",
|
||||
"playlists-loading": "プレイリストを読み込み中...",
|
||||
"no-playlists": "プレイリストがありません",
|
||||
"download-playlists": "プレイリストをダウンロード",
|
||||
"created-by": "作成者",
|
||||
"stop-download": "ダウンロードを停止",
|
||||
"cancel-download": "ダウンロードをキャンセル",
|
||||
"open-file": "ファイルを開く",
|
||||
"link-playlists": "プレイリストをリンク",
|
||||
"link-playlist-desc": "プレイリストをリンクすると、すべてのバージョン間でプレイリストを共有できます。リンクすると、このバージョンは共有プレイリストの恩恵を受けます",
|
||||
"link-playlist-info": "プレイリストの追加と削除も共有されます",
|
||||
"keep-playlists": "プレイリストを保持",
|
||||
"keep-playlists-tip": "プレイリストを保持すると、現在のバージョンのプレイリストが共有プレイリストフォルダに移動されます。そうしない場合、それらは失われます",
|
||||
"unlink-playlists": "プレイリストのリンクを解除",
|
||||
"unlink-playlist-desc": "警告:プレイリストのリンクを解除すると、このバージョンでは共有プレイリストを使用できなくなります。",
|
||||
"unlink-keep-playlists-tip": "プレイリストを保持すると、現在のバージョン用に共有プレイリストのコピーが作成されます。そうしない場合、このバージョンのプレイリストは保持されません。",
|
||||
"delete-playlist-ask": "プレイリストを削除しますか?",
|
||||
"delete-playlists-ask": "プレイリストを削除しますか?",
|
||||
"delete-playlist-desc": "プレイリスト「{playlistTitle}」を削除してもよろしいですか?",
|
||||
"delete-playlists-desc": "{nb}個のプレイリストを削除してもよろしいですか?",
|
||||
"delete-maps": "マップを削除",
|
||||
"delete-playlist-maps-tip": "有効にすると、プレイリスト内のすべてのマップが削除されます",
|
||||
"delete-playlists-maps-tip": "有効にすると、プレイリスト内のすべてのマップが削除されます",
|
||||
"export-playlist-ask": "プレイリストをエクスポートしますか?",
|
||||
"export-playlists-ask": "プレイリストをエクスポートしますか?",
|
||||
"export-playlist-desc": "プレイリスト「{playlistTitle}」をエクスポートしてもよろしいですか?",
|
||||
"export-playlists-desc": "{nb}個のプレイリストをエクスポートしてもよろしいですか?",
|
||||
"export-maps": "マップをエクスポート",
|
||||
"export-playlist-maps-tip": "有効にすると、プレイリスト内のすべてのマップもエクスポートされます",
|
||||
"export-playlists-maps-tip": "有効にすると、プレイリスト内のすべてのマップもエクスポートされます",
|
||||
"export": "エクスポート",
|
||||
"need-clone-title": "警告",
|
||||
"need-clone-desc-1": "このプレイリストは外部サイトからダウンロードされ、同期リンクが含まれています。",
|
||||
"need-clone-desc-2": "同期中に変更を失わないようにするため、プレイリストが複製され、同期リンクが削除されます。",
|
||||
"need-clone-desc-3": "その後、必要に応じて元のプレイリストを削除できます。",
|
||||
"understood": "理解しました",
|
||||
"synchronize-playlist-ask": "プレイリストを同期しますか?",
|
||||
"synchronize-playlists-ask": "プレイリストを同期しますか?",
|
||||
"synchronize-playlist-desc": "プレイリスト「{playlistTitle}」を同期してもよろしいですか?",
|
||||
"synchronize-playlists-desc": "{nb}個のプレイリストを同期してもよろしいですか?",
|
||||
"synchronize-playlist-tip": "この操作はプレイリストを更新し、不足しているマップをダウンロードします。数分かかる場合があります。",
|
||||
"synchronize": "同期",
|
||||
"curated": "おすすめ",
|
||||
"verified-mapper": "認証済みマッパー",
|
||||
"empty-playlists": "空のプレイリスト",
|
||||
"search-playlist": "プレイリストを検索",
|
||||
"no-playlists-found": "プレイリストが見つかりません",
|
||||
"error-occur-while-loading-playlists": "プレイリストの読み込み中にエラーが発生しました",
|
||||
"error-occur-while-loading-playlist": "プレイリストの読み込み中にエラーが発生しました",
|
||||
"loading-maps": "マップを読み込み中...",
|
||||
"no-maps-found-for-playlist": "このプレイリストにマップが見つかりません",
|
||||
"playlist-contain-no-maps": "プレイリストにマップが含まれていません",
|
||||
"no-map-installed-for-playlist": "このプレイリストにインストールされたマップがありません",
|
||||
"playlist-is-waiting-to-download": "プレイリストはダウンロード待ちです",
|
||||
"download-maps": "マップをダウンロード",
|
||||
"download-missing-maps": "不足しているマップをダウンロード",
|
||||
"playlist-is-downloading": "プレイリストをダウンロード中です",
|
||||
"some-playlist-maps-are-missing": "このプレイリストの一部のマップが不足しています",
|
||||
"create-a-playlist": "プレイリストを作成",
|
||||
"synchronize-playlists": "プレイリストを同期",
|
||||
"export-playlists": "プレイリストをエクスポート",
|
||||
"delete-playlists": "プレイリストを削除",
|
||||
"choose-image": "画像を選択",
|
||||
"title": "タイトル",
|
||||
"playlist-title": "プレイリストのタイトル",
|
||||
"description": "説明",
|
||||
"playlist-description": "プレイリストの説明",
|
||||
"author": "作者",
|
||||
"playlist-author": "プレイリストの作者",
|
||||
"save": "保存",
|
||||
"loading": "読み込み中...",
|
||||
"installed": "インストール済み",
|
||||
"no-map-found": "マップが見つかりません",
|
||||
"edit-playlist-shortcuts": "ShiftキーまたはCtrlキーを押しながら複数のマップを選択",
|
||||
"add-to-playlist": "プレイリストに追加",
|
||||
"remove-from-playlist": "プレイリストから削除",
|
||||
"playlist-is-empty": "プレイリストが空です",
|
||||
"continue": "続ける",
|
||||
"nb-maps": "マップ数",
|
||||
"nb-mappers": "マッパー数",
|
||||
"duration": "継続時間",
|
||||
"nps": "1秒あたりの音符数",
|
||||
"date-picker": {
|
||||
"start-date-end-date": "開始日 — 終了日",
|
||||
"all": "すべて",
|
||||
"last-24h": "過去24時間",
|
||||
"last-week": "先週",
|
||||
"last-month": "先月",
|
||||
"3-last-month": "過去3ヶ月"
|
||||
}
|
||||
},
|
||||
"dateformat": {
|
||||
"dayNames": ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
||||
"monthNames": ["Jan", "Feb", "Mar", "Apr", "May", "June", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
||||
"timeNames": ["a", "p", "am", "pm", "A", "P", "AM", "PM"]
|
||||
"dayNames": ["日", "月", "火", "水", "木", "金", "土", "日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"],
|
||||
"monthNames": ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月", "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
|
||||
"timeNames": ["午前", "午後", "午前", "午後", "午前", "午後", "午前", "午後"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,6 +190,10 @@
|
||||
"report-bug": "Сообщить о баге",
|
||||
"open-logs": "Открыть логи"
|
||||
}
|
||||
},
|
||||
"changelogs": {
|
||||
"open" : "🚀 Изучаем Changelog!",
|
||||
"not-founds": "😕 Ой, Changelog нигде не видно!"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -234,9 +238,6 @@
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"titles": {
|
||||
"dotnet-required": "Требуется .NET 6"
|
||||
},
|
||||
"msg": {
|
||||
"401": "Похоже Steam не хочет, чтобы мы скачали Beat Saber 😢",
|
||||
"404": "Нет связи с серверами Steam.",
|
||||
@@ -259,11 +260,7 @@
|
||||
"LicenceError": "Не удалось проверить наличие лицензии.",
|
||||
"RateLimitExceeded": "Слишком много попыток, вернитесь позже и попробуйте снова.",
|
||||
"TokenRejected": "Ваш токен для входа был отклонен 😕 Пожалуйста, попробуйте снова.",
|
||||
"AccessDenied": "Доступ к Steam был отклонен.",
|
||||
"dotnet-required": "Среда запуска .NET 6 должна быть установлена, чтобы скачать Beat Saber. Скачайте её с помощью кнопки ниже."
|
||||
},
|
||||
"actions": {
|
||||
"download-dotnet": "Скачать .NET 6"
|
||||
"AccessDenied": "Доступ к Steam был отклонен."
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -760,13 +757,13 @@
|
||||
"rb": "ар-н-би",
|
||||
"holiday": "праздник",
|
||||
"vocaloid": "вокалоиды",
|
||||
"jrock": "джей-рок",
|
||||
"j-rock": "джей-рок",
|
||||
"trance": "транс",
|
||||
"drumbass": "драм-н-бейс",
|
||||
"comedy": "комедия",
|
||||
"instrumental": "инструментальные",
|
||||
"hardcore": "хардкор",
|
||||
"kpop": "кей-поп",
|
||||
"k-pop": "кей-поп",
|
||||
"indie": "инди",
|
||||
"techno": "техно",
|
||||
"house": "хаус",
|
||||
@@ -777,7 +774,7 @@
|
||||
"metal": "метал",
|
||||
"anime": "аниме",
|
||||
"hiphop": "хипхоп",
|
||||
"jpop": "джей-поп",
|
||||
"j-pop": "джей-поп",
|
||||
"rock": "прк",
|
||||
"pop": "поп",
|
||||
"electronic": "электроника",
|
||||
@@ -1000,6 +997,122 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist": {
|
||||
"error-playlist-creation-title": "Ошибка при создании плейлиста",
|
||||
"error-playlist-creation-desc": "Произошла ошибка при создании плейлиста.",
|
||||
"playlist-created-title": "Плейлист создан",
|
||||
"playlist-created-desc": "Плейлист успешно создан. Теперь вы можете синхронизировать его карты!",
|
||||
"download-playlist": "Скачать плейлист",
|
||||
"synchronize-playlist": "Синхронизировать плейлист",
|
||||
"synchronize-maps": "Синхронизировать карты",
|
||||
"error-playlists-synchronization-title": "Ошибка синхронизации плейлистов",
|
||||
"error-playlists-synchronization-desc": "Произошла ошибка при синхронизации плейлистов.",
|
||||
"playlists-synchronized-title": "Плейлисты синхронизированы!",
|
||||
"playlists-synchronized-desc": "Плейлисты и их карты были загружены.",
|
||||
"playlists-export-error-title": "Ошибка экспорта плейлистов",
|
||||
"playlists-export-error-desc": "Произошла ошибка при экспорте плейлистов.",
|
||||
"playlists-exported-title": "Плейлисты экспортированы!",
|
||||
"playlists-exported-desc": "Плейлисты успешно экспортированы.",
|
||||
"playlists-with-maps-exported-desc": "Плейлисты и их карты успешно экспортированы.",
|
||||
"playlist-delete-error-title": "Ошибка удаления плейлиста",
|
||||
"playlist-delete-error-desc": "Произошла ошибка при удалении плейлиста.",
|
||||
"playlists-deleted-title": "Плейлисты удалены!",
|
||||
"playlists-deleted-desc": "Плейлисты успешно удалены.",
|
||||
"edit-playlist": "Редактировать плейлист",
|
||||
"playlist-edit-error-title": "Ошибка редактирования плейлиста",
|
||||
"playlist-edit-error-desc": "Произошла ошибка при редактировании плейлиста.",
|
||||
"playlist-edited-title": "Плейлист отредактирован!",
|
||||
"playlist-edited-desc": "Плейлист успешно изменен. Теперь вы можете синхронизировать его карты!",
|
||||
"playlists-loading": "Загрузка плейлистов...",
|
||||
"no-playlists": "Нет плейлистов",
|
||||
"download-playlists": "Скачать плейлисты",
|
||||
"created-by": "Создано",
|
||||
"stop-download": "Остановить загрузку",
|
||||
"cancel-download": "Отменить загрузку",
|
||||
"open-file": "Открыть файл",
|
||||
"link-playlists": "Связать плейлисты",
|
||||
"link-playlist-desc": "Связывание плейлистов позволяет делиться плейлистами между всеми версиями. После связывания эта версия будет иметь доступ к общим плейлистам",
|
||||
"link-playlist-info": "Добавление и удаление плейлистов также будет общим",
|
||||
"keep-playlists": "Сохранить плейлисты",
|
||||
"keep-playlists-tip": "Сохранение плейлистов переместит плейлисты из текущей версии в папку общих плейлистов. В противном случае они будут потеряны",
|
||||
"unlink-playlists": "Отвязать плейлисты",
|
||||
"unlink-playlist-desc": "Внимание, отвязка плейлистов больше не позволит использовать общие плейлисты для этой версии.",
|
||||
"unlink-keep-playlists-tip": "Сохранение плейлистов создаст копию общих плейлистов для текущей версии. В противном случае для этой версии не будут сохранены плейлисты.",
|
||||
"delete-playlist-ask": "Удалить плейлист?",
|
||||
"delete-playlists-ask": "Удалить плейлисты?",
|
||||
"delete-playlist-desc": "Вы уверены, что хотите удалить плейлист \"{playlistTitle}\"?",
|
||||
"delete-playlists-desc": "Вы уверены, что хотите удалить {nb} плейлистов?",
|
||||
"delete-maps": "Удалить карты",
|
||||
"delete-playlist-maps-tip": "Если включено, все карты в плейлисте будут удалены",
|
||||
"delete-playlists-maps-tip": "Если включено, все карты в плейлистах будут удалены",
|
||||
"export-playlist-ask": "Экспортировать плейлист?",
|
||||
"export-playlists-ask": "Экспортировать плейлисты?",
|
||||
"export-playlist-desc": "Вы уверены, что хотите экспортировать плейлист \"{playlistTitle}\"?",
|
||||
"export-playlists-desc": "Вы уверены, что хотите экспортировать {nb} плейлистов?",
|
||||
"export-maps": "Экспортировать карты",
|
||||
"export-playlist-maps-tip": "Если включено, все карты в плейлисте также будут экспортированы",
|
||||
"export-playlists-maps-tip": "Если включено, все карты в плейлистах также будут экспортированы",
|
||||
"export": "Экспорт",
|
||||
"need-clone-title": "Предупреждение",
|
||||
"need-clone-desc-1": "Этот плейлист был загружен с внешнего сайта и содержит ссылку для синхронизации.",
|
||||
"need-clone-desc-2": "Чтобы избежать потери ваших изменений во время синхронизации, плейлист будет дублирован, а его ссылка для синхронизации удалена.",
|
||||
"need-clone-desc-3": "Затем вы можете, если хотите, удалить оригинальный плейлист.",
|
||||
"understood": "Я понимаю",
|
||||
"synchronize-playlist-ask": "Синхронизировать плейлист?",
|
||||
"synchronize-playlists-ask": "Синхронизировать плейлисты?",
|
||||
"synchronize-playlist-desc": "Вы уверены, что хотите синхронизировать плейлист \"{playlistTitle}\"?",
|
||||
"synchronize-playlists-desc": "Вы уверены, что хотите синхронизировать {nb} плейлистов?",
|
||||
"synchronize-playlist-tip": "Это действие обновляет плейлисты и загружает отсутствующие карты; это может занять несколько минут.",
|
||||
"synchronize": "Синхронизировать",
|
||||
"curated": "Рекомендованные",
|
||||
"verified-mapper": "Проверенный маппер",
|
||||
"empty-playlists": "Пустые плейлисты",
|
||||
"search-playlist": "Поиск плейлиста",
|
||||
"no-playlists-found": "Плейлисты не найдены",
|
||||
"error-occur-while-loading-playlists": "Произошла ошибка при загрузке плейлистов",
|
||||
"error-occur-while-loading-playlist": "Произошла ошибка при загрузке плейлиста",
|
||||
"loading-maps": "Загрузка карт...",
|
||||
"no-maps-found-for-playlist": "Для этого плейлиста не найдено карт",
|
||||
"playlist-contain-no-maps": "Плейлист не содержит карт",
|
||||
"no-map-installed-for-playlist": "Для этого плейлиста не установлено карт",
|
||||
"playlist-is-waiting-to-download": "Плейлист ожидает загрузки",
|
||||
"download-maps": "Скачать карты",
|
||||
"download-missing-maps": "Скачать отсутствующие карты",
|
||||
"playlist-is-downloading": "Плейлист загружается",
|
||||
"some-playlist-maps-are-missing": "Некоторые карты в этом плейлисте отсутствуют",
|
||||
"create-a-playlist": "Создать плейлист",
|
||||
"synchronize-playlists": "Синхронизировать плейлисты",
|
||||
"export-playlists": "Экспортировать плейлисты",
|
||||
"delete-playlists": "Удалить плейлисты",
|
||||
"choose-image": "Выбрать изображение",
|
||||
"title": "Название",
|
||||
"playlist-title": "Название плейлиста",
|
||||
"description": "Описание",
|
||||
"playlist-description": "Описание плейлиста",
|
||||
"author": "Автор",
|
||||
"playlist-author": "Автор плейлиста",
|
||||
"save": "Сохранить",
|
||||
"loading": "Загрузка...",
|
||||
"installed": "Установлено",
|
||||
"no-map-found": "Карта не найдена",
|
||||
"edit-playlist-shortcuts": "Удерживайте Shift или Ctrl для выбора нескольких карт",
|
||||
"add-to-playlist": "Добавить в плейлист",
|
||||
"remove-from-playlist": "Удалить из плейлиста",
|
||||
"playlist-is-empty": "Плейлист пуст",
|
||||
"continue": "Продолжить",
|
||||
"nb-maps": "Количество карт",
|
||||
"nb-mappers": "Количество мапперов",
|
||||
"duration": "Продолжительность",
|
||||
"nps": "Нот в секунду",
|
||||
"date-picker": {
|
||||
"start-date-end-date": "Дата начала — Дата окончания",
|
||||
"all": "Все",
|
||||
"last-24h": "Последние 24 часа",
|
||||
"last-week": "Последняя неделя",
|
||||
"last-month": "Последний месяц",
|
||||
"3-last-month": "Последние 3 месяца"
|
||||
}
|
||||
},
|
||||
"dateformat": {
|
||||
"dayNames": ["Вск", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Суб", "Воскресение", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"],
|
||||
"monthNames": ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авн", "Сен", "Окт", "Ноя", "Дек", "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"],
|
||||
|
||||
@@ -190,6 +190,10 @@
|
||||
"report-bug": "報告 bug",
|
||||
"open-logs": "打開日誌"
|
||||
}
|
||||
},
|
||||
"changelogs": {
|
||||
"open" : "🚀 探索更新日誌!",
|
||||
"not-founds": "😕 噢,找不到更新日誌!"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -234,9 +238,6 @@
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"titles": {
|
||||
"dotnet-required": "需要 .NET 6"
|
||||
},
|
||||
"msg": {
|
||||
"401": "Steam 似乎不想讓我們下載 Beat Saber😢",
|
||||
"404": "無法聯繫 Steam 伺服器。",
|
||||
@@ -259,11 +260,7 @@
|
||||
"LicenceError": "無法獲取許可證列表。",
|
||||
"RateLimitExceeded": "你已經嘗試了太多次,請稍等片刻,稍後再試。",
|
||||
"TokenRejected": "你的登錄令牌已被拒絕 😕 請重試。",
|
||||
"AccessDenied": "訪問 Steam 被拒絕。",
|
||||
"dotnet-required": "必須安裝 .NET 6 Runtime 才能下載 Beat Saber 版本。單擊下面的按鈕下載它。"
|
||||
},
|
||||
"actions": {
|
||||
"download-dotnet": "下載 .NET 6"
|
||||
"AccessDenied": "訪問 Steam 被拒絕。"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -761,13 +758,13 @@
|
||||
"rb": "R&B",
|
||||
"holiday": "Holiday",
|
||||
"vocaloid": "Vocaloid",
|
||||
"jrock": "J-rock",
|
||||
"j-rock": "J-rock",
|
||||
"trance": "Trance",
|
||||
"drumbass": "Drum & Bass",
|
||||
"comedy": "Comedy",
|
||||
"instrumental": "Instrumental",
|
||||
"hardcore": "Hardcore",
|
||||
"kpop": "K-pop",
|
||||
"k-pop": "K-pop",
|
||||
"indie": "Indie",
|
||||
"techno": "Techno",
|
||||
"house": "House",
|
||||
@@ -778,7 +775,7 @@
|
||||
"metal": "Metal",
|
||||
"anime": "Anime",
|
||||
"hiphop": "Hiphop",
|
||||
"jpop": "J-pop",
|
||||
"j-pop": "J-pop",
|
||||
"rock": "Rock",
|
||||
"pop": "Pop",
|
||||
"electronic": "Electronic",
|
||||
@@ -1001,6 +998,122 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist": {
|
||||
"error-playlist-creation-title": "建立播放清單時發生錯誤",
|
||||
"error-playlist-creation-desc": "建立播放清單時發生錯誤。",
|
||||
"playlist-created-title": "播放清單已建立",
|
||||
"playlist-created-desc": "播放清單已成功建立。您現在可以同步其地圖了!",
|
||||
"download-playlist": "下載播放清單",
|
||||
"synchronize-playlist": "同步播放清單",
|
||||
"synchronize-maps": "同步地圖",
|
||||
"error-playlists-synchronization-title": "同步播放清單時發生錯誤",
|
||||
"error-playlists-synchronization-desc": "同步播放清單時發生錯誤。",
|
||||
"playlists-synchronized-title": "播放清單已同步!",
|
||||
"playlists-synchronized-desc": "播放清單及其地圖已下載。",
|
||||
"playlists-export-error-title": "匯出播放清單時發生錯誤",
|
||||
"playlists-export-error-desc": "匯出播放清單時發生錯誤。",
|
||||
"playlists-exported-title": "播放清單已匯出!",
|
||||
"playlists-exported-desc": "播放清單已成功匯出。",
|
||||
"playlists-with-maps-exported-desc": "播放清單及其地圖已成功匯出。",
|
||||
"playlist-delete-error-title": "刪除播放清單時發生錯誤",
|
||||
"playlist-delete-error-desc": "刪除播放清單時發生錯誤。",
|
||||
"playlists-deleted-title": "播放清單已刪除!",
|
||||
"playlists-deleted-desc": "播放清單已成功刪除。",
|
||||
"edit-playlist": "編輯播放清單",
|
||||
"playlist-edit-error-title": "編輯播放清單時發生錯誤",
|
||||
"playlist-edit-error-desc": "編輯播放清單時發生錯誤。",
|
||||
"playlist-edited-title": "播放清單已編輯!",
|
||||
"playlist-edited-desc": "播放清單已成功修改。您現在可以同步其地圖了!",
|
||||
"playlists-loading": "正在載入播放清單...",
|
||||
"no-playlists": "沒有播放清單",
|
||||
"download-playlists": "下載播放清單",
|
||||
"created-by": "建立者",
|
||||
"stop-download": "停止下載",
|
||||
"cancel-download": "取消下載",
|
||||
"open-file": "開啟檔案",
|
||||
"link-playlists": "連結播放清單",
|
||||
"link-playlist-desc": "連結播放清單允許在所有版本之間共享播放清單。一旦連結,此版本將受益於共享播放清單",
|
||||
"link-playlist-info": "新增和刪除播放清單也將被共享",
|
||||
"keep-playlists": "保留播放清單",
|
||||
"keep-playlists-tip": "保留播放清單將把當前版本的播放清單移動到共享播放清單資料夾。否則,它們將遺失",
|
||||
"unlink-playlists": "取消連結播放清單",
|
||||
"unlink-playlist-desc": "警告,取消連結播放清單將不再允許此版本使用共享播放清單。",
|
||||
"unlink-keep-playlists-tip": "保留播放清單將為當前版本建立共享播放清單的副本。否則,此版本將不保留任何播放清單。",
|
||||
"delete-playlist-ask": "刪除播放清單?",
|
||||
"delete-playlists-ask": "刪除播放清單?",
|
||||
"delete-playlist-desc": "您確定要刪除播放清單 \"{playlistTitle}\" 嗎?",
|
||||
"delete-playlists-desc": "您確定要刪除 {nb} 個播放清單嗎?",
|
||||
"delete-maps": "刪除地圖",
|
||||
"delete-playlist-maps-tip": "如果啟用,播放清單中的所有地圖都將被刪除",
|
||||
"delete-playlists-maps-tip": "如果啟用,播放清單中的所有地圖都將被刪除",
|
||||
"export-playlist-ask": "匯出播放清單?",
|
||||
"export-playlists-ask": "匯出播放清單?",
|
||||
"export-playlist-desc": "您確定要匯出播放清單 \"{playlistTitle}\" 嗎?",
|
||||
"export-playlists-desc": "您確定要匯出 {nb} 個播放清單嗎?",
|
||||
"export-maps": "匯出地圖",
|
||||
"export-playlist-maps-tip": "如果啟用,播放清單中的所有地圖也將被匯出",
|
||||
"export-playlists-maps-tip": "如果啟用,播放清單中的所有地圖也將被匯出",
|
||||
"export": "匯出",
|
||||
"need-clone-title": "警告",
|
||||
"need-clone-desc-1": "此播放清單已從外部網站下載,並包含同步連結。",
|
||||
"need-clone-desc-2": "為避免在同步過程中遺失更改,播放清單將被複製,並刪除其同步連結。",
|
||||
"need-clone-desc-3": "然後,如果您願意,可以刪除原始播放清單。",
|
||||
"understood": "我明白了",
|
||||
"synchronize-playlist-ask": "同步播放清單?",
|
||||
"synchronize-playlists-ask": "同步播放清單?",
|
||||
"synchronize-playlist-desc": "您確定要同步播放清單 \"{playlistTitle}\" 嗎?",
|
||||
"synchronize-playlists-desc": "您確定要同步 {nb} 個播放清單嗎?",
|
||||
"synchronize-playlist-tip": "此操作更新播放清單並下載缺失的地圖;可能需要幾分鐘。",
|
||||
"synchronize": "同步",
|
||||
"curated": "精選",
|
||||
"verified-mapper": "已驗證的製圖者",
|
||||
"empty-playlists": "空播放清單",
|
||||
"search-playlist": "搜尋播放清單",
|
||||
"no-playlists-found": "未找到播放清單",
|
||||
"error-occur-while-loading-playlists": "載入播放清單時發生錯誤",
|
||||
"error-occur-while-loading-playlist": "載入播放清單時發生錯誤",
|
||||
"loading-maps": "正在載入地圖...",
|
||||
"no-maps-found-for-playlist": "未找到此播放清單的地圖",
|
||||
"playlist-contain-no-maps": "播放清單不包含地圖",
|
||||
"no-map-installed-for-playlist": "此播放清單沒有已安裝的地圖",
|
||||
"playlist-is-waiting-to-download": "播放清單正在等待下載",
|
||||
"download-maps": "下載地圖",
|
||||
"download-missing-maps": "下載缺失的地圖",
|
||||
"playlist-is-downloading": "播放清單正在下載",
|
||||
"some-playlist-maps-are-missing": "此播放清單中的一些地圖缺失",
|
||||
"create-a-playlist": "建立播放清單",
|
||||
"synchronize-playlists": "同步播放清單",
|
||||
"export-playlists": "匯出播放清單",
|
||||
"delete-playlists": "刪除播放清單",
|
||||
"choose-image": "選擇圖片",
|
||||
"title": "標題",
|
||||
"playlist-title": "播放清單標題",
|
||||
"description": "描述",
|
||||
"playlist-description": "播放清單描述",
|
||||
"author": "作者",
|
||||
"playlist-author": "播放清單作者",
|
||||
"save": "儲存",
|
||||
"loading": "載入中...",
|
||||
"installed": "已安裝",
|
||||
"no-map-found": "未找到地圖",
|
||||
"edit-playlist-shortcuts": "按住 Shift 或 Ctrl 選擇多個地圖",
|
||||
"add-to-playlist": "新增到播放清單",
|
||||
"remove-from-playlist": "從播放清單中移除",
|
||||
"playlist-is-empty": "播放清單為空",
|
||||
"continue": "繼續",
|
||||
"nb-maps": "地圖數量",
|
||||
"nb-mappers": "製圖者數量",
|
||||
"duration": "持續時間",
|
||||
"nps": "每秒音符數",
|
||||
"date-picker": {
|
||||
"start-date-end-date": "開始日期 — 結束日期",
|
||||
"all": "全部",
|
||||
"last-24h": "最近24小時",
|
||||
"last-week": "上週",
|
||||
"last-month": "上個月",
|
||||
"3-last-month": "最近3個月"
|
||||
}
|
||||
},
|
||||
"dateformat": {
|
||||
"dayNames": ["週日", "週一", "週二", "週三", "週四", "週五", "週六", "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
|
||||
"monthNames": ["1 月", "2 月", "3 月", "4 月", "5 月", "6 月", "7 月", "8 月", "9 月", "10 月", "11 月", "12 月", "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
||||
|
||||
@@ -190,6 +190,10 @@
|
||||
"report-bug": "报告 bug",
|
||||
"open-logs": "打开日志"
|
||||
}
|
||||
},
|
||||
"changelogs": {
|
||||
"open" : "🚀 探索更新日志!",
|
||||
"not-founds": "😕 哎呀,找不到更新日志!"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -234,9 +238,6 @@
|
||||
}
|
||||
},
|
||||
"errors": {
|
||||
"titles": {
|
||||
"dotnet-required": "需要 .NET 6"
|
||||
},
|
||||
"msg": {
|
||||
"401": "Steam 似乎不想让我们下载 Beat Saber😢",
|
||||
"404": "无法联系 Steam 服务器。",
|
||||
@@ -259,11 +260,7 @@
|
||||
"LicenceError": "无法获取许可证列表。",
|
||||
"RateLimitExceeded": "你已经尝试了太多次,请稍等片刻,稍后再试。",
|
||||
"TokenRejected": "你的登录令牌已被拒绝 😕 请重试。",
|
||||
"AccessDenied": "访问 Steam 被拒绝。",
|
||||
"dotnet-required": "必须安装 .NET 6 Runtime 才能下载 Beat Saber 版本。单击下面的按钮下载它。"
|
||||
},
|
||||
"actions": {
|
||||
"download-dotnet": "下载 .NET 6"
|
||||
"AccessDenied": "访问 Steam 被拒绝。"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -761,13 +758,13 @@
|
||||
"rb": "r&b",
|
||||
"holiday": "holiday",
|
||||
"vocaloid": "vocaloid",
|
||||
"jrock": "j-rock",
|
||||
"j-rock": "j-rock",
|
||||
"trance": "trance",
|
||||
"drumbass": "drum & bass",
|
||||
"comedy": "comedy",
|
||||
"instrumental": "instrumental",
|
||||
"hardcore": "hardcore",
|
||||
"kpop": "k-pop",
|
||||
"k-pop": "k-pop",
|
||||
"indie": "indie",
|
||||
"techno": "techno",
|
||||
"house": "house",
|
||||
@@ -778,7 +775,7 @@
|
||||
"metal": "metal",
|
||||
"anime": "anime",
|
||||
"hiphop": "hiphop",
|
||||
"jpop": "j-pop",
|
||||
"j-pop": "j-pop",
|
||||
"rock": "rock",
|
||||
"pop": "pop",
|
||||
"electronic": "electronic",
|
||||
@@ -1001,6 +998,122 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"playlist": {
|
||||
"error-playlist-creation-title": "创建播放列表时出错",
|
||||
"error-playlist-creation-desc": "创建播放列表时发生错误。",
|
||||
"playlist-created-title": "播放列表已创建",
|
||||
"playlist-created-desc": "播放列表已成功创建。您现在可以同步其地图了!",
|
||||
"download-playlist": "下载播放列表",
|
||||
"synchronize-playlist": "同步播放列表",
|
||||
"synchronize-maps": "同步地图",
|
||||
"error-playlists-synchronization-title": "同步播放列表时出错",
|
||||
"error-playlists-synchronization-desc": "同步播放列表时发生错误。",
|
||||
"playlists-synchronized-title": "播放列表已同步!",
|
||||
"playlists-synchronized-desc": "播放列表及其地图已下载。",
|
||||
"playlists-export-error-title": "导出播放列表时出错",
|
||||
"playlists-export-error-desc": "导出播放列表时发生错误。",
|
||||
"playlists-exported-title": "播放列表已导出!",
|
||||
"playlists-exported-desc": "播放列表已成功导出。",
|
||||
"playlists-with-maps-exported-desc": "播放列表及其地图已成功导出。",
|
||||
"playlist-delete-error-title": "删除播放列表时出错",
|
||||
"playlist-delete-error-desc": "删除播放列表时发生错误。",
|
||||
"playlists-deleted-title": "播放列表已删除!",
|
||||
"playlists-deleted-desc": "播放列表已成功删除。",
|
||||
"edit-playlist": "编辑播放列表",
|
||||
"playlist-edit-error-title": "编辑播放列表时出错",
|
||||
"playlist-edit-error-desc": "编辑播放列表时发生错误。",
|
||||
"playlist-edited-title": "播放列表已编辑!",
|
||||
"playlist-edited-desc": "播放列表已成功修改。您现在可以同步其地图了!",
|
||||
"playlists-loading": "正在加载播放列表...",
|
||||
"no-playlists": "没有播放列表",
|
||||
"download-playlists": "下载播放列表",
|
||||
"created-by": "创建者",
|
||||
"stop-download": "停止下载",
|
||||
"cancel-download": "取消下载",
|
||||
"open-file": "打开文件",
|
||||
"link-playlists": "链接播放列表",
|
||||
"link-playlist-desc": "链接播放列表允许在所有版本之间共享播放列表。一旦链接,此版本将受益于共享播放列表",
|
||||
"link-playlist-info": "添加和删除播放列表也将被共享",
|
||||
"keep-playlists": "保留播放列表",
|
||||
"keep-playlists-tip": "保留播放列表将把当前版本的播放列表移动到共享播放列表文件夹。否则,它们将丢失",
|
||||
"unlink-playlists": "取消链接播放列表",
|
||||
"unlink-playlist-desc": "警告,取消链接播放列表将不再允许此版本使用共享播放列表。",
|
||||
"unlink-keep-playlists-tip": "保留播放列表将为当前版本创建共享播放列表的副本。否则,此版本将不保留任何播放列表。",
|
||||
"delete-playlist-ask": "删除播放列表?",
|
||||
"delete-playlists-ask": "删除播放列表?",
|
||||
"delete-playlist-desc": "您确定要删除播放列表 \"{playlistTitle}\" 吗?",
|
||||
"delete-playlists-desc": "您确定要删除 {nb} 个播放列表吗?",
|
||||
"delete-maps": "删除地图",
|
||||
"delete-playlist-maps-tip": "如果启用,播放列表中的所有地图都将被删除",
|
||||
"delete-playlists-maps-tip": "如果启用,播放列表中的所有地图都将被删除",
|
||||
"export-playlist-ask": "导出播放列表?",
|
||||
"export-playlists-ask": "导出播放列表?",
|
||||
"export-playlist-desc": "您确定要导出播放列表 \"{playlistTitle}\" 吗?",
|
||||
"export-playlists-desc": "您确定要导出 {nb} 个播放列表吗?",
|
||||
"export-maps": "导出地图",
|
||||
"export-playlist-maps-tip": "如果启用,播放列表中的所有地图也将被导出",
|
||||
"export-playlists-maps-tip": "如果启用,播放列表中的所有地图也将被导出",
|
||||
"export": "导出",
|
||||
"need-clone-title": "警告",
|
||||
"need-clone-desc-1": "此播放列表已从外部站点下载,并包含同步链接。",
|
||||
"need-clone-desc-2": "为避免在同步过程中丢失更改,播放列表将被复制,并删除其同步链接。",
|
||||
"need-clone-desc-3": "然后,如果您愿意,可以删除原始播放列表。",
|
||||
"understood": "我明白了",
|
||||
"synchronize-playlist-ask": "同步播放列表?",
|
||||
"synchronize-playlists-ask": "同步播放列表?",
|
||||
"synchronize-playlist-desc": "您确定要同步播放列表 \"{playlistTitle}\" 吗?",
|
||||
"synchronize-playlists-desc": "您确定要同步 {nb} 个播放列表吗?",
|
||||
"synchronize-playlist-tip": "此操作更新播放列表并下载缺失的地图;可能需要几分钟。",
|
||||
"synchronize": "同步",
|
||||
"curated": "推荐",
|
||||
"verified-mapper": "已验证的制图者",
|
||||
"empty-playlists": "空播放列表",
|
||||
"search-playlist": "搜索播放列表",
|
||||
"no-playlists-found": "未找到播放列表",
|
||||
"error-occur-while-loading-playlists": "加载播放列表时发生错误",
|
||||
"error-occur-while-loading-playlist": "加载播放列表时发生错误",
|
||||
"loading-maps": "正在加载地图...",
|
||||
"no-maps-found-for-playlist": "未找到此播放列表的地图",
|
||||
"playlist-contain-no-maps": "播放列表不包含地图",
|
||||
"no-map-installed-for-playlist": "此播放列表没有已安装的地图",
|
||||
"playlist-is-waiting-to-download": "播放列表正在等待下载",
|
||||
"download-maps": "下载地图",
|
||||
"download-missing-maps": "下载缺失的地图",
|
||||
"playlist-is-downloading": "播放列表正在下载",
|
||||
"some-playlist-maps-are-missing": "此播放列表中的一些地图缺失",
|
||||
"create-a-playlist": "创建播放列表",
|
||||
"synchronize-playlists": "同步播放列表",
|
||||
"export-playlists": "导出播放列表",
|
||||
"delete-playlists": "删除播放列表",
|
||||
"choose-image": "选择图片",
|
||||
"title": "标题",
|
||||
"playlist-title": "播放列表标题",
|
||||
"description": "描述",
|
||||
"playlist-description": "播放列表描述",
|
||||
"author": "作者",
|
||||
"playlist-author": "播放列表作者",
|
||||
"save": "保存",
|
||||
"loading": "加载中...",
|
||||
"installed": "已安装",
|
||||
"no-map-found": "未找到地图",
|
||||
"edit-playlist-shortcuts": "按住 Shift 或 Ctrl 选择多个地图",
|
||||
"add-to-playlist": "添加到播放列表",
|
||||
"remove-from-playlist": "从播放列表中移除",
|
||||
"playlist-is-empty": "播放列表为空",
|
||||
"continue": "继续",
|
||||
"nb-maps": "地图数量",
|
||||
"nb-mappers": "制图者数量",
|
||||
"duration": "持续时间",
|
||||
"nps": "每秒音符数",
|
||||
"date-picker": {
|
||||
"start-date-end-date": "开始日期 — 结束日期",
|
||||
"all": "全部",
|
||||
"last-24h": "最近24小时",
|
||||
"last-week": "上周",
|
||||
"last-month": "上个月",
|
||||
"3-last-month": "最近3个月"
|
||||
}
|
||||
},
|
||||
"dateformat": {
|
||||
"dayNames": ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
|
||||
"monthNames": ["1 月", "2 月", "3 月", "4 月", "5 月", "6 月", "7 月", "8 月", "9 月", "10 月", "11 月", "12 月", "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package song_details_cache_v1;
|
||||
|
||||
message SongDetailsCache {
|
||||
repeated SongDetails songs = 1;
|
||||
uint32 lastUpdated = 2;
|
||||
uint32 total = 3;
|
||||
UploadersList uploaders = 4;
|
||||
repeated string difficultyLabels = 5;
|
||||
}
|
||||
|
||||
message UploadersList {
|
||||
repeated string names = 1;
|
||||
repeated uint32 ids = 2;
|
||||
}
|
||||
|
||||
message SongDetails {
|
||||
uint32 idInt = 1;
|
||||
repeated uint32 hashIndices = 2;
|
||||
string name = 3;
|
||||
uint32 duration = 4;
|
||||
UploaderRef uploaderRef = 5;
|
||||
uint32 uploadedAt = 6;
|
||||
repeated MapTag tags = 7;
|
||||
bool ranked = 8;
|
||||
bool qualified = 9;
|
||||
bool curated = 10;
|
||||
bool blRanked = 11;
|
||||
bool blQualified = 12;
|
||||
uint32 upVotes = 13;
|
||||
uint32 downVotes = 14;
|
||||
uint32 downloads = 15;
|
||||
bool automapper = 16;
|
||||
repeated Difficulty difficulties = 17;
|
||||
}
|
||||
|
||||
message Difficulty {
|
||||
DifficultyLabel difficulty = 1;
|
||||
DifficultyCharacteristic characteristic = 2;
|
||||
uint32 labelIndex = 3;
|
||||
uint32 starsT100 = 4;
|
||||
uint32 starsBlT100 = 5;
|
||||
uint32 njsT100 = 6;
|
||||
uint32 npsT100 = 7;
|
||||
int32 offsetT100 = 8;
|
||||
bool chroma = 9;
|
||||
bool cinema = 10;
|
||||
bool me = 11;
|
||||
bool ne = 12;
|
||||
uint32 bombs = 13;
|
||||
uint32 notes = 14;
|
||||
uint32 obstacles = 15;
|
||||
}
|
||||
|
||||
message UploaderRef {
|
||||
uint32 uploader_ref_index = 1;
|
||||
bool verified = 2;
|
||||
}
|
||||
|
||||
enum DifficultyLabel {
|
||||
UNKNOWN_LABEL = 0; // Default value for undefined/unknown labels
|
||||
EASY = 1;
|
||||
NORMAL = 2;
|
||||
HARD = 3;
|
||||
EXPERT = 4;
|
||||
EXPERT_PLUS = 5;
|
||||
}
|
||||
|
||||
enum DifficultyCharacteristic {
|
||||
UNKNOWN_CHARACTERISTIC = 0; // Default value for undefined/unknown characteristics
|
||||
STANDARD = 1;
|
||||
ONE_SABER = 2;
|
||||
NO_ARROWS = 3;
|
||||
LAWLESS = 4;
|
||||
LIGHTSHOW = 5;
|
||||
LEGACY = 6;
|
||||
NINETY_DEGREE = 7;
|
||||
THREESIXTY_DEGREE = 8;
|
||||
}
|
||||
|
||||
enum MapTag {
|
||||
UNKNOWN_TAG = 0; // Default value for undefined/unknown tags
|
||||
DANCE = 1;
|
||||
SWING = 2;
|
||||
NIGHTCORE = 3;
|
||||
FOLK = 4;
|
||||
FAMILY = 5;
|
||||
AMBIENT = 6;
|
||||
FUNK = 7;
|
||||
JAZZ = 8;
|
||||
SOUL = 9;
|
||||
SPEEDCORE = 10;
|
||||
PUNK = 11;
|
||||
RB = 12;
|
||||
HOLIDAY = 13;
|
||||
VOCALOID = 14;
|
||||
J_ROCK = 15;
|
||||
TRANCE = 16;
|
||||
DRUMBASS = 17;
|
||||
COMEDY = 18;
|
||||
INSTRUMENTAL = 19;
|
||||
HARDCORE = 20;
|
||||
K_POP = 21;
|
||||
INDIE = 22;
|
||||
TECHNO = 23;
|
||||
HOUSE = 24;
|
||||
GAME = 25;
|
||||
FILM = 26;
|
||||
ALT = 27;
|
||||
DUBSTEP = 28;
|
||||
METAL = 29;
|
||||
ANIME = 30;
|
||||
HIPHOP = 31;
|
||||
J_POP = 32;
|
||||
ROCK = 33;
|
||||
POP = 34;
|
||||
ELECTRONIC = 35;
|
||||
CLASSICAL_ORCHESTRAL = 36;
|
||||
ACCURACY = 37;
|
||||
BALANCED = 38;
|
||||
CHALLENGE = 39;
|
||||
DANCESTYLE = 40;
|
||||
FITNESS = 41;
|
||||
SPEED = 42;
|
||||
TECH = 43;
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v6.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v6.0": {
|
||||
"DepotDownloader/2.5.0": {
|
||||
"dependencies": {
|
||||
"QRCoder": "1.4.3",
|
||||
"SteamKit2": "2.5.0-Beta.1",
|
||||
"protobuf-net": "3.2.16"
|
||||
},
|
||||
"runtime": {
|
||||
"DepotDownloader.dll": {}
|
||||
}
|
||||
},
|
||||
"Microsoft.NETCore.Platforms/5.0.0": {},
|
||||
"Microsoft.Win32.Registry/5.0.0": {
|
||||
"dependencies": {
|
||||
"System.Security.AccessControl": "5.0.0",
|
||||
"System.Security.Principal.Windows": "5.0.0"
|
||||
}
|
||||
},
|
||||
"protobuf-net/3.2.16": {
|
||||
"dependencies": {
|
||||
"protobuf-net.Core": "3.2.16"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/protobuf-net.dll": {
|
||||
"assemblyVersion": "3.0.0.0",
|
||||
"fileVersion": "3.2.16.54102"
|
||||
}
|
||||
}
|
||||
},
|
||||
"protobuf-net.Core/3.2.16": {
|
||||
"dependencies": {
|
||||
"System.Collections.Immutable": "7.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/protobuf-net.Core.dll": {
|
||||
"assemblyVersion": "3.0.0.0",
|
||||
"fileVersion": "3.2.16.54102"
|
||||
}
|
||||
}
|
||||
},
|
||||
"QRCoder/1.4.3": {
|
||||
"runtime": {
|
||||
"lib/net6.0/QRCoder.dll": {
|
||||
"assemblyVersion": "1.4.3.0",
|
||||
"fileVersion": "1.4.3.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SteamKit2/2.5.0-Beta.1": {
|
||||
"dependencies": {
|
||||
"Microsoft.Win32.Registry": "5.0.0",
|
||||
"protobuf-net": "3.2.16"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/SteamKit2.dll": {
|
||||
"assemblyVersion": "2.5.0.0",
|
||||
"fileVersion": "2.5.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Collections.Immutable/7.0.0": {
|
||||
"dependencies": {
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net6.0/System.Collections.Immutable.dll": {
|
||||
"assemblyVersion": "7.0.0.0",
|
||||
"fileVersion": "7.0.22.51805"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe/6.0.0": {},
|
||||
"System.Security.AccessControl/5.0.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "5.0.0",
|
||||
"System.Security.Principal.Windows": "5.0.0"
|
||||
}
|
||||
},
|
||||
"System.Security.Principal.Windows/5.0.0": {}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"DepotDownloader/2.5.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Microsoft.NETCore.Platforms/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-VyPlqzH2wavqquTcYpkIIAQ6WdenuKoFN0BdYBbCWsclXacSOHNQn66Gt4z5NBqEYW0FAPm5rlvki9ZiCij5xQ==",
|
||||
"path": "microsoft.netcore.platforms/5.0.0",
|
||||
"hashPath": "microsoft.netcore.platforms.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.Win32.Registry/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-dDoKi0PnDz31yAyETfRntsLArTlVAVzUzCIvvEDsDsucrl33Dl8pIJG06ePTJTI3tGpeyHS9Cq7Foc/s4EeKcg==",
|
||||
"path": "microsoft.win32.registry/5.0.0",
|
||||
"hashPath": "microsoft.win32.registry.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"protobuf-net/3.2.16": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-W6RM2B2f5O7SigBGfkXFYzI/a7Mks+rCHtuGlE/b5O3NMupDon7I0akjCLhrfcnqIfdWDkDafseav/MnIzUSHA==",
|
||||
"path": "protobuf-net/3.2.16",
|
||||
"hashPath": "protobuf-net.3.2.16.nupkg.sha512"
|
||||
},
|
||||
"protobuf-net.Core/3.2.16": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ZFoY0lfMUWGJ4RoyI0oNj2o2l8t08n3k27YyDD0kYWQ+vXj0hTbWEwYWOpGAfCWvyUPkq9Jcc/4uR74GICZL2g==",
|
||||
"path": "protobuf-net.core/3.2.16",
|
||||
"hashPath": "protobuf-net.core.3.2.16.nupkg.sha512"
|
||||
},
|
||||
"QRCoder/1.4.3": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-fWuFqjm8GTlEb2GqBl3Hi8HZZeZQwBSHxvRPtPjyNbT82H0ff0JwavKRBmMaXCno1Av6McPC8aJzri0Mj2w9Jw==",
|
||||
"path": "qrcoder/1.4.3",
|
||||
"hashPath": "qrcoder.1.4.3.nupkg.sha512"
|
||||
},
|
||||
"SteamKit2/2.5.0-Beta.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-fwwdF0cZZEIdNpcUc1+B9zbP5Q48A3DFOAclPhBh2dMTU03aROaIDktFW+Ww/NN1Z/Emp/LwVqHB+hCM8uxS4Q==",
|
||||
"path": "steamkit2/2.5.0-beta.1",
|
||||
"hashPath": "steamkit2.2.5.0-beta.1.nupkg.sha512"
|
||||
},
|
||||
"System.Collections.Immutable/7.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==",
|
||||
"path": "system.collections.immutable/7.0.0",
|
||||
"hashPath": "system.collections.immutable.7.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Runtime.CompilerServices.Unsafe/6.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==",
|
||||
"path": "system.runtime.compilerservices.unsafe/6.0.0",
|
||||
"hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Security.AccessControl/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-dagJ1mHZO3Ani8GH0PHpPEe/oYO+rVdbQjvjJkBRNQkX4t0r1iaeGn8+/ybkSLEan3/slM0t59SVdHzuHf2jmw==",
|
||||
"path": "system.security.accesscontrol/5.0.0",
|
||||
"hashPath": "system.security.accesscontrol.5.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Security.Principal.Windows/5.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA==",
|
||||
"path": "system.security.principal.windows/5.0.0",
|
||||
"hashPath": "system.security.principal.windows.5.0.0.nupkg.sha512"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net6.0",
|
||||
"rollForward": "LatestMajor",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "6.0.0"
|
||||
},
|
||||
"configProperties": {
|
||||
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 945 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 442 KiB After Width: | Height: | Size: 442 KiB |
@@ -1,20 +1,25 @@
|
||||
{
|
||||
"name": "bs-manager",
|
||||
"description": "Manage maps, mods and more for Beat Saber",
|
||||
"main": "./src/main/main.ts",
|
||||
"version": "1.5.0-alpha.2",
|
||||
"scripts": {
|
||||
"build-rust-scripts": "node -r esbuild-register ./.erb/scripts/build-rust-scripts.js",
|
||||
"build": "concurrently \"npm run build:main\" \"npm run build:renderer\"",
|
||||
"build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts",
|
||||
"build:renderer": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts",
|
||||
"build:dll": "cross-env NODE_ENV=development webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
|
||||
"build:main": "cross-env NODE_ENV=production webpack --config ./.erb/configs/webpack.config.main.prod.ts",
|
||||
"build:renderer": "cross-env NODE_ENV=production webpack --config ./.erb/configs/webpack.config.renderer.prod.ts",
|
||||
"postinstall": "node -r esbuild-register .erb/scripts/check-native-dep.js && electron-builder install-app-deps && npm run build:dll",
|
||||
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
|
||||
"lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
|
||||
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never",
|
||||
"postinstall": "ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts && opencollective-postinstall",
|
||||
"start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer",
|
||||
"start:main": "cross-env NODE_ENV=development electronmon -r ts-node/register/transpile-only ./src/main/main.ts",
|
||||
"start:preload": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.preload.dev.ts",
|
||||
"start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
|
||||
"package": "node -r esbuild-register ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never && npm run build:dll",
|
||||
"start": "node -r esbuild-register ./.erb/scripts/check-port-in-use.js && npm run start:renderer",
|
||||
"start:main": "cross-env NODE_ENV=development NODE_OPTIONS=\"--loader esbuild-register/loader -r esbuild-register\" electronmon .",
|
||||
"start:preload": "cross-env NODE_ENV=development webpack --config ./.erb/configs/webpack.config.preload.dev.ts",
|
||||
"start:renderer": "cross-env NODE_ENV=development webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
|
||||
"test": "jest",
|
||||
"publish": "npm run build && electron-builder -c.win.certificateSha1=842a817a51e2a1d360fcd62f54bf5f9193e919e1 --publish always --win --x64"
|
||||
"publish": "npm run build && electron-builder -c.win.certificateSha1=842a817a51e2a1d360fcd62f54bf5f9193e919e1 --publish always --win --x64",
|
||||
"publish:linux": "npm run build && electron-builder --publish always --linux --x64"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,jsx,ts,tsx}": [
|
||||
@@ -32,10 +37,9 @@
|
||||
},
|
||||
"build": {
|
||||
"extraResources": [
|
||||
"./assets/favicon.ico",
|
||||
"./assets/jsons/bs-versions.json",
|
||||
"./assets/jsons/patreons.json",
|
||||
"./assets/scripts/**"
|
||||
"./assets/proto/song_details_cache_v1.proto"
|
||||
],
|
||||
"productName": "BSManager",
|
||||
"appId": "org.erb.BSManager",
|
||||
@@ -47,46 +51,27 @@
|
||||
],
|
||||
"afterSign": ".erb/scripts/notarize.js",
|
||||
"afterPack": ".erb/scripts/after-pack.js",
|
||||
"mac": {
|
||||
"target": {
|
||||
"target": "default",
|
||||
"arch": [
|
||||
"arm64",
|
||||
"x64"
|
||||
]
|
||||
},
|
||||
"type": "distribution",
|
||||
"hardenedRuntime": true,
|
||||
"entitlements": "assets/entitlements.mac.plist",
|
||||
"entitlementsInherit": "assets/entitlements.mac.plist",
|
||||
"gatekeeperAssess": false
|
||||
},
|
||||
"dmg": {
|
||||
"contents": [
|
||||
{
|
||||
"x": 130,
|
||||
"y": 220
|
||||
},
|
||||
{
|
||||
"x": 410,
|
||||
"y": 220,
|
||||
"type": "link",
|
||||
"path": "/Applications"
|
||||
}
|
||||
]
|
||||
},
|
||||
"win": {
|
||||
"target": [
|
||||
"nsis",
|
||||
"nsis-web"
|
||||
],
|
||||
"icon": "assets/favicon.ico"
|
||||
"icon": "./build/icons/win/favicon.ico",
|
||||
"extraResources": [
|
||||
"./build/icons/win",
|
||||
"./assets/scripts/*.exe"
|
||||
]
|
||||
},
|
||||
"linux": {
|
||||
"target": [
|
||||
"AppImage"
|
||||
],
|
||||
"category": "Development"
|
||||
"icon": "./build/icons/png",
|
||||
"category": "Utility;Game;",
|
||||
"extraResources": [
|
||||
"./build/icons/png",
|
||||
"./assets/scripts/DepotDownloader"
|
||||
]
|
||||
},
|
||||
"directories": {
|
||||
"app": "release/app",
|
||||
@@ -96,7 +81,15 @@
|
||||
"publish": {
|
||||
"provider": "github",
|
||||
"owner": "Zagrios"
|
||||
}
|
||||
},
|
||||
"fileAssociations": [
|
||||
{
|
||||
"ext": "bplist",
|
||||
"description": "Beat Saber Playlist (BSManager)",
|
||||
"icon": "./assets/bsm_file.ico",
|
||||
"role": "Viewer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -148,131 +141,144 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron/rebuild": "^3.2.13",
|
||||
"@electron/fuses": "^1.7.0",
|
||||
"@electron/notarize": "^2.3.0",
|
||||
"@electron/rebuild": "^3.6.0",
|
||||
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
|
||||
"@teamsupercell/typings-for-css-modules-loader": "^2.5.1",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^13.3.0",
|
||||
"@types/archiver": "^5.3.1",
|
||||
"@teamsupercell/typings-for-css-modules-loader": "^2.5.2",
|
||||
"@testing-library/jest-dom": "^6.4.1",
|
||||
"@testing-library/react": "^14.2.0",
|
||||
"@types/archiver": "^6.0.2",
|
||||
"@types/color": "^3.0.3",
|
||||
"@types/crypto-js": "^4.2.1",
|
||||
"@types/dateformat": "^5.0.0",
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/node": "17.0.23",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/got": "^9.6.12",
|
||||
"@types/jest": "^29.5.11",
|
||||
"@types/node": "20.11.15",
|
||||
"@types/node-fetch": "^2.6.3",
|
||||
"@types/pako": "^2.0.1",
|
||||
"@types/react": "^18.0.33",
|
||||
"@types/react-beautiful-dnd": "^13.1.8",
|
||||
"@types/react-dom": "^18.0.11",
|
||||
"@types/react-outside-click-handler": "^1.3.1",
|
||||
"@types/react-test-renderer": "^17.0.2",
|
||||
"@types/react-test-renderer": "^18.0.7",
|
||||
"@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/to-ico": "^1.1.1",
|
||||
"@types/use-double-click": "^1.0.1",
|
||||
"@types/use-double-click": "^1.0.4",
|
||||
"@types/webpack-bundle-analyzer": "^4.4.2",
|
||||
"@types/webpack-env": "^1.18.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.34.0",
|
||||
"@typescript-eslint/parser": "^5.34.0",
|
||||
"autoprefixer": "^10.4.8",
|
||||
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
||||
"@typescript-eslint/parser": "^6.20.0",
|
||||
"autoprefixer": "^10.4.17",
|
||||
"browserslist-config-erb": "^0.0.3",
|
||||
"chalk": "^4.1.2",
|
||||
"concurrently": "^7.2.2",
|
||||
"core-js": "^3.24.1",
|
||||
"concurrently": "^8.2.2",
|
||||
"core-js": "^3.36.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.1",
|
||||
"css-minimizer-webpack-plugin": "^4.1.0",
|
||||
"detect-port": "^1.3.0",
|
||||
"electron": "^27.1.3",
|
||||
"electron-builder": "^24.9.1",
|
||||
"css-loader": "^6.10.0",
|
||||
"css-minimizer-webpack-plugin": "^6.0.0",
|
||||
"detect-port": "^1.5.1",
|
||||
"electron": "^28.2.4",
|
||||
"electron-builder": "^24.13.3",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-notarize": "^1.2.1",
|
||||
"electronmon": "^2.0.2",
|
||||
"eslint": "^8.22.0",
|
||||
"esbuild": "^0.20.1",
|
||||
"esbuild-register": "^3.5.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-config-erb": "^4.0.3",
|
||||
"eslint-import-resolver-typescript": "^2.7.1",
|
||||
"eslint-import-resolver-webpack": "^0.13.2",
|
||||
"eslint-plugin-compat": "^4.0.2",
|
||||
"eslint-plugin-import": "^2.25.4",
|
||||
"eslint-plugin-jest": "^26.8.7",
|
||||
"eslint-plugin-jsx-a11y": "^6.6.1",
|
||||
"eslint-plugin-promise": "^6.0.0",
|
||||
"eslint-plugin-react": "^7.30.0",
|
||||
"eslint-config-erb": "^4.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.1",
|
||||
"eslint-import-resolver-webpack": "^0.13.8",
|
||||
"eslint-plugin-compat": "^4.2.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-jest": "^27.6.3",
|
||||
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-react": "^7.33.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"html-webpack-plugin": "^5.6.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^27.5.1",
|
||||
"lint-staged": "^12.5.0",
|
||||
"mini-css-extract-plugin": "^2.6.1",
|
||||
"jest": "^29.7.0",
|
||||
"lint-staged": "^15.2.1",
|
||||
"mini-css-extract-plugin": "^2.7.7",
|
||||
"opencollective-postinstall": "^2.0.3",
|
||||
"postcss": "^8.4.16",
|
||||
"postcss-loader": "^6.2.1",
|
||||
"prettier": "^2.7.1",
|
||||
"postcss": "^8.4.33",
|
||||
"postcss-loader": "^8.1.0",
|
||||
"prettier": "^3.2.4",
|
||||
"ps-scrollbar-tailwind": "0.0.1",
|
||||
"react-refresh": "^0.12.0",
|
||||
"react-refresh-typescript": "^2.0.7",
|
||||
"react-refresh": "^0.14.0",
|
||||
"react-test-renderer": "^18.2.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"sass": "^1.54.5",
|
||||
"sass-loader": "^12.6.0",
|
||||
"style-loader": "^3.3.1",
|
||||
"tailwind-scrollbar": "^2.0.1",
|
||||
"tailwindcss": "^3.3.1",
|
||||
"terser-webpack-plugin": "^5.3.5",
|
||||
"ts-jest": "^27.1.5",
|
||||
"ts-loader": "^9.3.0",
|
||||
"ts-node": "^10.8.2",
|
||||
"typescript": "^4.7.4",
|
||||
"rimraf": "^5.0.5",
|
||||
"sass": "^1.70.0",
|
||||
"sass-loader": "^14.1.0",
|
||||
"style-loader": "^3.3.4",
|
||||
"tailwind-scrollbar": "^3.1.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"terser-webpack-plugin": "^5.3.10",
|
||||
"ts-jest": "^29.1.2",
|
||||
"ts-loader": "^9.5.1",
|
||||
"typescript": "^5.3.3",
|
||||
"url-loader": "^4.1.1",
|
||||
"webpack": "^5.74.0",
|
||||
"webpack-bundle-analyzer": "^4.6.1",
|
||||
"webpack-cli": "^4.10.0",
|
||||
"webpack-dev-server": "^4.10.0",
|
||||
"webpack-merge": "^5.8.0"
|
||||
"webpack": "^5.90.3",
|
||||
"webpack-bundle-analyzer": "^4.10.1",
|
||||
"webpack-cli": "^5.1.4",
|
||||
"webpack-dev-server": "^4.15.1",
|
||||
"webpack-merge": "^5.10.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron/fuses": "^1.6.2",
|
||||
"@internationalized/date": "^3.5.4",
|
||||
"@nextui-org/date-picker": "^2.0.7",
|
||||
"@nextui-org/react": "^2.3.6",
|
||||
"@node-steam/vdf": "^2.2.0",
|
||||
"@tippyjs/react": "^4.2.6",
|
||||
"archiver": "^6.0.1",
|
||||
"clsx": "^2.1.1",
|
||||
"color": "^4.2.3",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dateformat": "^5.0.3",
|
||||
"dompurify": "^3.0.9",
|
||||
"dot-prop": "^8.0.2",
|
||||
"electron-debug": "^3.2.0",
|
||||
"electron-log": "^4.4.8",
|
||||
"electron-store": "^8.1.0",
|
||||
"electron-updater": "^6.1.7",
|
||||
"electron-updater": "^6.2.1",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"framer-motion": "^10.16.16",
|
||||
"format-duration": "^3.0.2",
|
||||
"framer-motion": "^11.2.6",
|
||||
"fs-extra": "^11.2.0",
|
||||
"got": "^14.4.1",
|
||||
"history": "^5.3.0",
|
||||
"is-elevated": "^3.0.0",
|
||||
"is-elevated": "^4.0.0",
|
||||
"jszip": "^3.10.1",
|
||||
"md5-file": "^5.0.0",
|
||||
"node-abi": "^3.47.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-abi": "^3.65.0",
|
||||
"node-fetch": "^3.3.2",
|
||||
"node-stream-zip": "^1.15.0",
|
||||
"pako": "^2.1.0",
|
||||
"ps-list": "^7.2.0",
|
||||
"protobufjs": "^7.3.2",
|
||||
"qrcode.react": "^3.1.0",
|
||||
"query-process": "^0.0.3",
|
||||
"react": "^18.2.0",
|
||||
"react-beautiful-dnd": "^13.1.1",
|
||||
"react-colorful": "^5.6.1",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-range": "^1.8.14",
|
||||
"react-router-dom": "^6.3.0",
|
||||
"react-virtualized-auto-sizer": "^1.0.12",
|
||||
"react-window": "^1.8.8",
|
||||
"react-router-dom": "^6.24.1",
|
||||
"react-virtualized-auto-sizer": "^1.0.24",
|
||||
"react-window": "^1.8.10",
|
||||
"recursive-readdir": "^2.2.3",
|
||||
"rfdc": "^1.3.0",
|
||||
"rxjs": "^7.8.0",
|
||||
"rfdc": "^1.3.1",
|
||||
"rxjs": "^7.8.1",
|
||||
"sanitize-filename": "^1.6.3",
|
||||
"semver": "^7.5.4",
|
||||
"serialize-error": "^8.1.0",
|
||||
"semver": "^7.6.2",
|
||||
"serialize-error": "^11.0.3",
|
||||
"striptags": "^4.0.0-alpha.4",
|
||||
"tailwind-merge": "^2.4.0",
|
||||
"tailwind-scrollbar-hide": "^1.1.7",
|
||||
"tailwindcss-scoped-groups": "^2.0.0",
|
||||
"tippy.js": "^6.3.7",
|
||||
@@ -280,9 +286,8 @@
|
||||
"use-double-click": "^1.0.5",
|
||||
"use-fit-text": "^2.4.0"
|
||||
},
|
||||
"devEngines": {
|
||||
"node": ">=14.x",
|
||||
"npm": ">=7.x"
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"collective": {
|
||||
"url": "https://www.patreon.com/bsmanager"
|
||||
@@ -317,5 +322,8 @@
|
||||
"!assets/**"
|
||||
],
|
||||
"logLevel": "quiet"
|
||||
},
|
||||
"volta": {
|
||||
"node": "20.11.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bs-manager",
|
||||
"version": "1.4.6",
|
||||
"version": "1.5.0-alpha.2",
|
||||
"description": "BSManager",
|
||||
"main": "./dist/main/main.js",
|
||||
"author": {
|
||||
@@ -9,15 +9,18 @@
|
||||
"url": "https://github.com/Zagrios/bs-manager"
|
||||
},
|
||||
"scripts": {
|
||||
"electron-rebuild": "node -r ts-node/register ../../.erb/scripts/electron-rebuild.js",
|
||||
"link-modules": "node -r ts-node/register ../../.erb/scripts/link-modules.ts",
|
||||
"electron-rebuild": "node -r esbuild-register ../../.erb/scripts/electron-rebuild.js",
|
||||
"link-modules": "node -r esbuild-register ../../.erb/scripts/link-modules.ts",
|
||||
"postinstall": "npm run electron-rebuild && npm run link-modules"
|
||||
},
|
||||
"dependencies": {
|
||||
"@resvg/resvg-js": "2.6.2",
|
||||
"ps-list": "^7.2.0",
|
||||
"query-process": "^0.0.3",
|
||||
"regedit-rs": "^1.0.2",
|
||||
"sharp": "^0.32.6"
|
||||
"regedit-rs": "^1.0.2"
|
||||
},
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"volta": {
|
||||
"node": "20.11.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { app } from "electron";
|
||||
import { constants } from "http2";
|
||||
import path from "path";
|
||||
|
||||
export const BS_EXECUTABLE = "Beat Saber.exe";
|
||||
@@ -10,5 +11,8 @@ export const APP_NAME = "BSManager";
|
||||
|
||||
export const STEAMVR_APP_ID = "250820";
|
||||
|
||||
export const IMAGE_CACHE_FOLDER = "imagescache";
|
||||
export const IMAGE_CACHE_PATH = path.join(app.getPath("userData"), IMAGE_CACHE_FOLDER);
|
||||
export const CACHE_PATH = path.join(app.getPath("userData"), "CachedData");
|
||||
|
||||
export const IMAGE_CACHE_PATH = path.join(CACHE_PATH, "imagescache");
|
||||
|
||||
export const HTTP_STATUS_CODES = constants;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CopyOptions, copy, createReadStream, ensureDir, move, realpath, stat, symlink } from "fs-extra";
|
||||
import { CopyOptions, copy, createReadStream, ensureDir, move, pathExists, pathExistsSync, realpath, stat, symlink } from "fs-extra";
|
||||
import { access, mkdir, rm, readdir, unlink, lstat, readlink } from "fs/promises";
|
||||
import path from "path";
|
||||
import { Observable, concatMap, from } from "rxjs";
|
||||
@@ -175,7 +175,7 @@ export async function dirSize(dirPath: string): Promise<number>{
|
||||
const realPath = await realpath(fullPath);
|
||||
const stat = await lstat(realPath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
if (stat.isDirectory()) {
|
||||
return dirSize(fullPath);
|
||||
}
|
||||
|
||||
@@ -217,13 +217,27 @@ export function rxCopy(src: string, dest: string, option?: CopyOptions): Observa
|
||||
|
||||
export async function ensurePathNotAlreadyExist(path: string): Promise<string> {
|
||||
let destPath = path;
|
||||
let folderExist = await pathExist(destPath);
|
||||
let folderExist = await pathExists(destPath);
|
||||
let i = 0;
|
||||
|
||||
while (folderExist) {
|
||||
i++;
|
||||
destPath = `${path} (${i})`;
|
||||
folderExist = await pathExist(destPath);
|
||||
folderExist = await pathExists(destPath);
|
||||
}
|
||||
|
||||
return destPath;
|
||||
}
|
||||
|
||||
export function ensurePathNotAlreadyExistSync(path: string): string {
|
||||
let destPath = path;
|
||||
let folderExist = pathExistsSync(destPath);
|
||||
let i = 0;
|
||||
|
||||
while (folderExist) {
|
||||
i++;
|
||||
destPath = `${path} (${i})`;
|
||||
folderExist = pathExistsSync(destPath);
|
||||
}
|
||||
|
||||
return destPath;
|
||||
@@ -244,9 +258,23 @@ export function resolveGUIDPath(guidPath: string): string {
|
||||
return path.join(driveLetter, path.relative(guidVolume, guidPath));
|
||||
}
|
||||
|
||||
export interface Progression<T = unknown> {
|
||||
export function getUniqueFileNamePath(filePath: string): string {
|
||||
const { dir, name, ext } = path.parse(filePath);
|
||||
let i = 0;
|
||||
let newFileName = `${name}${ext}`;
|
||||
|
||||
while (pathExistsSync(path.join(dir, newFileName))) {
|
||||
i++;
|
||||
newFileName = `${name} (${i})${ext}`;
|
||||
}
|
||||
|
||||
return path.join(dir, newFileName);
|
||||
}
|
||||
|
||||
export interface Progression<T = unknown, D = unknown> {
|
||||
total: number;
|
||||
current: number;
|
||||
diff?: number;
|
||||
data?: T;
|
||||
extra?: D;
|
||||
}
|
||||
|
||||
@@ -1,63 +1,30 @@
|
||||
import { ipcMain } from "electron";
|
||||
import { UtilsService } from "../services/utils.service";
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { SearchParams } from "shared/models/maps/beat-saver.model";
|
||||
import { BeatSaverService } from "../services/thrid-party/beat-saver/beat-saver.service";
|
||||
import log from "electron-log";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { from } from "rxjs";
|
||||
|
||||
ipcMain.on("bsv-search-map", async (event, request: IpcRequest<SearchParams>) => {
|
||||
const utlis = UtilsService.getInstance();
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipc.on("bsv-search-map", (args, reply) => {
|
||||
const bsvService = BeatSaverService.getInstance();
|
||||
|
||||
bsvService
|
||||
.searchMaps(request.args)
|
||||
.then(maps => {
|
||||
utlis.ipcSend(request.responceChannel, { success: true, data: maps });
|
||||
})
|
||||
.catch(e => {
|
||||
utlis.ipcSend(request.responceChannel, { success: false, error: e });
|
||||
});
|
||||
reply(from(bsvService.searchMaps(args)));
|
||||
});
|
||||
|
||||
ipcMain.on("bsv-get-map-details-from-hashs", async (event, request: IpcRequest<string[]>) => {
|
||||
const utlis = UtilsService.getInstance();
|
||||
ipc.on("bsv-get-map-details-from-hashs", (args, reply) => {
|
||||
const bsvService = BeatSaverService.getInstance();
|
||||
|
||||
bsvService
|
||||
.getMapDetailsFromHashs(request.args)
|
||||
.then(maps => {
|
||||
utlis.ipcSend(request.responceChannel, { success: true, data: maps });
|
||||
})
|
||||
.catch(e => {
|
||||
log.error(e);
|
||||
utlis.ipcSend(request.responceChannel, { success: false, error: e });
|
||||
});
|
||||
reply(from(bsvService.getMapDetailsFromHashs(args)));
|
||||
});
|
||||
|
||||
ipcMain.on("bsv-get-map-details-by-id", async (event, request: IpcRequest<string>) => {
|
||||
const utlis = UtilsService.getInstance();
|
||||
ipc.on("bsv-get-map-details-by-id", (args, reply) => {
|
||||
const bsvService = BeatSaverService.getInstance();
|
||||
|
||||
bsvService
|
||||
.getMapDetailsById(request.args)
|
||||
.then(maps => {
|
||||
utlis.ipcSend(request.responceChannel, { success: true, data: maps });
|
||||
})
|
||||
.catch(e => {
|
||||
utlis.ipcSend(request.responceChannel, { success: false, error: e });
|
||||
});
|
||||
reply(from(bsvService.getMapDetailsById(args)));
|
||||
});
|
||||
|
||||
ipcMain.on("bsv-get-playlist-details-by-id", async (event, request: IpcRequest<string>) => {
|
||||
const utlis = UtilsService.getInstance();
|
||||
ipc.on("bsv-search-playlist", (args, reply) => {
|
||||
const bsvService = BeatSaverService.getInstance();
|
||||
|
||||
bsvService
|
||||
.getPlaylistPage(request.args)
|
||||
.then(maps => {
|
||||
utlis.ipcSend(request.responceChannel, { success: true, data: maps });
|
||||
})
|
||||
.catch(e => {
|
||||
utlis.ipcSend(request.responceChannel, { success: false, error: e });
|
||||
});
|
||||
reply(from(bsvService.searchPlaylists(args)));
|
||||
});
|
||||
|
||||
ipc.on("bsv-get-playlist-details-by-id", (args, reply) => {
|
||||
const bsvService = BeatSaverService.getInstance();
|
||||
reply(from(bsvService.getPlaylistDetailsById(args.id, args.page)));
|
||||
});
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
|
||||
import { LaunchOption } from "shared/models/bs-launch";
|
||||
import { BSLauncherService } from "../services/bs-launcher/bs-launcher.service"
|
||||
import { IpcService } from '../services/ipc.service';
|
||||
import { from } from "rxjs";
|
||||
import { SteamLauncherService } from "../services/bs-launcher/steam-launcher.service";
|
||||
import { OculusLauncherService } from "../services/bs-launcher/oculus-launcher.service";
|
||||
import { SteamService } from "../services/steam.service";
|
||||
import log from "electron-log";
|
||||
import isElevated from "is-elevated";
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipc.on<LaunchOption>('bs-launch.launch', (req, reply) => {
|
||||
ipc.on('bs-launch.launch', (args, reply) => {
|
||||
const bsLauncher = BSLauncherService.getInstance();
|
||||
reply(bsLauncher.launch(req.args));
|
||||
reply(bsLauncher.launch(args));
|
||||
});
|
||||
|
||||
ipc.on<boolean>("bs-launch.need-start-as-admin", (_, reply) => {
|
||||
ipc.on("bs-launch.need-start-as-admin", (_, reply) => {
|
||||
const steam = SteamService.getInstance();
|
||||
reply(from(isElevated().then(elevated => {
|
||||
if(elevated){ return false; }
|
||||
@@ -27,13 +25,12 @@ ipc.on<boolean>("bs-launch.need-start-as-admin", (_, reply) => {
|
||||
})));
|
||||
});
|
||||
|
||||
ipc.on<LaunchOption>("create-launch-shortcut", (req, reply) => {
|
||||
ipc.on("create-launch-shortcut", (args, reply) => {
|
||||
const bsLauncher = BSLauncherService.getInstance();
|
||||
reply(from(bsLauncher.createLaunchShortcut(req.args)));
|
||||
reply(from(bsLauncher.createLaunchShortcut(args)));
|
||||
});
|
||||
|
||||
|
||||
ipc.on<void>("bs-launch.restore-steamvr", (_, reply) => {
|
||||
ipc.on("bs-launch.restore-steamvr", (_, reply) => {
|
||||
const steamLauncher = SteamLauncherService.getInstance();
|
||||
reply(from(steamLauncher.restoreSteamVR()));
|
||||
});
|
||||
|
||||
@@ -1,119 +1,83 @@
|
||||
import { LocalMapsManagerService } from "../services/additional-content/local-maps-manager.service";
|
||||
import { UtilsService } from "../services/utils.service";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface";
|
||||
import { BsvMapDetail } from "shared/models/maps";
|
||||
import { LocalMapsManagerService } from "../services/additional-content/maps/local-maps-manager.service";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { from } from "rxjs";
|
||||
import log from "electron-log"
|
||||
import { from, of, throwError } from "rxjs";
|
||||
import { tryit } from "shared/helpers/error.helpers";
|
||||
import { SongDetailsCacheService } from "main/services/additional-content/maps/song-details-cache.service";
|
||||
import { SongDetails } from "shared/models/maps";
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipc.on("load-version-maps", async (request: IpcRequest<BSVersion>, reply) => {
|
||||
ipc.on("load-version-maps", (args, reply) => {
|
||||
const localMaps = LocalMapsManagerService.getInstance();
|
||||
reply(localMaps.getMaps(request.args));
|
||||
reply(localMaps.getMaps(args));
|
||||
});
|
||||
|
||||
ipc.on("verion-have-maps-linked", async (request: IpcRequest<BSVersion>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
ipc.on("delete-maps", (args, reply) => {
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
|
||||
utils.ipcSend<boolean>(request.responceChannel, { success: true, data: await maps.versionIsLinked(request.args) });
|
||||
reply(maps.deleteMaps(args));
|
||||
});
|
||||
|
||||
ipc.on("link-version-maps", async (request: IpcRequest<{ version: BSVersion; keepMaps: boolean }>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
ipc.on("export-maps", async (args, reply) => {
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
|
||||
maps.linkVersionMaps(request.args.version, request.args.keepMaps)
|
||||
.then(() => {
|
||||
utils.ipcSend<void>(request.responceChannel, { success: true });
|
||||
})
|
||||
.catch(err => {
|
||||
utils.ipcSend<void>(request.responceChannel, { success: true, error: err });
|
||||
});
|
||||
reply(await maps.exportMaps(args.version, args.maps, args.outPath));
|
||||
});
|
||||
|
||||
ipc.on("unlink-version-maps", async (request: IpcRequest<{ version: BSVersion; keepMaps: boolean }>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
ipc.on("download-map", async (args, reply) => {
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
|
||||
maps.unlinkVersionMaps(request.args.version, request.args.keepMaps)
|
||||
.then(() => {
|
||||
utils.ipcSend<void>(request.responceChannel, { success: true });
|
||||
})
|
||||
.catch(err => {
|
||||
utils.ipcSend<void>(request.responceChannel, { success: true, error: err });
|
||||
});
|
||||
reply(from(maps.downloadMap(args.map, args.version)));
|
||||
});
|
||||
|
||||
ipc.on("delete-maps", async (request: IpcRequest<BsmLocalMap[]>, reply) => {
|
||||
ipc.on("one-click-install-map", (args, reply) => {
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
reply(maps.deleteMaps(request.args));
|
||||
reply(from(maps.oneClickDownloadMap(args)))
|
||||
});
|
||||
|
||||
ipc.on("export-maps", async (request: IpcRequest<{ version: BSVersion; maps: BsmLocalMap[]; outPath: string }>, reply) => {
|
||||
ipc.on("register-maps-deep-link", (_, reply) => {
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
reply(await maps.exportMaps(request.args.version, request.args.maps, request.args.outPath));
|
||||
});
|
||||
const { error, result } = tryit(() => maps.enableDeepLinks());
|
||||
|
||||
ipc.on("download-map", async (request: IpcRequest<{ map: BsvMapDetail; version: BSVersion }>, reply) => {
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
reply(from(maps.downloadMap(request.args.map, request.args.version)));
|
||||
});
|
||||
|
||||
ipc.on("one-click-install-map", async (request: IpcRequest<BsvMapDetail>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
|
||||
maps.oneClickDownloadMap(request.args)
|
||||
.then(() => {
|
||||
utils.ipcSend(request.responceChannel, { success: true });
|
||||
})
|
||||
.catch(err => {
|
||||
log.error(err);
|
||||
utils.ipcSend(request.responceChannel, { success: false, error: err });
|
||||
});
|
||||
});
|
||||
|
||||
ipc.on("register-maps-deep-link", async (request: IpcRequest<void>) => {
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
const utils = UtilsService.getInstance();
|
||||
|
||||
try {
|
||||
const res = maps.enableDeepLinks();
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: res });
|
||||
} catch (e) {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
if(error) {
|
||||
return reply(throwError(() => error));
|
||||
}
|
||||
|
||||
reply(of(result));
|
||||
});
|
||||
|
||||
ipc.on("unregister-maps-deep-link", async (request: IpcRequest<void>) => {
|
||||
ipc.on("unregister-maps-deep-link", (_, reply) => {
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
const utils = UtilsService.getInstance();
|
||||
const { error, result } = tryit(() => maps.disableDeepLinks());
|
||||
|
||||
try {
|
||||
const res = maps.disableDeepLinks();
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: res });
|
||||
} catch (e) {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
if(error) {
|
||||
return reply(throwError(() => error));
|
||||
}
|
||||
|
||||
reply(of(result));
|
||||
});
|
||||
|
||||
ipc.on("is-map-deep-links-enabled", async (request: IpcRequest<void>) => {
|
||||
ipc.on("is-map-deep-links-enabled", (_, reply) => {
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
const utils = UtilsService.getInstance();
|
||||
const { error, result } = tryit(() => maps.isDeepLinksEnabled());
|
||||
|
||||
try {
|
||||
const res = maps.isDeepLinksEnabled();
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: res });
|
||||
} catch (e) {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
if(error) {
|
||||
return reply(throwError(() => error));
|
||||
}
|
||||
|
||||
reply(of(result));
|
||||
});
|
||||
|
||||
ipc.on("get-version-maps-path", async (req: IpcRequest<BSVersion>, reply) => {
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
reply(from(maps.getMapsFolderPath(req.args)));
|
||||
});
|
||||
ipc.on("get-maps-info-from-cache", (args, reply) => {
|
||||
const songsCache = SongDetailsCacheService.getInstance();
|
||||
|
||||
const res = (args ?? []).reduce((acc, hash) => {
|
||||
const songDetails = songsCache.getSongDetails(hash);
|
||||
|
||||
if(songDetails){
|
||||
acc.push(songDetails);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, [] as SongDetails[]);
|
||||
|
||||
reply(of(res));
|
||||
|
||||
})
|
||||
|
||||
@@ -1,82 +1,45 @@
|
||||
import { ipcMain } from "electron";
|
||||
import { UtilsService } from "../services/utils.service";
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { MSModel, MSModelType } from "shared/models/models/model-saber.model";
|
||||
import { LocalModelsManagerService } from "../services/additional-content/local-models-manager.service";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { BsmLocalModel } from "shared/models/models/bsm-local-model.interface";
|
||||
import { ModelDownload } from "renderer/services/models-management/models-downloader.service";
|
||||
import { from, of } from "rxjs";
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipcMain.on("one-click-install-model", async (event, request: IpcRequest<MSModel>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
ipc.on("one-click-install-model", (args, reply) => {
|
||||
const models = LocalModelsManagerService.getInstance();
|
||||
|
||||
models
|
||||
.oneClickDownloadModel(request.args)
|
||||
.then(() => {
|
||||
utils.ipcSend(request.responceChannel, { success: true });
|
||||
})
|
||||
.catch(e => {
|
||||
utils.ipcSend(request.responceChannel, { success: false, error: e });
|
||||
});
|
||||
reply(from(models.oneClickDownloadModel(args)));
|
||||
});
|
||||
|
||||
ipcMain.on("register-models-deep-link", async (event, request: IpcRequest<void>) => {
|
||||
ipc.on("register-models-deep-link", (_, reply) => {
|
||||
const models = LocalModelsManagerService.getInstance();
|
||||
reply(of(models.enableDeepLinks()));
|
||||
});
|
||||
|
||||
ipc.on("unregister-models-deep-link", (_, reply) => {
|
||||
const models = LocalModelsManagerService.getInstance();
|
||||
reply(of(models.disableDeepLinks()));
|
||||
});
|
||||
|
||||
ipc.on("is-models-deep-links-enabled", (_, reply) => {
|
||||
const maps = LocalModelsManagerService.getInstance();
|
||||
const utils = UtilsService.getInstance();
|
||||
|
||||
try {
|
||||
const res = maps.enableDeepLinks();
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: res });
|
||||
} catch (e) {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
}
|
||||
reply(of(maps.isDeepLinksEnabled()));
|
||||
});
|
||||
|
||||
ipcMain.on("unregister-models-deep-link", async (event, request: IpcRequest<void>) => {
|
||||
const maps = LocalModelsManagerService.getInstance();
|
||||
const utils = UtilsService.getInstance();
|
||||
|
||||
try {
|
||||
const res = maps.disableDeepLinks();
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: res });
|
||||
} catch (e) {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on("is-models-deep-links-enabled", async (event, request: IpcRequest<void>) => {
|
||||
const maps = LocalModelsManagerService.getInstance();
|
||||
const utils = UtilsService.getInstance();
|
||||
|
||||
try {
|
||||
const res = maps.isDeepLinksEnabled();
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: res });
|
||||
} catch (e) {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
}
|
||||
});
|
||||
|
||||
ipc.on<ModelDownload>("download-model", async (req, reply) => {
|
||||
ipc.on("download-model", (args, reply) => {
|
||||
const models = LocalModelsManagerService.getInstance();
|
||||
reply(models.downloadModel(req.args.model, req.args.version));
|
||||
reply(models.downloadModel(args.model, args.version));
|
||||
});
|
||||
|
||||
ipc.on<{ version: BSVersion; type: MSModelType }>("get-version-models", async (req, reply) => {
|
||||
ipc.on("get-version-models", (args, reply) => {
|
||||
const models = LocalModelsManagerService.getInstance();
|
||||
const res = await models.getModels(req.args.type, req.args.version);
|
||||
reply(res);
|
||||
reply(from(models.getModels(args.type, args.version)));
|
||||
});
|
||||
|
||||
ipc.on<{ version: BSVersion; models: BsmLocalModel[]; outPath: string }>("export-models", async (req, reply) => {
|
||||
ipc.on("export-models", (args, reply) => {
|
||||
const models = LocalModelsManagerService.getInstance();
|
||||
reply(models.exportModels(req.args.outPath, req.args.version, req.args.models));
|
||||
reply(models.exportModels(args.outPath, args.version, args.models));
|
||||
});
|
||||
|
||||
ipc.on<BsmLocalModel[]>("delete-models", async (req, reply) => {
|
||||
ipc.on("delete-models", (args, reply) => {
|
||||
const models = LocalModelsManagerService.getInstance();
|
||||
reply(models.deleteModels(req.args));
|
||||
reply(models.deleteModels(args));
|
||||
});
|
||||
|
||||
@@ -1,67 +1,30 @@
|
||||
import { ipcMain } from "electron";
|
||||
import { BsModsManagerService } from "../services/mods/bs-mods-manager.service";
|
||||
import { UtilsService } from "../services/utils.service";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { Mod } from "shared/models/mods/mod.interface";
|
||||
import { InstallModsResult } from "shared/models/mods";
|
||||
import log from "electron-log";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { from } from "rxjs";
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipc.on<BSVersion>("get-available-mods", (req, reply) => {
|
||||
ipc.on("get-available-mods", (args, reply) => {
|
||||
const modsManager = BsModsManagerService.getInstance();
|
||||
reply(from(modsManager.getAvailableMods(req.args)));
|
||||
reply(from(modsManager.getAvailableMods(args)));
|
||||
});
|
||||
|
||||
ipc.on<BSVersion>("get-installed-mods", (req, reply) => {
|
||||
ipc.on("get-installed-mods", (args, reply) => {
|
||||
const modsManager = BsModsManagerService.getInstance();
|
||||
reply(from(modsManager.getInstalledMods(req.args)));
|
||||
reply(from(modsManager.getInstalledMods(args)));
|
||||
});
|
||||
|
||||
ipcMain.on("install-mods", (event, request: IpcRequest<{ mods: Mod[]; version: BSVersion }>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
ipc.on("install-mods", (args, reply) => {
|
||||
const modsManager = BsModsManagerService.getInstance();
|
||||
|
||||
modsManager
|
||||
.installMods(request.args.mods, request.args.version)
|
||||
.then(nbInstalled => {
|
||||
utils.ipcSend<InstallModsResult>(request.responceChannel, { success: true, data: nbInstalled });
|
||||
})
|
||||
.catch(err => {
|
||||
utils.ipcSend(request.responceChannel, { success: false, error: err });
|
||||
log.error("ipc", "install-mods", err, request);
|
||||
});
|
||||
reply(from(modsManager.installMods(args.mods, args.version)));
|
||||
});
|
||||
|
||||
ipcMain.on("uninstall-mods", (event, request: IpcRequest<{ mods: Mod[]; version: BSVersion }>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
ipc.on("uninstall-mods", (args, reply) => {
|
||||
const modsManager = BsModsManagerService.getInstance();
|
||||
|
||||
modsManager
|
||||
.uninstallMods(request.args.mods, request.args.version)
|
||||
.then(nbInstalled => {
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: nbInstalled });
|
||||
})
|
||||
.catch(err => {
|
||||
utils.ipcSend(request.responceChannel, { success: false, error: err });
|
||||
log.error("ipc", "uninstall-mods", err, request);
|
||||
});
|
||||
reply(from(modsManager.uninstallMods(args.mods, args.version)));
|
||||
});
|
||||
|
||||
ipcMain.on("uninstall-all-mods", (event, request: IpcRequest<BSVersion>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
ipc.on("uninstall-all-mods", (args, reply) => {
|
||||
const modsManager = BsModsManagerService.getInstance();
|
||||
|
||||
modsManager
|
||||
.uninstallAllMods(request.args)
|
||||
.then(nbInstalled => {
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: nbInstalled });
|
||||
})
|
||||
.catch(err => {
|
||||
utils.ipcSend(request.responceChannel, { success: false, error: err });
|
||||
log.error("ipc", "uninstall-all-mods", err, request);
|
||||
});
|
||||
reply(from(modsManager.uninstallAllMods(args)));
|
||||
});
|
||||
|
||||
@@ -1,48 +1,75 @@
|
||||
import { ipcMain } from "electron";
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { LocalPlaylistsManagerService } from "../services/additional-content/local-playlists-manager.service";
|
||||
import { UtilsService } from "../services/utils.service";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { from, lastValueFrom, mergeMap, of } from "rxjs";
|
||||
import { LocalMapsManagerService } from "../services/additional-content/maps/local-maps-manager.service";
|
||||
import { Progression } from "main/helpers/fs.helpers";
|
||||
import { isValidUrl } from "shared/helpers/url.helpers";
|
||||
import { pathToFileURL } from "url";
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipc.on<string>("one-click-install-playlist", (req, reply) => {
|
||||
ipc.on("one-click-install-playlist", (args, reply) => {
|
||||
const mapsManager = LocalPlaylistsManagerService.getInstance();
|
||||
reply(mapsManager.oneClickInstallPlaylist(req.args));
|
||||
reply(mapsManager.oneClickInstallPlaylist(args));
|
||||
});
|
||||
|
||||
ipcMain.on("register-playlists-deep-link", async (event, request: IpcRequest<void>) => {
|
||||
ipc.on("register-playlists-deep-link", (args, reply) => {
|
||||
const maps = LocalPlaylistsManagerService.getInstance();
|
||||
const utils = UtilsService.getInstance();
|
||||
|
||||
try {
|
||||
const res = maps.enableDeepLinks();
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: res });
|
||||
} catch (e) {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
}
|
||||
reply(of(maps.enableDeepLinks()));
|
||||
});
|
||||
|
||||
ipcMain.on("unregister-playlists-deep-link", async (event, request: IpcRequest<void>) => {
|
||||
ipc.on("unregister-playlists-deep-link", (args, reply) => {
|
||||
const maps = LocalPlaylistsManagerService.getInstance();
|
||||
const utils = UtilsService.getInstance();
|
||||
|
||||
try {
|
||||
const res = maps.disableDeepLinks();
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: res });
|
||||
} catch (e) {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
}
|
||||
reply(of(maps.disableDeepLinks()));
|
||||
});
|
||||
|
||||
ipcMain.on("is-playlists-deep-links-enabled", async (event, request: IpcRequest<void>) => {
|
||||
ipc.on("is-playlists-deep-links-enabled", (args, reply) => {
|
||||
const maps = LocalPlaylistsManagerService.getInstance();
|
||||
const utils = UtilsService.getInstance();
|
||||
|
||||
try {
|
||||
const res = maps.isDeepLinksEnabled();
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: res });
|
||||
} catch (e) {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
}
|
||||
reply(of(maps.isDeepLinksEnabled()));
|
||||
});
|
||||
|
||||
ipc.on("download-playlist", (args, reply) => {
|
||||
const playlists = LocalPlaylistsManagerService.getInstance();
|
||||
|
||||
const downloadUrl = isValidUrl(args.downloadSource) ? args.downloadSource : pathToFileURL(args.downloadSource).href;
|
||||
|
||||
return reply(playlists.downloadPlaylist({
|
||||
bpListUrl: downloadUrl,
|
||||
version: args.version,
|
||||
ignoreSongsHashs: args.ignoreSongsHashs,
|
||||
dest: args.dest
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
ipc.on("get-version-playlists-details", (args, reply) => {
|
||||
const playlists = LocalPlaylistsManagerService.getInstance();
|
||||
reply(playlists.getVersionPlaylistsDetails(args));
|
||||
});
|
||||
|
||||
ipc.on("delete-playlist", (args, reply) => {
|
||||
const playlists = LocalPlaylistsManagerService.getInstance();
|
||||
const maps = LocalMapsManagerService.getInstance();
|
||||
reply(playlists.deletePlaylistFile(args.bpList).pipe(mergeMap(() => {
|
||||
if(args.deleteMaps){
|
||||
return maps.deleteMapsFromHashs(args.version, args.bpList.songs.map(s => s.hash));
|
||||
}
|
||||
return of({ current: 0, total: 0 } as Progression);
|
||||
})));
|
||||
});
|
||||
|
||||
ipc.on("export-playlists", (args, reply) => {
|
||||
const playlists = LocalPlaylistsManagerService.getInstance();
|
||||
reply(playlists.exportPlaylists(args));
|
||||
});
|
||||
|
||||
ipc.on("install-playlist-file", (args, reply) => {
|
||||
const playlists = LocalPlaylistsManagerService.getInstance();
|
||||
|
||||
const promise = async () => {
|
||||
const playlist = await lastValueFrom(playlists.writeBPListFile({ bpList: args.bplist, version: args.version, dest: args.dest}));
|
||||
return playlists.getLocalBPListDetails(playlist);
|
||||
}
|
||||
|
||||
reply(from(promise()));
|
||||
})
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { BSLocalVersionService } from "../services/bs-local-version.service";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { from } from "rxjs";
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipc.on<BSVersion>("bs.uninstall", (req, reply) => {
|
||||
ipc.on("bs.uninstall", (args, reply) => {
|
||||
const bsLocalVersionService = BSLocalVersionService.getInstance();
|
||||
|
||||
reply(from(bsLocalVersionService.deleteVersion(req.args)));
|
||||
reply(from(bsLocalVersionService.deleteVersion(args)));
|
||||
});
|
||||
|
||||
@@ -1,47 +1,42 @@
|
||||
import { BsOculusDownloaderService } from "../../services/bs-version-download/bs-oculus-downloader.service";
|
||||
import { BsSteamDownloaderService, DownloadInfo, DownloadSteamInfo } from "../../services/bs-version-download/bs-steam-downloader.service";
|
||||
import { BsSteamDownloaderService } from "../../services/bs-version-download/bs-steam-downloader.service";
|
||||
import { InstallationLocationService } from "../../services/installation-location.service";
|
||||
import { IpcService } from "../../services/ipc.service";
|
||||
import { from, of } from "rxjs";
|
||||
import { BSLocalVersionService, ImportVersionOptions } from "../../services/bs-local-version.service";
|
||||
import { BSLocalVersionService } from "../../services/bs-local-version.service";
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipc.on<ImportVersionOptions>("import-version", (req, reply) => {
|
||||
ipc.on("import-version", (args, reply) => {
|
||||
const versionManager = BSLocalVersionService.getInstance();
|
||||
reply(versionManager.importVersion(req.args));
|
||||
reply(versionManager.importVersion(args));
|
||||
});
|
||||
|
||||
// #region Steam
|
||||
|
||||
ipc.on("is-dotnet-6-installed", (_, reply) => {
|
||||
const installer = BsSteamDownloaderService.getInstance();
|
||||
reply(from(installer.isDotNet6Installed()));
|
||||
});
|
||||
// #region Steam
|
||||
|
||||
ipc.on("bs-download.installation-folder", (_, reply) => {
|
||||
const installLocation = InstallationLocationService.getInstance();
|
||||
reply(from(installLocation.installationDirectory()));
|
||||
});
|
||||
|
||||
ipc.on<string>("bs-download.set-installation-folder", (req, reply) => {
|
||||
ipc.on("bs-download.set-installation-folder", (args, reply) => {
|
||||
const installerService = InstallationLocationService.getInstance();
|
||||
reply(from(installerService.setInstallationDirectory(req.args)));
|
||||
reply(from(installerService.setInstallationDirectory(args)));
|
||||
});
|
||||
|
||||
ipc.on<DownloadSteamInfo>("auto-download-bs-version", (req, reply) => {
|
||||
ipc.on("auto-download-bs-version", (args, reply) => {
|
||||
const bsInstaller = BsSteamDownloaderService.getInstance();
|
||||
reply(bsInstaller.autoDownloadBsVersion(req.args));
|
||||
reply(bsInstaller.autoDownloadBsVersion(args));
|
||||
});
|
||||
|
||||
ipc.on<DownloadSteamInfo>("download-bs-version", (req, reply) => {
|
||||
ipc.on("download-bs-version", (args, reply) => {
|
||||
const bsInstaller = BsSteamDownloaderService.getInstance();
|
||||
reply(bsInstaller.downloadBsVersion(req.args))
|
||||
reply(bsInstaller.downloadBsVersion(args))
|
||||
});
|
||||
|
||||
ipc.on<DownloadSteamInfo>("download-bs-version-qr", (req, reply) => {
|
||||
ipc.on("download-bs-version-qr", (args, reply) => {
|
||||
const bsInstaller = BsSteamDownloaderService.getInstance();
|
||||
reply(bsInstaller.downloadBsVersionWithQRCode(req.args))
|
||||
reply(bsInstaller.downloadBsVersionWithQRCode(args))
|
||||
});
|
||||
|
||||
ipc.on("stop-download-bs-version", (_, reply) => {
|
||||
@@ -49,23 +44,18 @@ ipc.on("stop-download-bs-version", (_, reply) => {
|
||||
reply(of(bsInstaller.stopDownload()));
|
||||
});
|
||||
|
||||
ipc.on<string>("send-input-bs-download", (req, reply) => {
|
||||
ipc.on("send-input-bs-download", (args, reply) => {
|
||||
const bsInstaller = BsSteamDownloaderService.getInstance();
|
||||
reply(of(bsInstaller.sendInput(req.args)));
|
||||
reply(of(bsInstaller.sendInput(args)));
|
||||
});
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Oculus
|
||||
|
||||
ipc.on<DownloadInfo>("bs-oculus-download", async (req, reply) => {
|
||||
ipc.on("bs-oculus-download", async (args, reply) => {
|
||||
const oculusDownloader = BsOculusDownloaderService.getInstance();
|
||||
reply(oculusDownloader.downloadVersion(req.args));
|
||||
});
|
||||
|
||||
ipc.on<DownloadInfo>("bs-oculus-auto-download", async (req, reply) => {
|
||||
const oculusDownloader = BsOculusDownloaderService.getInstance();
|
||||
reply(oculusDownloader.autoDownloadVersion(req.args));
|
||||
reply(oculusDownloader.downloadVersion(args));
|
||||
});
|
||||
|
||||
ipc.on("bs-oculus-stop-download", async (_, reply) => {
|
||||
@@ -73,14 +63,4 @@ ipc.on("bs-oculus-stop-download", async (_, reply) => {
|
||||
reply(of(oculusDownloader.stopDownload()));
|
||||
});
|
||||
|
||||
ipc.on("bs-oculus-has-auth-token", async (_, reply) => {
|
||||
const oculusDownloader = BsOculusDownloaderService.getInstance();
|
||||
reply(from(oculusDownloader.getAuthToken().then(token => !!token)));
|
||||
});
|
||||
|
||||
ipc.on("bs-oculus-clear-auth-token", async (_, reply) => {
|
||||
const oculusDownloader = BsOculusDownloaderService.getInstance();
|
||||
reply(from(oculusDownloader.clearAuthToken()));
|
||||
});
|
||||
|
||||
// #endregion
|
||||
// #endregion
|
||||
|
||||
@@ -1,173 +1,69 @@
|
||||
import { ipcMain, shell } from "electron";
|
||||
import { UtilsService } from "../services/utils.service";
|
||||
import { shell } from "electron";
|
||||
import { BSVersionLibService } from "../services/bs-version-lib.service";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
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 { pathExists } from "fs-extra";
|
||||
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 => {
|
||||
UtilsService.getInstance().ipcSend(req.responceChannel, { success: true, data: versions });
|
||||
})
|
||||
.catch(() => {
|
||||
UtilsService.getInstance().ipcSend(req.responceChannel, { success: false });
|
||||
});
|
||||
ipc.on("bs-version.get-version-dict", (_, reply) => {
|
||||
const versionsLib = BSVersionLibService.getInstance();
|
||||
reply(from(versionsLib.getAvailableVersions()));
|
||||
});
|
||||
|
||||
ipcMain.on("bs-version.installed-versions", async (_event, req: IpcRequest<void>) => {
|
||||
BSLocalVersionService.getInstance()
|
||||
.getInstalledVersions()
|
||||
.then(versions => {
|
||||
UtilsService.getInstance().ipcSend(req.responceChannel, { success: true, data: versions });
|
||||
})
|
||||
.catch(() => {
|
||||
UtilsService.getInstance().ipcSend(req.responceChannel, { success: false });
|
||||
});
|
||||
ipc.on("bs-version.installed-versions", (_, reply) => {
|
||||
const versions = BSLocalVersionService.getInstance();
|
||||
reply(from(versions.getInstalledVersions()));
|
||||
});
|
||||
|
||||
ipcMain.on("bs-version.open-folder", async (_event, req: IpcRequest<BSVersion>) => {
|
||||
const localVersionService = BSLocalVersionService.getInstance();
|
||||
const versionFolder = await localVersionService.getVersionPath(req.args);
|
||||
if (!(await pathExist(versionFolder))) return;
|
||||
shell.openPath(versionFolder);
|
||||
});
|
||||
|
||||
ipcMain.on("bs-version.edit", async (__event, req: IpcRequest<{ version: BSVersion; name: string; color: string }>) => {
|
||||
BSLocalVersionService.getInstance()
|
||||
.editVersion(req.args.version, req.args.name, req.args.color)
|
||||
.then(res => {
|
||||
UtilsService.getInstance().ipcSend(req.responceChannel, { success: !!res, data: res });
|
||||
})
|
||||
.catch((error: BsmException) => {
|
||||
UtilsService.getInstance().ipcSend(req.responceChannel, { success: false, error });
|
||||
});
|
||||
});
|
||||
|
||||
ipcMain.on("bs-version.clone", async (_event, req: IpcRequest<{ version: BSVersion; name: string; color: string }>) => {
|
||||
BSLocalVersionService.getInstance()
|
||||
.cloneVersion(req.args.version, req.args.name, req.args.color)
|
||||
.then(res => {
|
||||
UtilsService.getInstance().ipcSend(req.responceChannel, { success: !!res, data: res });
|
||||
})
|
||||
.catch((error: BsmException) => {
|
||||
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);
|
||||
});
|
||||
ipc.on("bs-version.open-folder", (args, reply) => {
|
||||
const versions = BSLocalVersionService.getInstance();
|
||||
const promise = versions.getVersionPath(args).then(versionFolder => {
|
||||
if(!versionFolder || !pathExists(versionFolder)) return;
|
||||
shell.openPath(versionFolder);
|
||||
})
|
||||
reply(from(promise));
|
||||
});
|
||||
|
||||
ipc.on("full-version-path-to-relative", async (req: IpcRequest<{ version: BSVersion; fullPath: string }>, reply) => {
|
||||
ipc.on("bs-version.edit", (args, reply) => {
|
||||
const versions = BSLocalVersionService.getInstance();
|
||||
reply(from(versions.editVersion(args.version, args.name, args.color)));
|
||||
});
|
||||
|
||||
ipc.on("bs-version.clone", (args, reply) => {
|
||||
const versions = BSLocalVersionService.getInstance();
|
||||
reply(from(versions.cloneVersion(args.version, args.name, args.color)));
|
||||
});
|
||||
|
||||
ipc.on("get-version-full-path", (args, 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));
|
||||
reply(from(localVersions.getVersionPath(args)));
|
||||
});
|
||||
|
||||
ipc.on("get-linked-folders", async (req: IpcRequest<{ version: BSVersion; options?: { relative?: boolean } }>, reply) => {
|
||||
ipc.on("full-version-path-to-relative", (args, reply) => {
|
||||
const localVersions = BSLocalVersionService.getInstance();
|
||||
reply(from(localVersions.getVersionPath(args.version).then(versionPath => path.relative(versionPath, args.fullPath))));
|
||||
});
|
||||
|
||||
ipc.on("get-linked-folders", (args, reply) => {
|
||||
const versionLinker = VersionFolderLinkerService.getInstance();
|
||||
reply(from(versionLinker.getLinkedFolders(req.args.version, req.args.options)));
|
||||
reply(from(versionLinker.getLinkedFolders(args.version, 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) => {
|
||||
ipc.on("link-version-folder-action", (args, reply) => {
|
||||
const versionLinker = VersionFolderLinkerService.getInstance();
|
||||
reply(from(versionLinker.doAction(req.args)));
|
||||
reply(from(versionLinker.doAction(args)));
|
||||
});
|
||||
|
||||
ipc.on("is-version-folder-linked", async (req: IpcRequest<{ version: BSVersion; relativeFolder: string }>, reply) => {
|
||||
ipc.on("is-version-folder-linked", (args, reply) => {
|
||||
const versionLinker = VersionFolderLinkerService.getInstance();
|
||||
reply(from(versionLinker.isFolderLinked(req.args.version, req.args.relativeFolder)));
|
||||
reply(from(versionLinker.isFolderLinked(args.version, 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) => {
|
||||
ipc.on("relink-all-versions-folders", (_, reply) => {
|
||||
const versionLinker = VersionFolderLinkerService.getInstance();
|
||||
reply(from(versionLinker.relinkAllVersionsFolders()));
|
||||
});
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
import { ipcMain } from "electron";
|
||||
import { AutoUpdaterService } from "../services/auto-updater.service";
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { UtilsService } from "../services/utils.service";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { from } from "rxjs";
|
||||
import { from, of } from "rxjs";
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipcMain.on("download-update", async (event, request: IpcRequest<void>) => {
|
||||
ipc.on("download-update", (_, reply) => {
|
||||
const updaterService = AutoUpdaterService.getInstance();
|
||||
const utilsService = UtilsService.getInstance();
|
||||
|
||||
updaterService
|
||||
.downloadUpdate()
|
||||
.then(res => utilsService.ipcSend(request.responceChannel, { success: res }))
|
||||
.catch(() => utilsService.ipcSend(request.responceChannel, { success: false }));
|
||||
reply(from(updaterService.downloadUpdate()));
|
||||
});
|
||||
|
||||
ipc.on("check-update", (_, reply) => {
|
||||
@@ -22,7 +14,7 @@ ipc.on("check-update", (_, reply) => {
|
||||
reply(from(updaterService.isUpdateAvailable()));
|
||||
});
|
||||
|
||||
ipcMain.on("install-update", async (event, request: IpcRequest<void>) => {
|
||||
ipc.on("install-update", (_, reply) => {
|
||||
const updaterService = AutoUpdaterService.getInstance();
|
||||
updaterService.quitAndInstall();
|
||||
reply(of(updaterService.quitAndInstall()));
|
||||
});
|
||||
|
||||
@@ -1,26 +1,15 @@
|
||||
import { ipcMain } from "electron";
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { ModelSaberService } from "../services/thrid-party/model-saber/model-saber.service";
|
||||
import { UtilsService } from "../services/utils.service";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { MSGetQuery } from "shared/models/models/model-saber.model";
|
||||
import { from } from "rxjs";
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipcMain.on("ms-get-model-by-id", async (event, request: IpcRequest<string | number>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
ipc.on("ms-get-model-by-id", (args, reply) => {
|
||||
const ms = ModelSaberService.getInstance();
|
||||
|
||||
ms.getModelById(request.args)
|
||||
.then(model => {
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: model });
|
||||
})
|
||||
.catch(e => {
|
||||
utils.ipcSend(request.responceChannel, { success: false, error: e });
|
||||
});
|
||||
reply(from(ms.getModelById(args)));
|
||||
});
|
||||
|
||||
ipc.on<MSGetQuery>("search-models", async (req, reply) => {
|
||||
ipc.on("search-models", async (args, reply) => {
|
||||
const ms = ModelSaberService.getInstance();
|
||||
reply(ms.searchModels(req.args));
|
||||
reply(ms.searchModels(args));
|
||||
});
|
||||
|
||||
@@ -1,59 +1,64 @@
|
||||
import { ipcMain, shell, dialog, app, BrowserWindow } from "electron";
|
||||
import { UtilsService } from "../services/utils.service";
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { SystemNotificationOptions } from "shared/models/notification/system-notification.model";
|
||||
import { shell, dialog, app, BrowserWindow } from "electron";
|
||||
import { NotificationService } from "../services/notification.service";
|
||||
import { SteamService } from "../services/steam.service";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { from, of } from "rxjs";
|
||||
import { readFileSync } from "fs-extra";
|
||||
|
||||
// TODO IMPROVE WINDOW CONTROL BY USING WINDOW SERVICE
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipcMain.on("new-window", async (event, request: IpcRequest<string>) => {
|
||||
shell.openExternal(request.args);
|
||||
ipc.on("new-window", (args, reply) => {
|
||||
reply(from(shell.openExternal(args)));
|
||||
});
|
||||
|
||||
ipc.on<string>("choose-folder", async (req, reply) => {
|
||||
reply(from(dialog.showOpenDialog({ properties: ["openDirectory"], defaultPath: req.args ?? "" })));
|
||||
ipc.on("choose-folder", (args, reply) => {
|
||||
reply(from(dialog.showOpenDialog({ properties: ["openDirectory"], defaultPath: args ?? "" })));
|
||||
});
|
||||
|
||||
ipcMain.on("window.progression", async (event, request: IpcRequest<number>) => {
|
||||
BrowserWindow.fromWebContents(event.sender)?.setProgressBar(request.args / 100);
|
||||
ipc.on<string>("choose-file", async (args, reply) => {
|
||||
reply(from(dialog.showOpenDialog({ properties: ["openFile"], defaultPath: args ?? "" })));
|
||||
});
|
||||
|
||||
ipcMain.on("save-file", async (event, request: IpcRequest<{ filename?: string; filters?: Electron.FileFilter[] }>) => {
|
||||
dialog.showSaveDialog({ properties: ["showOverwriteConfirmation"], defaultPath: request.args.filename, filters: request.args.filters }).then(res => {
|
||||
const utils = UtilsService.getInstance();
|
||||
ipc.on("window.progression",(args, reply, sender) => {
|
||||
BrowserWindow.fromWebContents(sender)?.setProgressBar(args / 100);
|
||||
reply(of(undefined));
|
||||
});
|
||||
|
||||
ipc.on("save-file", (args, reply) => {
|
||||
reply(from(dialog.showSaveDialog({ properties: ["showOverwriteConfirmation"], defaultPath: args.filename, filters: args.filters }).then(res => {
|
||||
if (res.canceled || !res.filePath) {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
throw new Error("No file path selected");
|
||||
}
|
||||
UtilsService.getInstance().ipcSend(request.responceChannel, { success: true, data: res.filePath });
|
||||
});
|
||||
return res.filePath;
|
||||
})));
|
||||
});
|
||||
|
||||
ipc.on("current-version", (_, reply) => {
|
||||
reply(of(app.getVersion()));
|
||||
});
|
||||
|
||||
ipcMain.on("open-logs", async (event, request: IpcRequest<void>) => {
|
||||
shell.openPath(app.getPath("logs"));
|
||||
ipc.on("open-logs", (_, reply) => {
|
||||
reply(from(shell.openPath(app.getPath("logs"))));
|
||||
});
|
||||
|
||||
ipcMain.on("notify-system", async (event, request: IpcRequest<SystemNotificationOptions>) => {
|
||||
NotificationService.getInstance().notify(request.args);
|
||||
ipc.on("notify-system", (args, reply) => {
|
||||
const systemNotification = NotificationService.getInstance();
|
||||
reply(of(systemNotification.notify(args)));
|
||||
});
|
||||
|
||||
ipcMain.on("open-steam", async (event, request: IpcRequest<void>) => {
|
||||
const steam = SteamService.getInstance();
|
||||
const utils = UtilsService.getInstance();
|
||||
steam
|
||||
.openSteam()
|
||||
.then(res => {
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: res });
|
||||
})
|
||||
.catch(e => {
|
||||
utils.ipcSend(request.responceChannel, { success: false, error: e });
|
||||
});
|
||||
ipc.on("view-path-in-explorer", (args, reply) => {
|
||||
reply(of(shell.showItemInFolder(args)));
|
||||
});
|
||||
|
||||
ipc.on("choose-image", (args, reply) => {
|
||||
reply(from(dialog.showOpenDialog({ properties: ["openFile", "multiSelections"], filters: [{ name: "Images", extensions: ["jpg", "png", "jpeg"] }] }).then(res => {
|
||||
if (res.canceled || !res.filePaths) {
|
||||
return [];
|
||||
}
|
||||
if(args.base64){
|
||||
return res.filePaths.map(path => Buffer.from(readFileSync(path)).toString("base64"));
|
||||
}
|
||||
return res.filePaths;
|
||||
})));
|
||||
});
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
import { ipcMain } from "electron";
|
||||
import { SupportersService } from "../services/supporters.service";
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { UtilsService } from "../services/utils.service";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { from } from "rxjs";
|
||||
|
||||
ipcMain.on("get-supporters", (event, request: IpcRequest<void>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
ipc.on("get-supporters", (_, reply) => {
|
||||
const supportersService = SupportersService.getInstance();
|
||||
|
||||
supportersService
|
||||
.getSupporters()
|
||||
.then(supporters => {
|
||||
utils.ipcSend(request.responceChannel, { success: true, data: supporters });
|
||||
})
|
||||
.catch(() => {
|
||||
utils.ipcSend(request.responceChannel, { success: false });
|
||||
});
|
||||
reply(from(supportersService.getSupporters()));
|
||||
});
|
||||
|
||||
@@ -1,40 +1,39 @@
|
||||
import { WindowManagerService } from "../services/window-manager.service";
|
||||
import { AppWindow } from "shared/models/window-manager/app-window.model";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { from } from "rxjs";
|
||||
import { BrowserWindow, ipcMain } from "electron";
|
||||
import { from, of } from "rxjs";
|
||||
import { BrowserWindow } from "electron";
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
// Native windows control, do not pass through IPC service
|
||||
ipcMain.on("close-window", async (event) => {
|
||||
BrowserWindow.fromWebContents(event.sender)?.close();
|
||||
ipc.on("close-window", (_, reply, sender) => {
|
||||
reply(of(BrowserWindow.fromWebContents(sender)?.close()));
|
||||
});
|
||||
|
||||
ipcMain.on("maximise-window", async (event) => {
|
||||
BrowserWindow.fromWebContents(event.sender)?.maximize();
|
||||
ipc.on("maximise-window", (_, reply, sender) => {
|
||||
reply(of(BrowserWindow.fromWebContents(sender)?.maximize()));
|
||||
});
|
||||
|
||||
ipcMain.on("minimise-window", async (event) => {
|
||||
BrowserWindow.fromWebContents(event.sender)?.minimize();
|
||||
ipc.on("minimise-window", (_, reply, sender) => {
|
||||
reply(of(BrowserWindow.fromWebContents(sender)?.minimize()));
|
||||
});
|
||||
|
||||
ipcMain.on("unmaximise-window", async (event) => {
|
||||
BrowserWindow.fromWebContents(event.sender)?.unmaximize();
|
||||
ipc.on("unmaximise-window", (_, reply, sender) => {
|
||||
reply(of(BrowserWindow.fromWebContents(sender)?.unmaximize()));
|
||||
});
|
||||
|
||||
|
||||
ipc.on<AppWindow>("open-window-then-close-all", (req, reply) => {
|
||||
ipc.on("open-window-then-close-all", (args, reply) => {
|
||||
const windowManager = WindowManagerService.getInstance();
|
||||
|
||||
const res = windowManager.openWindow(req.args).then(() => {
|
||||
windowManager.closeAllWindows(req.args);
|
||||
const res = windowManager.openWindow(args).then(() => {
|
||||
windowManager.closeAllWindows(args);
|
||||
});
|
||||
|
||||
reply(from(res));
|
||||
});
|
||||
|
||||
ipc.on<AppWindow>("open-window-or-focus", (req, reply) => {
|
||||
ipc.on("open-window-or-focus", (args, reply) => {
|
||||
const windowManager = WindowManagerService.getInstance();
|
||||
reply(from(windowManager.openWindowOrFocus(req.args)));
|
||||
reply(from(windowManager.openWindowOrFocus(args)));
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ import "./ipcs";
|
||||
import { WindowManagerService } from "./services/window-manager.service";
|
||||
import { DeepLinkService } from "./services/deep-link.service";
|
||||
import { AppWindow } from "shared/models/window-manager/app-window.model";
|
||||
import { LocalMapsManagerService } from "./services/additional-content/local-maps-manager.service";
|
||||
import { LocalMapsManagerService } from "./services/additional-content/maps/local-maps-manager.service";
|
||||
import { LocalPlaylistsManagerService } from "./services/additional-content/local-playlists-manager.service";
|
||||
import { LocalModelsManagerService } from "./services/additional-content/local-models-manager.service";
|
||||
import { APP_NAME } from "./constants";
|
||||
@@ -21,6 +21,8 @@ import { BSLauncherService } from "./services/bs-launcher/bs-launcher.service";
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { LivShortcut } from "./services/liv/liv-shortcut.service";
|
||||
import { SteamLauncherService } from "./services/bs-launcher/steam-launcher.service";
|
||||
import { FileAssociationService } from "./services/file-association.service";
|
||||
import { SongDetailsCacheService } from "./services/additional-content/maps/song-details-cache.service";
|
||||
|
||||
const isDebug = process.env.NODE_ENV === "development" || process.env.DEBUG_PROD === "true";
|
||||
|
||||
@@ -67,6 +69,15 @@ const initServicesMustBeInitialized = () => {
|
||||
LocalModelsManagerService.getInstance();
|
||||
LivShortcut.getInstance();
|
||||
BSLauncherService.getInstance();
|
||||
SongDetailsCacheService.getInstance();
|
||||
}
|
||||
|
||||
const findDeepLinkInArgs = (args: string[]): string => {
|
||||
return args.find(arg => DeepLinkService.getInstance().isDeepLink(arg));
|
||||
}
|
||||
|
||||
const findAssociatedFileInArgs = (args: string[]): string => {
|
||||
return args.find(arg => FileAssociationService.getInstance().isFileAssociated(arg));
|
||||
}
|
||||
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
@@ -75,13 +86,15 @@ if (!gotTheLock) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on("second-instance", (_, argv) => {
|
||||
const deepLink = argv.find(arg => DeepLinkService.getInstance().isDeepLink(arg));
|
||||
const deepLink = findDeepLinkInArgs(argv);
|
||||
const associatedFile = findAssociatedFileInArgs(argv);
|
||||
|
||||
if (!deepLink) {
|
||||
return;
|
||||
if (deepLink) {
|
||||
DeepLinkService.getInstance().dispatchLinkOpened(deepLink);
|
||||
} else if (associatedFile) {
|
||||
FileAssociationService.getInstance().handleFileAssociation(associatedFile);
|
||||
}
|
||||
|
||||
DeepLinkService.getInstance().dispatchLinkOpened(deepLink);
|
||||
});
|
||||
|
||||
app.on("window-all-closed", () => {
|
||||
@@ -90,25 +103,30 @@ if (!gotTheLock) {
|
||||
})
|
||||
|
||||
app.whenReady().then(() => {
|
||||
|
||||
|
||||
// C:\\Users\\Mathieu\\Desktop\\BSManager\\BSInstances\\My Version\\UserData\\SongDetailsCache.proto
|
||||
|
||||
app.setAppUserModelId(APP_NAME);
|
||||
|
||||
initServicesMustBeInitialized();
|
||||
|
||||
const deepLink = process.argv.find(arg => DeepLinkService.getInstance().isDeepLink(arg));
|
||||
|
||||
if (!deepLink) {
|
||||
createWindow();
|
||||
} else {
|
||||
const deepLink = findDeepLinkInArgs(process.argv);
|
||||
const associatedFile = findAssociatedFileInArgs(process.argv);
|
||||
|
||||
if (deepLink) {
|
||||
DeepLinkService.getInstance().dispatchLinkOpened(deepLink);
|
||||
} else if (associatedFile) {
|
||||
FileAssociationService.getInstance().handleFileAssociation(associatedFile);
|
||||
} else {
|
||||
createWindow();
|
||||
}
|
||||
|
||||
|
||||
SteamLauncherService.getInstance().restoreSteamVR();
|
||||
|
||||
|
||||
// Log renderer errors
|
||||
ipcMain.on("log-error", (_, args: IpcRequest<unknown>) => {
|
||||
log.error(args?.args);
|
||||
});
|
||||
|
||||
|
||||
}).catch(log.error);
|
||||
}
|
||||
|
||||
@@ -36,8 +36,7 @@ export class Archive {
|
||||
|
||||
public addDirectory(path: string, destPath?: string | false): void {
|
||||
this.directories.push(path);
|
||||
destPath = destPath === false ? false : _path.basename(path);
|
||||
this.archive.directory(path, destPath);
|
||||
this.archive.directory(path, destPath ?? _path.basename(path));
|
||||
}
|
||||
|
||||
public addFile(path: string, destPath?: string): void {
|
||||
@@ -46,13 +45,14 @@ export class Archive {
|
||||
this.archive.file(path, { name: destPath });
|
||||
}
|
||||
|
||||
public finalize(): Observable<Progression> {
|
||||
const progress: Progression = {
|
||||
public finalize(): Observable<Progression<string>> {
|
||||
const progress: Progression<string> = {
|
||||
total: 0,
|
||||
current: 0,
|
||||
data: this.output,
|
||||
};
|
||||
|
||||
return new Observable<Progression>(observer => {
|
||||
return new Observable<Progression<string>>(observer => {
|
||||
(async () => {
|
||||
progress.total = await this.loadTotalFiles();
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
import { writeFileSync } from "fs-extra";
|
||||
import { tryit } from "shared/helpers/error.helpers";
|
||||
import log from "electron-log";
|
||||
import { Subject, debounceTime } from "rxjs";
|
||||
|
||||
export class JsonCache<T = unknown> {
|
||||
|
||||
private _cache: Record<string, T> = {};
|
||||
private readonly setEvent: Subject<void> = new Subject<void>();
|
||||
|
||||
public constructor(
|
||||
private readonly jsonPath: string,
|
||||
private readonly options: JsonCacheOptions = { autoSave: true, saveDebounce: 1000}
|
||||
){
|
||||
this.load();
|
||||
|
||||
if(this.options.autoSave){
|
||||
this.setEvent = new Subject<void>();
|
||||
this.setEvent.pipe(debounceTime(this.options.saveDebounce ?? 1000)).subscribe(() => this.save());
|
||||
}
|
||||
}
|
||||
|
||||
private load(): void {
|
||||
try {
|
||||
this._cache = require(this.jsonPath);
|
||||
} catch (error) {
|
||||
log.warn("Failed to load cache or file cache not exist yet", this.jsonPath, error);
|
||||
} finally {
|
||||
this._cache ??= {};
|
||||
}
|
||||
}
|
||||
|
||||
public save(): void {
|
||||
const res = tryit(() => writeFileSync(this.jsonPath, JSON.stringify(this._cache), { flush: true }));
|
||||
if(res.error){
|
||||
log.error("Failed to save cache", this.jsonPath, res.error);
|
||||
}
|
||||
}
|
||||
|
||||
public get(key: string): T {
|
||||
return this._cache[key];
|
||||
}
|
||||
|
||||
public set(key: string, value: T): void {
|
||||
this._cache[key] = value;
|
||||
this.setEvent?.next();
|
||||
}
|
||||
|
||||
public delete(key: string): void {
|
||||
delete this._cache[key];
|
||||
this.setEvent?.next();
|
||||
}
|
||||
|
||||
public clear(): void {
|
||||
this._cache = {};
|
||||
this.setEvent?.next();
|
||||
}
|
||||
|
||||
public get cache(): Record<string, T> {
|
||||
return this._cache;
|
||||
}
|
||||
}
|
||||
|
||||
export type JsonCacheOptions = {
|
||||
/**
|
||||
* Load the cache immediately after creating the instance
|
||||
* @default true
|
||||
*/
|
||||
loadImmediately?: boolean;
|
||||
/**
|
||||
* Auto save the cache after a change
|
||||
* @default true
|
||||
*/
|
||||
autoSave?: boolean;
|
||||
/**
|
||||
* Time in ms to wait before saving the cache after a change
|
||||
* @default 1000
|
||||
*/
|
||||
saveDebounce?: number;
|
||||
};
|
||||
@@ -4,6 +4,7 @@ import { ProviderPlatform } from "shared/models/provider-platform.enum";
|
||||
const sep = process.platform === ProviderPlatform.WINDOWS ? "\\" : "/";
|
||||
|
||||
contextBridge.exposeInMainWorld("electron", {
|
||||
platform: process.platform,
|
||||
ipcRenderer: {
|
||||
sendMessage(channel: string, args: unknown[]) {
|
||||
ipcRenderer.send(channel, args);
|
||||
@@ -26,12 +27,5 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
join: (...args: string[]): string => {
|
||||
return args.join(sep);
|
||||
}
|
||||
},
|
||||
window: {
|
||||
close: () => { ipcRenderer.send("close-window"); },
|
||||
minimise: () => { ipcRenderer.send("minimise-window"); },
|
||||
maximise: () => { ipcRenderer.send("maximise-window"); },
|
||||
unmaximise: () => { ipcRenderer.send("unmaximise-window"); },
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,14 +11,13 @@ import sanitize from "sanitize-filename";
|
||||
import { Progression, ensureFolderExist, unlinkPath } from "../../helpers/fs.helpers";
|
||||
import { MODEL_FILE_EXTENSIONS, MODEL_TYPES, MODEL_TYPE_FOLDERS } from "../../../shared/models/models/constants";
|
||||
import { InstallationLocationService } from "../installation-location.service";
|
||||
import { Observable, Subscription, lastValueFrom, of } from "rxjs";
|
||||
import { Observable, Subscription, lastValueFrom } from "rxjs";
|
||||
import { readdir } from "fs/promises";
|
||||
import md5File from "md5-file";
|
||||
import { allSettled } from "../../../shared/helpers/promise.helpers";
|
||||
import { ModelSaberService } from "../thrid-party/model-saber/model-saber.service";
|
||||
import { BsmLocalModel } from "shared/models/models/bsm-local-model.interface";
|
||||
import { Archive } from "../../models/archive.class";
|
||||
import { IpcService } from "../ipc.service";
|
||||
|
||||
export class LocalModelsManagerService {
|
||||
private static instance: LocalModelsManagerService;
|
||||
@@ -40,7 +39,6 @@ export class LocalModelsManagerService {
|
||||
private readonly installPaths: InstallationLocationService;
|
||||
private readonly request: RequestService;
|
||||
private readonly modelSaber: ModelSaberService;
|
||||
private readonly ipc: IpcService;
|
||||
|
||||
private constructor() {
|
||||
this.deepLink = DeepLinkService.getInstance();
|
||||
@@ -49,26 +47,14 @@ export class LocalModelsManagerService {
|
||||
this.request = RequestService.getInstance();
|
||||
this.installPaths = InstallationLocationService.getInstance();
|
||||
this.modelSaber = ModelSaberService.getInstance();
|
||||
this.ipc = IpcService.getInstance();
|
||||
|
||||
this.deepLink.addLinkOpenedListener(this.DEEP_LINKS.ModelSaber, link => {
|
||||
log.info("DEEP-LINK RECEIVED FROM", this.DEEP_LINKS.ModelSaber, link);
|
||||
const url = new URL(link);
|
||||
|
||||
const type = url.host;
|
||||
const url = new URL(link);
|
||||
const id = url.pathname.replace("/", "").split("/").at(0);
|
||||
|
||||
this.openOneClickDownloadModelWindow(id, type);
|
||||
});
|
||||
}
|
||||
|
||||
private openOneClickDownloadModelWindow(id: string, type: string) {
|
||||
this.windows.openWindow("oneclick-download-model.html").then(window => {
|
||||
|
||||
this.ipc.once("one-click-model-info", (_, reply) => {
|
||||
reply(of({ id, type }));
|
||||
}, window.webContents.ipc);
|
||||
|
||||
this.windows.openWindow(`oneclick-download-model.html?modelId=${id}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,32 @@
|
||||
import path from "path";
|
||||
import { Observable, lastValueFrom, tap } from "rxjs";
|
||||
import { Observable, Subject, from, lastValueFrom, takeUntil, tap } from "rxjs";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { BSLocalVersionService } from "../bs-local-version.service";
|
||||
import { DeepLinkService } from "../deep-link.service";
|
||||
import { RequestService } from "../request.service";
|
||||
import { LocalMapsManagerService } from "./local-maps-manager.service";
|
||||
import { LocalMapsManagerService } from "./maps/local-maps-manager.service";
|
||||
import log from "electron-log";
|
||||
import { WindowManagerService } from "../window-manager.service";
|
||||
import { BPList, DownloadPlaylistProgressionData } from "shared/models/playlists/playlist.interface";
|
||||
import { readFileSync } from "fs";
|
||||
import { BPList, DownloadPlaylistProgressionData, PlaylistSong } from "shared/models/playlists/playlist.interface";
|
||||
import { readFileSync, Stats } from "fs";
|
||||
import { BeatSaverService } from "../thrid-party/beat-saver/beat-saver.service";
|
||||
import { copy, copyFile, pathExists, realpath } from "fs-extra";
|
||||
import { Progression, ensureFolderExist, pathExist } from "../../helpers/fs.helpers";
|
||||
import { IpcService } from "../ipc.service";
|
||||
import { copy, ensureDir, pathExists, pathExistsSync, realpath, writeFileSync } from "fs-extra";
|
||||
import { Progression, getUniqueFileNamePath, unlinkPath } from "../../helpers/fs.helpers";
|
||||
import { FileAssociationService } from "../file-association.service";
|
||||
import { SongDetailsCacheService } from "./maps/song-details-cache.service";
|
||||
import { sToMs } from "shared/helpers/time.helpers";
|
||||
import { LocalBPList, LocalBPListsDetails } from "shared/models/playlists/local-playlist.models";
|
||||
import { SongCacheService } from "./maps/song-cache.service";
|
||||
import { InstallationLocationService } from "../installation-location.service";
|
||||
import sanitize from "sanitize-filename";
|
||||
import { isValidUrl } from "shared/helpers/url.helpers";
|
||||
import { Archive } from "main/models/archive.class";
|
||||
import { CustomError } from "shared/models/exceptions/custom-error.class";
|
||||
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface";
|
||||
import { tryit } from "shared/helpers/error.helpers";
|
||||
import recursiveReadDir from "recursive-readdir";
|
||||
import { BsvMapDetail, SongDetails } from "shared/models/maps";
|
||||
import { findHashInString } from "shared/helpers/string.helpers";
|
||||
|
||||
export class LocalPlaylistsManagerService {
|
||||
private static instance: LocalPlaylistsManagerService;
|
||||
@@ -33,91 +47,283 @@ export class LocalPlaylistsManagerService {
|
||||
private readonly maps: LocalMapsManagerService;
|
||||
private readonly request: RequestService;
|
||||
private readonly deepLink: DeepLinkService;
|
||||
private readonly fileAssociation: FileAssociationService;
|
||||
private readonly windows: WindowManagerService;
|
||||
private readonly bsaver: BeatSaverService;
|
||||
private readonly ipc: IpcService;
|
||||
private readonly songDetails: SongDetailsCacheService;
|
||||
private readonly songCache: SongCacheService;
|
||||
private readonly bsmFs: InstallationLocationService;
|
||||
|
||||
private constructor() {
|
||||
this.maps = LocalMapsManagerService.getInstance();
|
||||
this.versions = BSLocalVersionService.getInstance();
|
||||
this.request = RequestService.getInstance();
|
||||
this.deepLink = DeepLinkService.getInstance();
|
||||
this.fileAssociation = FileAssociationService.getInstance();
|
||||
this.windows = WindowManagerService.getInstance();
|
||||
this.bsaver = BeatSaverService.getInstance();
|
||||
this.ipc = IpcService.getInstance();
|
||||
this.songDetails = SongDetailsCacheService.getInstance();
|
||||
this.songCache = SongCacheService.getInstance();
|
||||
this.bsmFs = InstallationLocationService.getInstance();
|
||||
|
||||
|
||||
this.deepLink.addLinkOpenedListener(this.DEEP_LINKS.BeatSaver, link => {
|
||||
log.info("DEEP-LINK RECEIVED FROM", this.DEEP_LINKS.BeatSaver, link);
|
||||
const url = new URL(link);
|
||||
const bplistUrl = url.host === "playlist" ? url.pathname.replace("/", "") : "";
|
||||
this.openOneClickDownloadPlaylistWindow(bplistUrl);
|
||||
this.windows.openWindow(`oneclick-download-playlist.html?playlistUrl=${bplistUrl}`);
|
||||
});
|
||||
|
||||
this.fileAssociation.registerFileAssociation(".bplist", filePath => {
|
||||
log.info("FILE ASSOCIATION RECEIVED", filePath);
|
||||
this.openOneClickDownloadPlaylistWindow(filePath);
|
||||
});
|
||||
}
|
||||
|
||||
private async getPlaylistsFolder(version?: BSVersion) {
|
||||
if (!version) {
|
||||
throw "Playlists are not available to be linked yet";
|
||||
}
|
||||
const rootPath = version ? await this.versions.getVersionPath(version) : this.bsmFs.sharedContentPath();
|
||||
const fullPath = path.join(rootPath, this.PLAYLISTS_FOLDER);
|
||||
|
||||
const versionFolder = await this.versions.getVersionPath(version);
|
||||
await ensureDir(fullPath);
|
||||
|
||||
const folder = path.join(versionFolder, this.PLAYLISTS_FOLDER);
|
||||
|
||||
await ensureFolderExist(folder);
|
||||
|
||||
return folder;
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
private async installBPListFile(bslistSource: string, version: BSVersion): Promise<string> {
|
||||
const playlistFolder = await this.getPlaylistsFolder(version);
|
||||
const isLocalFile = await pathExists(bslistSource).catch(e => { log.error(e); return false; });
|
||||
const filename = isLocalFile ? path.basename(bslistSource) : new URL(bslistSource).pathname.split('/').pop()
|
||||
const destFile = path.join(playlistFolder, filename);
|
||||
public writeBPListFile(opt: { bpList: BPList, version?: BSVersion, dest?: string }): Observable<LocalBPList> {
|
||||
return new Observable<LocalBPList>(obs => {
|
||||
(async () => {
|
||||
const dest = await (async () => {
|
||||
if(opt.dest && path.isAbsolute(opt.dest) && path.extname(opt.dest) === ".bplist") { return opt.dest; }
|
||||
const playlistFolder = await this.getPlaylistsFolder(opt.version);
|
||||
const playlistPath = path.join(playlistFolder, `${sanitize(opt.bpList.playlistTitle)}.bplist`);
|
||||
return getUniqueFileNamePath(playlistPath);
|
||||
})();
|
||||
|
||||
if (isLocalFile) {
|
||||
return copyFile(bslistSource, destFile).then(() => destFile);
|
||||
}
|
||||
return lastValueFrom(this.request.downloadFile(bslistSource, destFile)).then(res => res.data);
|
||||
writeFileSync(dest, JSON.stringify(opt.bpList, null, 2));
|
||||
|
||||
const localBPList: LocalBPList = { ...opt.bpList, path: dest };
|
||||
|
||||
obs.next(localBPList);
|
||||
})()
|
||||
.catch(err => obs.error(err))
|
||||
.finally(() => obs.complete());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private async readPlaylistFile(path: string): Promise<BPList> {
|
||||
if (!(await pathExist(path))) {
|
||||
throw `bplist file not exist at ${path}`;
|
||||
private async installBPListFile(opt: {
|
||||
bslistSource: string,
|
||||
version?: BSVersion,
|
||||
dest?: string
|
||||
}): Promise<{path: string, localBPList: LocalBPList}> {
|
||||
const bplist = await this.readPlaylistFromSource(opt.bslistSource);
|
||||
|
||||
const dest = await (async () => {
|
||||
if(opt.dest && path.isAbsolute(opt.dest) && path.extname(opt.dest) === ".bplist") { return opt.dest; }
|
||||
const playlistFolder = await this.getPlaylistsFolder(opt.version);
|
||||
return path.join(playlistFolder, `${sanitize(bplist.playlistTitle)}.bplist`);
|
||||
})();
|
||||
|
||||
writeFileSync(dest, JSON.stringify(bplist, null, 2));
|
||||
|
||||
const localBPList: LocalBPList = { ...bplist, path: dest };
|
||||
|
||||
return { path: dest, localBPList };
|
||||
}
|
||||
|
||||
|
||||
private async readPlaylistFromSource(source: string): Promise<BPList> {
|
||||
const isLocalFile = await pathExists(source).catch(e => { log.error(e); return false; });
|
||||
|
||||
if(!isLocalFile && !isValidUrl(source)) {
|
||||
throw new Error(`Invalid source ${source}`);
|
||||
}
|
||||
|
||||
const rawContent = readFileSync(path).toString();
|
||||
const bpList: BPList = isLocalFile ? JSON.parse(readFileSync(source).toString()) : await this.request.getJSON<BPList>(source);
|
||||
|
||||
return JSON.parse(rawContent);
|
||||
if(!bpList?.playlistTitle) {
|
||||
throw new Error(`Invalid playlist file ${source}`);
|
||||
}
|
||||
|
||||
bpList.songs = (bpList.songs ?? []).map(s => s.hash ? (
|
||||
{ ...s, hash: findHashInString(s.hash) ?? s.hash }
|
||||
) : s).filter(Boolean);
|
||||
|
||||
return bpList;
|
||||
}
|
||||
|
||||
private openOneClickDownloadPlaylistWindow(downloadUrl: string): void {
|
||||
this.windows.openWindow(`oneclick-download-playlist.html?playlistUrl=${downloadUrl}`);
|
||||
}
|
||||
|
||||
public downloadPlaylist(bpListUrl: string, version: BSVersion): Observable<Progression<DownloadPlaylistProgressionData>> {
|
||||
private getLocalBPListsOfFolder(folerPath: string): Observable<Progression<LocalBPList[]>> {
|
||||
return new Observable<Progression<LocalBPList[]>>(obs => {
|
||||
|
||||
const progress: Progression<LocalBPList[]> = { current: 0, total: 0, data: [] };
|
||||
const bpLists: LocalBPList[] = [];
|
||||
|
||||
(async () => {
|
||||
|
||||
if(!pathExistsSync(folerPath)) {
|
||||
throw new Error(`Playlists folder not found ${folerPath}`);
|
||||
}
|
||||
|
||||
const ignoreFunc = (file: string, stats: Stats): boolean => {
|
||||
if(stats.isFile() && path.extname(file) !== ".bplist") { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
const playlistPaths = (await recursiveReadDir(folerPath, [ignoreFunc]));
|
||||
|
||||
progress.total = playlistPaths.length;
|
||||
|
||||
for (const playlistPath of playlistPaths) {
|
||||
const {result: bpList, error} = await tryit(() => this.readPlaylistFromSource(playlistPath));
|
||||
|
||||
if(error) {
|
||||
log.error(error);
|
||||
continue;
|
||||
}
|
||||
|
||||
const localBpList: LocalBPList = { ...bpList, path: playlistPath };
|
||||
bpLists.push(localBpList);
|
||||
progress.current += 1;
|
||||
obs.next(progress);
|
||||
}
|
||||
|
||||
progress.data = bpLists;
|
||||
obs.next(progress);
|
||||
})().catch(err => obs.error(err)).finally(() => obs.complete());
|
||||
});
|
||||
}
|
||||
|
||||
private getSongDetailsFromPlaylistSong(song: PlaylistSong): SongDetails | undefined {
|
||||
let songDetails: SongDetails;
|
||||
|
||||
const songHash = findHashInString(song.hash);
|
||||
if(songHash){
|
||||
songDetails = this.songDetails.getSongDetails(song.hash);
|
||||
}
|
||||
|
||||
if(song.key && !songDetails){
|
||||
songDetails = this.songDetails.getSongDetailsById(song.key);
|
||||
}
|
||||
|
||||
const levelIdHash = findHashInString(song.levelid);
|
||||
if(levelIdHash && !songDetails){
|
||||
songDetails = this.songDetails.getSongDetails(levelIdHash);
|
||||
}
|
||||
return songDetails;
|
||||
}
|
||||
|
||||
public getLocalBPListDetails(localBPList: LocalBPList): LocalBPListsDetails {
|
||||
|
||||
const tryExtractPlaylistId = (url: string) => {
|
||||
const regex = /\/id\/(\d+)\/download/;
|
||||
const match = regex.exec(url);
|
||||
return match ? Number(match[1]) : undefined;
|
||||
}
|
||||
|
||||
const bpListDetails: LocalBPListsDetails = {
|
||||
...localBPList,
|
||||
duration: 0,
|
||||
nbMaps: localBPList.songs?.length ?? 0,
|
||||
id: localBPList.customData?.syncURL ? tryExtractPlaylistId(localBPList.customData.syncURL) : undefined
|
||||
}
|
||||
|
||||
const mappers = new Set<number>();
|
||||
|
||||
for(const song of localBPList.songs){
|
||||
const songDetails = this.getSongDetailsFromPlaylistSong(song);
|
||||
|
||||
if(!songDetails) { continue; }
|
||||
|
||||
bpListDetails.duration += songDetails?.duration ? +songDetails.duration : 0;
|
||||
mappers.add(songDetails.uploader?.id);
|
||||
bpListDetails.minNps = Math.min(bpListDetails?.minNps ?? 0, Math.min(...songDetails.difficulties?.map(d => d?.nps || 0) ?? [0]));
|
||||
bpListDetails.maxNps = Math.max(bpListDetails?.maxNps ?? 0, Math.max(...songDetails.difficulties?.map(d => d?.nps || 0) ?? [0]));
|
||||
|
||||
song.songDetails = songDetails;
|
||||
}
|
||||
|
||||
bpListDetails.nbMappers = mappers.size;
|
||||
|
||||
return bpListDetails;
|
||||
}
|
||||
|
||||
public getVersionPlaylistsDetails(version: BSVersion): Observable<Progression<LocalBPListsDetails[]>> {
|
||||
|
||||
return new Observable<Progression<LocalBPListsDetails[]>>(obs => {
|
||||
(async () => {
|
||||
|
||||
const folder = await this.getPlaylistsFolder(version);
|
||||
const progress$ = this.getLocalBPListsOfFolder(folder);
|
||||
|
||||
const localBPListsRes = (await lastValueFrom(progress$.pipe(tap({ next: progress => obs.next({...progress, data: []}) }))));
|
||||
|
||||
await this.songDetails.waitLoaded(sToMs(15));
|
||||
|
||||
const bpListsDetails: LocalBPListsDetails[] = [];
|
||||
for(const bpList of localBPListsRes.data){
|
||||
bpListsDetails.push(this.getLocalBPListDetails(bpList));
|
||||
}
|
||||
|
||||
obs.next({...localBPListsRes, data: bpListsDetails});
|
||||
|
||||
})().catch(err => obs.error(err))
|
||||
.finally(() => obs.complete());
|
||||
});
|
||||
}
|
||||
|
||||
public downloadPlaylistSongs(localBPList: LocalBPList, ignoreSongsHashs: string[], version: BSVersion): Observable<Progression<DownloadPlaylistProgressionData>> {
|
||||
|
||||
let destroyed = false;
|
||||
|
||||
return new Observable<Progression<DownloadPlaylistProgressionData>>(obs => {
|
||||
(async () => {
|
||||
|
||||
const bpListFilePath = await this.installBPListFile(bpListUrl, version);
|
||||
const bpList = await this.readPlaylistFile(bpListFilePath);
|
||||
|
||||
const progress: Progression<DownloadPlaylistProgressionData> = {
|
||||
total: bpList.songs.length,
|
||||
const progress: Progression<DownloadPlaylistProgressionData> = {
|
||||
total: localBPList.songs.length,
|
||||
current: 0,
|
||||
data: {
|
||||
downloadedMaps: [],
|
||||
currentDownload: null,
|
||||
playlistInfos: bpList,
|
||||
playlistPath: bpListFilePath,
|
||||
playlist: this.getLocalBPListDetails(localBPList),
|
||||
}
|
||||
};
|
||||
|
||||
obs.next(progress);
|
||||
|
||||
for (const song of bpList.songs) {
|
||||
const [ mapDetail ] = await this.bsaver.getMapDetailsFromHashs([song.hash]);
|
||||
for (const song of localBPList.songs) {
|
||||
|
||||
if(destroyed) { break; }
|
||||
|
||||
if(ignoreSongsHashs.includes(song.hash)) {
|
||||
progress.current += 1;
|
||||
obs.next(progress);
|
||||
continue;
|
||||
}
|
||||
|
||||
const mapDetail = await (async () => {
|
||||
let mapDetail: BsvMapDetail;
|
||||
|
||||
const mapHash = findHashInString(song?.hash);
|
||||
if(mapHash) {
|
||||
mapDetail = (await this.bsaver.getMapDetailsFromHashs([findHashInString(mapHash)])).at(0);
|
||||
}
|
||||
|
||||
if(song.key && !mapDetail) {
|
||||
mapDetail = await this.bsaver.getMapDetailsById(song.key);
|
||||
}
|
||||
|
||||
const levelIdHash = findHashInString(song?.levelid);
|
||||
if(levelIdHash && !mapDetail) {
|
||||
mapDetail = (await this.bsaver.getMapDetailsFromHashs([levelIdHash])).at(0);
|
||||
}
|
||||
|
||||
return mapDetail;
|
||||
})().catch(e => {
|
||||
log.error(e);
|
||||
return undefined as BsvMapDetail;
|
||||
});
|
||||
|
||||
if(!mapDetail) {
|
||||
continue;
|
||||
@@ -134,29 +340,113 @@ export class LocalPlaylistsManagerService {
|
||||
})()
|
||||
.catch(err => obs.error(err))
|
||||
.finally(() => obs.complete());
|
||||
|
||||
return () => {
|
||||
destroyed = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public downloadPlaylist({ bpListUrl, version, ignoreSongsHashs = [], dest }: {
|
||||
bpListUrl: string,
|
||||
version?: BSVersion
|
||||
ignoreSongsHashs?: string[]
|
||||
dest?: string
|
||||
}): Observable<Progression<DownloadPlaylistProgressionData>> {
|
||||
|
||||
const destroyed$ = new Subject<void>()
|
||||
|
||||
return new Observable<Progression<DownloadPlaylistProgressionData>>(obs => {
|
||||
(async () => {
|
||||
|
||||
const { localBPList } = await this.installBPListFile({ bslistSource: bpListUrl, version, dest });
|
||||
|
||||
await lastValueFrom(this.downloadPlaylistSongs(localBPList, ignoreSongsHashs, version).pipe(
|
||||
tap({ next: p => obs.next(p) }),
|
||||
takeUntil(destroyed$),
|
||||
));
|
||||
|
||||
})()
|
||||
.catch(err => obs.error(err))
|
||||
.finally(() => obs.complete());
|
||||
|
||||
return () => {
|
||||
destroyed$.next();
|
||||
destroyed$.complete();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public deletePlaylistFile(bpList: LocalBPList): Observable<void>{
|
||||
return from(unlinkPath(bpList.path));
|
||||
}
|
||||
|
||||
public exportPlaylists(opt: {version?: BSVersion, bpLists: LocalBPList[], dest: string, playlistsMaps?: BsmLocalMap[]}): Observable<Progression<string>> {
|
||||
|
||||
if(!pathExistsSync(opt.dest)) {
|
||||
throw new CustomError(`Destination folder not found ${opt.dest}`, "DEST_ENOENT");
|
||||
}
|
||||
|
||||
if(opt.bpLists?.length === 0) {
|
||||
throw new CustomError("No playlists to export", "NO_PLAYLISTS");
|
||||
}
|
||||
|
||||
const versionName = opt.version ? opt.version.name ?? opt.version.BSVersion : "Shared";
|
||||
const destName = opt.version ? `${versionName} Playlists` : "Playlists";
|
||||
const zipDest = path.join(opt.dest, `${destName}.zip`);
|
||||
|
||||
const archive = new Archive(zipDest)
|
||||
|
||||
for(const bpList of opt.bpLists) {
|
||||
|
||||
if(!pathExistsSync(bpList.path)) {
|
||||
log.warn(`Playlist file not found for export`, bpList.path);
|
||||
continue;
|
||||
}
|
||||
|
||||
archive.addFile(bpList.path, path.join(this.PLAYLISTS_FOLDER, path.basename(bpList.path)));
|
||||
}
|
||||
|
||||
if(!Array.isArray(opt.playlistsMaps) || opt.playlistsMaps.length === 0){
|
||||
return archive.finalize();
|
||||
}
|
||||
|
||||
for(const map of opt.playlistsMaps) {
|
||||
|
||||
if(!map?.path || !pathExistsSync(map.path)) {
|
||||
log.warn(`Map file not found for playlist export`, map?.path);
|
||||
continue;
|
||||
}
|
||||
|
||||
archive.addDirectory(
|
||||
map.path,
|
||||
path.join("Maps", path.basename(map.path)) // Dont't know why, but "CustomLevels" not work
|
||||
);
|
||||
}
|
||||
|
||||
return archive.finalize();
|
||||
}
|
||||
|
||||
public oneClickInstallPlaylist(bpListUrl: string): Observable<Progression<DownloadPlaylistProgressionData>> {
|
||||
|
||||
return new Observable<Progression<DownloadPlaylistProgressionData>>(obs => {
|
||||
(async () => {
|
||||
const versions = await this.versions.getInstalledVersions();
|
||||
|
||||
const download$ = this.downloadPlaylist(bpListUrl, versions.pop()).pipe(tap({
|
||||
const download$ = this.downloadPlaylist({ bpListUrl, version: versions.pop() }).pipe(tap({
|
||||
next: progress => obs.next(progress),
|
||||
error: err => obs.error(err),
|
||||
}));
|
||||
|
||||
const { data: {downloadedMaps, playlistPath} } = await lastValueFrom(download$);
|
||||
const { data: {downloadedMaps, playlist} } = await lastValueFrom(download$);
|
||||
|
||||
if(downloadedMaps?.length === 0 || !playlistPath) { return; }
|
||||
if(downloadedMaps?.length === 0 || !playlist.path) { return; }
|
||||
|
||||
const realSourceMapsFolder = await realpath(path.dirname(downloadedMaps[0].path));
|
||||
|
||||
for (const version of versions) {
|
||||
await this.installBPListFile(playlistPath, version);
|
||||
await this.installBPListFile({ bslistSource: playlist.path, version});
|
||||
|
||||
const versionMapsFolder = await this.maps.getMapsFolderPath(version);
|
||||
const realDestMapsFolder = await realpath(versionMapsFolder).catch(e => {
|
||||
|
||||
@@ -2,26 +2,31 @@ import path from "path";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { BsvMapDetail, RawMapInfoData } from "shared/models/maps";
|
||||
import { BsmLocalMap, BsmLocalMapsProgress, DeleteMapsProgress } from "shared/models/maps/bsm-local-map.interface";
|
||||
import { BSLocalVersionService } from "../bs-local-version.service";
|
||||
import { InstallationLocationService } from "../installation-location.service";
|
||||
import { UtilsService } from "../utils.service";
|
||||
import { BSLocalVersionService } from "../../bs-local-version.service";
|
||||
import { InstallationLocationService } from "../../installation-location.service";
|
||||
import { UtilsService } from "../../utils.service";
|
||||
import crypto from "crypto";
|
||||
import { lstatSync } from "fs";
|
||||
import { copy, createReadStream, ensureDir, pathExists, realpath, unlink } from "fs-extra";
|
||||
import { copy, createReadStream, ensureDir, pathExists, pathExistsSync, realpath, unlink } from "fs-extra";
|
||||
import StreamZip from "node-stream-zip";
|
||||
import { RequestService } from "../request.service";
|
||||
import { RequestService } from "../../request.service";
|
||||
import sanitize from "sanitize-filename";
|
||||
import { DeepLinkService } from "../deep-link.service";
|
||||
import { DeepLinkService } from "../../deep-link.service";
|
||||
import log from "electron-log";
|
||||
import { WindowManagerService } from "../window-manager.service";
|
||||
import { Observable, lastValueFrom, of } from "rxjs";
|
||||
import { Archive } from "../../models/archive.class";
|
||||
import { deleteFolder, ensureFolderExist, getFilesInFolder, getFoldersInFolder, pathExist } from "../../helpers/fs.helpers";
|
||||
import { WindowManagerService } from "../../window-manager.service";
|
||||
import { Observable, lastValueFrom } from "rxjs";
|
||||
import { Archive } from "../../../models/archive.class";
|
||||
import { Progression, deleteFolder, ensureFolderExist, getFilesInFolder, getFoldersInFolder, pathExist } from "../../../helpers/fs.helpers";
|
||||
import { readFile } from "fs/promises";
|
||||
import { FolderLinkerService } from "../folder-linker.service";
|
||||
import { allSettled } from "../../../shared/helpers/promise.helpers";
|
||||
import { splitIntoChunk } from "../../../shared/helpers/array.helpers";
|
||||
import { IpcService } from "../ipc.service";
|
||||
import { FolderLinkerService } from "../../folder-linker.service";
|
||||
import { allSettled } from "../../../../shared/helpers/promise.helpers";
|
||||
import { splitIntoChunk } from "../../../../shared/helpers/array.helpers";
|
||||
import { SongDetailsCacheService } from "./song-details-cache.service";
|
||||
import { SongCacheService } from "./song-cache.service";
|
||||
import { IpcService } from "../../ipc.service";
|
||||
import { pathToFileURL } from "url";
|
||||
import { sToMs } from "../../../../shared/helpers/time.helpers";
|
||||
import { FieldRequired } from "shared/helpers/type.helpers";
|
||||
|
||||
export class LocalMapsManagerService {
|
||||
private static instance: LocalMapsManagerService;
|
||||
@@ -35,6 +40,7 @@ export class LocalMapsManagerService {
|
||||
|
||||
public static readonly LEVELS_ROOT_FOLDER = "Beat Saber_Data";
|
||||
public static readonly CUSTOM_LEVELS_FOLDER = "CustomLevels";
|
||||
public static readonly RELATIVE_MAPS_FOLDER = path.join(LocalMapsManagerService.LEVELS_ROOT_FOLDER, LocalMapsManagerService.CUSTOM_LEVELS_FOLDER);
|
||||
public static readonly SHARED_MAPS_FOLDER = "SharedMaps";
|
||||
|
||||
private readonly DEEP_LINKS = {
|
||||
@@ -48,8 +54,10 @@ export class LocalMapsManagerService {
|
||||
private readonly reqService: RequestService;
|
||||
private readonly deepLink: DeepLinkService;
|
||||
private readonly windows: WindowManagerService;
|
||||
private readonly linker: FolderLinkerService;
|
||||
private readonly songDetailsCache: SongDetailsCacheService;
|
||||
private readonly songCache: SongCacheService;
|
||||
private readonly ipc: IpcService;
|
||||
private readonly linker = FolderLinkerService.getInstance();
|
||||
|
||||
private constructor() {
|
||||
this.localVersion = BSLocalVersionService.getInstance();
|
||||
@@ -59,24 +67,30 @@ export class LocalMapsManagerService {
|
||||
this.deepLink = DeepLinkService.getInstance();
|
||||
this.windows = WindowManagerService.getInstance();
|
||||
this.linker = FolderLinkerService.getInstance();
|
||||
this.songDetailsCache = SongDetailsCacheService.getInstance();
|
||||
this.songCache = SongCacheService.getInstance();
|
||||
this.ipc = IpcService.getInstance();
|
||||
|
||||
const handleOneClick = (mapId: string, isHash = false) => {
|
||||
this.windows.openWindow(`oneclick-download-map.html?mapId=${mapId}&isHash=${isHash}`);
|
||||
}
|
||||
|
||||
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);
|
||||
handleOneClick(new URL(link).host);
|
||||
});
|
||||
|
||||
this.deepLink.addLinkOpenedListener(this.DEEP_LINKS.ScoreSaber, link => {
|
||||
log.info("DEEP-LINK RECEIVED FROM", this.DEEP_LINKS.ScoreSaber, link);
|
||||
this.openOneClickDownloadMapWindow(new URL(link).host, true);
|
||||
handleOneClick(new URL(link).host, true);
|
||||
});
|
||||
}
|
||||
|
||||
public async getMapsFolderPath(version?: BSVersion): Promise<string> {
|
||||
if (version) {
|
||||
return path.join(await this.localVersion.getVersionPath(version), LocalMapsManagerService.LEVELS_ROOT_FOLDER, LocalMapsManagerService.CUSTOM_LEVELS_FOLDER);
|
||||
return path.join(await this.localVersion.getVersionPath(version), LocalMapsManagerService.RELATIVE_MAPS_FOLDER);
|
||||
}
|
||||
const sharedMapsPath = path.join(await this.installLocation.sharedContentPath(), LocalMapsManagerService.SHARED_MAPS_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);
|
||||
}
|
||||
@@ -87,7 +101,7 @@ export class LocalMapsManagerService {
|
||||
const mapRawInfo: RawMapInfoData = JSON.parse(rawInfoString);
|
||||
const shasum = crypto.createHash("sha1");
|
||||
shasum.update(rawInfoString);
|
||||
|
||||
|
||||
const hashFile = (filePath: string): Promise<void> => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const stream = createReadStream(filePath);
|
||||
@@ -103,11 +117,24 @@ export class LocalMapsManagerService {
|
||||
await hashFile(diffFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return shasum.digest("hex");
|
||||
}
|
||||
|
||||
private async loadMapInfoFromPath(mapPath: string): Promise<BsmLocalMap> {
|
||||
public async loadMapInfoFromPath(mapPath: string): Promise<BsmLocalMap> {
|
||||
|
||||
const getUrlsAndReturn = (rawInfo: RawMapInfoData, hash: string, mapPath: string) => {
|
||||
const coverUrl = pathToFileURL(path.join(mapPath, rawInfo._coverImageFilename)).href;
|
||||
const songUrl = pathToFileURL(path.join(mapPath, rawInfo._songFilename)).href;
|
||||
return { rawInfo, coverUrl, songUrl, hash, path: mapPath, songDetails: this.songDetailsCache.getSongDetails(hash) } as BsmLocalMap;
|
||||
};
|
||||
|
||||
const cachedInfos = this.songCache.getMapInfoFromDirname(path.basename(mapPath));
|
||||
|
||||
if (cachedInfos) {
|
||||
return getUrlsAndReturn(cachedInfos.rawInfo, cachedInfos.hash, mapPath);
|
||||
}
|
||||
|
||||
const files = await getFilesInFolder(mapPath);
|
||||
const infoFile = files.find(file => path.basename(file).toLowerCase() === "info.dat");
|
||||
|
||||
@@ -116,14 +143,10 @@ export class LocalMapsManagerService {
|
||||
}
|
||||
|
||||
const rawInfoString = await readFile(infoFile, { encoding: "utf-8" });
|
||||
|
||||
const rawInfo: RawMapInfoData = JSON.parse(rawInfoString);
|
||||
const coverUrl = new URL(`file:///${path.join(mapPath, rawInfo._coverImageFilename)}`).href;
|
||||
const songUrl = new URL(`file:///${path.join(mapPath, rawInfo._songFilename)}`).href;
|
||||
|
||||
const hash = await this.computeMapHash(mapPath, rawInfoString);
|
||||
|
||||
return { rawInfo, coverUrl, songUrl, hash, path: mapPath };
|
||||
return getUrlsAndReturn(rawInfo, hash, mapPath);
|
||||
}
|
||||
|
||||
private async downloadMapZip(zipUrl: string): Promise<{ zip: StreamZip.StreamZipAsync; zipPath: string }> {
|
||||
@@ -132,24 +155,13 @@ export class LocalMapsManagerService {
|
||||
await ensureFolderExist(this.utils.getTempPath());
|
||||
const dest = path.join(tempPath, fileName);
|
||||
|
||||
|
||||
const zipPath = (await lastValueFrom(this.reqService.downloadFile(zipUrl, dest))).data;
|
||||
const zip = new StreamZip.async({ file: zipPath });
|
||||
|
||||
return { zip, zipPath };
|
||||
}
|
||||
|
||||
private openOneClickDownloadMapWindow(mapId: string, isHash = false): void {
|
||||
this.windows.openWindow("oneclick-download-map.html").then(window => {
|
||||
|
||||
this.ipc.once("one-click-map-info", async (_, reply) => {
|
||||
reply(of({ id: mapId, isHash }));
|
||||
}, window.webContents.ipc);
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public getMaps(version?: BSVersion): Observable<BsmLocalMapsProgress> {
|
||||
const progression: BsmLocalMapsProgress = {
|
||||
total: 0,
|
||||
@@ -159,6 +171,8 @@ export class LocalMapsManagerService {
|
||||
|
||||
return new Observable<BsmLocalMapsProgress>(observer => {
|
||||
(async () => {
|
||||
await this.songDetailsCache.waitLoaded(sToMs(30));
|
||||
|
||||
const levelsFolder = await this.getMapsFolderPath(version);
|
||||
|
||||
if(!(await pathExist(levelsFolder))) {
|
||||
@@ -180,6 +194,8 @@ export class LocalMapsManagerService {
|
||||
return null;
|
||||
}
|
||||
|
||||
this.songCache.setMapInfoFromDirname(path.basename(mapPath), { rawInfo: mapInfo.rawInfo, hash: mapInfo.hash });
|
||||
|
||||
progression.loaded++;
|
||||
observer.next(progression);
|
||||
return mapInfo;
|
||||
@@ -221,36 +237,83 @@ export class LocalMapsManagerService {
|
||||
return this.linker.unlinkFolder(versionMapsPath, { keepContents: keepMaps, intermediateFolder: LocalMapsManagerService.SHARED_MAPS_FOLDER });
|
||||
}
|
||||
|
||||
public deleteMaps(maps: BsmLocalMap[]): Observable<DeleteMapsProgress> {
|
||||
const mapsFolders = maps.map(map => map.path);
|
||||
const mapsHashsToDelete = maps.map(map => map.hash);
|
||||
|
||||
public deleteMaps(maps: FieldRequired<BsmLocalMap, "path">[]): Observable<DeleteMapsProgress> {
|
||||
return new Observable<DeleteMapsProgress>(observer => {
|
||||
const progress: DeleteMapsProgress = { total: maps.length, deleted: 0 };
|
||||
|
||||
(async () => {
|
||||
const progress: DeleteMapsProgress = { total: maps.length, deleted: 0 };
|
||||
try {
|
||||
for (const folder of mapsFolders) {
|
||||
const detail = await this.loadMapInfoFromPath(folder);
|
||||
if (!mapsHashsToDelete.includes(detail?.hash)) {
|
||||
continue;
|
||||
}
|
||||
await deleteFolder(folder);
|
||||
for (const map of maps) {
|
||||
const mapPath = map.path;
|
||||
|
||||
if (pathExistsSync(mapPath)) {
|
||||
await deleteFolder(mapPath);
|
||||
this.songCache.deleteMapInfoFromDirname(path.basename(mapPath));
|
||||
progress.deleted++;
|
||||
observer.next(progress);
|
||||
}
|
||||
} catch (e) {
|
||||
observer.error(e);
|
||||
|
||||
observer.next(progress);
|
||||
}
|
||||
observer.complete();
|
||||
})();
|
||||
})()
|
||||
.catch(e => observer.error(e))
|
||||
.finally(() => observer.complete());
|
||||
});
|
||||
}
|
||||
|
||||
public deleteMapsFromHashs(version: BSVersion, hashs: string[]): Observable<Progression> {
|
||||
return new Observable<Progression>(observer => {
|
||||
const progress: Progression = { total: hashs.length, current: 0 };
|
||||
|
||||
(async () => {
|
||||
const versionMapsPath = await this.getMapsFolderPath(version);
|
||||
const mapsPaths = await getFoldersInFolder(versionMapsPath);
|
||||
|
||||
for (const mapPath of mapsPaths) {
|
||||
const mapInfo = await this.loadMapInfoFromPath(mapPath);
|
||||
if (hashs.includes(mapInfo.hash)) {
|
||||
await deleteFolder(mapPath);
|
||||
this.songCache.deleteMapInfoFromDirname(path.basename(mapPath));
|
||||
progress.current++;
|
||||
}
|
||||
|
||||
observer.next(progress);
|
||||
}
|
||||
})()
|
||||
.catch(e => observer.error(e))
|
||||
.finally(() => observer.complete());
|
||||
});
|
||||
}
|
||||
|
||||
public async getMapInfoFromHash(hash: string, version?: BSVersion): Promise<BsmLocalMap> {
|
||||
const versionMapsPath = await this.getMapsFolderPath(version);
|
||||
const mapInfo = this.songCache.getMapInfoFromHash(hash);
|
||||
|
||||
const cachedMapPath = (versionMapsPath && mapInfo?.dirname) && path.join(versionMapsPath, mapInfo.dirname);
|
||||
|
||||
if(cachedMapPath && pathExistsSync(cachedMapPath)){
|
||||
return this.loadMapInfoFromPath(cachedMapPath);
|
||||
}
|
||||
|
||||
// if not in cache, search in the folder
|
||||
const mapsPaths = await getFoldersInFolder(versionMapsPath);
|
||||
|
||||
for (const mapPath of mapsPaths) {
|
||||
const mapInfo = await this.loadMapInfoFromPath(mapPath);
|
||||
if (mapInfo.hash === hash) {
|
||||
return mapInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public async downloadMap(map: BsvMapDetail, version?: BSVersion): Promise<BsmLocalMap> {
|
||||
if (!map.versions.at(0).hash) {
|
||||
throw "Cannot download map, no hash found";
|
||||
throw new Error("Cannot download map, no hash found");
|
||||
}
|
||||
|
||||
log.info("Downloading map", map.name, map.id);
|
||||
|
||||
const zipUrl = map.versions.at(0).downloadURL;
|
||||
const mapFolderName = sanitize(`${map.id}-${map.name}`);
|
||||
const mapsFolder = await this.getMapsFolderPath(version);
|
||||
@@ -261,7 +324,7 @@ export class LocalMapsManagerService {
|
||||
if(!exists){ return null; }
|
||||
return this.loadMapInfoFromPath(mapPath);
|
||||
}).catch(() => null);
|
||||
|
||||
|
||||
if(map.versions.every(version => version.hash === installedMap?.hash)) {
|
||||
return installedMap;
|
||||
}
|
||||
@@ -269,7 +332,7 @@ export class LocalMapsManagerService {
|
||||
const { zip, zipPath } = await this.downloadMapZip(zipUrl);
|
||||
|
||||
if (!zip) {
|
||||
throw `Cannot download ${zipUrl}`;
|
||||
throw new Error(`Cannot download ${zipUrl}`);
|
||||
}
|
||||
|
||||
await ensureFolderExist(mapPath);
|
||||
@@ -279,12 +342,14 @@ export class LocalMapsManagerService {
|
||||
await unlink(zipPath);
|
||||
|
||||
const localMap = await this.loadMapInfoFromPath(mapPath);
|
||||
localMap.bsaverInfo = map;
|
||||
localMap.songDetails = this.songDetailsCache.getSongDetails(localMap.hash);
|
||||
|
||||
this.ipc.send<{map: BsmLocalMap, version?: BSVersion}>("map-downloaded", this.windows.getWindows("index.html").at(0), { map: localMap, version });
|
||||
|
||||
return localMap;
|
||||
}
|
||||
|
||||
public async exportMaps(version: BSVersion, maps: BsmLocalMap[], outPath: string) {
|
||||
public async exportMaps(version: BSVersion, maps: BsmLocalMap[], outPath: string): Promise<Observable<Progression>> {
|
||||
const archive = new Archive(outPath);
|
||||
|
||||
if (!maps || maps.length === 0) {
|
||||
@@ -0,0 +1,47 @@
|
||||
import { CACHE_PATH } from "main/constants";
|
||||
import { JsonCache } from "main/models/json-cache.class";
|
||||
import path from "path";
|
||||
import { RawMapInfoData } from "shared/models/maps";
|
||||
|
||||
export class SongCacheService {
|
||||
|
||||
private static instance: SongCacheService;
|
||||
|
||||
public static getInstance(): SongCacheService {
|
||||
if (!SongCacheService.instance) {
|
||||
SongCacheService.instance = new SongCacheService();
|
||||
}
|
||||
return SongCacheService.instance;
|
||||
}
|
||||
|
||||
private readonly RAW_INFOS_CACHE_PATH = path.join(CACHE_PATH, "song-raw-info-cache.json");
|
||||
|
||||
private readonly rawInfosCache: JsonCache<CachedRawInfoWithHash>;
|
||||
|
||||
private constructor(){
|
||||
this.rawInfosCache = new JsonCache(this.RAW_INFOS_CACHE_PATH);
|
||||
}
|
||||
|
||||
public getMapInfoFromDirname(dirname: string): CachedRawInfoWithHash {
|
||||
return this.rawInfosCache.get(dirname);
|
||||
}
|
||||
|
||||
public getMapInfoFromHash(hash: string): { dirname: string, info: CachedRawInfoWithHash } | undefined {
|
||||
const res = Object.entries(this.rawInfosCache.cache).find(([, info]) => info.hash === hash);
|
||||
return res ? { dirname: res[0], info: res[1] } : undefined;
|
||||
}
|
||||
|
||||
public setMapInfoFromDirname(dirname: string, info: CachedRawInfoWithHash): void {
|
||||
this.rawInfosCache.set(dirname, info);
|
||||
}
|
||||
|
||||
public deleteMapInfoFromDirname(dirname: string): void {
|
||||
this.rawInfosCache.delete(dirname);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export type CachedRawInfoWithHash = {
|
||||
hash: string;
|
||||
rawInfo: RawMapInfoData;
|
||||
};
|
||||
@@ -0,0 +1,190 @@
|
||||
import path from "path";
|
||||
import { ensureDirSync, existsSync, readFile, writeFile } from "fs-extra";
|
||||
import { BehaviorSubject, Observable, catchError, filter, lastValueFrom, of, take, timeout } from "rxjs";
|
||||
import { ConfigurationService } from "../../configuration.service";
|
||||
import { RequestService } from "../../request.service";
|
||||
import { tryit } from "shared/helpers/error.helpers";
|
||||
import { CACHE_PATH, HTTP_STATUS_CODES } from "main/constants";
|
||||
import log from "electron-log";
|
||||
import protobuf from "protobufjs";
|
||||
import { UtilsService } from "../../utils.service";
|
||||
import { SongDetails } from "shared/models/maps/song-details-cache/song-details-cache.model";
|
||||
import { inflate } from "pako";
|
||||
import { RawSongDetailsCache } from "shared/models/maps/song-details-cache/raw-song-details-cache.model";
|
||||
import { RawSongDetailsDeserializer } from "shared/models/maps/song-details-cache/raw-song-details-deserializer.class";
|
||||
|
||||
export class SongDetailsCacheService {
|
||||
|
||||
private static instance: SongDetailsCacheService;
|
||||
|
||||
public static getInstance(): SongDetailsCacheService {
|
||||
if (!SongDetailsCacheService.instance) {
|
||||
SongDetailsCacheService.instance = new SongDetailsCacheService();
|
||||
}
|
||||
return SongDetailsCacheService.instance;
|
||||
}
|
||||
|
||||
private readonly dataSource = [
|
||||
"https://raw.githubusercontent.com/Zagrios/beat-saber-scraped-maps/master/song_details_cache_v1.gz",
|
||||
"https://cdn.jsdelivr.net/gh/Zagrios/beat-saber-scraped-maps@master/song_details_cache_v1.gz",
|
||||
]
|
||||
|
||||
private readonly PROTO_CACHE_PATH = path.join(CACHE_PATH, "song-details-cache");
|
||||
private readonly etagKey = "song-details-cache-etag";
|
||||
|
||||
private readonly config: ConfigurationService;
|
||||
private readonly request: RequestService;
|
||||
private readonly utils: UtilsService;
|
||||
|
||||
private songDetailsCache: Record<string, SongDetails> = {};
|
||||
private songDetailsIdIndex: Record<string, SongDetails> = {};
|
||||
private readonly _loaded$ = new BehaviorSubject<boolean>(null);
|
||||
|
||||
private constructor(){
|
||||
this.config = ConfigurationService.getInstance();
|
||||
this.request = RequestService.getInstance();
|
||||
this.utils = UtilsService.getInstance();
|
||||
this.loadCache()
|
||||
}
|
||||
|
||||
private async loadCache(): Promise<void> {
|
||||
const protoCacheExists = existsSync(this.PROTO_CACHE_PATH);
|
||||
const etag = protoCacheExists ? this.config.get<string>(this.etagKey) : null;
|
||||
|
||||
await this.downloadCacheFile(etag).then(etag => {
|
||||
this.config.set(this.etagKey, etag);
|
||||
log.info("SongDetailsCache downloaded");
|
||||
this.songDetailsIdIndex = this.createIdIndex(this.songDetailsCache);
|
||||
log.info("SongDetailsIdIndex created");
|
||||
}).catch(err => {
|
||||
log.error("Unable to download cache file", err);
|
||||
});
|
||||
|
||||
this.readProtoMessageCacheFile(this.PROTO_CACHE_PATH).then(cache => {
|
||||
this.songDetailsCache = cache;
|
||||
log.info("SongDetailsCache loaded");
|
||||
}).catch(err => {
|
||||
log.error("Failed to read cache file", this.PROTO_CACHE_PATH, err);
|
||||
}).finally(() => {
|
||||
this._loaded$.next(true);
|
||||
})
|
||||
}
|
||||
|
||||
private createIdIndex(songDetailsCache: Record<string, SongDetails>): Record<string, SongDetails> {
|
||||
const res: Record<string, SongDetails> = {};
|
||||
// eslint-disable-next-line guard-for-in
|
||||
for(const hash in songDetailsCache){
|
||||
res[songDetailsCache[hash].id] = songDetailsCache[hash];
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private async readProtoMessageCacheFile(filePath: string): Promise<Record<string, SongDetails>> {
|
||||
const protobufRoot = protobuf.loadSync(this.getProtoShemaPath());
|
||||
const cacheMessage = protobufRoot.lookupType("SongDetailsCache");
|
||||
|
||||
const buffer = await readFile(filePath);
|
||||
|
||||
const messageBuffer = cacheMessage.decode(buffer);
|
||||
const messageObj = cacheMessage.toObject(messageBuffer) as RawSongDetailsCache;
|
||||
|
||||
const res: Record<string, SongDetails> = {};
|
||||
|
||||
RawSongDetailsDeserializer.setUploadersList(messageObj.uploaders);
|
||||
RawSongDetailsDeserializer.setDifficultyLabels(messageObj.difficultyLabels);
|
||||
|
||||
for(const rawSong of messageObj.songs){
|
||||
const deserialized = RawSongDetailsDeserializer.deserialize(rawSong);
|
||||
res[deserialized.hash.toLowerCase()] = deserialized;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the GZipped Proto file and write it to the cache destination
|
||||
* @param etag
|
||||
* @returns {string} new etag or the same if the file is the same
|
||||
*/
|
||||
private async downloadCacheFile(etag?: string): Promise<string> {
|
||||
const { buffer, etag: newEtag } = await this.downloadGZCacheFile(etag);
|
||||
|
||||
if(!buffer) { return etag; }
|
||||
|
||||
ensureDirSync(path.dirname(this.PROTO_CACHE_PATH));
|
||||
|
||||
await writeFile(this.PROTO_CACHE_PATH, inflate(buffer), { encoding: "binary" });
|
||||
|
||||
return newEtag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the GZipped Proto file from the sources
|
||||
* @returns {Promise<{ buffer: Buffer, etag: string }>} {\
|
||||
* buffer: GZipper Buffer, will be empty if etag is the same\
|
||||
* etag: ETag of the file, should be never empty\
|
||||
* }
|
||||
*/
|
||||
private async downloadGZCacheFile(etag?: string): Promise<{ buffer: Buffer, etag: string }> {
|
||||
|
||||
let lastError: Error;
|
||||
|
||||
for(const sourceUrl of this.dataSource){
|
||||
|
||||
const { result, error } = await tryit(() => {
|
||||
return lastValueFrom(this.request.downloadBuffer(sourceUrl, {
|
||||
headers: etag ? { "If-None-Match": etag } : {},
|
||||
decompress: false
|
||||
})).then(res => ({ buffer: res.data, request: res.extra}));
|
||||
});
|
||||
|
||||
|
||||
if(error) {
|
||||
lastError = error;
|
||||
continue;
|
||||
}
|
||||
|
||||
log.info("Downloaded SongDetailCache file from source:", sourceUrl, "ETAG:", result.request.headers.etag, result.request.statusCode);
|
||||
|
||||
return {
|
||||
buffer: result.request.statusCode === HTTP_STATUS_CODES.HTTP_STATUS_NOT_MODIFIED ? null : result.buffer,
|
||||
etag: result.request.headers.etag
|
||||
}
|
||||
}
|
||||
|
||||
log.error("Failed to download SongDetailCache file", etag, lastError);
|
||||
throw lastError;
|
||||
}
|
||||
|
||||
private getProtoShemaPath(): string {
|
||||
return this.utils.getAssetsPath(path.join("proto", "song_details_cache_v1.proto"))
|
||||
}
|
||||
|
||||
public get loaded$(): Observable<boolean> {
|
||||
return this._loaded$.pipe(filter(val => typeof val === "boolean"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Promise that resolves when the cache is loaded (loaded does not mean cache contains data, just the all load process is done)
|
||||
* @param timeoutMs in milliseconds
|
||||
* @throws {TimeoutError} if the cache is not ready after the provided timeout
|
||||
*/
|
||||
public waitLoaded(timeoutMs: number): Promise<boolean> {
|
||||
|
||||
const obs = this.loaded$.pipe(take(1));
|
||||
|
||||
return lastValueFrom(obs.pipe(timeout(timeoutMs), catchError((err => {
|
||||
log.error("Wait loaded SongDetailsCache timed out", err);
|
||||
return of(false);
|
||||
}))));
|
||||
}
|
||||
|
||||
public getSongDetails(hash: string): SongDetails | undefined {
|
||||
return this.songDetailsCache[hash.toLowerCase()];
|
||||
}
|
||||
|
||||
public getSongDetailsById(id: string): SongDetails | undefined {
|
||||
return this.songDetailsIdIndex[id.toLowerCase()];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { BSLocalVersionService } from "../bs-local-version.service";
|
||||
import { ChildProcessWithoutNullStreams, SpawnOptionsWithoutStdio, spawn } from "child_process";
|
||||
import path from "path";
|
||||
import log from "electron-log";
|
||||
import { sToMs } from "../../../shared/helpers/time.helpers";
|
||||
|
||||
export abstract class AbstractLauncherService {
|
||||
|
||||
@@ -46,20 +47,47 @@ export abstract class AbstractLauncherService {
|
||||
|
||||
}
|
||||
|
||||
protected launchBs(bsExePath: string, args: string[], options?: SpawnOptionsWithoutStdio): {process: ChildProcessWithoutNullStreams, exit: Promise<number>} {
|
||||
protected launchBs(bsExePath: string, args: string[], options?: SpawnBsProcessOptions): {process: ChildProcessWithoutNullStreams, exit: Promise<number>} {
|
||||
const process = this.launchBSProcess(bsExePath, args, options);
|
||||
|
||||
let timoutId: NodeJS.Timeout;
|
||||
|
||||
const exit = new Promise<number>((resolve, reject) => {
|
||||
// Don't remove, useful for debugging!
|
||||
// process.stdout.on("data", (data) => {
|
||||
// log.info(`BS stdout: ${data}`);
|
||||
// });
|
||||
// process.stderr.on("data", (data) => {
|
||||
// log.error(`BS stderr: ${data}`);
|
||||
// });
|
||||
|
||||
process.on("error", (err) => {
|
||||
log.error(`Error while launching BS`, err);
|
||||
reject(err);
|
||||
});
|
||||
|
||||
process.on("exit", (code) => {
|
||||
log.info(`BS process exit with code ${code}`);
|
||||
resolve(code);
|
||||
});
|
||||
|
||||
const unrefAfter = options?.unrefAfter ?? sToMs(10);
|
||||
|
||||
timoutId = setTimeout(() => {
|
||||
log.error("BS process unref after timeout", unrefAfter);
|
||||
process.unref();
|
||||
process.removeAllListeners();
|
||||
resolve(-1);
|
||||
}, unrefAfter);
|
||||
|
||||
}).finally(() => {
|
||||
clearTimeout(timoutId);
|
||||
});
|
||||
|
||||
return { process, exit };
|
||||
}
|
||||
}
|
||||
|
||||
export type SpawnBsProcessOptions = {
|
||||
unrefAfter?: number;
|
||||
} & SpawnOptionsWithoutStdio;
|
||||
|
||||
@@ -14,7 +14,7 @@ import { WindowManagerService } from "../window-manager.service";
|
||||
import { IpcService } from "../ipc.service";
|
||||
import { BSVersionLibService } from "../bs-version-lib.service";
|
||||
import { execOnOs } from "../../helpers/env.helpers";
|
||||
import sharp from "sharp";
|
||||
import { Resvg } from "@resvg/resvg-js";
|
||||
import { StoreLauncherInterface } from "./store-launcher.interface";
|
||||
import { SteamLauncherService } from "./steam-launcher.service";
|
||||
import { OculusLauncherService } from "./oculus-launcher.service";
|
||||
@@ -127,22 +127,24 @@ export class BSLauncherService {
|
||||
return res;
|
||||
}
|
||||
|
||||
private createShortcutPngBuffer(color: Color): Promise<Buffer>{
|
||||
|
||||
const svgBuffer = Buffer.from(`
|
||||
private createShortcutPngBuffer(color: Color): Buffer{
|
||||
|
||||
const svg = `
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 406.4 406.4" height="406.4" width="406.4">
|
||||
<rect rx="69.453" height="406.4" width="406.4" fill="${color.hex()}"/>
|
||||
<path d="M65.467 60.6H336.4v33.867L200.933 162.2 65.467 94.467z" fill="#fff"/>
|
||||
</svg>
|
||||
`);
|
||||
`;
|
||||
|
||||
return sharp(svgBuffer).resize(256).png().toBuffer();
|
||||
return new Resvg(svg, {
|
||||
fitTo: { mode: "width", value: 256 }
|
||||
}).render().asPng();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create .png file for the shortcut with the given color
|
||||
* @param {Color} color
|
||||
* @returns {Promise<string>} Path of the icon
|
||||
* @param {Color} color
|
||||
* @returns {Promise<string>} Path of the icon
|
||||
*/
|
||||
private async createShortcutPng(color: Color): Promise<string>{
|
||||
const pngBuffer = this.createShortcutPngBuffer(color);
|
||||
@@ -211,25 +213,25 @@ export class BSLauncherService {
|
||||
const bsPath: string = await (async () => {
|
||||
const bsPath = await this.localVersionService.getInstalledVersionPath(launchOption.version);
|
||||
return bsPath ?? this.localVersionService.getVersionPath(launchOption.version);
|
||||
})().catch(e => {
|
||||
log.error(e);
|
||||
})().catch(e => {
|
||||
log.error(e);
|
||||
return null;
|
||||
});
|
||||
|
||||
launchOption.version = (await this.localVersionService.getVersionOfBSFolder(bsPath, {
|
||||
steam: launchOption.version.steam,
|
||||
oculus: launchOption.version.oculus,
|
||||
oculus: launchOption.version.oculus,
|
||||
})) ?? launchOption.version;
|
||||
|
||||
launchOption.version = {...(await this.remoteVersion.getVersionDetails(launchOption.version.BSVersion)), ...launchOption.version};
|
||||
|
||||
|
||||
this.ipc.once("shortcut-launch-options", (_data, reply) => {
|
||||
reply(of(launchOption));
|
||||
});
|
||||
|
||||
this.windows.openWindow("shortcut-launch.html");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
type ShortcutParams = {
|
||||
@@ -246,9 +248,9 @@ type ShortcutParams = {
|
||||
|
||||
/**
|
||||
* Create .desktop file for url shortcut (only for linux)
|
||||
* @param {string} shortcutPath
|
||||
* @param options
|
||||
* @returns
|
||||
* @param {string} shortcutPath
|
||||
* @param options
|
||||
* @returns
|
||||
*/
|
||||
function createDesktopUrlShortcut(shortcutPath: string, options?: {
|
||||
url: string
|
||||
|
||||
@@ -8,9 +8,9 @@ import { BS_APP_ID, BS_EXECUTABLE, STEAMVR_APP_ID } from "../../constants";
|
||||
import log from "electron-log";
|
||||
import { AbstractLauncherService } from "./abstract-launcher.service";
|
||||
import { CustomError } from "../../../shared/models/exceptions/custom-error.class";
|
||||
import isElevated from "is-elevated";
|
||||
import { UtilsService } from "../utils.service";
|
||||
import { exec } from "child_process";
|
||||
import fs from 'fs';
|
||||
|
||||
export class SteamLauncherService extends AbstractLauncherService implements StoreLauncherInterface{
|
||||
|
||||
@@ -46,13 +46,6 @@ export class SteamLauncherService extends AbstractLauncherService implements Sto
|
||||
});
|
||||
}
|
||||
|
||||
private needStartBsAsAdmin(): Promise<boolean> {
|
||||
return isElevated().then(elevated => {
|
||||
if(elevated){ return false; }
|
||||
return this.steam.isElevated();
|
||||
})
|
||||
}
|
||||
|
||||
private getStartBsAsAdminExePath(): string {
|
||||
return path.join(this.util.getAssetsScriptsPath(), "start_beat_saber_admin.exe");
|
||||
}
|
||||
@@ -75,7 +68,7 @@ export class SteamLauncherService extends AbstractLauncherService implements Sto
|
||||
return new Observable<BSLaunchEventData>(obs => {(async () => {
|
||||
|
||||
const bsFolderPath = await this.localVersions.getInstalledVersionPath(launchOptions.version);
|
||||
const exePath = path.join(bsFolderPath, BS_EXECUTABLE);
|
||||
let exePath = path.join(bsFolderPath, BS_EXECUTABLE);
|
||||
|
||||
if(!(await pathExists(exePath))){
|
||||
throw CustomError.fromError(new Error(`Path not exist : ${exePath}`), BSLaunchError.BS_NOT_FOUND);
|
||||
@@ -102,15 +95,66 @@ export class SteamLauncherService extends AbstractLauncherService implements Sto
|
||||
await this.restoreSteamVR().catch(log.error);
|
||||
}
|
||||
|
||||
const launchArgs = this.buildBsLaunchArgs(launchOptions);
|
||||
let launchArgs = this.buildBsLaunchArgs(launchOptions);
|
||||
const steamPath = await this.steam.getSteamPath();
|
||||
|
||||
const env = {
|
||||
...process.env,
|
||||
"SteamAppId": BS_APP_ID,
|
||||
"SteamOverlayGameId": BS_APP_ID,
|
||||
"SteamGameId": BS_APP_ID,
|
||||
};
|
||||
|
||||
// Linux setup
|
||||
if (process.platform === "linux") {
|
||||
if (launchOptions.admin) {
|
||||
log.warn("Launching as admin is not supported on Linux! Starting the game as a normal user.");
|
||||
launchOptions.admin = false;
|
||||
}
|
||||
|
||||
// Create the compat data path if it doesn't exist.
|
||||
// If the user never ran Beat Saber through steam before
|
||||
// using bsmanager, it won't exist, and proton will fail
|
||||
// to launch the game.
|
||||
const compatDataPath = `${steamPath}/steamapps/compatdata/${BS_APP_ID}`;
|
||||
if (!fs.existsSync(compatDataPath)) {
|
||||
log.info(`Proton compat data path not found at '${compatDataPath}', creating directory`);
|
||||
fs.mkdirSync(compatDataPath);
|
||||
}
|
||||
|
||||
// proton run BeatSaber.exe
|
||||
launchArgs = [
|
||||
"run",
|
||||
`${exePath}`,
|
||||
...launchArgs,
|
||||
];
|
||||
exePath = launchOptions.protonPath;
|
||||
if (!exePath) {
|
||||
throw CustomError.fromError(new Error("Proton path not set"), BSLaunchError.PROTON_NOT_SET);
|
||||
}
|
||||
|
||||
// Setup Proton environment variables
|
||||
Object.assign(env, {
|
||||
"WINEDLLOVERRIDES": "winhttp=n,b", // Required for mods to work
|
||||
"STEAM_COMPAT_DATA_PATH": compatDataPath,
|
||||
"STEAM_COMPAT_INSTALL_PATH": bsFolderPath,
|
||||
"STEAM_COMPAT_CLIENT_INSTALL_PATH": steamPath,
|
||||
"STEAM_COMPAT_APP_ID": BS_APP_ID,
|
||||
// Uncomment these to create a proton log file in the Beat Saber install directory.
|
||||
// "PROTON_LOG": 1,
|
||||
// "PROTON_LOG_DIR": bsFolderPath,
|
||||
});
|
||||
}
|
||||
|
||||
obs.next({type: BSLaunchEvent.BS_LAUNCHING});
|
||||
|
||||
const spawnOpts = { env, cwd: bsFolderPath };
|
||||
|
||||
const launchPromise = !launchOptions.admin ? (
|
||||
this.launchBs(exePath, launchArgs, { env: {...process.env, "SteamAppId": BS_APP_ID} }).exit
|
||||
this.launchBs(exePath, launchArgs, spawnOpts).exit
|
||||
) : (
|
||||
new Promise<number>(resolve => {
|
||||
const adminProcess = exec(`"${this.getStartBsAsAdminExePath()}" "${exePath}" ${launchArgs.join(" ")}`, { env: {...process.env, "SteamAppId": BS_APP_ID} });
|
||||
const adminProcess = exec(`"${this.getStartBsAsAdminExePath()}" "${exePath}" ${launchArgs.join(" ")}`, spawnOpts);
|
||||
adminProcess.on("error", err => {
|
||||
log.error("Error while starting BS as Admin", err);
|
||||
resolve(-1)
|
||||
|
||||
@@ -92,7 +92,7 @@ export class BSLocalVersionService {
|
||||
}
|
||||
|
||||
public async getVersionOfBSFolder(
|
||||
bsPath: string,
|
||||
bsPath: string,
|
||||
options?: {
|
||||
steam?: boolean;
|
||||
oculus?: boolean;
|
||||
@@ -126,7 +126,7 @@ export class BSLocalVersionService {
|
||||
|
||||
// Will be removed in future version. It just to prepare future features
|
||||
if(!metadata?.id){
|
||||
metadata = await this.initVersionMetadata(folderVersion, metadata ?? { store: BsStore.STEAM });
|
||||
metadata = await this.initVersionMetadata(folderVersion, metadata ?? { store: BsStore.STEAM });
|
||||
}
|
||||
folderVersion.metadata = metadata;
|
||||
|
||||
@@ -182,8 +182,8 @@ export class BSLocalVersionService {
|
||||
|
||||
|
||||
/**
|
||||
* Return path of a version even if it's not installed.
|
||||
* @param {BSVersion} version
|
||||
* Return path of a version even if it's not installed.
|
||||
* @param {BSVersion} version
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
public async getVersionPath(version: BSVersion): Promise<string>{
|
||||
@@ -191,25 +191,25 @@ export class BSLocalVersionService {
|
||||
if(version.oculus){ return this.oculusService.tryGetGameFolder([OCULUS_BS_DIR, OCULUS_BS_BACKUP_DIR]); }
|
||||
|
||||
return path.join(
|
||||
await this.installLocationService.versionsDirectory(),
|
||||
this.installLocationService.versionsDirectory(),
|
||||
this.getVersionFolder(version)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return path of an installed version. Returns null if not found.
|
||||
* @param {BSVersion} version
|
||||
* @param {BSVersion} version
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
public async getInstalledVersionPath(version: BSVersion): Promise<string>{
|
||||
const versionPath = await this.getVersionPath(version);
|
||||
if(await pathExists(versionPath)){ return versionPath; }
|
||||
|
||||
const versionFolders = await getFoldersInFolder(await this.installLocationService.versionsDirectory());
|
||||
const versionFolders = await getFoldersInFolder(this.installLocationService.versionsDirectory());
|
||||
|
||||
for(const folder of versionFolders){
|
||||
const stats = await lstat(folder);
|
||||
if(stats.ino === version.ino){
|
||||
if(stats.ino === version.ino){
|
||||
return folder;
|
||||
}
|
||||
}
|
||||
@@ -270,11 +270,11 @@ export class BSLocalVersionService {
|
||||
versions.push(oculusVersion);
|
||||
}
|
||||
|
||||
if (!(await pathExists(await this.installLocationService.versionsDirectory()))) {
|
||||
if (!(await pathExists(this.installLocationService.versionsDirectory()))) {
|
||||
return versions;
|
||||
}
|
||||
|
||||
const folderInInstallation = await getFoldersInFolder(await this.installLocationService.versionsDirectory());
|
||||
const folderInInstallation = await getFoldersInFolder(this.installLocationService.versionsDirectory());
|
||||
|
||||
log.info("Finded versions folders", folderInInstallation);
|
||||
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import { BSVersion } from "../../../shared/bs-version.interface";
|
||||
import { WindowManagerService } from "../window-manager.service";
|
||||
import { minToMs, msToS } from "../../../shared/helpers/time.helpers";
|
||||
import log from "electron-log";
|
||||
import { CustomError } from "../../../shared/models/exceptions/custom-error.class";
|
||||
import { OculusDownloader } from "../../models/oculus-downloader.class";
|
||||
import { Cookie, session } from "electron";
|
||||
import { Progression, ensurePathNotAlreadyExist } from "../../helpers/fs.helpers";
|
||||
import { BSLocalVersionService } from "../bs-local-version.service";
|
||||
import { Observable, finalize, from, map, of, switchMap } from "rxjs";
|
||||
import { Observable, finalize, map, of, switchMap } from "rxjs";
|
||||
import path from "path";
|
||||
import { DownloadInfo } from "./bs-steam-downloader.service";
|
||||
import { BsStore } from "../../../shared/models/bs-store.enum";
|
||||
@@ -26,90 +22,19 @@ export class BsOculusDownloaderService {
|
||||
}
|
||||
|
||||
private readonly oculusDownloader: OculusDownloader;
|
||||
|
||||
private readonly windows: WindowManagerService;
|
||||
private readonly versions: BSLocalVersionService;
|
||||
|
||||
private constructor() {
|
||||
this.windows = WindowManagerService.getInstance();
|
||||
this.versions = BSLocalVersionService.getInstance();
|
||||
|
||||
this.oculusDownloader = new OculusDownloader();
|
||||
}
|
||||
|
||||
private isUserTokenValid(token: string): boolean{
|
||||
return isOculusTokenValid(token, log.info);
|
||||
}
|
||||
|
||||
private isCookieValid(cookie: Cookie): boolean {
|
||||
|
||||
if(!cookie){
|
||||
return false;
|
||||
}
|
||||
|
||||
return cookie.expirationDate > msToS(Date.now());
|
||||
}
|
||||
|
||||
public async getAuthToken(): Promise<string | undefined> {
|
||||
const cookie = await session.defaultSession.cookies.get({ name: "oc_www_at" }).then(a => a?.at(0));
|
||||
|
||||
if(this.isCookieValid(cookie) && this.isUserTokenValid(cookie.value)){
|
||||
return cookie.value;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private async getUserTokenFromMetaAuth(keepToken: boolean): Promise<string>{
|
||||
|
||||
const redirectUrl = "https://developer.oculus.com/manage/";
|
||||
const loginUrl = `https://auth.oculus.com/login/?redirect_uri=${encodeURIComponent(redirectUrl)}`;
|
||||
const window = await this.windows.openWindow(loginUrl, { frame: true, width: 650, height: 800 });
|
||||
|
||||
let timout: NodeJS.Timeout;
|
||||
|
||||
const promise = new Promise<string>((resolve, reject) => {
|
||||
timout = setTimeout(() => {
|
||||
reject(new CustomError("Trying to get Oculus user token timed out", "META_LOGIN_TIMED_OUT"));
|
||||
window.close();
|
||||
}, minToMs(5));
|
||||
|
||||
window.webContents.on("did-navigate", async (_, url) => {
|
||||
if(!url.startsWith(redirectUrl)){ return; }
|
||||
|
||||
const token = (await window.webContents.session.cookies.get({ name: "oc_www_at" })).at(0)?.value;
|
||||
|
||||
if(!this.isUserTokenValid(token)){
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(token);
|
||||
});
|
||||
|
||||
window.on("closed", () => {
|
||||
reject(new CustomError("Oculus login window closed by user", "META_LOGIN_WINDOW_CLOSED_BY_USER"));
|
||||
});
|
||||
}).finally(() => {
|
||||
|
||||
clearTimeout(timout);
|
||||
|
||||
if(!keepToken){
|
||||
this.clearAuthToken();
|
||||
}
|
||||
|
||||
if(!window.isDestroyed() && window.isClosable()){
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
private async createDownloadVersion(version: BSVersion): Promise<{version: BSVersion, dest: string}>{
|
||||
const dest = await ensurePathNotAlreadyExist(await this.versions.getVersionPath(version));
|
||||
return {
|
||||
version: {
|
||||
...version,
|
||||
...version,
|
||||
...(path.basename(dest) !== version.BSVersion && { name: path.basename(dest) }),
|
||||
metadata: { store: BsStore.OCULUS, id: "" }
|
||||
},
|
||||
@@ -125,9 +50,7 @@ export class BsOculusDownloaderService {
|
||||
|
||||
let downloadVersion: BSVersion
|
||||
|
||||
const tokenObs$ = downloadInfo.token ? of(downloadInfo.token) : from(this.getUserTokenFromMetaAuth(downloadInfo.stay));
|
||||
|
||||
return tokenObs$.pipe(
|
||||
return of(downloadInfo.token).pipe(
|
||||
switchMap(token => {
|
||||
isOculusTokenValid(token, log.info); // Log token validity
|
||||
if(!downloadInfo.isVerification){
|
||||
@@ -138,7 +61,7 @@ export class BsOculusDownloaderService {
|
||||
switchMap(({token, version, dest}) => {
|
||||
downloadVersion = version;
|
||||
return this.oculusDownloader.downloadApp({ accessToken: token, binaryId: version.OculusBinaryId, destination: dest }).pipe(map(
|
||||
progress => ({...progress, data: version})
|
||||
progress => ({...progress, data: version})
|
||||
));
|
||||
}),
|
||||
finalize(() => downloadVersion && this.versions.initVersionMetadata(downloadVersion, { store: BsStore.OCULUS })),
|
||||
@@ -146,43 +69,9 @@ export class BsOculusDownloaderService {
|
||||
);
|
||||
}
|
||||
|
||||
public autoDownloadVersion(downloadInfo: DownloadInfo): Observable<Progression<BSVersion>>{
|
||||
|
||||
let downloadVersion: BSVersion
|
||||
|
||||
const tokenObs$ = downloadInfo.token ? of(downloadInfo.token) : from(this.getAuthToken());
|
||||
|
||||
return tokenObs$.pipe(
|
||||
map(token => {
|
||||
if(!token){
|
||||
throw new CustomError("No Meta auth token was found in cookies for auto download", "NO_META_AUTH_TOKEN");
|
||||
}
|
||||
return token;
|
||||
}),
|
||||
switchMap(token => {
|
||||
if(!downloadInfo.isVerification){
|
||||
return this.createDownloadVersion(downloadInfo.bsVersion).then(({version, dest}) => ({token, version, dest}));
|
||||
}
|
||||
return this.versions.getVersionPath(downloadInfo.bsVersion).then(path => ({token, version: downloadInfo.bsVersion, dest: path}));
|
||||
}),
|
||||
switchMap(({token, version, dest}) => {
|
||||
downloadVersion = version;
|
||||
return this.oculusDownloader.downloadApp({ accessToken: token, binaryId: version.OculusBinaryId, destination: dest }).pipe(
|
||||
map(progress => ({...progress, data: version})),
|
||||
);
|
||||
}),
|
||||
finalize(() => downloadVersion && this.versions.initVersionMetadata(downloadVersion, { store: BsStore.OCULUS })),
|
||||
finalize(() => this.oculusDownloader.stopDownload()),
|
||||
);
|
||||
}
|
||||
|
||||
public clearAuthToken(): Promise<void>{
|
||||
return session.defaultSession.clearStorageData({ storages: ["cookies"], origin: ".oculus.com" })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export interface OculusDownloadInfo {
|
||||
version: BSVersion;
|
||||
stay?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { BS_APP_ID, BS_DEPOT } from "../../constants";
|
||||
import path from "path";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { UtilsService } from "../utils.service";
|
||||
import { spawnSync } from "child_process";
|
||||
import log from "electron-log";
|
||||
import { InstallationLocationService } from "../installation-location.service";
|
||||
import { BSLocalVersionService } from "../bs-local-version.service";
|
||||
@@ -41,23 +40,7 @@ export class BsSteamDownloaderService {
|
||||
}
|
||||
|
||||
private getDepotDownloaderExePath(): string {
|
||||
return path.join(this.utils.getAssetsScriptsPath(), "depot-downloader", `DepotDownloader.${process.platform === 'linux' ? 'dll' : 'exe'}`);
|
||||
}
|
||||
|
||||
public async isDotNet6Installed(): Promise<boolean> {
|
||||
try {
|
||||
const proc = process.platform === 'linux'
|
||||
? spawnSync('dotnet', [this.getDepotDownloaderExePath()])
|
||||
: spawnSync(this.getDepotDownloaderExePath());
|
||||
if (proc.stderr?.toString()) {
|
||||
log.error("no dotnet", proc.stderr.toString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (e) {
|
||||
log.error("Error while checking .NET 6", e);
|
||||
return false;
|
||||
}
|
||||
return path.join(this.utils.getAssetsScriptsPath(), process.platform === 'linux' ? "DepotDownloader" : "DepotDownloader.exe");
|
||||
}
|
||||
|
||||
private async buildDepotDownloaderInstance(downloadInfos: DownloadSteamInfo, qr?: boolean): Promise<{depotDownloader: DepotDownloader, depotDownloaderOptions: DepotDownloaderArgsOptions, version: BSVersion}> {
|
||||
@@ -82,16 +65,15 @@ export class BsSteamDownloaderService {
|
||||
qr
|
||||
}
|
||||
|
||||
await ensureDir(await this.installLocationService.versionsDirectory());
|
||||
await ensureDir(this.installLocationService.versionsDirectory());
|
||||
|
||||
const isLinux = process.platform === 'linux';
|
||||
const exePath = this.getDepotDownloaderExePath();
|
||||
const args = DepotDownloader.buildArgs(depotDownloaderOptions);
|
||||
|
||||
const depotDownloader = new DepotDownloader({
|
||||
command: isLinux ? 'dotnet' : exePath,
|
||||
args: isLinux ? [exePath, ...args] : args,
|
||||
options: { cwd: await this.installLocationService.versionsDirectory() },
|
||||
command: exePath,
|
||||
args,
|
||||
options: { cwd: this.installLocationService.versionsDirectory() },
|
||||
echoStartData: downloadVersion
|
||||
}, log);
|
||||
|
||||
|
||||
@@ -23,11 +23,12 @@ export class ConfigurationService {
|
||||
}
|
||||
|
||||
private async initStore() {
|
||||
const contentPath = await this.locations.installationDirectory();
|
||||
const contentPath = this.locations.installationDirectory();
|
||||
this.store = new ElectronStore({
|
||||
cwd: contentPath,
|
||||
name: "config",
|
||||
fileExtension: "cfg",
|
||||
accessPropertiesByDotNotation: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import { pathExistsSync } from "fs-extra";
|
||||
import path from "path";
|
||||
import log from "electron-log";
|
||||
|
||||
export class FileAssociationService {
|
||||
private static instance: FileAssociationService;
|
||||
|
||||
public static getInstance(): FileAssociationService {
|
||||
if (!FileAssociationService.instance) {
|
||||
FileAssociationService.instance = new FileAssociationService();
|
||||
}
|
||||
return FileAssociationService.instance;
|
||||
}
|
||||
|
||||
private readonly listeners = new Map<ExtKey, Listerner[]>();
|
||||
|
||||
private constructor() {}
|
||||
|
||||
private getAbsolutePath(filePath: string) {
|
||||
return path.isAbsolute(filePath) ? filePath : path.join(process.cwd(), filePath);
|
||||
}
|
||||
|
||||
public registerFileAssociation(ext: ExtKey, fn: Listerner) {
|
||||
if (!this.listeners.has(ext)) {
|
||||
this.listeners.set(ext, [] as Listerner[]);
|
||||
}
|
||||
|
||||
this.listeners.get(ext).push(fn);
|
||||
}
|
||||
|
||||
public isFileAssociated(filePath: string): boolean {
|
||||
const fileExt = path.extname(filePath) as ExtKey;
|
||||
return this.listeners.has(fileExt);
|
||||
}
|
||||
|
||||
public handleFileAssociation(filePath: string) {
|
||||
const absolutePath = this.getAbsolutePath(filePath);
|
||||
|
||||
if(!pathExistsSync(absolutePath)) {
|
||||
log.error(`[FileAssociationService] File not found: ${absolutePath}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const fileExt = path.extname(absolutePath) as ExtKey;
|
||||
const listeners = this.listeners.get(fileExt);
|
||||
|
||||
if (!listeners) {
|
||||
log.error(`[FileAssociationService] No listeners for file: ${absolutePath}`);
|
||||
return;
|
||||
}
|
||||
|
||||
listeners.forEach(listener => listener(this.getAbsolutePath(filePath)));
|
||||
}
|
||||
}
|
||||
type ExtKey = `.${string}`;
|
||||
type Listerner = (filePath: string) => void;
|
||||
@@ -1,7 +1,7 @@
|
||||
import path from "path";
|
||||
import { app } from "electron";
|
||||
import ElectronStore from "electron-store";
|
||||
import { copyDirectoryWithJunctions, deleteFolder, ensureFolderExist, pathExist } from "../helpers/fs.helpers";
|
||||
import { copyDirectoryWithJunctions, deleteFolder, ensureFolderExist } from "../helpers/fs.helpers";
|
||||
import { tryit } from "../../shared/helpers/error.helpers";
|
||||
import { pathExistsSync } from "fs-extra";
|
||||
|
||||
@@ -19,6 +19,7 @@ export class InstallationLocationService {
|
||||
public readonly VERSIONS_FOLDER = "BSInstances";
|
||||
|
||||
private readonly SHARED_CONTENT_FOLDER = "SharedContent";
|
||||
private readonly CACHE_FOLDER = "cache";
|
||||
|
||||
private readonly STORE_INSTALLATION_PATH_KEY = "installation-folder";
|
||||
|
||||
@@ -41,7 +42,7 @@ export class InstallationLocationService {
|
||||
|
||||
public async setInstallationDirectory(newDir: string): Promise<string> {
|
||||
newDir = path.basename(newDir) === this.INSTALLATION_FOLDER ? path.join(newDir, "..") : newDir;
|
||||
const oldDir = await this.installationDirectory();
|
||||
const oldDir = this.installationDirectory();
|
||||
|
||||
await ensureFolderExist(oldDir);
|
||||
await copyDirectoryWithJunctions(oldDir, path.join(newDir, this.INSTALLATION_FOLDER), { overwrite: true });
|
||||
@@ -58,9 +59,9 @@ export class InstallationLocationService {
|
||||
this.updateListeners.add(fn);
|
||||
}
|
||||
|
||||
public async installationDirectory(): Promise<string> {
|
||||
public installationDirectory(): string {
|
||||
|
||||
const installParentPath = async () => {
|
||||
const installParentPath = () => {
|
||||
if(this._installationDirectory) {
|
||||
return this._installationDirectory;
|
||||
}
|
||||
@@ -77,17 +78,21 @@ export class InstallationLocationService {
|
||||
return app.getPath("home");
|
||||
};
|
||||
|
||||
this._installationDirectory = await installParentPath();
|
||||
this._installationDirectory = installParentPath();
|
||||
|
||||
return path.join(this._installationDirectory, this.INSTALLATION_FOLDER);
|
||||
}
|
||||
|
||||
public async versionsDirectory(): Promise<string> {
|
||||
return path.join(await this.installationDirectory(), this.VERSIONS_FOLDER);
|
||||
public versionsDirectory(): string {
|
||||
return path.join(this.installationDirectory(), this.VERSIONS_FOLDER);
|
||||
}
|
||||
|
||||
public async sharedContentPath(): Promise<string> {
|
||||
return path.join(await this.installationDirectory(), this.SHARED_CONTENT_FOLDER);
|
||||
public sharedContentPath(): string {
|
||||
return path.join(this.installationDirectory(), this.SHARED_CONTENT_FOLDER);
|
||||
}
|
||||
|
||||
public cachePath(): string {
|
||||
return path.join(this.installationDirectory(), this.CACHE_FOLDER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { IpcRequest } from "shared/models/ipc";
|
||||
import { BrowserWindow, ipcMain } from "electron";
|
||||
import { BrowserWindow, IpcMainEvent, WebContents, ipcMain } from "electron";
|
||||
import { Observable } from "rxjs";
|
||||
import { IpcCompleteChannel, IpcErrorChannel, IpcTearDownChannel } from "shared/models/ipc/ipc-response.interface";
|
||||
import { IpcReplier } from "shared/models/ipc/ipc-request.interface";
|
||||
import { serializeError } from 'serialize-error';
|
||||
import log from "electron-log";
|
||||
import { IpcChannels, IpcRequestType, IpcResponseType } from "shared/models/ipc/ipc-routes";
|
||||
|
||||
export class IpcService {
|
||||
private static instance: IpcService;
|
||||
@@ -30,11 +31,11 @@ export class IpcService {
|
||||
return `${channel}_teardown`;
|
||||
}
|
||||
|
||||
private buildProxyListener<T>(listener: IpcListener<T>) {
|
||||
return (event: Electron.IpcMainEvent, req: IpcRequest<T>) => {
|
||||
private buildProxyListener<C extends IpcChannels>(listener: IpcListenerFromChannel<C>) {
|
||||
return (event: IpcMainEvent, req: IpcRequest<IpcRequestType<C>>) => {
|
||||
const window = BrowserWindow.fromWebContents(event.sender);
|
||||
const replier = (data: Observable<unknown>) => this.connectStream(req.responceChannel, window, data);
|
||||
listener(req, replier);
|
||||
listener(req.args, replier, event.sender);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,21 +55,26 @@ export class IpcService {
|
||||
complete: () => this.send(this.getCompleteChannel(channel), window)
|
||||
})
|
||||
|
||||
window.webContents.once("destroyed", () => sub.unsubscribe());
|
||||
window.webContents.ipc.once(this.getTearDownChannel(channel), () => sub.unsubscribe());
|
||||
const unsubscribe = () => sub.unsubscribe();
|
||||
|
||||
window.webContents.once("destroyed", unsubscribe);
|
||||
window.webContents.ipc.once(this.getTearDownChannel(channel), unsubscribe);
|
||||
|
||||
sub.add(() => {
|
||||
window.webContents.ipc.removeAllListeners(this.getTearDownChannel(channel));
|
||||
window.webContents.removeListener("destroyed", unsubscribe);
|
||||
});
|
||||
}
|
||||
|
||||
public on<T>(channel: string, listener: IpcListener<T>, ipc = ipcMain): void {
|
||||
ipc.on(channel, this.buildProxyListener(listener));
|
||||
public on<C extends IpcChannels>(channel: C, listener: IpcListenerFromChannel<C>, ipc = ipcMain): void {
|
||||
ipc.on(channel as string, this.buildProxyListener(listener));
|
||||
}
|
||||
|
||||
public once<T>(channel: string, listener: IpcListener<T>, ipc = ipcMain): void {
|
||||
ipc.once(channel, this.buildProxyListener(listener));
|
||||
public once<C extends IpcChannels>(channel: C, listener: IpcListenerFromChannel<C>, ipc = ipcMain): void {
|
||||
ipc.once(channel as string, this.buildProxyListener(listener));
|
||||
}
|
||||
}
|
||||
|
||||
type IpcListener<T = unknown> = (req: IpcRequest<T>, replier: IpcReplier) => void | Promise<void>;
|
||||
|
||||
type IpcListener<TRequest = unknown, TResponse = unknown> = (req: TRequest, replier: IpcReplier<TResponse>, webContents: WebContents) => void | Promise<void>;
|
||||
type IpcListenerFromChannel<C extends IpcChannels> = IpcListener<IpcRequestType<C>, IpcResponseType<C>>;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { execOnOs } from "../../helpers/env.helpers";
|
||||
import path from "path";
|
||||
import { Log } from "../../decorators/log.decorator";
|
||||
|
||||
const { list, createKey, putValue, deleteKey, RegSzValue } = (execOnOs({ win32: () => require("regedit-rs") }, true) ?? {}) as typeof import("regedit-rs");
|
||||
|
||||
@@ -22,7 +21,6 @@ export class LivService {
|
||||
|
||||
}
|
||||
|
||||
@Log()
|
||||
public async isLivInstalled(): Promise<boolean> {
|
||||
return execOnOs({
|
||||
win32: async () => {
|
||||
@@ -32,7 +30,6 @@ export class LivService {
|
||||
}, true);
|
||||
}
|
||||
|
||||
@Log()
|
||||
public async createLivShortcut(entry: LivEntry): Promise<void> {
|
||||
return execOnOs({
|
||||
win32: async () => {
|
||||
@@ -50,7 +47,6 @@ export class LivService {
|
||||
});
|
||||
}
|
||||
|
||||
@Log()
|
||||
public async deleteLivShortcuts(ids: string[]): Promise<void> {
|
||||
return execOnOs({
|
||||
win32: async () => {
|
||||
@@ -60,7 +56,6 @@ export class LivService {
|
||||
})
|
||||
}
|
||||
|
||||
@Log()
|
||||
public getLivShortcuts(): Promise<LivEntry[]> {
|
||||
|
||||
return execOnOs({
|
||||
|
||||
@@ -7,7 +7,6 @@ export class BeatModsApiService {
|
||||
|
||||
private readonly requestService: RequestService;
|
||||
|
||||
private readonly BEAT_MODS_VERSIONS = "https://versions.beatmods.com/versions.json";
|
||||
private readonly BEAT_MODS_ALIAS = "https://alias.beatmods.com/aliases.json";
|
||||
|
||||
private readonly BEAT_MODS_API_URL = "https://beatmods.com/api/v1/";
|
||||
@@ -15,6 +14,7 @@ export class BeatModsApiService {
|
||||
|
||||
private readonly aliasesCache = new Map<string, BSVersion[]>();
|
||||
private readonly versionModsCache = new Map<string, Mod[]>();
|
||||
private readonly modsHashCache = new Map<string, Mod>();
|
||||
|
||||
private allModsCache: Mod[];
|
||||
|
||||
@@ -57,7 +57,7 @@ export class BeatModsApiService {
|
||||
if (Array.from(aliases.keys()).some(k => k === version.BSVersion)) {
|
||||
return version;
|
||||
}
|
||||
const alias = Array.from(aliases.entries()).find(([key, value]) => value.find(v => v.BSVersion === version.BSVersion))?.[0];
|
||||
const alias = Array.from(aliases.entries()).find(([, value]) => value.find(v => v.BSVersion === version.BSVersion))?.[0];
|
||||
return { BSVersion: alias } as BSVersion;
|
||||
});
|
||||
}
|
||||
@@ -67,6 +67,29 @@ export class BeatModsApiService {
|
||||
return mod;
|
||||
}
|
||||
|
||||
private updateModsHashCache(mods: Mod[]): void {
|
||||
|
||||
if(!Array.isArray(mods)){
|
||||
return;
|
||||
}
|
||||
|
||||
for (const mod of mods) {
|
||||
for (const downloads of (mod.downloads ?? [])) {
|
||||
for (const hashMd5 of (downloads.hashMd5 ?? [])) {
|
||||
this.modsHashCache.set(hashMd5.hash, mod);
|
||||
}
|
||||
}
|
||||
|
||||
for (const dep of (mod.dependencies ?? [])) {
|
||||
for (const downloads of (dep.downloads ?? [])) {
|
||||
for (const hashMd5 of (downloads.hashMd5 ?? [])) {
|
||||
this.modsHashCache.set(hashMd5.hash, dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async getVersionMods(version: BSVersion): Promise<Mod[]> {
|
||||
if (this.versionModsCache.has(version.BSVersion)) {
|
||||
return this.versionModsCache.get(version.BSVersion);
|
||||
@@ -77,6 +100,9 @@ export class BeatModsApiService {
|
||||
return this.requestService.getJSON<Mod[]>(this.getVersionModsUrl(alias)).then(mods => {
|
||||
mods = mods.map(mod => this.asignDependencies(mod, mods));
|
||||
this.versionModsCache.set(version.BSVersion, mods);
|
||||
|
||||
this.updateModsHashCache(mods);
|
||||
|
||||
return mods;
|
||||
});
|
||||
}
|
||||
@@ -90,4 +116,15 @@ export class BeatModsApiService {
|
||||
return this.allModsCache;
|
||||
});
|
||||
}
|
||||
|
||||
public getModByHash(hash: string): Promise<Mod> {
|
||||
if (this.modsHashCache.has(hash)) {
|
||||
return Promise.resolve(this.modsHashCache.get(hash));
|
||||
}
|
||||
|
||||
return this.requestService.getJSON<Mod[]>(`${this.BEAT_MODS_API_URL}mod?hash=${hash}`).then(mods => {
|
||||
this.updateModsHashCache(mods);
|
||||
return mods.at(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,9 @@ import { lastValueFrom } from "rxjs";
|
||||
import JSZip from "jszip";
|
||||
import { extractZip } from "../../helpers/zip.helpers";
|
||||
import recursiveReadDir from "recursive-readdir";
|
||||
import { minToMs } from "../../../shared/helpers/time.helpers";
|
||||
import { sToMs } from "../../../shared/helpers/time.helpers";
|
||||
import { ensureDir } from "fs-extra";
|
||||
import { CustomError } from "shared/models/exceptions/custom-error.class";
|
||||
|
||||
export class BsModsManagerService {
|
||||
private static instance: BsModsManagerService;
|
||||
@@ -48,23 +49,14 @@ export class BsModsManagerService {
|
||||
}
|
||||
|
||||
private async getModFromHash(hash: string): Promise<Mod> {
|
||||
const allMods = await this.beatModsApi.getAllMods();
|
||||
return allMods.find(mod => {
|
||||
if (mod.name.toLowerCase() === "bsipa") {
|
||||
return false;
|
||||
}
|
||||
return mod.downloads.some(download => download.hashMd5.some(md5 => md5.hash === hash));
|
||||
});
|
||||
}
|
||||
|
||||
private async getIpaFromHash(hash: string): Promise<Mod> {
|
||||
const allMods = await this.beatModsApi.getAllMods();
|
||||
return allMods.find(mod => {
|
||||
if (mod.name.toLowerCase() !== "bsipa") {
|
||||
return false;
|
||||
}
|
||||
return mod.downloads.some(download => download.hashMd5.some(md5 => md5.hash === hash));
|
||||
});
|
||||
const mod = await this.beatModsApi.getModByHash(hash);
|
||||
|
||||
if(mod?.name?.toLowerCase() === "bsipa"){
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return mod;
|
||||
}
|
||||
|
||||
private async getModsInDir(version: BSVersion, modsDir: ModsInstallFolder): Promise<Mod[]> {
|
||||
@@ -84,7 +76,6 @@ export class BsModsManagerService {
|
||||
return undefined;
|
||||
}
|
||||
const hash = await md5File(filePath);
|
||||
|
||||
const mod = await this.getModFromHash(hash);
|
||||
|
||||
if (!mod) {
|
||||
@@ -107,7 +98,7 @@ export class BsModsManagerService {
|
||||
});
|
||||
|
||||
const mods = await Promise.all(promises);
|
||||
return mods.filter(Boolean);
|
||||
return mods.filter(Boolean);
|
||||
}
|
||||
|
||||
private async getBsipaInstalled(version: BSVersion): Promise<Mod> {
|
||||
@@ -117,7 +108,7 @@ export class BsModsManagerService {
|
||||
return undefined;
|
||||
}
|
||||
const injectorMd5 = await md5File(injectorPath);
|
||||
return this.getIpaFromHash(injectorMd5);
|
||||
return this.beatModsApi.getModByHash(injectorMd5);
|
||||
}
|
||||
|
||||
private async downloadZip(zipUrl: string): Promise<JSZip> {
|
||||
@@ -155,9 +146,24 @@ export class BsModsManagerService {
|
||||
}
|
||||
|
||||
return new Promise<boolean>(resolve => {
|
||||
log.info("START IPA PROCESS", `start /wait /min "" "${ipaPath}" ${args.join(" ")}`);
|
||||
const processIPA = spawn(`start /wait /min "" "${ipaPath}" ${args.join(" ")}`, { cwd: versionPath, detached: true, shell: true });
|
||||
const cmd = process.platform === 'linux'
|
||||
? `screen -dmS "BSIPA" dotnet ${ipaPath} ${args.join(" ")}` // Must run through screen, otherwise BSIPA tries to move console cursor and crashes.
|
||||
: `"${ipaPath}" ${args.join(" ")}`;
|
||||
|
||||
log.info("START IPA PROCESS", cmd);
|
||||
const processIPA = spawn(cmd, { cwd: versionPath, detached: true, shell: true });
|
||||
|
||||
const timemout = setTimeout(() => {
|
||||
log.info("Ipa process timeout");
|
||||
resolve(false)
|
||||
}, sToMs(30));
|
||||
|
||||
processIPA.stderr.on("data", data => {
|
||||
log.error("IPA process stderr", data.toString());
|
||||
})
|
||||
|
||||
processIPA.once("exit", code => {
|
||||
clearTimeout(timemout);
|
||||
if (code === 0) {
|
||||
log.info("Ipa process exist with code 0");
|
||||
return resolve(true);
|
||||
@@ -166,10 +172,6 @@ export class BsModsManagerService {
|
||||
resolve(false);
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
log.info("Ipa process timeout");
|
||||
resolve(false)
|
||||
}, minToMs(1));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -230,7 +232,7 @@ export class BsModsManagerService {
|
||||
log.error("Error while extracting mod zip", e);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
log.info("Mod zip extraction end", mod.name, "to", destDir, "success:", extracted);
|
||||
|
||||
const res = isBSIPA
|
||||
@@ -241,7 +243,9 @@ export class BsModsManagerService {
|
||||
}))
|
||||
: extracted;
|
||||
|
||||
res && this.nbInstalledMods++;
|
||||
if(res){
|
||||
this.nbInstalledMods++;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -315,8 +319,10 @@ export class BsModsManagerService {
|
||||
|
||||
public async getInstalledMods(version: BSVersion): Promise<Mod[]> {
|
||||
this.manifestMatches = [];
|
||||
await this.beatModsApi.getAllMods();
|
||||
|
||||
const bsipa = await this.getBsipaInstalled(version);
|
||||
|
||||
|
||||
return Promise.all([this.getModsInDir(version, ModsInstallFolder.PLUGINS_PENDING), this.getModsInDir(version, ModsInstallFolder.LIBS_PENDING), this.getModsInDir(version, ModsInstallFolder.PLUGINS), this.getModsInDir(version, ModsInstallFolder.LIBS)]).then(dirMods => {
|
||||
const modsDict = new Map<string, Mod>();
|
||||
|
||||
@@ -337,7 +343,7 @@ export class BsModsManagerService {
|
||||
|
||||
public async installMods(mods: Mod[], version: BSVersion): Promise<InstallModsResult> {
|
||||
if (!mods?.length) {
|
||||
throw "no-mods";
|
||||
throw CustomError.fromError(new Error("No mods to install"), "no-mods");
|
||||
}
|
||||
|
||||
const deps = await this.resolveDependencies(mods, version);
|
||||
@@ -357,7 +363,7 @@ export class BsModsManagerService {
|
||||
return false;
|
||||
});
|
||||
if (!installed) {
|
||||
throw "cannot-install-bsipa";
|
||||
throw CustomError.fromError(new Error("Unable to install BSIPA"), "cannot-install-bsipa");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +379,7 @@ export class BsModsManagerService {
|
||||
|
||||
public async uninstallMods(mods: Mod[], version: BSVersion): Promise<UninstallModsResult> {
|
||||
if (!mods?.length) {
|
||||
throw "no-mods";
|
||||
throw CustomError.fromError(new Error("No mods to uninstall"), "no-mods");
|
||||
}
|
||||
|
||||
this.nbModsToUninstall = mods.length;
|
||||
@@ -393,7 +399,7 @@ export class BsModsManagerService {
|
||||
const mods = await this.getInstalledMods(version);
|
||||
|
||||
if (!mods?.length) {
|
||||
throw "no-mods";
|
||||
throw CustomError.fromError(new Error("This version has to mods to uninstall"), "no-mods");
|
||||
}
|
||||
|
||||
this.nbModsToUninstall = mods.length;
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import { Agent, get } from "https";
|
||||
import { createWriteStream, unlink } from "fs";
|
||||
import { Agent, RequestOptions } from "https";
|
||||
import { createWriteStream } from "fs";
|
||||
import { Progression } from "main/helpers/fs.helpers";
|
||||
import { Observable, shareReplay, tap } from "rxjs";
|
||||
import log from "electron-log";
|
||||
import fetch, { RequestInfo, RequestInit } from "node-fetch";
|
||||
import got, { Options } from "got";
|
||||
import { IncomingMessage } from "http";
|
||||
import { app } from "electron";
|
||||
import os from "os";
|
||||
import { unlinkSync } from "fs-extra";
|
||||
import { tryit } from "shared/helpers/error.helpers";
|
||||
|
||||
export class RequestService {
|
||||
private static instance: RequestService;
|
||||
@@ -15,22 +21,39 @@ export class RequestService {
|
||||
return RequestService.instance;
|
||||
}
|
||||
|
||||
private constructor() {}
|
||||
private readonly defaultRequestInit: RequestInit;
|
||||
|
||||
private get ipv4Agent(){
|
||||
return new Agent({ family: 4 });
|
||||
private constructor() {
|
||||
|
||||
this.defaultRequestInit = {
|
||||
headers: {
|
||||
"User-Agent": `BSManager/${app.getVersion()} (${os.type()} ${os.release()})`
|
||||
},
|
||||
agent: new Agent({ family: 4 }),
|
||||
};
|
||||
}
|
||||
|
||||
private getInitWithOptions(options?: RequestInit): RequestInit {
|
||||
return { ...this.defaultRequestInit, ...(options || {}) };
|
||||
}
|
||||
|
||||
private requestOptionsFromDefaultInit(): RequestOptions {
|
||||
return {
|
||||
headers: this.defaultRequestInit.headers as Record<string, string>,
|
||||
agent: this.defaultRequestInit.agent as Agent,
|
||||
};
|
||||
}
|
||||
|
||||
public async getJSON<T = unknown>(url: RequestInfo, options?: RequestInit): Promise<T> {
|
||||
|
||||
try {
|
||||
const response = await fetch(url, {...options, agent: this.ipv4Agent});
|
||||
const response = await fetch(url, this.getInitWithOptions(options));
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status} ${url}`);
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
return await response.json() as T;
|
||||
} catch (err) {
|
||||
log.error(err);
|
||||
throw err;
|
||||
@@ -39,63 +62,80 @@ export class RequestService {
|
||||
|
||||
public downloadFile(url: string, dest: string): Observable<Progression<string>> {
|
||||
return new Observable<Progression<string>>(subscriber => {
|
||||
const progress: Progression<string> = { current: 0, total: 0 };
|
||||
const progress: Progression<string> = { current: 0, total: 0, data: dest };
|
||||
|
||||
const stream = got.stream(url)
|
||||
const file = createWriteStream(dest);
|
||||
|
||||
file.on("close", () => {
|
||||
progress.data = dest;
|
||||
stream.on("downloadProgress", ({ transferred, total }) => {
|
||||
progress.current = transferred;
|
||||
progress.total = total;
|
||||
subscriber.next(progress);
|
||||
});
|
||||
|
||||
stream.on("error", err => {
|
||||
tryit(() => unlinkSync(dest));
|
||||
subscriber.error(err);
|
||||
});
|
||||
|
||||
stream.on("end", () => {
|
||||
subscriber.next(progress);
|
||||
subscriber.complete();
|
||||
});
|
||||
file.on("error", err => unlink(dest, () => subscriber.error(err)));
|
||||
|
||||
const req = get(url, { agent: this.ipv4Agent }, res => {
|
||||
progress.total = parseInt(res.headers?.["content-length"] || "0", 10);
|
||||
stream.pipe(file);
|
||||
|
||||
res.on("data", chunk => {
|
||||
progress.current += chunk.length;
|
||||
subscriber.next(progress);
|
||||
});
|
||||
return () => {
|
||||
stream.destroy();
|
||||
}
|
||||
|
||||
res.pipe(file);
|
||||
});
|
||||
|
||||
req.on("error", err => {
|
||||
subscriber.error(err);
|
||||
});
|
||||
}).pipe(tap({ error: e => log.error(e, url, dest) }), shareReplay(1));
|
||||
}
|
||||
|
||||
public downloadBuffer(url: string): Observable<Progression<Buffer>> {
|
||||
return new Observable<Progression<Buffer>>(subscriber => {
|
||||
const progress: Progression<Buffer> = {
|
||||
public downloadBuffer(url: string, options?: Options & { isStream?: true }): Observable<Progression<Buffer, IncomingMessage>> {
|
||||
return new Observable<Progression<Buffer, IncomingMessage>>(subscriber => {
|
||||
const progress: Progression<Buffer, IncomingMessage> = {
|
||||
current: 0,
|
||||
total: 0,
|
||||
data: null,
|
||||
};
|
||||
|
||||
const allChunks: Buffer[] = [];
|
||||
const req = got.stream(url, options);
|
||||
|
||||
const req = get(url, { agent: this.ipv4Agent }, res => {
|
||||
progress.total = parseInt(res.headers?.["content-length"] || "0", 10);
|
||||
let data = Buffer.alloc(0);
|
||||
let response: IncomingMessage;
|
||||
|
||||
res.on("data", chunk => {
|
||||
allChunks.push(chunk);
|
||||
progress.current += chunk.length;
|
||||
subscriber.next(progress);
|
||||
});
|
||||
res.on("end", () => {
|
||||
progress.data = Buffer.concat(allChunks);
|
||||
subscriber.next(progress);
|
||||
subscriber.complete();
|
||||
});
|
||||
res.on("error", err => subscriber.error(err));
|
||||
req.once("response", res => {
|
||||
response = res;
|
||||
});
|
||||
|
||||
req.on("error", err => {
|
||||
req.on("data", (chunk: Buffer) => {
|
||||
data = Buffer.concat([data, chunk]);
|
||||
})
|
||||
|
||||
req.on("downloadProgress", ({ transferred, total }) => {
|
||||
progress.current = transferred;
|
||||
progress.total = total;
|
||||
subscriber.next(progress);
|
||||
});
|
||||
|
||||
req.once("error", err => {
|
||||
subscriber.error(err);
|
||||
});
|
||||
}).pipe(tap({ error: e => log.error(e) }), shareReplay(1));
|
||||
|
||||
req.once("end", () => {
|
||||
progress.data = data;
|
||||
progress.extra = response;
|
||||
subscriber.next(progress);
|
||||
subscriber.complete();
|
||||
});
|
||||
|
||||
req.resume();
|
||||
|
||||
return () => {
|
||||
req.destroy();
|
||||
}
|
||||
|
||||
}).pipe(tap({ error: log.error }), shareReplay(1))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { BsvMapDetail } from "shared/models/maps";
|
||||
import { BsvPlaylist, BsvPlaylistPage, MapFilter, SearchParams, SearchResponse } from "shared/models/maps/beat-saver.model";
|
||||
import { BsvPlaylistPage, MapFilter, PlaylistSearchParams, PlaylistSearchResponse, SearchParams, SearchResponse } from "shared/models/maps/beat-saver.model";
|
||||
import { RequestService } from "../../request.service";
|
||||
import { CustomError } from "shared/models/exceptions/custom-error.class";
|
||||
|
||||
export class BeatSaverApiService {
|
||||
private static instance: BeatSaverApiService;
|
||||
@@ -20,6 +21,12 @@ export class BeatSaverApiService {
|
||||
this.request = RequestService.getInstance();
|
||||
}
|
||||
|
||||
private objectToStringRecord(obj: Record<string, any>): Record<string, string> {
|
||||
return Object.fromEntries(Object.entries(obj)
|
||||
.filter(([, value]) => value !== undefined && value !== null)
|
||||
.map(([key, value]) => [key, String(value)] as [string, string]));
|
||||
}
|
||||
|
||||
private mapFilterToUrlParams(filter: MapFilter): URLSearchParams {
|
||||
if (!filter) {
|
||||
return new URLSearchParams();
|
||||
@@ -30,24 +37,7 @@ export class BeatSaverApiService {
|
||||
|
||||
const tags = enbledTagsString || excludedTagsString ? [...enbledTagsString, excludedTagsString].join("|") : null;
|
||||
|
||||
const params = {
|
||||
...(filter.automapper && { automapper: String(filter.automapper) }),
|
||||
...(filter.chroma && { chroma: String(filter.chroma) }),
|
||||
...(filter.cinema && { cinema: String(filter.cinema) }),
|
||||
...(filter.me && { me: String(filter.me) }),
|
||||
...(filter.noodle && { noodle: String(filter.noodle) }),
|
||||
...(filter.ranked && { ranked: String(filter.ranked) }),
|
||||
...(filter.verified && { verified: String(filter.verified) }),
|
||||
...(filter.curated && { curated: String(filter.curated) }),
|
||||
...(filter.fullSpread && { fullSpread: String(filter.fullSpread) }),
|
||||
...(filter.from && { from: String(filter.from) }),
|
||||
...(filter.to && { to: String(filter.to) }),
|
||||
...(tags && { tags: String(tags) }),
|
||||
...(filter.minDuration && { minDuration: String(filter.minDuration) }),
|
||||
...(filter.maxDuration && { maxDuration: String(filter.maxDuration) }),
|
||||
...(filter.minNps && { minNps: String(filter.minNps) }),
|
||||
...(filter.maxNps && { maxNps: String(filter.maxNps) }),
|
||||
};
|
||||
const params: Record<string, string> = this.objectToStringRecord({...filter, tags});
|
||||
|
||||
return new URLSearchParams(params);
|
||||
}
|
||||
@@ -73,7 +63,7 @@ export class BeatSaverApiService {
|
||||
|
||||
public async getMapsDetailsByHashs<T extends string>(hashs: T[]): Promise<Record<Lowercase<T>, BsvMapDetail>> {
|
||||
if (hashs.length > 50) {
|
||||
throw "too musch map hashs";
|
||||
throw new CustomError("too musch map hashs", "TOO_MUCH_MAP_HASHS");
|
||||
}
|
||||
|
||||
const paramsHashs = hashs.join(",");
|
||||
@@ -95,14 +85,19 @@ export class BeatSaverApiService {
|
||||
return this.request.getJSON<BsvMapDetail>(`${this.bsaverApiUrl}/maps/id/${id}`);
|
||||
}
|
||||
|
||||
public async searchMaps(search: SearchParams): Promise<SearchResponse> {
|
||||
public searchMaps(search: SearchParams): Promise<SearchResponse> {
|
||||
const url = new URL(`${this.bsaverApiUrl}/search/text/${search?.page ?? 0}`);
|
||||
url.search = this.searchParamsToUrlParams(search).toString();
|
||||
return this.request.getJSON<SearchResponse>(url.toString());
|
||||
}
|
||||
|
||||
public async getPlaylistDetails(id: string): Promise<BsvPlaylist> {
|
||||
const res = await this.request.getJSON<BsvPlaylistPage>(`${this.bsaverApiUrl}/playlists/id/${id}/0`);
|
||||
return res.playlist;
|
||||
public searchPlaylists(search: PlaylistSearchParams): Promise<PlaylistSearchResponse> {
|
||||
const url = new URL(`${this.bsaverApiUrl}/playlists/search/${search?.page ?? 0}`);
|
||||
url.search = new URLSearchParams(this.objectToStringRecord(search)).toString();
|
||||
return this.request.getJSON<PlaylistSearchResponse>(url.toString());
|
||||
}
|
||||
|
||||
public getPlaylistDetailsById(id: string, page = 0): Promise<BsvPlaylistPage> {
|
||||
return this.request.getJSON<BsvPlaylistPage>(`${this.bsaverApiUrl}/playlists/id/${id}/${page}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { splitIntoChunk } from "../../../../shared/helpers/array.helpers";
|
||||
import { BsvMapDetail } from "shared/models/maps";
|
||||
import { BsvPlaylist, SearchParams } from "shared/models/maps/beat-saver.model";
|
||||
import { BsvPlaylist, BsvPlaylistPage, PlaylistSearchParams, SearchParams } from "shared/models/maps/beat-saver.model";
|
||||
import { BeatSaverApiService } from "./beat-saver-api.service";
|
||||
import log from "electron-log";
|
||||
|
||||
@@ -23,14 +23,15 @@ export class BeatSaverService {
|
||||
}
|
||||
|
||||
public async getMapDetailsFromHashs(hashs: string[]): Promise<BsvMapDetail[]> {
|
||||
const filtredHashs = hashs.map(h => h.toLowerCase()).filter(hash => !Array.from(this.cachedMapsDetails.keys()).includes(hash));
|
||||
const filtredHashs = hashs.map(h => h.toLowerCase()).filter(hash => !this.cachedMapsDetails.has(hash));
|
||||
const chunkHash = splitIntoChunk(filtredHashs, 50);
|
||||
|
||||
const mapDetails = Array.from(this.cachedMapsDetails.entries()).reduce((res, [hash, details]) => {
|
||||
if (hashs.includes(hash)) {
|
||||
res.push(details);
|
||||
const mapDetails = hashs.reduce((acc, hash) => {
|
||||
const detail = this.cachedMapsDetails.get(hash.toLowerCase());
|
||||
if (detail) {
|
||||
acc.push(detail);
|
||||
}
|
||||
return res;
|
||||
return acc;
|
||||
}, [] as BsvMapDetail[]);
|
||||
|
||||
await Promise.allSettled(
|
||||
@@ -59,11 +60,25 @@ export class BeatSaverService {
|
||||
})
|
||||
.catch(e => {
|
||||
log.error(e);
|
||||
return [];
|
||||
return e;
|
||||
});
|
||||
}
|
||||
|
||||
public async getPlaylistPage(id: string): Promise<BsvPlaylist> {
|
||||
return this.bsaverApi.getPlaylistDetails(id);
|
||||
public searchPlaylists(search: PlaylistSearchParams): Promise<BsvPlaylist[]> {
|
||||
return this.bsaverApi
|
||||
.searchPlaylists(search)
|
||||
.then(res => res.docs)
|
||||
.catch(e => {
|
||||
log.error(e);
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
|
||||
public getPlaylistDetailsById(id: string, page = 0): Promise<BsvPlaylistPage> {
|
||||
return this.bsaverApi.getPlaylistDetailsById(id, page)
|
||||
.catch(e => {
|
||||
log.error(e);
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getFoldersInFolder } 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 { LocalMapsManagerService } from "./additional-content/maps/local-maps-manager.service";
|
||||
import { BSLocalVersionService } from "./bs-local-version.service";
|
||||
import { FolderLinkerService, LinkOptions } from "./folder-linker.service";
|
||||
import { allSettled } from "../../shared/helpers/promise.helpers";
|
||||
|
||||
@@ -47,7 +47,7 @@ export class WindowManagerService {
|
||||
if(isValidUrl(url)){
|
||||
shell.openExternal(url);
|
||||
}
|
||||
|
||||
|
||||
return { action: "deny"}
|
||||
});
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ export const AvailableVersionItem = memo(function AvailableVersionItem({version,
|
||||
{version.recommended && (
|
||||
<span className="uppercase absolute -rotate-45 top-9 -left-[6.2rem] font-bold text-white bg-red-600 w-full text-center text-xs z-[1] shadow-sm shadow-black py-0.5" title={t("pages.available-versions.recommended-tooltip")}>{t("pages.available-versions.recommended")}</span>
|
||||
)}
|
||||
<BsmImage image={version.ReleaseImg ? version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="absolute top-0 right-0 w-full h-full opacity-40 blur-xl object-cover" loading="lazy" />
|
||||
<BsmImage image={version.ReleaseImg ? version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="bg-black w-full h-3/4 object-cover" loading="lazy" />
|
||||
<BsmImage image={version.ReleaseImg ? version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="absolute top-0 right-0 w-full h-full opacity-40 blur-xl object-cover" />
|
||||
<BsmImage image={version.ReleaseImg ? version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="bg-black w-full h-3/4 object-cover" />
|
||||
<div className="z-[1] p-2 w-full flex items-center justify-between grow">
|
||||
<div>
|
||||
<h2 className="block text-xl font-bold text-white tracking-wider">{version.BSVersion}</h2>
|
||||
|
||||
@@ -29,7 +29,7 @@ export function AvailableVersionsSlide({ versions }: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<ol className="w-full flex items-start justify-center gap-6 shrink-0 content-start flex-wrap px-3.5 py-4 overflow-x-hidden overflow-y-scroll scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900">
|
||||
<ol className="w-full flex items-start justify-center gap-6 shrink-0 content-start flex-wrap px-3.5 py-4 overflow-x-hidden overflow-y-scroll scrollbar-default">
|
||||
{getVersions().map(version => (
|
||||
<AvailableVersionItem key={version.BSManifest} version={version} selected={equal(version, context.selectedVersion)} onClick={() => setSelectedVersion(version)}/>
|
||||
))}
|
||||
|
||||
@@ -1,238 +0,0 @@
|
||||
import { MapFilter, MapSpecificity, MapStyle, MapTag, MapType } from "shared/models/maps/beat-saver.model";
|
||||
import { motion } from "framer-motion";
|
||||
import { MutableRefObject, useEffect, useRef, useState } from "react";
|
||||
import { MAP_TYPES } from "renderer/partials/maps/map-tags/map-types";
|
||||
import { MAP_STYLES } from "renderer/partials/maps/map-tags/map-styles";
|
||||
import { BsmCheckbox } from "../shared/bsm-checkbox.component";
|
||||
import { minToS } from "../../../shared/helpers/time.helpers";
|
||||
import dateFormat from "dateformat";
|
||||
import { BsmRange } from "../shared/bsm-range.component";
|
||||
import { useTranslation } from "renderer/hooks/use-translation.hook";
|
||||
import { MAP_SPECIFICITIES } from "renderer/partials/maps/map-general/map-specificity";
|
||||
import { MAP_REQUIREMENTS } from "renderer/partials/maps/map-requirements/map-requirements";
|
||||
import { MAP_DIFFICULTIES_COLORS } from "renderer/partials/maps/map-difficulties/map-difficulties-colors";
|
||||
import { MapExclude, MAP_EXCLUDES } from "renderer/partials/maps/map-excludes/map-excludes";
|
||||
import { BsmButton } from "../shared/bsm-button.component";
|
||||
import equal from "fast-deep-equal/es6";
|
||||
import clone from "rfdc";
|
||||
import { GlowEffect } from "../shared/glow-effect.component";
|
||||
|
||||
export type Props = {
|
||||
className?: string;
|
||||
ref?: MutableRefObject<undefined>;
|
||||
playlist?: boolean;
|
||||
filter: MapFilter;
|
||||
localData?: boolean;
|
||||
onChange?: (filter: MapFilter) => void;
|
||||
onApply?: (filter: MapFilter) => void;
|
||||
onClose?: (filter: MapFilter) => void;
|
||||
};
|
||||
|
||||
export function FilterPanel({ className, ref, playlist = false, filter, localData = true, onChange, onApply, onClose }: Props) {
|
||||
const t = useTranslation();
|
||||
|
||||
const [haveChanged, setHaveChanged] = useState(false);
|
||||
const [firstFilter] = useState(clone()(filter));
|
||||
const firstRun = useRef(true);
|
||||
|
||||
const MIN_NPS = 0;
|
||||
const MAX_NPS = 17;
|
||||
|
||||
const MIN_DURATION = 0;
|
||||
const MAX_DURATION = minToS(30);
|
||||
|
||||
const npss = [filter?.minNps || MIN_NPS, filter?.maxNps || MAX_NPS];
|
||||
const durations = [filter?.minDuration || MIN_DURATION, filter?.maxDuration || MAX_DURATION];
|
||||
|
||||
const isTagActivated = (tag: MapTag): boolean => filter?.enabledTags?.has(tag) || filter?.excludedTags?.has(tag);
|
||||
const isTagExcluded = (tag: MapTag): boolean => filter?.excludedTags?.has(tag);
|
||||
|
||||
useEffect(() => {
|
||||
if (firstRun.current) {
|
||||
firstRun.current = false;
|
||||
return;
|
||||
}
|
||||
setHaveChanged(() => !equal(filter, firstFilter));
|
||||
}, [filter]);
|
||||
|
||||
const renderDurationLabel = (sec: number): JSX.Element => {
|
||||
const textValue = (() => {
|
||||
if (sec === MIN_DURATION) {
|
||||
return MIN_DURATION;
|
||||
}
|
||||
if (sec === MAX_DURATION) {
|
||||
return "∞";
|
||||
}
|
||||
const date = new Date(0);
|
||||
date.setSeconds(sec);
|
||||
return sec > 3600 ? dateFormat(date, "h:MM:ss") : dateFormat(date, "MM:ss");
|
||||
})();
|
||||
|
||||
return renderLabel(textValue, sec === MAX_DURATION);
|
||||
};
|
||||
|
||||
const renderNpsLabel = (nps: number): JSX.Element => {
|
||||
const textValue = (() => {
|
||||
if (nps === MIN_NPS) {
|
||||
return MIN_NPS;
|
||||
}
|
||||
if (nps === MAX_NPS) {
|
||||
return "∞";
|
||||
}
|
||||
return nps;
|
||||
})();
|
||||
|
||||
return renderLabel(textValue, nps === MAX_NPS);
|
||||
};
|
||||
|
||||
const renderLabel = (text: string | number, isMax: boolean): JSX.Element => {
|
||||
return <span className={`bg-inherit absolute top-[calc(100%+4px)] whitespace-nowrap h-5 font-bold rounded-md shadow-center shadow-black px-1 flex items-center ${isMax ? "text-lg" : "text-sm"}`}>{text}</span>;
|
||||
};
|
||||
|
||||
const onNpssChange = ([min, max]: number[]) => {
|
||||
const newFilter: MapFilter = { ...filter, minNps: min, maxNps: max };
|
||||
if (max === MAX_NPS) {
|
||||
delete newFilter.maxNps;
|
||||
}
|
||||
if (min === MIN_NPS) {
|
||||
delete newFilter.minNps;
|
||||
}
|
||||
onChange(newFilter);
|
||||
};
|
||||
|
||||
const onDurationsChange = ([min, max]: number[]) => {
|
||||
const newFilter: MapFilter = { ...filter, minDuration: min, maxDuration: max };
|
||||
if (max === MAX_DURATION) {
|
||||
delete newFilter.maxDuration;
|
||||
}
|
||||
if (min === MIN_DURATION) {
|
||||
delete newFilter.minDuration;
|
||||
}
|
||||
onChange(newFilter);
|
||||
};
|
||||
|
||||
const handleTagClick = (tag: MapTag) => {
|
||||
const enabledTags = filter.enabledTags ?? new Set<MapTag>();
|
||||
const excludedTags = filter.excludedTags ?? new Set<MapTag>();
|
||||
|
||||
if (isTagExcluded(tag)) {
|
||||
excludedTags.delete(tag);
|
||||
} else if (isTagActivated(tag)) {
|
||||
excludedTags.add(tag);
|
||||
enabledTags.delete(tag);
|
||||
} else {
|
||||
enabledTags.add(tag);
|
||||
}
|
||||
|
||||
const newFilter = { ...filter, enabledTags, excludedTags };
|
||||
|
||||
if (newFilter.enabledTags.size === 0) {
|
||||
delete newFilter.enabledTags;
|
||||
}
|
||||
|
||||
if (newFilter.excludedTags.size === 0) {
|
||||
delete newFilter.excludedTags;
|
||||
}
|
||||
|
||||
onChange(newFilter);
|
||||
};
|
||||
|
||||
const translateMapType = (type: MapType): string => {
|
||||
return t(`maps.map-types.${type}`);
|
||||
};
|
||||
|
||||
const translateMapStyle = (style: MapStyle): string => {
|
||||
return t(`maps.map-styles.${style}`);
|
||||
};
|
||||
|
||||
const translateMapSpecificity = (specificity: MapSpecificity): string => {
|
||||
return t(`maps.map-specificities.${specificity}`);
|
||||
};
|
||||
|
||||
const translateMapExclude = (exclude: MapExclude): string => {
|
||||
return t(`maps.map-excludes.${exclude}`);
|
||||
};
|
||||
|
||||
type BooleanKeys<T> = { [k in keyof T]: T[k] extends boolean ? k : never }[keyof T];
|
||||
|
||||
const handleCheckbox = (key: BooleanKeys<MapFilter>) => {
|
||||
const newFilter = { ...(filter ?? {}) };
|
||||
if (newFilter[key] === true) {
|
||||
delete newFilter[key];
|
||||
} else {
|
||||
newFilter[key] = true;
|
||||
}
|
||||
onChange(newFilter);
|
||||
};
|
||||
|
||||
const handleApply = () => {
|
||||
onApply(filter);
|
||||
setHaveChanged(() => false);
|
||||
onClose?.(filter);
|
||||
};
|
||||
|
||||
return !playlist ? (
|
||||
<motion.div ref={ref} className={`${className} bg-light-main-color-2 dark:bg-main-color-3`} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }}>
|
||||
<div className="w-full h-6 grid grid-cols-2 gap-x-12 px-4 mb-6 pt-1">
|
||||
<BsmRange min={MIN_NPS} max={MAX_NPS} values={npss} onChange={onNpssChange} renderLabel={renderNpsLabel} step={0.1} />
|
||||
<BsmRange min={MIN_DURATION} max={MAX_DURATION} values={durations} onChange={onDurationsChange} renderLabel={renderDurationLabel} step={5} />
|
||||
<span className=" text-sm font-bold text-center mt-2.5">{t("maps.map-filter-panel.nps")}</span>
|
||||
<span className=" text-sm font-bold text-center mt-2.5">{t("maps.map-filter-panel.duration")}</span>
|
||||
</div>
|
||||
<div className="w-full h-full flex gap-x-2">
|
||||
<section className="shrink-0">
|
||||
<h2 className="mb-1 uppercase text-sm">{t("maps.map-filter-panel.specificities")}</h2>
|
||||
{MAP_SPECIFICITIES.map(specificity => (
|
||||
<div key={specificity} className="flex justify-start items-center h-[22px] z-20 relative py-0.5 cursor-pointer" onClick={() => handleCheckbox(specificity)}>
|
||||
<BsmCheckbox className="h-full aspect-square relative bg-inherit mr-1" checked={filter?.[specificity]} onChange={() => handleCheckbox(specificity)} />
|
||||
<span className="grow capitalize">{translateMapSpecificity(specificity)}</span>
|
||||
</div>
|
||||
))}
|
||||
<h2 className="my-1 uppercase text-sm">{t("maps.map-filter-panel.requirements")}</h2>
|
||||
{MAP_REQUIREMENTS.map(requirement => (
|
||||
<div key={requirement} className="flex justify-start items-center h-[22px] z-20 relative py-0.5 cursor-pointer" onClick={() => handleCheckbox(requirement)}>
|
||||
<BsmCheckbox className="h-full aspect-square relative bg-inherit mr-1" checked={filter?.[requirement]} onChange={() => handleCheckbox(requirement)} />
|
||||
<span className="grow capitalize">{requirement}</span>
|
||||
</div>
|
||||
))}
|
||||
{ !localData && (
|
||||
<>
|
||||
<h2 className="my-1 uppercase text-sm">{t("maps.map-filter-panel.exclude")}</h2>
|
||||
{MAP_EXCLUDES.map(exclude => (
|
||||
<div key={exclude} className="flex justify-start items-center h-[22px] z-20 relative py-0.5 cursor-pointer" onClick={() => handleCheckbox(exclude)}>
|
||||
<BsmCheckbox className="h-full aspect-square relative bg-inherit mr-1" checked={filter?.[exclude]} onChange={() => handleCheckbox(exclude)} />
|
||||
<span className="grow capitalize">{translateMapExclude(exclude)}</span>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
<section className="grow capitalize">
|
||||
<h2 className="uppercase text-sm mb-1">{t("maps.map-filter-panel.tags")}</h2>
|
||||
<div className="w-full flex flex-row flex-wrap items-start justify-start content-start gap-1 mb-2">
|
||||
{MAP_TYPES.map(tag => (
|
||||
<span key={tag} onClick={() => handleTagClick(tag)} className={`text-[12.5px] text-black rounded-md px-1 font-bold cursor-pointer ${!isTagActivated(tag) && "opacity-40 hover:opacity-90"}`} style={{ backgroundColor: isTagExcluded(tag) ? MAP_DIFFICULTIES_COLORS.Expert : MAP_DIFFICULTIES_COLORS.Normal }}>
|
||||
{translateMapType(tag)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<div className="w-full flex flex-row flex-wrap items-start justify-start content-start gap-1">
|
||||
{MAP_STYLES.map(tag => (
|
||||
<span key={tag} onClick={() => handleTagClick(tag)} className={`text-[12.5px] text-black rounded-md px-1 font-bold cursor-pointer ${!isTagActivated(tag) && "opacity-40 hover:opacity-90"}`} style={{ backgroundColor: isTagExcluded(tag) ? MAP_DIFFICULTIES_COLORS.Expert : MAP_DIFFICULTIES_COLORS.Easy }}>
|
||||
{translateMapStyle(tag)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{onApply && (
|
||||
<div className="inline float-right relative w-fit h-fit mt-2">
|
||||
<BsmButton className="inline float-right rounded-md font-bold px-1 py-0.5 text-sm" text="misc.apply" typeColor="primary" withBar={false} onClick={handleApply} />
|
||||
<GlowEffect visible={haveChanged} />
|
||||
</div>
|
||||
)}
|
||||
</motion.div>
|
||||
) : (
|
||||
<></>
|
||||
);
|
||||
}
|
||||
@@ -1,437 +0,0 @@
|
||||
import { MapsManagerService } from "renderer/services/maps-manager.service";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
|
||||
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface";
|
||||
import { Subscription, BehaviorSubject } from "rxjs";
|
||||
import { MapFilter } from "shared/models/maps/beat-saver.model";
|
||||
import { MapsDownloaderService } from "renderer/services/maps-downloader.service";
|
||||
import { VariableSizeList } from "react-window";
|
||||
import { MapsRow } from "./maps-row.component";
|
||||
import { debounceTime, last, mergeMap, tap } from "rxjs/operators";
|
||||
import { BeatSaverService } from "renderer/services/thrird-partys/beat-saver.service";
|
||||
import { OsDiagnosticService } from "renderer/services/os-diagnostic.service";
|
||||
import { useTranslation } from "renderer/hooks/use-translation.hook";
|
||||
import BeatWaitingImg from "../../../../assets/images/apngs/beat-waiting.png";
|
||||
import BeatConflict from "../../../../assets/images/apngs/beat-conflict.png";
|
||||
import { BsmImage } from "../shared/bsm-image.component";
|
||||
import { BsmButton } from "../shared/bsm-button.component";
|
||||
import TextProgressBar from "../progress-bar/text-progress-bar.component";
|
||||
import { useChangeOnce } from "renderer/hooks/use-change-once.hook";
|
||||
import { useService } from "renderer/hooks/use-service.hook";
|
||||
|
||||
type Props = {
|
||||
version: BSVersion;
|
||||
className?: string;
|
||||
filter?: MapFilter;
|
||||
search?: string;
|
||||
linked?: boolean;
|
||||
isActive?: boolean;
|
||||
};
|
||||
|
||||
export const LocalMapsListPanel = forwardRef(({ version, className, filter, search, linked, isActive }: Props, forwardRef) => {
|
||||
const mapsManager = useService(MapsManagerService);
|
||||
const mapsDownloader = useService(MapsDownloaderService);
|
||||
const bsaver = useService(BeatSaverService);
|
||||
const os = useService(OsDiagnosticService);
|
||||
|
||||
const t = useTranslation();
|
||||
const ref = useRef(null);
|
||||
const [maps, setMaps] = useState<BsmLocalMap[]>(null);
|
||||
const [subs] = useState<Subscription[]>([]);
|
||||
const [selectedMaps$] = useState(new BehaviorSubject<BsmLocalMap[]>([]));
|
||||
const [itemPerRow, setItemPerRow] = useState(2);
|
||||
const [listHeight, setListHeight] = useState(0);
|
||||
const isActiveOnce = useChangeOnce(isActive, true);
|
||||
|
||||
const [loadPercent$] = useState(new BehaviorSubject(0));
|
||||
|
||||
useImperativeHandle(
|
||||
forwardRef,
|
||||
() => ({
|
||||
deleteMaps() {
|
||||
const mapsToDelete = selectedMaps$.value.length === 0 ? maps : selectedMaps$.value;
|
||||
mapsManager.deleteMaps(mapsToDelete, version).then(res => {
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
removeMapsFromList(mapsToDelete);
|
||||
selectedMaps$.next([]);
|
||||
});
|
||||
},
|
||||
exportMaps() {
|
||||
mapsManager.exportMaps(version, selectedMaps$.value);
|
||||
},
|
||||
getMaps() {
|
||||
return maps;
|
||||
},
|
||||
}),
|
||||
[selectedMaps$.value, maps, version]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (isActiveOnce) {
|
||||
loadMaps();
|
||||
mapsDownloader.addOnMapDownloadedListener((map, targerVersion) => {
|
||||
if (targerVersion !== version) {
|
||||
return;
|
||||
}
|
||||
setMaps(maps => (maps ? [map, ...maps] : [map]));
|
||||
});
|
||||
}
|
||||
|
||||
return () => {
|
||||
setMaps(() => null);
|
||||
loadPercent$.next(0);
|
||||
subs.forEach(s => s.unsubscribe());
|
||||
mapsDownloader.removeOnMapDownloadedListener(loadMaps);
|
||||
};
|
||||
}, [isActiveOnce, version, linked]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isActiveOnce) {
|
||||
return;
|
||||
}
|
||||
|
||||
const updateItemPerRow = (listWidth: number) => {
|
||||
const newPerRow = Math.min(Math.floor(listWidth / 400), 3);
|
||||
if (newPerRow === itemPerRow) {
|
||||
return;
|
||||
}
|
||||
setItemPerRow(newPerRow);
|
||||
};
|
||||
|
||||
const heightObserver$ = new BehaviorSubject(0);
|
||||
|
||||
const observer = new ResizeObserver(() => {
|
||||
updateItemPerRow(ref.current?.clientWidth || 0);
|
||||
heightObserver$.next(ref.current?.clientHeight || 0);
|
||||
});
|
||||
|
||||
observer.observe(ref.current);
|
||||
|
||||
const sub = heightObserver$.pipe(debounceTime(100)).subscribe(setListHeight);
|
||||
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
sub.unsubscribe();
|
||||
};
|
||||
}, [isActiveOnce, itemPerRow]);
|
||||
|
||||
const loadMaps = () => {
|
||||
setMaps(() => null);
|
||||
loadPercent$.next(0);
|
||||
|
||||
const loadMapsObs$ = mapsManager.getMaps(version);
|
||||
|
||||
subs.push(
|
||||
loadMapsObs$
|
||||
.pipe(
|
||||
tap(progress => loadPercent$.next(Math.floor((progress.loaded / progress.total) * 100))),
|
||||
last(),
|
||||
mergeMap(async progress => {
|
||||
if (os.isOffline) {
|
||||
return progress.maps;
|
||||
}
|
||||
const { maps } = progress;
|
||||
const details = await bsaver.getMapDetailsFromHashs(maps.map(map => map.hash));
|
||||
return maps.map(map => {
|
||||
map.bsaverInfo = details.find(d => d.versions.at(0).hash === map.hash);
|
||||
return map;
|
||||
});
|
||||
})
|
||||
)
|
||||
.subscribe({
|
||||
next: maps => setMaps(() => maps),
|
||||
complete: () => loadPercent$.next(0),
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
const removeMapsFromList = (mapsToRemove: BsmLocalMap[]) => {
|
||||
const filtredMaps = maps.filter(map => !mapsToRemove.some(toDeleteMaps => map.hash === toDeleteMaps.hash));
|
||||
setMaps(() => filtredMaps);
|
||||
|
||||
const filtredSelectedMaps = selectedMaps$.value.filter(map => !mapsToRemove.some(toDeleteMaps => map.hash === toDeleteMaps.hash));
|
||||
selectedMaps$.next(filtredSelectedMaps);
|
||||
};
|
||||
|
||||
const handleDelete = useCallback(
|
||||
(map: BsmLocalMap) => {
|
||||
mapsManager.deleteMaps([map], version).then(res => {
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
removeMapsFromList([map]);
|
||||
});
|
||||
},
|
||||
[version, maps]
|
||||
);
|
||||
|
||||
const onMapSelected = useCallback(
|
||||
(map: BsmLocalMap) => {
|
||||
const mapsCopy = [...selectedMaps$.value];
|
||||
if (mapsCopy.some(selectedMap => selectedMap.hash === map.hash)) {
|
||||
const i = mapsCopy.findIndex(selectedMap => selectedMap.hash === map.hash);
|
||||
mapsCopy.splice(i, 1);
|
||||
} else {
|
||||
mapsCopy.push(map);
|
||||
}
|
||||
|
||||
selectedMaps$.next(mapsCopy);
|
||||
},
|
||||
[selectedMaps$.value]
|
||||
);
|
||||
|
||||
const isMapFitFilter = (map: BsmLocalMap): boolean => {
|
||||
// Can be more clean and optimized i think
|
||||
|
||||
const fitEnabledTags = (() => {
|
||||
if (!filter?.enabledTags || filter.enabledTags.size === 0) {
|
||||
return true;
|
||||
}
|
||||
if (!map?.bsaverInfo?.tags) {
|
||||
return false;
|
||||
}
|
||||
return Array.from(filter.enabledTags.values()).every(tag => map.bsaverInfo.tags.some(mapTag => mapTag === tag));
|
||||
})();
|
||||
|
||||
if (!fitEnabledTags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fitExcluedTags = (() => {
|
||||
if (!filter?.excludedTags || filter.excludedTags.size === 0) {
|
||||
return true;
|
||||
}
|
||||
if (!map?.bsaverInfo?.tags) {
|
||||
return true;
|
||||
}
|
||||
return !map.bsaverInfo.tags.some(tag => filter.excludedTags.has(tag));
|
||||
})();
|
||||
|
||||
if (!fitExcluedTags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fitMinNps = (() => {
|
||||
if (!filter?.minNps) {
|
||||
return true;
|
||||
}
|
||||
if (!map?.bsaverInfo?.versions?.at(0)) {
|
||||
return false;
|
||||
}
|
||||
return !map.bsaverInfo.versions.some(version => {
|
||||
return version.diffs.some(diff => diff.nps < filter.minNps);
|
||||
});
|
||||
})();
|
||||
|
||||
if (!fitMinNps) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fitMaxNps = (() => {
|
||||
if (!filter?.maxNps) {
|
||||
return true;
|
||||
}
|
||||
if (!map?.bsaverInfo?.versions?.at(0)) {
|
||||
return false;
|
||||
}
|
||||
return !map.bsaverInfo.versions.some(version => {
|
||||
return version.diffs.some(diff => diff.nps > filter.maxNps);
|
||||
});
|
||||
})();
|
||||
|
||||
if (!fitMaxNps) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fitMinDuration = (() => {
|
||||
if (!filter?.minDuration) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!map?.bsaverInfo?.metadata?.duration) {
|
||||
return false;
|
||||
}
|
||||
return map.bsaverInfo.metadata.duration >= filter.minDuration;
|
||||
})();
|
||||
|
||||
if (!fitMinDuration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fitMaxDuration = (() => {
|
||||
if (!filter?.maxDuration) {
|
||||
return true;
|
||||
}
|
||||
if (!map?.bsaverInfo?.metadata?.duration) {
|
||||
return false;
|
||||
}
|
||||
return map.bsaverInfo.metadata.duration <= filter.maxDuration;
|
||||
})();
|
||||
|
||||
if (!fitMaxDuration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fitNoodle = (() => {
|
||||
if (!filter?.noodle) {
|
||||
return true;
|
||||
}
|
||||
if (!map?.bsaverInfo?.versions?.at(0)) {
|
||||
return false;
|
||||
}
|
||||
return map.bsaverInfo.versions.some(version => version.diffs.some(diff => !!diff.ne));
|
||||
})();
|
||||
|
||||
if (!fitNoodle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fitMe = (() => {
|
||||
if (!filter?.me) {
|
||||
return true;
|
||||
}
|
||||
if (!map?.bsaverInfo?.versions?.at(0)) {
|
||||
return false;
|
||||
}
|
||||
return map.bsaverInfo.versions.some(version => version.diffs.some(diff => !!diff.me));
|
||||
})();
|
||||
|
||||
if (!fitMe) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fitCinema = (() => {
|
||||
if (!filter?.cinema) {
|
||||
return true;
|
||||
}
|
||||
if (!map?.bsaverInfo?.versions?.at(0)) {
|
||||
return false;
|
||||
}
|
||||
return map.bsaverInfo.versions.some(version => version.diffs.some(diff => !!diff.cinema));
|
||||
})();
|
||||
|
||||
if (!fitCinema) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fitChroma = (() => {
|
||||
if (!filter?.chroma) {
|
||||
return true;
|
||||
}
|
||||
if (!map?.bsaverInfo?.versions?.at(0)) {
|
||||
return false;
|
||||
}
|
||||
return map.bsaverInfo.versions.some(version => version.diffs.some(diff => !!diff.chroma));
|
||||
})();
|
||||
|
||||
if (!fitChroma) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fitFullSpread = (() => {
|
||||
if (!filter?.fullSpread) {
|
||||
return true;
|
||||
}
|
||||
if (!map?.bsaverInfo?.versions?.at(0)) {
|
||||
return false;
|
||||
}
|
||||
return map.bsaverInfo.versions.some(version => version?.diffs?.length >= 5);
|
||||
})();
|
||||
|
||||
if (!fitFullSpread) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(filter?.automapper ? map.bsaverInfo?.automapper === filter.automapper : true)) {
|
||||
return false;
|
||||
}
|
||||
if (!(filter?.ranked ? map.bsaverInfo?.ranked === filter.ranked : true)) {
|
||||
return false;
|
||||
}
|
||||
if (!(filter?.curated ? !!map.bsaverInfo?.curatedAt : true)) {
|
||||
return false;
|
||||
}
|
||||
if (!(filter?.verified ? !!map.bsaverInfo?.uploader?.verifiedMapper : true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const searchCheck = (() => {
|
||||
return ((map.rawInfo?._songName ?? map.bsaverInfo?.name) || "")?.toLowerCase().includes(search.toLowerCase()) || ((map.rawInfo?._songAuthorName ?? map.bsaverInfo?.metadata?.songAuthorName) || "")?.toLowerCase().includes(search.toLowerCase()) || ((map.rawInfo?._levelAuthorName ?? map.bsaverInfo?.metadata?.levelAuthorName) || "")?.toLowerCase().includes(search.toLowerCase());
|
||||
})();
|
||||
|
||||
if (!searchCheck) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
const preppedMaps: BsmLocalMap[][] = (() => {
|
||||
if (!maps) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const res: BsmLocalMap[][] = [];
|
||||
let mapsRow: BsmLocalMap[] = [];
|
||||
|
||||
for (const map of maps) {
|
||||
if (!isMapFitFilter(map)) {
|
||||
continue;
|
||||
}
|
||||
if (mapsRow.length === itemPerRow) {
|
||||
res.push(mapsRow);
|
||||
mapsRow = [];
|
||||
}
|
||||
mapsRow.push(map);
|
||||
}
|
||||
|
||||
if (mapsRow.length) {
|
||||
res.push(mapsRow);
|
||||
}
|
||||
|
||||
return res;
|
||||
})();
|
||||
|
||||
if (!maps) {
|
||||
return (
|
||||
<div ref={ref} className={className}>
|
||||
<div className="h-full flex flex-col items-center justify-center flex-wrap gap-1 text-gray-800 dark:text-gray-200">
|
||||
<BsmImage className="w-32 h-32 spin-loading" image={BeatWaitingImg} />
|
||||
<span className="font-bold">{t("modals.download-maps.loading-maps")}</span>
|
||||
<TextProgressBar value$={loadPercent$} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!maps.length) {
|
||||
return (
|
||||
<div ref={ref} className={className}>
|
||||
<div className="h-full flex flex-col items-center justify-center flex-wrap gap-1 text-gray-800 dark:text-gray-200">
|
||||
<BsmImage className="h-32" image={BeatConflict} />
|
||||
<span className="font-bold">{t("pages.version-viewer.maps.tabs.maps.empty-maps.text")}</span>
|
||||
<BsmButton
|
||||
className="font-bold rounded-md p-2"
|
||||
text="pages.version-viewer.maps.tabs.maps.empty-maps.button"
|
||||
typeColor="primary"
|
||||
withBar={false}
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
mapsDownloader.openDownloadMapModal(version);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div ref={ref} className={className}>
|
||||
<VariableSizeList className="scrollbar-thin scrollbar-thumb-rounded-full scrollbar-thumb-neutral-900" width="100%" height={listHeight} itemSize={() => 108} itemCount={preppedMaps.length} itemData={preppedMaps} layout="vertical" style={{ scrollbarGutter: "stable both-edges" }} itemKey={(i, data) => data[i].map(map => map.hash).join()}>
|
||||
{props => <MapsRow maps={props.data[props.index]} style={props.style} selectedMaps$={selectedMaps$} onMapSelect={onMapSelected} onMapDelete={handleDelete} />}
|
||||
</VariableSizeList>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -1,146 +0,0 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { LocalMapsListPanel } from "./local-maps-list-panel.component";
|
||||
import { BsmDropdownButton, DropDownItem } from "../shared/bsm-dropdown-button.component";
|
||||
import { FilterPanel } from "./filter-panel.component";
|
||||
import { MapFilter } from "shared/models/maps/beat-saver.model";
|
||||
import { MapsManagerService } from "renderer/services/maps-manager.service";
|
||||
import { MapsDownloaderService } from "renderer/services/maps-downloader.service";
|
||||
import { BsmImage } from "../shared/bsm-image.component";
|
||||
import wipGif from "../../../../assets/images/gifs/wip.gif";
|
||||
import { useTranslation } from "renderer/hooks/use-translation.hook";
|
||||
import { FolderLinkState, VersionFolderLinkerService, VersionLinkerActionListener } from "renderer/services/version-folder-linker.service";
|
||||
import { useService } from "renderer/hooks/use-service.hook";
|
||||
import { BsContentTabPanel } from "../shared/bs-content-tab-panel/bs-content-tab-panel.component";
|
||||
import { BsmButton } from "../shared/bsm-button.component";
|
||||
import { MapIcon } from "../svgs/icons/map-icon.component";
|
||||
import { PlaylistIcon } from "../svgs/icons/playlist-icon.component";
|
||||
import { useObservable } from "renderer/hooks/use-observable.hook";
|
||||
import { of } from "rxjs";
|
||||
|
||||
type Props = {
|
||||
version?: BSVersion;
|
||||
isActive?: boolean;
|
||||
};
|
||||
|
||||
export function MapsPlaylistsPanel({ version, isActive }: Props) {
|
||||
|
||||
const mapsService = useService(MapsManagerService);
|
||||
const mapsDownloader = useService(MapsDownloaderService);
|
||||
const linker = useService(VersionFolderLinkerService);
|
||||
|
||||
const [tabIndex, setTabIndex] = useState(0);
|
||||
const [mapFilter, setMapFilter] = useState<MapFilter>({});
|
||||
const [mapSearch, setMapSearch] = useState("");
|
||||
const [playlistSearch, setPlaylistSearch] = useState("");
|
||||
const [mapsLinked, setMapsLinked] = useState(false);
|
||||
const mapsLinkedState = useObservable(() => version ? mapsService.$mapsFolderLinkState(version) : of(null), FolderLinkState.Unlinked, [version]);
|
||||
const t = useTranslation();
|
||||
const mapsRef = useRef<any>();
|
||||
|
||||
useEffect(() => {
|
||||
if (!version) {
|
||||
return;
|
||||
}
|
||||
|
||||
loadMapIsLinked();
|
||||
|
||||
const onMapsLinked: VersionLinkerActionListener = action => {
|
||||
if (!action.relativeFolder.includes(MapsManagerService.RELATIVE_MAPS_FOLDER)) {
|
||||
return;
|
||||
}
|
||||
loadMapIsLinked();
|
||||
};
|
||||
|
||||
linker.onVersionFolderLinked(onMapsLinked);
|
||||
linker.onVersionFolderUnlinked(onMapsLinked);
|
||||
|
||||
return () => {
|
||||
linker.removeVersionFolderLinkedListener(onMapsLinked);
|
||||
linker.removeVersionFolderUnlinkedListener(onMapsLinked);
|
||||
};
|
||||
}, [version, isActive]);
|
||||
|
||||
const loadMapIsLinked = () => {
|
||||
mapsService.versionHaveMapsLinked(version).then(setMapsLinked);
|
||||
};
|
||||
|
||||
const handleSearch = (value: string) => {
|
||||
if (tabIndex === 0) {
|
||||
return setMapSearch(() => value);
|
||||
}
|
||||
return setPlaylistSearch(() => value);
|
||||
};
|
||||
|
||||
const handleMapsAddClick = () => {
|
||||
mapsDownloader.openDownloadMapModal(version, mapsRef.current.getMaps?.());
|
||||
};
|
||||
|
||||
const handleMapsLinkClick = () => {
|
||||
if (!mapsLinked) {
|
||||
return mapsService.linkVersion(version);
|
||||
}
|
||||
return mapsService.unlinkVersion(version);
|
||||
};
|
||||
|
||||
const dropDownItems = ((): DropDownItem[] => {
|
||||
if (tabIndex === 1) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
{ icon: "export", text: "pages.version-viewer.maps.search-bar.dropdown.export-maps", onClick: () => mapsRef.current.exportMaps?.() },
|
||||
{ icon: "trash", text: "pages.version-viewer.maps.search-bar.dropdown.delete-maps", onClick: () => mapsRef.current.deleteMaps?.() },
|
||||
];
|
||||
})();
|
||||
|
||||
return (
|
||||
<div className="w-full h-full flex flex-col items-center justify-center gap-4">
|
||||
<nav className="w-full shrink-0 flex h-9 justify-center px-40 gap-2 text-main-color-1 dark:text-white">
|
||||
<BsmButton
|
||||
className="flex items-center justify-center w-fit rounded-full px-2 py-1 font-bold"
|
||||
icon="add"
|
||||
text="misc.add"
|
||||
typeColor="primary"
|
||||
withBar={false}
|
||||
disabled={tabIndex === 1}
|
||||
onClick={handleMapsAddClick}
|
||||
/>
|
||||
<div className="h-full rounded-full bg-light-main-color-2 dark:bg-main-color-2 grow p-[6px]">
|
||||
<input type="text" className="h-full w-full bg-light-main-color-1 dark:bg-main-color-1 rounded-full px-2" placeholder={t("pages.version-viewer.maps.search-bar.search-placeholder")} value={tabIndex === 0 ? mapSearch : playlistSearch} onChange={e => handleSearch(e.target.value)} tabIndex={-1} />
|
||||
</div>
|
||||
<BsmDropdownButton className="h-full relative z-[1] flex justify-center" buttonClassName="flex items-center justify-center h-full rounded-full px-2 py-1" icon="filter" text="pages.version-viewer.maps.search-bar.filters-btn" textClassName="whitespace-nowrap" withBar={false}>
|
||||
<FilterPanel className="absolute top-[calc(100%+3px)] origin-top w-[500px] h-fit p-2 rounded-md shadow-md shadow-black" filter={mapFilter} onChange={setMapFilter} />
|
||||
</BsmDropdownButton>
|
||||
<BsmDropdownButton className="h-full flex aspect-square relative rounded-full z-[1] bg-light-main-color-1 dark:bg-main-color-3" buttonClassName="rounded-full h-full w-full p-[6px]" icon="three-dots" withBar={false} items={dropDownItems} menuTranslationY="6px" align="center" />
|
||||
</nav>
|
||||
<BsContentTabPanel
|
||||
tabIndex={tabIndex}
|
||||
onTabChange={index => setTabIndex(index)}
|
||||
tabs={[
|
||||
{
|
||||
text: "misc.maps",
|
||||
icon: MapIcon,
|
||||
onClick: () => setTabIndex(0),
|
||||
linkProps: version ? {
|
||||
state: mapsLinkedState,
|
||||
onClick: handleMapsLinkClick,
|
||||
} : null,
|
||||
},
|
||||
{
|
||||
text: "misc.playlists",
|
||||
icon: PlaylistIcon,
|
||||
onClick: () => setTabIndex(1),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<>
|
||||
<LocalMapsListPanel isActive={isActive && tabIndex === 0} 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>
|
||||
</>
|
||||
</BsContentTabPanel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
import { CSSProperties, memo } from "react";
|
||||
import { useObservable } from "renderer/hooks/use-observable.hook";
|
||||
import { distinctUntilChanged, map } from "rxjs/operators";
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
import { BsvMapCharacteristic } from "shared/models/maps/beat-saver.model";
|
||||
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface";
|
||||
import { ParsedMapDiff, MapItem } from "./map-item.component";
|
||||
import equal from "fast-deep-equal/es6";
|
||||
|
||||
type Props = {
|
||||
maps: BsmLocalMap[];
|
||||
style?: CSSProperties;
|
||||
onMapDelete: (map: BsmLocalMap) => void;
|
||||
onMapSelect: (map: BsmLocalMap) => void;
|
||||
selectedMaps$: BehaviorSubject<BsmLocalMap[]>;
|
||||
};
|
||||
|
||||
export const MapsRow = memo(({ maps, style, selectedMaps$, onMapSelect, onMapDelete }: Props) => {
|
||||
const selectedMaps = useObservable<BsmLocalMap[]>(() => selectedMaps$.pipe(
|
||||
map(selectedMaps => selectedMaps.filter(selected => maps.some(map => map.hash === selected.hash))),
|
||||
distinctUntilChanged(equal),
|
||||
), []);
|
||||
|
||||
const extractMapDiffs = (map: BsmLocalMap): Map<BsvMapCharacteristic, ParsedMapDiff[]> => {
|
||||
const res = new Map<BsvMapCharacteristic, ParsedMapDiff[]>();
|
||||
if (map.bsaverInfo?.versions[0]?.diffs) {
|
||||
map.bsaverInfo.versions[0].diffs.forEach(diff => {
|
||||
const arr = res.get(diff.characteristic) || [];
|
||||
const diffName = map.rawInfo._difficultyBeatmapSets.find(set => set._beatmapCharacteristicName === diff.characteristic)._difficultyBeatmaps.find(rawDiff => rawDiff._difficulty === diff.difficulty)?._customData?._difficultyLabel || diff.difficulty;
|
||||
arr.push({ name: diffName, type: diff.difficulty, stars: diff.stars });
|
||||
res.set(diff.characteristic, arr);
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
map.rawInfo._difficultyBeatmapSets.forEach(set => {
|
||||
set._difficultyBeatmaps.forEach(diff => {
|
||||
const arr = res.get(set._beatmapCharacteristicName) || [];
|
||||
arr.push({ name: diff._customData?._difficultyLabel || diff._difficulty, type: diff._difficulty, stars: null });
|
||||
res.set(set._beatmapCharacteristicName, arr);
|
||||
});
|
||||
});
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
const renderMapItem = (map: BsmLocalMap) => {
|
||||
return <MapItem
|
||||
key={map.hash}
|
||||
hash={map.hash}
|
||||
title={map.rawInfo._songName}
|
||||
coverUrl={map.coverUrl}
|
||||
songUrl={map.songUrl}
|
||||
autor={map.rawInfo._levelAuthorName}
|
||||
songAutor={map.rawInfo._songAuthorName}
|
||||
bpm={map.rawInfo._beatsPerMinute}
|
||||
duration={map.bsaverInfo?.metadata?.duration}
|
||||
selected={selectedMaps.some(selected => selected.hash === map.hash)}
|
||||
diffs={extractMapDiffs(map)} mapId={map.bsaverInfo?.id}
|
||||
ranked={map.bsaverInfo?.ranked}
|
||||
autorId={map.bsaverInfo?.uploader?.id}
|
||||
likes={map.bsaverInfo?.stats?.upvotes}
|
||||
createdAt={map.bsaverInfo?.createdAt}
|
||||
onDelete={onMapDelete}
|
||||
onSelected={onMapSelect}
|
||||
callBackParam={map}
|
||||
/>;
|
||||
};
|
||||
|
||||
return (
|
||||
<ul className="h-fit w-full flex flex-nowrap basis-0 gap-x-2 p-2" style={style}>
|
||||
{maps?.map(renderMapItem)}
|
||||
</ul>
|
||||
);
|
||||
}, equal);
|
||||
@@ -0,0 +1,183 @@
|
||||
import { createContext, useRef, useState } from "react";
|
||||
import { BSVersion } from "shared/bs-version.interface";
|
||||
import { LocalMapsListPanel } from "./maps/local-maps-list-panel.component";
|
||||
import { BsmDropdownButton, DropDownItem } from "../shared/bsm-dropdown-button.component";
|
||||
import { FilterPanel } from "./maps/filter-panel.component";
|
||||
import { MapFilter } from "shared/models/maps/beat-saver.model";
|
||||
import { MapsManagerService } from "renderer/services/maps-manager.service";
|
||||
import { MapsDownloaderService } from "renderer/services/maps-downloader.service";
|
||||
import { useTranslation } from "renderer/hooks/use-translation.hook";
|
||||
import { FolderLinkState } from "renderer/services/version-folder-linker.service";
|
||||
import { useService } from "renderer/hooks/use-service.hook";
|
||||
import { BsContentTabPanel } from "../shared/bs-content-tab-panel/bs-content-tab-panel.component";
|
||||
import { BsmButton } from "../shared/bsm-button.component";
|
||||
import { MapIcon } from "../svgs/icons/map-icon.component";
|
||||
import { PlaylistIcon } from "../svgs/icons/playlist-icon.component";
|
||||
import { useObservable } from "renderer/hooks/use-observable.hook";
|
||||
import { BehaviorSubject, of } from "rxjs";
|
||||
import { LocalPlaylistsListPanel, LocalPlaylistsListRef } from "./playlists/local-playlists-list-panel.component";
|
||||
import { PlaylistsManagerService } from "renderer/services/playlists-manager.service";
|
||||
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface";
|
||||
import { useConstant } from "renderer/hooks/use-constant.hook";
|
||||
import { LocalBPListsDetails } from "shared/models/playlists/local-playlist.models";
|
||||
import { PlaylistDownloaderService } from "renderer/services/playlist-downloader.service";
|
||||
import { LocalPlaylistFilter, LocalPlaylistFilterPanel } from "./playlists/local-playlist-filter-panel.component";
|
||||
import { noop } from "shared/helpers/function.helpers";
|
||||
|
||||
type Props = {
|
||||
readonly version?: BSVersion;
|
||||
readonly isActive?: boolean;
|
||||
};
|
||||
|
||||
export const InstalledMapsContext = createContext<{
|
||||
maps$: BehaviorSubject<BsmLocalMap[]>;
|
||||
setMaps: (maps: BsmLocalMap[]) => void;
|
||||
playlists$: BehaviorSubject<LocalBPListsDetails[]>;
|
||||
setPlaylists: (playlist: LocalBPListsDetails[]) => void;
|
||||
}>(null);
|
||||
|
||||
export function MapsPlaylistsPanel({ version, isActive }: Props) {
|
||||
|
||||
const mapsManager = useService(MapsManagerService);
|
||||
const mapsDownloader = useService(MapsDownloaderService);
|
||||
const playlistsManager = useService(PlaylistsManagerService);
|
||||
const playlistsDownloader = useService(PlaylistDownloaderService);
|
||||
|
||||
const t = useTranslation();
|
||||
const [tabIndex, setTabIndex] = useState(0);
|
||||
|
||||
const maps$ = useConstant(() => new BehaviorSubject<BsmLocalMap[]>(undefined));
|
||||
const playlists$ = useConstant(() => new BehaviorSubject<LocalBPListsDetails[]>(undefined));
|
||||
|
||||
const mapsContextValue = useConstant(() => ({
|
||||
maps$,
|
||||
setMaps: maps$.next.bind(maps$),
|
||||
playlists$,
|
||||
setPlaylists: playlists$.next.bind(playlists$),
|
||||
}));
|
||||
|
||||
const mapsRef = useRef<any>();
|
||||
const playlistsRef = useRef<LocalPlaylistsListRef>();
|
||||
|
||||
const [mapFilter, setMapFilter] = useState<MapFilter>({});
|
||||
const [playlistFilter, setPlaylistFilter] = useState<LocalPlaylistFilter>({});
|
||||
|
||||
const [search, setSearch] = useState("");
|
||||
const mapsLinkedState = useObservable(() => {
|
||||
if(!version) return of(FolderLinkState.Unlinked);
|
||||
return mapsManager.$mapsFolderLinkState(version);
|
||||
}, FolderLinkState.Unlinked, [version]);
|
||||
|
||||
const playlistLinkedState = useObservable(() => {
|
||||
if(!version) return of(FolderLinkState.Unlinked);
|
||||
return playlistsManager.$playlistsFolderLinkState(version);
|
||||
}, FolderLinkState.Unlinked, [version]);
|
||||
|
||||
const handleAddClick = () => {
|
||||
switch (tabIndex) {
|
||||
case 0: return mapsDownloader.openDownloadMapModal(version, maps$.value);
|
||||
case 1: return playlistsDownloader.openDownloadPlaylistModal(version, playlists$, maps$);
|
||||
default: return noop();
|
||||
}
|
||||
}
|
||||
|
||||
const handleMapsLinkClick = () => {
|
||||
if(mapsLinkedState === FolderLinkState.Pending || mapsLinkedState === FolderLinkState.Processing){ return Promise.resolve(false); }
|
||||
|
||||
if (mapsLinkedState === FolderLinkState.Unlinked) {
|
||||
return mapsManager.linkVersion(version);
|
||||
}
|
||||
|
||||
return mapsManager.unlinkVersion(version);
|
||||
};
|
||||
|
||||
const handlePlaylistLinkClick = () => {
|
||||
if(playlistLinkedState === FolderLinkState.Pending || playlistLinkedState === FolderLinkState.Processing){ return Promise.resolve(false); }
|
||||
|
||||
if (playlistLinkedState === FolderLinkState.Unlinked) {
|
||||
return playlistsManager.linkVersion(version);
|
||||
}
|
||||
|
||||
return playlistsManager.unlinkVersion(version);
|
||||
}
|
||||
|
||||
const dropDownItems = ((): DropDownItem[] => {
|
||||
if (tabIndex === 0) {
|
||||
return [
|
||||
{ icon: "export", text: "pages.version-viewer.maps.search-bar.dropdown.export-maps", onClick: () => mapsRef.current.exportMaps?.() },
|
||||
{ icon: "trash", text: "pages.version-viewer.maps.search-bar.dropdown.delete-maps", onClick: () => mapsRef.current.deleteMaps?.() },
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
{ icon: "add", text: t("playlist.create-a-playlist"), onClick: () => playlistsRef?.current?.createPlaylist?.() },
|
||||
{ icon: "sync", text: t("playlist.synchronize-playlists"), onClick: () => playlistsRef?.current?.syncPlaylists?.() },
|
||||
{ icon: "export", text: t("playlist.export-playlists"), onClick: () => playlistsRef?.current?.exportPlaylists?.() },
|
||||
{ icon: "trash", text: t("playlist.delete-playlists"), onClick: () => playlistsRef?.current?.deletePlaylists?.() },
|
||||
];
|
||||
})();
|
||||
|
||||
return (
|
||||
<div className="w-full h-full flex flex-col items-center justify-center gap-4">
|
||||
<nav className="w-full shrink-0 flex h-9 justify-center px-40 gap-2 text-main-color-1 dark:text-white">
|
||||
<BsmButton
|
||||
className="flex items-center justify-center w-fit rounded-full px-2 py-1 font-bold whitespace-nowrap"
|
||||
icon="add"
|
||||
text="misc.add"
|
||||
typeColor="primary"
|
||||
withBar={false}
|
||||
onClick={handleAddClick}
|
||||
/>
|
||||
<div className="h-full rounded-full bg-light-main-color-2 dark:bg-main-color-2 grow p-[6px]">
|
||||
<input
|
||||
type="text"
|
||||
className="h-full w-full bg-light-main-color-1 dark:bg-main-color-1 rounded-full px-2"
|
||||
placeholder={tabIndex === 0 ? t("pages.version-viewer.maps.search-bar.search-placeholder") : t("playlist.search-playlist")}
|
||||
value={search}
|
||||
onChange={e => setSearch(() => e.target.value)}
|
||||
tabIndex={-1}
|
||||
/>
|
||||
</div>
|
||||
<BsmDropdownButton className="h-full relative z-[1] flex justify-center" buttonClassName="flex items-center justify-center h-full rounded-full px-2 py-1 whitespace-nowrap" icon="filter" text="pages.version-viewer.maps.search-bar.filters-btn" textClassName="whitespace-nowrap" withBar={false}>
|
||||
{(
|
||||
tabIndex === 0 ? (
|
||||
<FilterPanel className="absolute top-[calc(100%+3px)] origin-top w-[500px] h-fit p-2 rounded-md shadow-md shadow-black" filter={mapFilter} onChange={setMapFilter} />
|
||||
) : (
|
||||
<LocalPlaylistFilterPanel className="absolute top-[calc(100%+3px)] origin-top w-[300px] h-fit p-2 rounded-md shadow-md shadow-black" filter={playlistFilter} onChange={setPlaylistFilter} />
|
||||
)
|
||||
)}
|
||||
</BsmDropdownButton>
|
||||
<BsmDropdownButton className="h-full flex aspect-square relative rounded-full z-[1] bg-light-main-color-1 dark:bg-main-color-3" buttonClassName="rounded-full h-full w-full p-[6px]" icon="three-dots" withBar={false} items={dropDownItems} menuTranslationY="6px" align="center" />
|
||||
</nav>
|
||||
<BsContentTabPanel
|
||||
tabIndex={tabIndex}
|
||||
onTabChange={index => setTabIndex(index)}
|
||||
tabs={[
|
||||
{
|
||||
text: "misc.maps",
|
||||
icon: MapIcon,
|
||||
onClick: () => setTabIndex(0),
|
||||
linkProps: version ? {
|
||||
state: mapsLinkedState,
|
||||
onClick: handleMapsLinkClick,
|
||||
} : null,
|
||||
},
|
||||
{
|
||||
text: "misc.playlists",
|
||||
icon: PlaylistIcon,
|
||||
onClick: () => setTabIndex(1),
|
||||
linkProps: version ? {
|
||||
state: playlistLinkedState,
|
||||
onClick: handlePlaylistLinkClick,
|
||||
} : null,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<InstalledMapsContext.Provider value={mapsContextValue}>
|
||||
<LocalMapsListPanel className="w-full h-full shrink-0" isActive={isActive && tabIndex === 0} ref={mapsRef} version={version} filter={mapFilter} search={search} linkedState={mapsLinkedState} />
|
||||
<LocalPlaylistsListPanel className="w-full h-full shrink-0" isActive={isActive && tabIndex === 1} ref={playlistsRef} version={version} linkedState={playlistLinkedState} filter={playlistFilter} search={search}/>
|
||||
</InstalledMapsContext.Provider>
|
||||
</BsContentTabPanel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
import { BsvMapDetail, MapFilter, MapRequirement, MapSpecificity, MapStyle, MapTag, MapType } from "shared/models/maps/beat-saver.model";
|
||||
import { motion } from "framer-motion";
|
||||
import { MutableRefObject, useEffect, useRef, useState } from "react";
|
||||
import { BsmCheckbox } from "../../shared/bsm-checkbox.component";
|
||||
import { minToS, sToMs } from "../../../../shared/helpers/time.helpers";
|
||||
import { BsmRange } from "../../shared/bsm-range.component";
|
||||
import { useTranslation } from "renderer/hooks/use-translation.hook";
|
||||
import { MAP_DIFFICULTIES_COLORS } from "shared/models/maps/difficulties-colors";
|
||||
import { BsmButton } from "../../shared/bsm-button.component";
|
||||
import equal from "fast-deep-equal/es6";
|
||||
import clone from "rfdc";
|
||||
import { GlowEffect } from "../../shared/glow-effect.component";
|
||||
import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface";
|
||||
import { SongDetails } from "shared/models/maps";
|
||||
import formatDuration from "format-duration";
|
||||
|
||||
export type Props = {
|
||||
className?: string;
|
||||
ref?: MutableRefObject<undefined>;
|
||||
playlist?: boolean;
|
||||
filter: MapFilter;
|
||||
localData?: boolean;
|
||||
onChange?: (filter: MapFilter) => void;
|
||||
onApply?: (filter: MapFilter) => void;
|
||||
onClose?: (filter: MapFilter) => void;
|
||||
};
|
||||
|
||||
export function FilterPanel({ className, ref, playlist = false, filter, localData = true, onChange, onApply, onClose }: Props) {
|
||||
const t = useTranslation();
|
||||
|
||||
const [haveChanged, setHaveChanged] = useState(false);
|
||||
const [firstFilter] = useState(clone()(filter));
|
||||
const firstRun = useRef(true);
|
||||
|
||||
const MIN_NPS = 0;
|
||||
const MAX_NPS = 17;
|
||||
|
||||
const MIN_DURATION = 0;
|
||||
const MAX_DURATION = minToS(30);
|
||||
|
||||
const npss = [filter?.minNps || MIN_NPS, filter?.maxNps || MAX_NPS];
|
||||
const durations = [filter?.minDuration || MIN_DURATION, filter?.maxDuration || MAX_DURATION];
|
||||
|
||||
const isTagActivated = (tag: MapTag): boolean => filter?.enabledTags?.has(tag) || filter?.excludedTags?.has(tag);
|
||||
const isTagExcluded = (tag: MapTag): boolean => filter?.excludedTags?.has(tag);
|
||||
|
||||
useEffect(() => {
|
||||
if (firstRun.current) {
|
||||
firstRun.current = false;
|
||||
return;
|
||||
}
|
||||
setHaveChanged(() => !equal(filter, firstFilter));
|
||||
}, [filter]);
|
||||
|
||||
const renderDurationLabel = (sec: number): JSX.Element => {
|
||||
const textValue = (() => {
|
||||
if (sec === MIN_DURATION) {
|
||||
return MIN_DURATION;
|
||||
}
|
||||
if (sec === MAX_DURATION) {
|
||||
return "∞";
|
||||
}
|
||||
const ms = sToMs(sec);
|
||||
return formatDuration(ms, { leading: true });
|
||||
})();
|
||||
|
||||
return renderLabel(textValue, sec === MAX_DURATION);
|
||||
};
|
||||
|
||||
const renderNpsLabel = (nps: number): JSX.Element => {
|
||||
const textValue = (() => {
|
||||
if (nps === MAX_NPS) { return "∞"; }
|
||||
return nps;
|
||||
})();
|
||||
|
||||
return renderLabel(textValue, nps === MAX_NPS);
|
||||
};
|
||||
|
||||
const renderLabel = (text: string | number, isMax: boolean): JSX.Element => {
|
||||
return <span className={`bg-inherit absolute top-[calc(100%+4px)] whitespace-nowrap h-5 font-bold rounded-md shadow-center shadow-black px-1 flex items-center ${isMax ? "text-lg" : "text-sm"}`}>{text}</span>;
|
||||
};
|
||||
|
||||
const onNpssChange = ([min, max]: number[]) => {
|
||||
const newFilter: MapFilter = { ...filter, minNps: min, maxNps: max };
|
||||
if (max === MAX_NPS) {
|
||||
delete newFilter.maxNps;
|
||||
}
|
||||
if (min === MIN_NPS) {
|
||||
delete newFilter.minNps;
|
||||
}
|
||||
onChange(newFilter);
|
||||
};
|
||||
|
||||
const onDurationsChange = ([min, max]: number[]) => {
|
||||
const newFilter: MapFilter = { ...filter, minDuration: min, maxDuration: max };
|
||||
if (max === MAX_DURATION) {
|
||||
delete newFilter.maxDuration;
|
||||
}
|
||||
if (min === MIN_DURATION) {
|
||||
delete newFilter.minDuration;
|
||||
}
|
||||
onChange(newFilter);
|
||||
};
|
||||
|
||||
const handleTagClick = (tag: MapTag) => {
|
||||
const enabledTags = filter.enabledTags ?? new Set<MapTag>();
|
||||
const excludedTags = filter.excludedTags ?? new Set<MapTag>();
|
||||
|
||||
if (isTagExcluded(tag)) {
|
||||
excludedTags.delete(tag);
|
||||
} else if (isTagActivated(tag)) {
|
||||
excludedTags.add(tag);
|
||||
enabledTags.delete(tag);
|
||||
} else {
|
||||
enabledTags.add(tag);
|
||||
}
|
||||
|
||||
const newFilter = { ...filter, enabledTags, excludedTags };
|
||||
|
||||
if (newFilter.enabledTags.size === 0) {
|
||||
delete newFilter.enabledTags;
|
||||
}
|
||||
|
||||
if (newFilter.excludedTags.size === 0) {
|
||||
delete newFilter.excludedTags;
|
||||
}
|
||||
|
||||
onChange(newFilter);
|
||||
};
|
||||
|
||||
const translateMapType = (type: MapType): string => {
|
||||
return t(`maps.map-types.${type}`);
|
||||
};
|
||||
|
||||
const translateMapStyle = (style: MapStyle): string => {
|
||||
return t(`maps.map-styles.${style}`);
|
||||
};
|
||||
|
||||
const translateMapSpecificity = (specificity: MapSpecificity): string => {
|
||||
return t(`maps.map-specificities.${specificity}`);
|
||||
};
|
||||
|
||||
type BooleanKeys<T> = { [k in keyof T]: T[k] extends boolean ? k : never }[keyof T];
|
||||
|
||||
const handleCheckbox = (key: BooleanKeys<MapFilter>) => {
|
||||
const newFilter = { ...(filter ?? {}) };
|
||||
if (newFilter[key] === true) {
|
||||
delete newFilter[key];
|
||||
} else {
|
||||
newFilter[key] = true;
|
||||
}
|
||||
onChange(newFilter);
|
||||
};
|
||||
|
||||
const handleApply = () => {
|
||||
onApply(filter);
|
||||
setHaveChanged(() => false);
|
||||
onClose?.(filter);
|
||||
};
|
||||
|
||||
return !playlist ? (
|
||||
<motion.div ref={ref} className={`${className} bg-light-main-color-2 dark:bg-main-color-3`} initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} draggable>
|
||||
<div className="w-full h-6 grid grid-cols-2 gap-x-12 px-4 mb-6 pt-1">
|
||||
<BsmRange min={MIN_NPS} max={MAX_NPS} values={npss} onChange={onNpssChange} renderLabel={renderNpsLabel} step={0.1} />
|
||||
<BsmRange min={MIN_DURATION} max={MAX_DURATION} values={durations} onChange={onDurationsChange} renderLabel={renderDurationLabel} step={5} />
|
||||
<span className=" text-sm font-bold text-center mt-2.5">{t("maps.map-filter-panel.nps")}</span>
|
||||
<span className=" text-sm font-bold text-center mt-2.5">{t("maps.map-filter-panel.duration")}</span>
|
||||
</div>
|
||||
<div className="w-full h-full flex gap-x-2">
|
||||
<section className="shrink-0">
|
||||
<h2 className="mb-1 uppercase text-sm">{t("maps.map-filter-panel.specificities")}</h2>
|
||||
{Object.values(MapSpecificity).map(specificity => (
|
||||
<div key={specificity} className="flex justify-start items-center h-[22px] z-20 relative py-0.5 cursor-pointer" onClick={() => handleCheckbox(specificity)}>
|
||||
<BsmCheckbox className="h-full aspect-square relative bg-inherit mr-1" checked={filter?.[specificity]} onChange={() => handleCheckbox(specificity)} />
|
||||
<span className="grow capitalize">{translateMapSpecificity(specificity)}</span>
|
||||
</div>
|
||||
))}
|
||||
<h2 className="my-1 uppercase text-sm">{t("maps.map-filter-panel.requirements")}</h2>
|
||||
{Object.values(MapRequirement).map(requirement => (
|
||||
<div key={requirement} className="flex justify-start items-center h-[22px] z-20 relative py-0.5 cursor-pointer" onClick={() => handleCheckbox(requirement)}>
|
||||
<BsmCheckbox className="h-full aspect-square relative bg-inherit mr-1" checked={filter?.[requirement]} onChange={() => handleCheckbox(requirement)} />
|
||||
<span className="grow capitalize">{requirement}</span>
|
||||
</div>
|
||||
))}
|
||||
{ !localData && (
|
||||
<>
|
||||
<h2 className="my-1 uppercase text-sm">{t("maps.map-filter-panel.exclude")}</h2>
|
||||
<div className="flex justify-start items-center h-[22px] z-20 relative py-0.5 cursor-pointer" onClick={() => handleCheckbox("installed")}>
|
||||
<BsmCheckbox className="h-full aspect-square relative bg-inherit mr-1" checked={filter?.installed} onChange={() => handleCheckbox("installed")} />
|
||||
<span className="grow capitalize">{t("maps.map-excludes.installed")}</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
<section className="grow capitalize">
|
||||
<h2 className="uppercase text-sm mb-1">{t("maps.map-filter-panel.tags")}</h2>
|
||||
<div className="w-full flex flex-row flex-wrap items-start justify-start content-start gap-1 mb-2">
|
||||
{Object.values(MapType).map(tag => (
|
||||
<span key={tag} onClick={() => handleTagClick(tag)} className={`text-[12.5px] text-black rounded-md px-1 font-bold cursor-pointer ${!isTagActivated(tag) && "opacity-40 hover:opacity-90"}`} style={{ backgroundColor: isTagExcluded(tag) ? MAP_DIFFICULTIES_COLORS.Expert : MAP_DIFFICULTIES_COLORS.Normal }}>
|
||||
{translateMapType(tag)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<div className="w-full flex flex-row flex-wrap items-start justify-start content-start gap-1">
|
||||
{Object.values(MapStyle).map(tag => (
|
||||
<span key={tag} onClick={() => handleTagClick(tag)} className={`text-[12.5px] text-black rounded-md px-1 font-bold cursor-pointer ${!isTagActivated(tag) && "opacity-40 hover:opacity-90"}`} style={{ backgroundColor: isTagExcluded(tag) ? MAP_DIFFICULTIES_COLORS.Expert : MAP_DIFFICULTIES_COLORS.Easy }}>
|
||||
{translateMapStyle(tag)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
{onApply && (
|
||||
<div className="inline float-right relative w-fit h-fit mt-2">
|
||||
<BsmButton className="inline float-right rounded-md font-bold px-1 py-0.5 text-sm" text="misc.apply" typeColor="primary" withBar={false} onClick={handleApply} />
|
||||
<GlowEffect visible={haveChanged} />
|
||||
</div>
|
||||
)}
|
||||
</motion.div>
|
||||
) : (
|
||||
undefined
|
||||
);
|
||||
}
|
||||
|
||||
// Filter functions
|
||||
|
||||
function isFitEnabledTags(filter: MapFilter, tags: MapTag[]): boolean {
|
||||
if (!filter?.enabledTags || filter.enabledTags.size === 0) { return true; }
|
||||
if(!Array.isArray(tags)) { return false; }
|
||||
return Array.from(filter.enabledTags.values()).every(tag => tags.some(mapTag => mapTag === tag));
|
||||
}
|
||||
|
||||
function isFitExcludedTags(filter: MapFilter, tags: MapTag[]): boolean {
|
||||
if (!filter?.excludedTags || filter.excludedTags.size === 0) { return true; }
|
||||
if(!Array.isArray(tags)) { return false; }
|
||||
return !tags.some(tag => filter.excludedTags.has(tag));
|
||||
}
|
||||
|
||||
function isFitMinNps(filter: MapFilter, nps: number): boolean {
|
||||
if (!filter?.minNps) { return true; }
|
||||
return nps > filter.minNps;
|
||||
}
|
||||
|
||||
function isFitMaxNps(filter: MapFilter, nps: number): boolean {
|
||||
if (!filter?.maxNps) { return true; }
|
||||
return nps < filter.maxNps;
|
||||
}
|
||||
|
||||
function isFitMinDuration(filter: MapFilter, duration: number): boolean {
|
||||
if (!filter?.minDuration) { return true; }
|
||||
return duration >= filter.minDuration;
|
||||
}
|
||||
|
||||
function isFitMaxDuration(filter: MapFilter, duration: number): boolean {
|
||||
if (!filter?.maxDuration) { return true; }
|
||||
return duration <= filter.maxDuration;
|
||||
}
|
||||
|
||||
function isFitNoodle(filter: MapFilter, noodle: boolean): boolean {
|
||||
if (!filter?.noodle) { return true; }
|
||||
return noodle;
|
||||
}
|
||||
|
||||
function isFitMe(filter: MapFilter, me: boolean): boolean {
|
||||
if (!filter?.me) { return true; }
|
||||
return me;
|
||||
}
|
||||
|
||||
function isFitCinema(filter: MapFilter, cinema: boolean): boolean {
|
||||
if (!filter?.cinema) { return true; }
|
||||
return cinema;
|
||||
}
|
||||
|
||||
function isFitChroma(filter: MapFilter, chroma: boolean): boolean {
|
||||
if (!filter?.chroma) { return true; }
|
||||
return chroma;
|
||||
}
|
||||
|
||||
function isFitFullSpread(filter: MapFilter, nbDiff: number): boolean {
|
||||
if (!filter?.fullSpread) { return true; }
|
||||
return nbDiff >= 5;
|
||||
}
|
||||
|
||||
function isFitAutomapper(filter: MapFilter, automapper: boolean): boolean {
|
||||
if (!filter?.automapper) { return true; }
|
||||
return automapper;
|
||||
}
|
||||
|
||||
|
||||
function isFitRanked(filter: MapFilter, ranked: boolean): boolean {
|
||||
if (!filter?.ranked) { return true; }
|
||||
return ranked;
|
||||
}
|
||||
|
||||
function isFitCurated(filter: MapFilter, curated: boolean): boolean {
|
||||
if (!filter?.curated) { return true; }
|
||||
return curated;
|
||||
}
|
||||
|
||||
function isFitVerified(filter: MapFilter, verified: boolean): boolean {
|
||||
if (!filter?.verified) { return true; }
|
||||
return verified;
|
||||
}
|
||||
|
||||
function isFitSearch(search: string, {songName, songAuthorName, levelAuthorName}: {songName: string, songAuthorName: string, levelAuthorName: string}): boolean {
|
||||
if (!search) { return true; }
|
||||
return songName?.toLowerCase().includes(search.toLowerCase()) || songAuthorName?.toLowerCase().includes(search.toLowerCase()) || levelAuthorName?.toLowerCase().includes(search.toLowerCase());
|
||||
}
|
||||
|
||||
export const isLocalMapFitMapFilter = ({filter, map, search}: { filter: MapFilter, map: BsmLocalMap, search: string }): boolean => {
|
||||
if (!isFitEnabledTags(filter, map.songDetails?.tags)) { return false; }
|
||||
if (!isFitExcludedTags(filter, map.songDetails?.tags)) { return false; }
|
||||
if (map?.songDetails?.difficulties?.length && !map.songDetails?.difficulties.some(diff => isFitMinNps(filter, diff.nps))) { return false; }
|
||||
if (map?.songDetails?.difficulties?.length && !map.songDetails?.difficulties.some(diff => isFitMaxNps(filter, diff.nps))) { return false; }
|
||||
if (!isFitMinDuration(filter, map.songDetails?.duration)) { return false; }
|
||||
if (!isFitMaxDuration(filter, map.songDetails?.duration)) { return false; }
|
||||
if (!isFitNoodle(filter, map.songDetails?.difficulties.some(diff => !!diff.ne))) { return false; }
|
||||
if (!isFitMe(filter, map.songDetails?.difficulties.some(diff => !!diff.me))) { return false; }
|
||||
if (!isFitCinema(filter, map.songDetails?.difficulties.some(diff => !!diff.cinema))) { return false; }
|
||||
if (!isFitChroma(filter, map.songDetails?.difficulties.some(diff => !!diff.chroma))) { return false; }
|
||||
if (!isFitFullSpread(filter, map.songDetails?.difficulties.length)) { return false; }
|
||||
if (!isFitAutomapper(filter, map.songDetails?.automapper)){ return false; }
|
||||
if (!isFitRanked(filter, map.songDetails?.ranked || map.songDetails?.blRanked)) { return false; }
|
||||
if (!isFitCurated(filter, map.songDetails?.curated)) { return false; }
|
||||
if (!isFitVerified(filter, map.songDetails?.uploader.verified)) { return false; }
|
||||
if (!isFitSearch(search, {songName: map.rawInfo?._songName, songAuthorName: map.rawInfo?._songAuthorName, levelAuthorName: map.rawInfo?._levelAuthorName})) { return false; }
|
||||
return true;
|
||||
};
|
||||
|
||||
export const isBsvMapFitMapFilter = ({filter, map, search}: { filter: MapFilter, map: BsvMapDetail, search: string }): boolean => {
|
||||
|
||||
if (!isFitEnabledTags(filter, map.tags)) { return false; }
|
||||
if (!isFitExcludedTags(filter, map.tags)) { return false; }
|
||||
if (map.versions?.at(0)?.diffs && !map.versions.at(0).diffs.some(diff => isFitMinNps(filter, diff.nps))) { return false; }
|
||||
if (map.versions?.at(0)?.diffs && !map.versions.at(0).diffs.some(diff => isFitMaxNps(filter, diff.nps))) { return false; }
|
||||
if (!isFitMinDuration(filter, map.metadata.duration)) { return false; }
|
||||
if (!isFitMaxDuration(filter, map.metadata.duration)) { return false; }
|
||||
if (!isFitNoodle(filter, map.versions?.at(0)?.diffs.some(diff => !!diff.ne))) { return false; }
|
||||
if (!isFitMe(filter, map.versions?.at(0)?.diffs.some(diff => !!diff.me))) { return false; }
|
||||
if (!isFitCinema(filter, map.versions?.at(0)?.diffs.some(diff => !!diff.cinema))) { return false; }
|
||||
if (!isFitChroma(filter, map.versions?.at(0)?.diffs.some(diff => !!diff.chroma))) { return false; }
|
||||
if (!isFitFullSpread(filter, map.versions?.at(0)?.diffs.length)) { return false; }
|
||||
if (!isFitAutomapper(filter, map.automapper)){ return false; }
|
||||
if (!isFitRanked(filter, map.ranked || map.blRanked)) { return false; }
|
||||
if (!isFitCurated(filter, !!map.curator)) { return false; }
|
||||
if (!isFitVerified(filter, !!map.curatedAt)) { return false; }
|
||||
if (!isFitSearch(search, {songName: map.name, songAuthorName: map.metadata.songAuthorName, levelAuthorName: map.metadata.levelAuthorName})) { return false; }
|
||||
return true;
|
||||
};
|
||||
|
||||
export const isSongDetailsFitMapFilter = ({filter, map, search}: { filter: MapFilter, map: SongDetails, search: string }): boolean => {
|
||||
if (!isFitEnabledTags(filter, map.tags)) { return false; }
|
||||
if (!isFitExcludedTags(filter, map.tags)) { return false; }
|
||||
if (map.difficulties && !map.difficulties.some(diff => isFitMinNps(filter, diff.nps))) { return false; }
|
||||
if (map.difficulties && !map.difficulties.some(diff => isFitMaxNps(filter, diff.nps))) { return false; }
|
||||
if (!isFitMinDuration(filter, map.duration)) { return false; }
|
||||
if (!isFitMaxDuration(filter, map.duration)) { return false; }
|
||||
if (!isFitNoodle(filter, map.difficulties.some(diff => !!diff.ne))) { return false; }
|
||||
if (!isFitMe(filter, map.difficulties.some(diff => !!diff.me))) { return false; }
|
||||
if (!isFitCinema(filter, map.difficulties.some(diff => !!diff.cinema))) { return false; }
|
||||
if (!isFitChroma(filter, map.difficulties.some(diff => !!diff.chroma))) { return false; }
|
||||
if (!isFitFullSpread(filter, map.difficulties.length)) { return false; }
|
||||
if (!isFitAutomapper(filter, map.automapper)){ return false; }
|
||||
if (!isFitRanked(filter, map.ranked || map.blRanked)) { return false; }
|
||||
if (!isFitCurated(filter, map.curated)) { return false; }
|
||||
if (!isFitVerified(filter, map.uploader.verified)) { return false; }
|
||||
if (!isFitSearch(search, {songName: map.name, songAuthorName: map.uploader.name, levelAuthorName: map.uploader.name})) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
export const isMapFitFilter = ({filter, map, search}: { filter: MapFilter, map: BsmLocalMap | BsvMapDetail | SongDetails, search: string }): boolean => {
|
||||
if ((map as BsmLocalMap)?.rawInfo) { return isLocalMapFitMapFilter({filter, map: (map as BsmLocalMap), search}); }
|
||||
if ((map as BsvMapDetail)?.metadata) { return isBsvMapFitMapFilter({filter, map: (map as BsvMapDetail), search}); }
|
||||
if ((map as SongDetails).hash) { return isSongDetailsFitMapFilter({filter, map: (map as SongDetails), search}); }
|
||||
return false;
|
||||
};
|
||||