Merge branch 'v1.5.0' into feature/playlists/107

This commit is contained in:
MathieuG-P
2024-06-08 16:38:13 +02:00
31 changed files with 61 additions and 337 deletions
@@ -14,11 +14,6 @@ ipc.on("import-version", (args, reply) => {
// #region Steam
ipc.on("is-dotnet-6-installed", (_, reply) => {
const installer = BsSteamDownloaderService.getInstance();
reply(from(installer.isDotNet6Installed()));
});
ipc.on("bs-download.installation-folder", (_, reply) => {
const installLocation = InstallationLocationService.getInstance();
reply(from(installLocation.installationDirectory()));
@@ -3,7 +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";
import { sToMs } from "../../../shared/helpers/time.helpers";
export abstract class AbstractLauncherService {
@@ -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}> {
@@ -84,13 +67,12 @@ export class BsSteamDownloaderService {
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,
command: exePath,
args,
options: { cwd: this.installLocationService.versionsDirectory() },
echoStartData: downloadVersion
}, log);
@@ -43,6 +43,20 @@ function ModelItemElement<T = unknown>(props: Props<T>) {
const [idContentCopied, setIdContentCopied] = useState<string>(null);
const ref = useRef();
const isNsfw = (() => {
const tags = props.tags?.map(tag => tag.toLowerCase()) ?? [];
const name = props.name.toLowerCase() ?? "";
return (
tags.includes("nsfw") ||
tags.includes("18+") ||
name.includes("nsfw") ||
name.includes("18+") ||
name.includes("nude") ||
name.includes("naked") ||
name.includes("lewd")
);
})();
useDoubleClick({
ref,
latency: props.onDoubleClick ? 200 : 0,
@@ -117,8 +131,8 @@ function ModelItemElement<T = unknown>(props: Props<T>) {
<GlowEffect visible={props.selected || hovered} />
<div className="absolute top-0 left-0 w-full h-full rounded-lg overflow-hidden blur-none bg-black shadow-sm shadow-black">
<div ref={ref} className="contents">
<BsmImage className="absolute top-0 left-0 w-full h-full object-cover brightness-50 scale-[200%] blur-md" image={thumbnailUrl} placeholder={defaultImage} />
<BsmImage className="absolute top-0 left-1/2 -translate-x-1/2 max-w-[20rem] w-full h-full object-cover" image={thumbnailUrl} placeholder={defaultImage} />
<BsmImage className="absolute top-0 left-0 w-full h-full object-cover brightness-50 scale-[200%] blur-md" image={thumbnailUrl} placeholder={defaultImage} loading="lazy" />
<BsmImage className="absolute top-0 left-1/2 -translate-x-1/2 max-w-[20rem] w-full h-full object-cover" image={thumbnailUrl} placeholder={defaultImage} loading="lazy" style={isNsfw && {filter: "blur(10px)"}} />
<div className="absolute top-0 right-0 h-full w-0 flex flex-col items-end gap-1 pt-1.5 pr-1.5">
{!props.isDownloading ? (
actionButtons().map((button, index) => (
@@ -41,6 +41,7 @@ import { OculusIcon } from "renderer/components/svgs/icons/oculus-icon.component
import { BsDownloaderService } from "renderer/services/bs-version-download/bs-downloader.service";
import { AutoUpdaterService } from "renderer/services/auto-updater.service";
import BeatWaitingImg from "../../../assets/images/apngs/beat-waiting.png";
import { logRenderError } from "renderer";
export function SettingsPage() {
@@ -145,7 +146,8 @@ export function SettingsPage() {
.then(() => {
setIsChangelogAvailable(() => true);
})
.catch(() => {
.catch(err => {
logRenderError(err);
setIsChangelogAvailable(() => false);
})
.finally(() => { isChangelogResolved = true; });
@@ -44,28 +44,11 @@ export class SteamDownloaderService extends AbstractBsDownloaderService implemen
this.linkOpener = LinkOpenerService.getInstance();
}
public isDotNet6Installed(): Promise<boolean> {
return lastValueFrom(this.ipcService.sendV2("is-dotnet-6-installed"));
}
private setSteamSession(username: string): void { localStorage.setItem(this.STEAM_SESSION_USERNAME_KEY, username); }
private getSteamUsername(): string { return localStorage.getItem(this.STEAM_SESSION_USERNAME_KEY); }
public deleteSteamSession(): void { localStorage.removeItem(this.STEAM_SESSION_USERNAME_KEY); }
public sessionExist(): boolean { return !!localStorage.getItem(this.STEAM_SESSION_USERNAME_KEY); }
private async showDotNetNotInstalledError(): Promise<void> {
const choice = await this.notificationService.notifyError({
duration: 11_000,
title: "notifications.bs-download.steam-download.errors.titles.dotnet-required",
desc: "notifications.bs-download.steam-download.errors.msg.dotnet-required",
actions: [{ id: "0", title: "notifications.bs-download.steam-download.errors.actions.download-dotnet" }],
});
if (choice === "0") {
this.linkOpener.open("https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-6.0.12-windows-x64-installer");
}
}
public async getInstallationFolder(): Promise<string> {
return lastValueFrom(this.ipcService.sendV2("bs-download.installation-folder"));
}
@@ -220,12 +203,6 @@ export class SteamDownloaderService extends AbstractBsDownloaderService implemen
const downloadPromise = (async () => {
const haveDotNet = await this.isDotNet6Installed().catch(() => false);
if(!haveDotNet){
this.showDotNetNotInstalledError();
return Promise.reject(new Error("DotNet not installed"));
}
const downloadInfo: DownloadSteamInfo = {bsVersion, isVerification}
const autoDownload = await lastValueFrom(this.tryAutoDownloadBsVersion(downloadInfo)).then(() => true).catch(() => false);
+2 -1
View File
@@ -24,6 +24,7 @@ import { OsDiagnosticService } from "renderer/services/os-diagnostic.service";
import { useService } from "renderer/hooks/use-service.hook";
import { AutoUpdaterService } from "renderer/services/auto-updater.service";
import { gt, parse } from "semver"
import { logRenderError } from "renderer";
export default function App() {
useService(OsDiagnosticService);
@@ -50,7 +51,7 @@ export default function App() {
autoUpdater.setLastAppVersion(appVersion);
if (parse(lastAppVersion) && gt(appVersion, lastAppVersion)) {
autoUpdater.showChangelog(appVersion);
await autoUpdater.showChangelog(appVersion).catch(logRenderError);
}
};
-1
View File
@@ -26,7 +26,6 @@ export interface IpcChannelMapping {
/* ** bs-download-ipcs ** */
"import-version": { request: ImportVersionOptions, response: Progression<BSVersion>};
"is-dotnet-6-installed": { request: void, response: boolean};
"bs-download.installation-folder": { request: void, response: string};
"bs-download.set-installation-folder": { request: string, response: string};
"auto-download-bs-version": { request: DownloadSteamInfo, response: DepotDownloaderEvent};