mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a977332c9 | |||
| 81c5a7928a |
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "bs-manager",
|
"name": "bs-manager",
|
||||||
"version": "1.4.11",
|
"version": "1.4.12",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "bs-manager",
|
"name": "bs-manager",
|
||||||
"version": "1.4.11",
|
"version": "1.4.12",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bs-manager",
|
"name": "bs-manager",
|
||||||
"version": "1.4.11",
|
"version": "1.4.12",
|
||||||
"description": "BSManager",
|
"description": "BSManager",
|
||||||
"main": "./dist/main/main.js",
|
"main": "./dist/main/main.js",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { BeatSaverService } from "../thrid-party/beat-saver/beat-saver.service";
|
|||||||
import { copy, copyFile, pathExists, realpath } from "fs-extra";
|
import { copy, copyFile, pathExists, realpath } from "fs-extra";
|
||||||
import { Progression, ensureFolderExist, pathExist } from "../../helpers/fs.helpers";
|
import { Progression, ensureFolderExist, pathExist } from "../../helpers/fs.helpers";
|
||||||
import { IpcService } from "../ipc.service";
|
import { IpcService } from "../ipc.service";
|
||||||
|
import sanitize from "sanitize-filename";
|
||||||
|
|
||||||
export class LocalPlaylistsManagerService {
|
export class LocalPlaylistsManagerService {
|
||||||
private static instance: LocalPlaylistsManagerService;
|
private static instance: LocalPlaylistsManagerService;
|
||||||
@@ -71,12 +72,13 @@ export class LocalPlaylistsManagerService {
|
|||||||
private async installBPListFile(bslistSource: string, version: BSVersion): Promise<string> {
|
private async installBPListFile(bslistSource: string, version: BSVersion): Promise<string> {
|
||||||
const playlistFolder = await this.getPlaylistsFolder(version);
|
const playlistFolder = await this.getPlaylistsFolder(version);
|
||||||
const isLocalFile = await pathExists(bslistSource).catch(e => { log.error(e); return false; });
|
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 filename = isLocalFile ? path.basename(bslistSource) : sanitize(new URL(bslistSource).pathname.split('/').pop())
|
||||||
const destFile = path.join(playlistFolder, filename);
|
const destFile = path.join(playlistFolder, filename);
|
||||||
|
|
||||||
if (isLocalFile) {
|
if (isLocalFile) {
|
||||||
return copyFile(bslistSource, destFile).then(() => destFile);
|
return copyFile(bslistSource, destFile).then(() => destFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return lastValueFrom(this.request.downloadFile(bslistSource, {
|
return lastValueFrom(this.request.downloadFile(bslistSource, {
|
||||||
destFolder: playlistFolder,
|
destFolder: playlistFolder,
|
||||||
filename,
|
filename,
|
||||||
|
|||||||
+3
-2
@@ -8,8 +8,9 @@ export function resolveHtmlPath (htmlFileName: string) {
|
|||||||
const url = new URL(`http://localhost:${port}/${htmlFileName}`);
|
const url = new URL(`http://localhost:${port}/${htmlFileName}`);
|
||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
const filePath = path.resolve(__dirname, "..", "renderer", htmlFileName);
|
|
||||||
return pathToFileURL(filePath).toString();
|
const filePath = path.resolve(__dirname, "..", "renderer");
|
||||||
|
return pathToFileURL(filePath).toString().concat("/", htmlFileName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user