mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-23 02:41:02 +00:00
feat: remove pslist and use sudo-prompt to close game if needed
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
PauseDownloadPayload,
|
||||
LibtorrentStatus,
|
||||
LibtorrentPayload,
|
||||
ProcessPayload,
|
||||
} from "./types";
|
||||
|
||||
export class RPCManager {
|
||||
@@ -49,8 +50,10 @@ export class RPCManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static async getProccessList() {
|
||||
return (await this.rpc.get<string[] | null>("/process-list")).data || [];
|
||||
public static async getProcessList() {
|
||||
return (
|
||||
(await this.rpc.get<ProcessPayload[] | null>("/process-list")).data || []
|
||||
);
|
||||
}
|
||||
|
||||
public static async getStatus() {
|
||||
|
||||
@@ -31,3 +31,8 @@ export interface LibtorrentPayload {
|
||||
status: LibtorrentStatus;
|
||||
gameId: number;
|
||||
}
|
||||
|
||||
export interface ProcessPayload {
|
||||
exe: string;
|
||||
pid: number;
|
||||
}
|
||||
|
||||
@@ -19,14 +19,13 @@ export const watchProcesses = async () => {
|
||||
});
|
||||
|
||||
if (games.length === 0) return;
|
||||
|
||||
const processes = await RPCManager.getProccessList();
|
||||
const processes = await RPCManager.getProcessList();
|
||||
|
||||
for (const game of games) {
|
||||
const executablePath = game.executablePath!;
|
||||
|
||||
const gameProcess = processes.find((runningProcess) => {
|
||||
return executablePath == runningProcess;
|
||||
return executablePath == runningProcess.exe;
|
||||
});
|
||||
|
||||
if (gameProcess) {
|
||||
|
||||
Reference in New Issue
Block a user