mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Compare commits
16 Commits
v1.3.1-alpha.2
...
v1.3.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 109d560953 | |||
| bfc853ee55 | |||
| fc2cb676d2 | |||
| 226468aa00 | |||
| 767bbf389b | |||
| 0de2ea44d3 | |||
| 1dde41f4f6 | |||
| 029df85ddb | |||
| 139f17d7fc | |||
| 92fd59be1e | |||
| d61f59c714 | |||
| 64e3652b60 | |||
| 6f018e6a32 | |||
| da3b2b13a8 | |||
| 381daa80a4 | |||
| bdfe8ce535 |
@@ -573,5 +573,13 @@
|
||||
"ReleaseImg": "https://clan.akamai.steamstatic.com/images/32055887/58621b3cb8bf42fcfbf3b97fe47aa91b290eea04.png",
|
||||
"ReleaseDate": "1693824747",
|
||||
"year": "2023"
|
||||
},
|
||||
{
|
||||
"BSVersion": "1.32.0",
|
||||
"BSManifest": "1660149393914874041",
|
||||
"ReleaseURL": "https://steamcommunity.com/games/620980/announcements/detail/3723971545002767483",
|
||||
"ReleaseImg": "https://clan.cloudflare.steamstatic.com/images/32055887/02284793f06188caf740da66939679afc25415e4.png",
|
||||
"ReleaseDate": "1696517680",
|
||||
"year": "2023"
|
||||
}
|
||||
]
|
||||
@@ -44,7 +44,7 @@
|
||||
"maps": {
|
||||
"title": "Shared maps",
|
||||
"search-bar": {
|
||||
"search-placeholder": "Search installed maps",
|
||||
"search-placeholder": "Search a map",
|
||||
"filters-btn": "Filters",
|
||||
"dropdown": {
|
||||
"export-maps": "Export maps",
|
||||
@@ -738,7 +738,7 @@
|
||||
},
|
||||
"panel": {
|
||||
"actions": {
|
||||
"search": "Search installed models",
|
||||
"search": "Search a model",
|
||||
"drop-down": {
|
||||
"delete": "Delete models",
|
||||
"export": "Export models"
|
||||
|
||||
Generated
+7
-8
@@ -24,6 +24,7 @@
|
||||
"history": "^5.3.0",
|
||||
"jszip": "^3.10.1",
|
||||
"md5-file": "^5.0.0",
|
||||
"node-abi": "^3.47.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-stream-zip": "^1.15.0",
|
||||
"ps-list": "^7.2.0",
|
||||
@@ -13509,10 +13510,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/node-abi": {
|
||||
"version": "3.28.0",
|
||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.28.0.tgz",
|
||||
"integrity": "sha512-fRlDb4I0eLcQeUvGq7IY3xHrSb0c9ummdvDSYWfT9+LKP+3jCKw/tKoqaM7r1BAoiAC6GtwyjaGnOz6B3OtF+A==",
|
||||
"dev": true,
|
||||
"version": "3.47.0",
|
||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.47.0.tgz",
|
||||
"integrity": "sha512-2s6B2CWZM//kPgwnuI0KrYwNjfdByE25zvAaEpq9IH4zcNsarH8Ihu/UuX6XMPEogDAxkuUFeZn60pXNHAqn3A==",
|
||||
"dependencies": {
|
||||
"semver": "^7.3.5"
|
||||
},
|
||||
@@ -29518,10 +29518,9 @@
|
||||
}
|
||||
},
|
||||
"node-abi": {
|
||||
"version": "3.28.0",
|
||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.28.0.tgz",
|
||||
"integrity": "sha512-fRlDb4I0eLcQeUvGq7IY3xHrSb0c9ummdvDSYWfT9+LKP+3jCKw/tKoqaM7r1BAoiAC6GtwyjaGnOz6B3OtF+A==",
|
||||
"dev": true,
|
||||
"version": "3.47.0",
|
||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.47.0.tgz",
|
||||
"integrity": "sha512-2s6B2CWZM//kPgwnuI0KrYwNjfdByE25zvAaEpq9IH4zcNsarH8Ihu/UuX6XMPEogDAxkuUFeZn60pXNHAqn3A==",
|
||||
"requires": {
|
||||
"semver": "^7.3.5"
|
||||
}
|
||||
|
||||
@@ -244,6 +244,7 @@
|
||||
"history": "^5.3.0",
|
||||
"jszip": "^3.10.1",
|
||||
"md5-file": "^5.0.0",
|
||||
"node-abi": "^3.47.0",
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-stream-zip": "^1.15.0",
|
||||
"ps-list": "^7.2.0",
|
||||
|
||||
Generated
+855
-246
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "bs-manager",
|
||||
"version": "1.3.1-alpha.2",
|
||||
"version": "1.3.2",
|
||||
"description": "BSManager",
|
||||
"main": "./dist/main/main.js",
|
||||
"author": {
|
||||
@@ -14,8 +14,8 @@
|
||||
"postinstall": "npm run electron-rebuild && npm run link-modules"
|
||||
},
|
||||
"dependencies": {
|
||||
"@resvg/resvg-js": "^2.4.1",
|
||||
"ps-list": "^7.2.0"
|
||||
"ps-list": "^7.2.0",
|
||||
"sharp": "^0.32.6"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { BsmLocalMap } from "shared/models/maps/bsm-local-map.interface";
|
||||
import { BsvMapDetail } from "shared/models/maps";
|
||||
import { IpcService } from "../services/ipc.service";
|
||||
import { from } from "rxjs";
|
||||
import log from "electron-log"
|
||||
|
||||
const ipc = IpcService.getInstance();
|
||||
|
||||
@@ -71,6 +72,7 @@ ipc.on("one-click-install-map", async (request: IpcRequest<BsvMapDetail>) => {
|
||||
utils.ipcSend(request.responceChannel, { success: true });
|
||||
})
|
||||
.catch(err => {
|
||||
log.error(err);
|
||||
utils.ipcSend(request.responceChannel, { success: false, error: err });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ 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 log from "electron-log";
|
||||
|
||||
ipcMain.on("one-click-install-playlist", async (event, request: IpcRequest<string>) => {
|
||||
const utils = UtilsService.getInstance();
|
||||
@@ -13,6 +14,7 @@ ipcMain.on("one-click-install-playlist", async (event, request: IpcRequest<strin
|
||||
utils.ipcSend(request.responceChannel, { success: true });
|
||||
})
|
||||
.catch(e => {
|
||||
log.error(e);
|
||||
utils.ipcSend(request.responceChannel, { success: false, error: e });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ import { InstallationLocationService } from "../installation-location.service";
|
||||
import { UtilsService } from "../utils.service";
|
||||
import crypto from "crypto";
|
||||
import { lstatSync } from "fs";
|
||||
import { copy, createReadStream, ensureDir, unlink } from "fs-extra";
|
||||
import { copy, createReadStream, ensureDir, realpath, unlink } from "fs-extra";
|
||||
import StreamZip from "node-stream-zip";
|
||||
import { RequestService } from "../request.service";
|
||||
import sanitize from "sanitize-filename";
|
||||
@@ -290,10 +290,16 @@ export class LocalMapsManagerService {
|
||||
|
||||
const versions = await this.localVersion.getInstalledVersions();
|
||||
const downloadedMap = await this.downloadMap(map, versions.pop());
|
||||
const downloadedMapRealFolder = await realpath(path.dirname(downloadedMap.path));
|
||||
|
||||
for (const version of versions) {
|
||||
const versionMapsPath = await this.getMapsFolderPath(version);
|
||||
await ensureDir(versionMapsPath);
|
||||
|
||||
if((await realpath(versionMapsPath)) === downloadedMapRealFolder){
|
||||
continue;
|
||||
}
|
||||
|
||||
await copy(downloadedMap.path, path.join(versionMapsPath, path.basename(downloadedMap.path)), { overwrite: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { IpcRequest } from "shared/models/ipc";
|
||||
import { BPList, DownloadPlaylistProgression } from "shared/models/playlists/playlist.interface";
|
||||
import { copyFileSync, readFileSync } from "fs";
|
||||
import { BeatSaverService } from "../thrid-party/beat-saver/beat-saver.service";
|
||||
import { copySync } from "fs-extra";
|
||||
import { copy, realpath } from "fs-extra";
|
||||
import { ensureFolderExist, pathExist } from "../../helpers/fs.helpers";
|
||||
|
||||
export class LocalPlaylistsManagerService {
|
||||
@@ -180,14 +180,27 @@ export class LocalPlaylistsManagerService {
|
||||
|
||||
const { bpListPath, mapsPath } = await lastValueFrom(this.downloadPlaylist(bpListUrl, versions.pop()));
|
||||
|
||||
if(mapsPath?.length === 0 || !bpListPath) {
|
||||
return;
|
||||
}
|
||||
|
||||
const realSourceMapsFolder = await realpath(path.dirname(mapsPath[0]));
|
||||
|
||||
for (const version of versions) {
|
||||
await this.installBPListFile(bpListPath, version);
|
||||
|
||||
const versionMapsFolder = await this.maps.getMapsFolderPath(version);
|
||||
const realDestMapsFolder = await realpath(versionMapsFolder);
|
||||
|
||||
if(realSourceMapsFolder === realDestMapsFolder) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const mapPath of mapsPath) {
|
||||
const versionMapsFolder = await this.maps.getMapsFolderPath(version);
|
||||
|
||||
const mapDest = path.join(versionMapsFolder, path.basename(mapPath));
|
||||
|
||||
copySync(mapPath, mapDest, { overwrite: true });
|
||||
await copy(mapPath, mapDest, { overwrite: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import log from "electron-log";
|
||||
import { Observable, of } from "rxjs";
|
||||
import { BsmProtocolService } from "./bsm-protocol.service";
|
||||
import { app, shell} from "electron";
|
||||
import { Resvg } from "@resvg/resvg-js";
|
||||
import Color from "color";
|
||||
import { ensureDir, writeFile } from "fs-extra";
|
||||
import toIco from "to-ico";
|
||||
@@ -20,6 +19,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";
|
||||
|
||||
export class BSLauncherService {
|
||||
private static instance: BSLauncherService;
|
||||
@@ -161,7 +161,7 @@ export class BSLauncherService {
|
||||
bsProcess.removeAllListeners("error");
|
||||
bsProcess.removeAllListeners("exit");
|
||||
resolve(-1);
|
||||
}, 15_000);
|
||||
}, 30_000);
|
||||
|
||||
}).then(exitCode => {
|
||||
log.info("BS process exit code", exitCode);
|
||||
@@ -183,7 +183,13 @@ export class BSLauncherService {
|
||||
shortcutLink = new URL(shortcutLink);
|
||||
}
|
||||
|
||||
return objectFromEntries(shortcutLink.searchParams.entries()) as ShortcutParams;
|
||||
const params = objectFromEntries(shortcutLink.searchParams.entries()) as ShortcutParams;
|
||||
|
||||
if(typeof params.additionalArgs === "string"){
|
||||
params.additionalArgs = [params.additionalArgs];
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
public shortcutLinkToLaunchOptions(shortcutLink: string|URL): LaunchOption{
|
||||
@@ -224,19 +230,16 @@ export class BSLauncherService {
|
||||
return res;
|
||||
}
|
||||
|
||||
private createShortcutPngBuffer(color: Color): Buffer{
|
||||
private createShortcutPngBuffer(color: Color): Promise<Buffer>{
|
||||
|
||||
const svgIcon = `
|
||||
const svgBuffer = Buffer.from(`
|
||||
<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 new Resvg(svgIcon, {
|
||||
fitTo: { mode: "width", value: 256 }
|
||||
}).render().asPng();
|
||||
`);
|
||||
|
||||
return sharp(svgBuffer).resize(256).png().toBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,7 +265,7 @@ export class BSLauncherService {
|
||||
* @returns {Promise<string>} Path of the icon
|
||||
*/
|
||||
private async createShortcutIco(color: Color): Promise<string>{
|
||||
const pngBuffer = this.createShortcutPngBuffer(color);
|
||||
const pngBuffer = await this.createShortcutPngBuffer(color);
|
||||
const icoBuffer = await toIco([pngBuffer]);
|
||||
|
||||
await ensureDir(IMAGE_CACHE_PATH);
|
||||
|
||||
Reference in New Issue
Block a user