mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Fix lint errors
This commit is contained in:
@@ -190,15 +190,13 @@ export class LocalPlaylistsManagerService {
|
||||
}
|
||||
|
||||
const songsDetails = localBPList.songs?.map(s => {
|
||||
if(!s){
|
||||
return undefined;
|
||||
}
|
||||
if(s.hash){
|
||||
return this.songDetails.getSongDetails(s.hash);
|
||||
}
|
||||
if(s.key){
|
||||
return this.songDetails.getSongDetailsById(s.key);
|
||||
}
|
||||
return undefined;
|
||||
}).filter(Boolean);
|
||||
|
||||
if(songsDetails && songsDetails.length){
|
||||
@@ -235,7 +233,7 @@ export class LocalPlaylistsManagerService {
|
||||
});
|
||||
}
|
||||
|
||||
public downloadPlaylistSongs(localBPList: LocalBPList, ignoreSongsHashs: string[] = [], version: BSVersion): Observable<Progression<DownloadPlaylistProgressionData>> {
|
||||
public downloadPlaylistSongs(localBPList: LocalBPList, ignoreSongsHashs: string[], version: BSVersion): Observable<Progression<DownloadPlaylistProgressionData>> {
|
||||
|
||||
let destroyed = false;
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ export class LocalMapsManagerService {
|
||||
|
||||
(async () => {
|
||||
for (const map of maps) {
|
||||
let mapPath = map.path;
|
||||
const mapPath = map.path;
|
||||
|
||||
if (pathExistsSync(mapPath)) {
|
||||
await deleteFolder(mapPath);
|
||||
|
||||
@@ -72,6 +72,7 @@ export class SongDetailsCacheService {
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ 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';
|
||||
@@ -47,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");
|
||||
}
|
||||
@@ -115,7 +107,7 @@ export class SteamLauncherService extends AbstractLauncherService implements Sto
|
||||
|
||||
// Linux setup
|
||||
if (process.platform === "linux") {
|
||||
if (launchOptions.admin == true) {
|
||||
if (launchOptions.admin) {
|
||||
log.warn("Launching as admin is not supported on Linux! Starting the game as a normal user.");
|
||||
launchOptions.admin = false;
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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/";
|
||||
@@ -57,7 +56,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;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { BsvMapDetail } from "shared/models/maps";
|
||||
import { BsvPlaylist, BsvPlaylistPage, MapFilter, PlaylistSearchParams, PlaylistSearchResponse, 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;
|
||||
@@ -22,7 +23,7 @@ export class BeatSaverApiService {
|
||||
|
||||
private objectToStringRecord(obj: Record<string, any>): Record<string, string> {
|
||||
return Object.fromEntries(Object.entries(obj)
|
||||
.filter(([_, value]) => value !== undefined && value !== null)
|
||||
.filter(([, value]) => value !== undefined && value !== null)
|
||||
.map(([key, value]) => [key, String(value)] as [string, string]));
|
||||
}
|
||||
|
||||
@@ -62,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(",");
|
||||
|
||||
Reference in New Issue
Block a user