revert: partially revert changes in getStatus

This commit is contained in:
Hachi-R 2024-11-06 22:23:26 -03:00
parent 6295637b48
commit e8fc71b36b
2 changed files with 9 additions and 11 deletions

View File

@ -16,8 +16,9 @@ import {
StartDownloadPayload,
PauseDownloadPayload,
LibtorrentStatus,
LibtorrentPayload,
ProcessPayload,
LibtorrentSeedingPayload,
LibtorrentDownloadingPayload,
} from "./types";
import { pythonInstanceLogger as logger } from "../logger";
@ -61,15 +62,17 @@ export class PythonInstance {
}
public static async getSeedingList() {
const response = await this.rpc.get<LibtorrentPayload>("/seed-list");
const response = await this.rpc.get<LibtorrentSeedingPayload[] | null>(
"/seed-list"
);
return response.data;
}
public static async getStatus() {
const response = await this.rpc.get<LibtorrentPayload | null>("/status");
const response = await this.rpc.get<LibtorrentDownloadingPayload | null>("/status");
if (response.data?.downloading) {
if (response.data) {
try {
const {
progress,
@ -81,7 +84,7 @@ export class PythonInstance {
folderName,
status,
gameId,
} = response.data.downloading;
} = response.data;
this.downloadingGameId = gameId;

View File

@ -20,7 +20,7 @@ export enum LibtorrentStatus {
Seeding = 5,
}
export interface LibtorrentGamePayload {
export interface LibtorrentDownloadingPayload {
progress: number;
numPeers: number;
numSeeds: number;
@ -32,11 +32,6 @@ export interface LibtorrentGamePayload {
gameId: number;
}
export interface LibtorrentPayload {
downloading?: LibtorrentGamePayload;
seeding: LibtorrentGamePayload[];
}
export interface LibtorrentSeedingPayload {
progress: number;
numPeers: number;