[chore] filter potential oculus token in logs

This commit is contained in:
MathieuG-P
2024-08-01 00:20:02 +02:00
parent 88a1691d4b
commit c313685f6f
5 changed files with 159 additions and 20 deletions
@@ -30,7 +30,7 @@ export const EnterMetaTokenModal: ModalComponent<string> = ({resolver}) => {
const cancel = () => {
resolver({exitCode: ModalExitCode.CANCELED});
}
return (
<form className="flex flex-col w-80 gap-4">
<h1 className="text-3xl uppercase tracking-wide w-full text-center">{t("modals.enter-meta-token.title")}</h1>
@@ -205,7 +205,7 @@ const PasswordInput = ({onChange, value}: {onChange: (value : {password: string,
<input className="grow px-1 py-[2px] outline-none bg-transparent" onChange={e => onChange({password: e.target.value, valid: isPasswordValid(e.target.value)})} value={value} type={showPassword ? "text" : "password"} name="password" id="password" placeholder={t("modals.enter-meta-token.body.password")} />
<BsmButton className="shrink-0 m-1 rounded-md p-0.5 !bg-light-main-color-3 dark:!bg-main-color-3" icon={showPassword ? "eye-cross" : "eye"} withBar={false} onClick={() => setShowPassword(prev => !prev)} />
</div>
</>
</>
)
}
+8
View File
@@ -62,4 +62,12 @@ export function logRenderError(...params: unknown[]){
ipc.sendLazy("log-error", { args: params });
}
export function addFilterStringLog(str: string){
ipc.sendLazy("add-filter-string", { args: str });
}
export function addFilterPatternLog(pattern: string){
ipc.sendLazy("add-filter-pattern", { args: pattern });
}
@@ -11,6 +11,7 @@ import { AbstractBsDownloaderService } from "./abstract-bs-downloader.service";
import { DownloadInfo } from "main/services/bs-version-download/bs-steam-downloader.service";
import { MetaAuthErrorCodes, OculusDownloaderErrorCodes } from "shared/models/bs-version-download/oculus-download.model";
import { EnterMetaTokenModal } from "renderer/components/modal/modal-types/bs-downgrade/enter-meta-token-modal.component";
import { addFilterStringLog } from "renderer";
export class OculusDownloaderService extends AbstractBsDownloaderService implements DownloaderServiceInterface{
@@ -88,6 +89,8 @@ export class OculusDownloaderService extends AbstractBsDownloaderService impleme
return false;
}
addFilterStringLog(tokenRes.data);
return lastValueFrom(this.startDownloadBsVersion({ bsVersion, isVerification, token: tokenRes.data })).then(() => true);
})().then(res => {
@@ -126,4 +129,4 @@ export class OculusDownloaderService extends AbstractBsDownloaderService impleme
return lastValueFrom(this.ipc.sendV2<void>("bs-oculus-clear-auth-token"));
}
}
}
@@ -13,9 +13,10 @@ import { DepotDownloaderErrorEvent, DepotDownloaderEvent, DepotDownloaderEventTy
import { SteamMobileApproveModal } from "renderer/components/modal/modal-types/bs-downgrade/steam-mobile-approve-modal.component";
import { DownloaderServiceInterface } from "./bs-store-downloader.interface";
import { AbstractBsDownloaderService } from "./abstract-bs-downloader.service";
import { addFilterStringLog } from "renderer";
export class SteamDownloaderService extends AbstractBsDownloaderService implements DownloaderServiceInterface{
private static instance: SteamDownloaderService;
public static getInstance(): SteamDownloaderService {
@@ -128,7 +129,7 @@ export class SteamDownloaderService extends AbstractBsDownloaderService implemen
return this.notificationService.notifySuccess({title: "notifications.bs-download.success.titles.verification-finished"});
}
return this.notificationService.notifySuccess({title: "notifications.bs-download.success.titles.download-success"});
}));
}));
return subs;
}
@@ -182,7 +183,7 @@ export class SteamDownloaderService extends AbstractBsDownloaderService implemen
}),
share({connector: () => new ReplaySubject(1)})
);
}
private tryAutoDownloadBsVersion(downloadInfo: DownloadSteamInfo){
@@ -217,7 +218,7 @@ export class SteamDownloaderService extends AbstractBsDownloaderService implemen
}
this.progressBarService.show(this.downloadProgress$, true);
const downloadPromise = (async () => {
const haveDotNet = await this.isDotNet6Installed().catch(() => false);
@@ -227,9 +228,9 @@ export class SteamDownloaderService extends AbstractBsDownloaderService implemen
}
const downloadInfo: DownloadSteamInfo = {bsVersion, isVerification}
const autoDownload = await lastValueFrom(this.tryAutoDownloadBsVersion(downloadInfo)).then(() => true).catch(() => false);
if(autoDownload){ return Promise.resolve(); }
const qrCodeDownload$ = this.startQrCodeDownload(downloadInfo);
@@ -242,6 +243,10 @@ export class SteamDownloaderService extends AbstractBsDownloaderService implemen
return Promise.resolve();
}
if(loginRes?.data?.password){
addFilterStringLog(loginRes.data.password);
}
if(loginRes.data.stay){
this.setSteamSession(loginRes.data.username);
}