Compare commits

..

8 Commits

Author SHA1 Message Date
MathieuG-P 571a4f23ea re-enable web installer 2023-01-26 00:09:30 +01:00
MathieuG-P 2b9829d57a bumb version 2023-01-25 23:46:55 +01:00
MathieuG-P 2f6ea39f79 Merge pull request #131 from Zagrios/hotfix/file-verification-download-a-version
hotfix/file-verification-download-a-version
2023-01-25 23:45:11 +01:00
MathieuG-P 8e33214fd0 re-add file verification 2023-01-25 23:44:38 +01:00
MathieuG-P 310dfb94c2 Merge pull request #130 from Zagrios/hotfix/disable-web-installer-for-update
hotfix/disable-web-installer-for-update
2023-01-25 20:54:13 +01:00
MathieuG-P 39e2a54e1e Merge pull request #129 from Zagrios/bugfix/selected-effect-missing-available-versions/127
bugfix/selected-effect-missing-available-versions/127
2023-01-25 20:51:02 +01:00
MathieuG-P 829cace7b9 add selected in glowEffect condition 2023-01-25 20:29:08 +01:00
MathieuG-P e82afa7e22 disable web installer for auto update 2023-01-25 20:23:52 +01:00
6 changed files with 23 additions and 20 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "bs-manager",
"version": "1.0.0-alpha.8",
"version": "1.0.0",
"description": "A foundation for scalable desktop apps",
"main": "./dist/main/main.js",
"author": {
+1 -9
View File
@@ -1,6 +1,5 @@
import { ipcMain } from 'electron';
import { BSVersion } from 'shared/bs-version.interface';
import { BSInstallerService, DownloadEventType } from '../services/bs-installer.service';
import { BSInstallerService, DownloadEventType, DownloadInfo } from '../services/bs-installer.service';
import { IpcRequest } from 'shared/models/ipc';
import { InstallationLocationService } from '../services/installation-location.service';
import { UtilsService } from '../services/utils.service';
@@ -18,13 +17,6 @@ export interface InitDownloadInfoInterface {
stay: boolean
}
export interface DownloadInfo {
bsVersion: BSVersion,
username: string,
password?: string,
stay?: boolean
}
ipcMain.on('is-dotnet-6-installed', async (event, request: IpcRequest<void>) => {
const installer = BSInstallerService.getInstance();
const utils = UtilsService.getInstance();
+5 -2
View File
@@ -87,7 +87,9 @@ export class BSInstallerService{
this.utils.createFolderIfNotExist(this.installLocationService.versionsDirectory);
const dest = this.getPathNotAleardyExist(await this.localVersionService.getVersionPath(bsVersion));
const versionPath = await this.localVersionService.getVersionPath(bsVersion)
const dest = !downloadInfos.isVerification ? this.getPathNotAleardyExist(versionPath) : versionPath;
const downloadVersion: BSVersion = {...downloadInfos.bsVersion, ...(path.basename(dest) !== downloadInfos.bsVersion.BSVersion && {name: path.basename(dest)})}
@@ -204,7 +206,8 @@ export interface DownloadInfo {
bsVersion: BSVersion,
username: string,
password?: string,
stay?: boolean
stay?: boolean,
isVerification: boolean
}
export interface DownloadEvent{
@@ -42,7 +42,7 @@ export const AvailableVersionItem = memo(function AvailableVersionItem(props: {v
return (
<motion.li className="group relative w-72 h-60 transition-transform active:scale-[.98]" onClick={toggleSelect} onHoverStart={() => setHovered(true)} onHoverEnd={() => setHovered(false)}>
<GlowEffect visible={hovered} className="absolute"/>
<GlowEffect visible={hovered || selected} className="absolute"/>
<div className={`relative flex flex-col overflow-hidden rounded-md w-72 h-60 cursor-pointer group-hover:shadow-none duration-300 bg-light-main-color-2 dark:bg-main-color-2 ${!selected && "shadow-lg shadow-gray-900"}`}>
<BsmImage image={props.version.ReleaseImg ? props.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={props.version.ReleaseImg ? props.version.ReleaseImg : defaultImage} errorImage={defaultImage} placeholder={defaultImage} className="bg-black w-full h-3/4 object-cover" loading="lazy"/>
@@ -43,9 +43,12 @@ export function BsVersionItem(props: {version: BSVersion}) {
const cancel = () => {
const versionDownload = downloaderService.currentBsVersionDownload$.value;
const wasVerification = downloaderService.isVerification;
downloaderService.cancelDownload().then(async res => {
if(!res.success){ return; }
bsUninstallerService.uninstall(versionDownload).then(res => res && verionManagerService.askInstalledVersions());
if(!wasVerification){
bsUninstallerService.uninstall(versionDownload).then(res => res && verionManagerService.askInstalledVersions());
}
});
}
+11 -6
View File
@@ -1,4 +1,4 @@
import { DownloadEvent } from 'main/services/bs-installer.service';
import { DownloadEvent, DownloadInfo } from 'main/services/bs-installer.service';
import { BehaviorSubject } from 'rxjs';
import { distinctUntilChanged, filter, throttleTime } from 'rxjs/operators';
import { IpcResponse } from 'shared/models/ipc';
@@ -25,6 +25,8 @@ export class BsDownloaderService{
private readonly notificationService: NotificationService;
private readonly linkOpener: LinkOpenerService;
private _isVerification: boolean = false;
public readonly currentBsVersionDownload$: BehaviorSubject<BSVersion> = new BehaviorSubject(null);
public readonly downloadProgress$: BehaviorSubject<number> = new BehaviorSubject(0);
public readonly selectedBsVersion$: BehaviorSubject<BSVersion> = new BehaviorSubject(null);
@@ -94,7 +96,7 @@ export class BsDownloaderService{
return this.ipcService.send<boolean>("is-dotnet-6-installed").then(res => res.success && res.data)
}
public async download(bsVersion: BSVersion, isFirstCall = true): Promise<IpcResponse<DownloadEvent>>{
public async download(bsVersion: BSVersion, isVerification?: boolean, isFirstCall = true): Promise<IpcResponse<DownloadEvent>>{
if(isFirstCall && !this.progressBarService.require()){ return {success: false}; }
if(isFirstCall && !(await this.isDotNet6Installed())){
@@ -114,6 +116,7 @@ export class BsDownloaderService{
}
this.progressBarService.show(this.downloadProgress$);
this._isVerification = isVerification;
let promise;
if(!this.authService.sessionExist()){
@@ -123,22 +126,22 @@ export class BsDownloaderService{
return {success: false};
}
this.authService.setSteamSession(res.data.username, res.data.stay);
promise = this.ipcService.send<DownloadEvent>('bs-download.start', {args: {bsVersion, username: res.data.username, password: res.data.password, stay: res.data.stay}});
promise = this.ipcService.send<DownloadEvent, DownloadInfo>('bs-download.start', {args: {bsVersion, username: res.data.username, password: res.data.password, stay: res.data.stay, isVerification}});
}
else{
promise = this.ipcService.send<DownloadEvent>('bs-download.start', {args: {bsVersion, username: this.authService.getSteamUsername()}});
promise = this.ipcService.send<DownloadEvent, DownloadInfo>('bs-download.start', {args: {bsVersion, username: this.authService.getSteamUsername(), isVerification}});
}
let res = await promise;
if(res.data?.type === "[Password]"){
this.authService.deleteSteamSession();
res = await this.download(bsVersion, false);
res = await this.download(bsVersion, isVerification, false);
}
this.progressBarService.hide(true);
this.resetDownload();
if(res.success && isFirstCall){ this.notificationService.notifySuccess({title: "notifications.bs-download.success.titles.download-success", duration: 3000}); }
if(res.success && isFirstCall){ this.notificationService.notifySuccess({title: `notifications.bs-download.success.titles.${isVerification ? "verification-finished" : "download-success"}`, duration: 3000}); }
else if(res.data && isFirstCall){ this.notificationService.notifyError({title: `notifications.types.error`, desc: `notifications.bs-download.errors.msg.${res.data}`, duration: 3000}); }
return res;
@@ -151,6 +154,8 @@ export class BsDownloaderService{
return res.success ? res.data : "";
}
public get isVerification(): boolean{ return this._isVerification; }
public setInstallationFolder(path: string): Promise<IpcResponse<string>>{
return this.ipcService.send<string>("bs-download.set-installation-folder", {args: path});
}