Remove GlosSITweaks uninstall from watchdog and let JS handle uninstall itself

pull/239/head
Peter Repukat 1 year ago
parent d303f2be79
commit f2f2144017

@ -32,8 +32,6 @@ limitations under the License.
#include "../common/Settings.h"
#include "../common/HidHide.h"
#include <CEFInject.h>
bool IsProcessRunning(DWORD pid)
{
const HANDLE process = OpenProcess(SYNCHRONIZE, FALSE, pid);
@ -119,10 +117,6 @@ DWORD WINAPI watchdog(HMODULE hModule)
HidHide hidhide;
hidhide.disableHidHide();
spdlog::info("Uninstalling GlosSITweaks");
auto steam_tweaks = CEFInject::SteamTweaks();
steam_tweaks.uninstallTweaks(true);
if (Settings::launch.closeOnExit)
{
spdlog::info("Closing launched processes");

@ -4,11 +4,40 @@ import type { GlosSISettings } from './@types/GlosSISettings';
class SteamTargetApi {
public getGlosSIActive() {
return fetchWithTimeout('http://localhost:8756/', { timeout: 500 })
public static GlosSIActive = true;
public static readonly ACTIVE_FAIL_THRESHOLD = 2;
private activeFailCounter = 0;
private static ActiveCheckTimer = 0;
public constructor() {
if (SteamTargetApi.ActiveCheckTimer !== 0) {
clearInterval(SteamTargetApi.ActiveCheckTimer);
}
SteamTargetApi.ActiveCheckTimer = setInterval(() => {
void this.getGlosSIActive().then((active) => {
if (!active) {
this.activeFailCounter++;
if (this.activeFailCounter >= SteamTargetApi.ACTIVE_FAIL_THRESHOLD) {
window?.GlosSITweaks?.GlosSI?.uninstall?.();
}
}
});
}, 666);
}
public async getGlosSIActive() {
return fetchWithTimeout('http://localhost:8756/running', { timeout: 500 })
.then(
() => true
).catch(() => false);
() => {
SteamTargetApi.GlosSIActive = true;
return true;
}
).catch(() => {
SteamTargetApi.GlosSIActive = false;
return false;
});
}
public getSteamSettings(): Promise<SteamConfig> {
return fetch('http://localhost:8756/steam_settings')
@ -33,6 +62,7 @@ class SteamTargetApi {
class GlosSIApiCtor {
public readonly SteamTarget: SteamTargetApi = new SteamTargetApi();
}
interface GlosSITweaks {
@ -51,7 +81,6 @@ declare global {
const GlosSITweaks: GlosSITweaks;
}
const installGlosSIApi = () => {
window.GlosSITweaks = {
GlosSI: {

Loading…
Cancel
Save