mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
refactor: Update import paths and improve async function in get-magnet-health
This commit is contained in:
parent
23ab98294a
commit
0333282915
3 changed files with 8 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { webTorrentData } from "@main/services/web-torrent-health"
|
import { webTorrentData } from "@main/services/web-torrent-data"
|
||||||
import { registerEvent } from "../register-event"
|
import { registerEvent } from "../../register-event"
|
||||||
|
|
||||||
const getMagnetHealth = async (_event: Electron.IpcMainInvokeEvent, magnet: string) => {
|
const getMagnetHealth = async (_event: Electron.IpcMainInvokeEvent, magnet: string) => {
|
||||||
return webTorrentData.getSeedersAndPeers(magnet)
|
return webTorrentData.getSeedersAndPeers(magnet)
|
|
@ -7,6 +7,7 @@ import "./catalogue/get-games";
|
||||||
import "./catalogue/get-how-long-to-beat";
|
import "./catalogue/get-how-long-to-beat";
|
||||||
import "./catalogue/get-random-game";
|
import "./catalogue/get-random-game";
|
||||||
import "./catalogue/search-games";
|
import "./catalogue/search-games";
|
||||||
|
import "./catalogue/repacks/get-magnet-health"
|
||||||
import "./hardware/get-disk-free-space";
|
import "./hardware/get-disk-free-space";
|
||||||
import "./library/add-game-to-library";
|
import "./library/add-game-to-library";
|
||||||
import "./library/close-game";
|
import "./library/close-game";
|
||||||
|
@ -27,7 +28,6 @@ import "./torrenting/start-game-download";
|
||||||
import "./user-preferences/get-user-preferences";
|
import "./user-preferences/get-user-preferences";
|
||||||
import "./user-preferences/update-user-preferences";
|
import "./user-preferences/update-user-preferences";
|
||||||
import "./user-preferences/auto-launch";
|
import "./user-preferences/auto-launch";
|
||||||
import "./repacks/get-magnet-health"
|
|
||||||
|
|
||||||
ipcMain.handle("ping", () => "pong");
|
ipcMain.handle("ping", () => "pong");
|
||||||
ipcMain.handle("getVersion", () => app.getVersion());
|
ipcMain.handle("getVersion", () => app.getVersion());
|
||||||
|
|
|
@ -10,10 +10,12 @@ export const webTorrentData = {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
WebTorrentHealth(magnet, (err: Error, data: WebTorrentHealthData) => {
|
WebTorrentHealth(magnet, (err: Error, data: WebTorrentHealthData) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
return reject(err);
|
||||||
} else {
|
|
||||||
resolve(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { peers, seeds } = data;
|
||||||
|
|
||||||
|
return resolve({ peers, seeders: seeds });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue