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, StartDownloadPayload,
PauseDownloadPayload, PauseDownloadPayload,
LibtorrentStatus, LibtorrentStatus,
LibtorrentPayload,
ProcessPayload, ProcessPayload,
LibtorrentSeedingPayload,
LibtorrentDownloadingPayload,
} from "./types"; } from "./types";
import { pythonInstanceLogger as logger } from "../logger"; import { pythonInstanceLogger as logger } from "../logger";
@ -61,15 +62,17 @@ export class PythonInstance {
} }
public static async getSeedingList() { 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; return response.data;
} }
public static async getStatus() { 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 { try {
const { const {
progress, progress,
@ -81,7 +84,7 @@ export class PythonInstance {
folderName, folderName,
status, status,
gameId, gameId,
} = response.data.downloading; } = response.data;
this.downloadingGameId = gameId; this.downloadingGameId = gameId;

View file

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