mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
fix: adding real debrid real time tracking
This commit is contained in:
parent
a39082d326
commit
1cc5a5b209
2272
aria2/README.html
2272
aria2/README.html
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@ import {
|
|||||||
defineConfig,
|
defineConfig,
|
||||||
loadEnv,
|
loadEnv,
|
||||||
swcPlugin,
|
swcPlugin,
|
||||||
externalizeDepsPlugin
|
externalizeDepsPlugin,
|
||||||
} from "electron-vite";
|
} from "electron-vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { sentryVitePlugin } from "@sentry/vite-plugin";
|
import { sentryVitePlugin } from "@sentry/vite-plugin";
|
||||||
@ -13,7 +13,7 @@ import svgr from "vite-plugin-svgr";
|
|||||||
var sentryPlugin = sentryVitePlugin({
|
var sentryPlugin = sentryVitePlugin({
|
||||||
authToken: process.env.SENTRY_AUTH_TOKEN,
|
authToken: process.env.SENTRY_AUTH_TOKEN,
|
||||||
org: "hydra-launcher",
|
org: "hydra-launcher",
|
||||||
project: "hydra-launcher"
|
project: "hydra-launcher",
|
||||||
});
|
});
|
||||||
var electron_vite_config_default = defineConfig(({ mode }) => {
|
var electron_vite_config_default = defineConfig(({ mode }) => {
|
||||||
loadEnv(mode);
|
loadEnv(mode);
|
||||||
@ -22,37 +22,35 @@ var electron_vite_config_default = defineConfig(({ mode }) => {
|
|||||||
build: {
|
build: {
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ["better-sqlite3"]
|
external: ["better-sqlite3"],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@main": resolve("src/main"),
|
"@main": resolve("src/main"),
|
||||||
"@locales": resolve("src/locales"),
|
"@locales": resolve("src/locales"),
|
||||||
"@resources": resolve("resources"),
|
"@resources": resolve("resources"),
|
||||||
"@shared": resolve("src/shared")
|
"@shared": resolve("src/shared"),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
plugins: [externalizeDepsPlugin(), swcPlugin(), sentryPlugin]
|
plugins: [externalizeDepsPlugin(), swcPlugin(), sentryPlugin],
|
||||||
},
|
},
|
||||||
preload: {
|
preload: {
|
||||||
plugins: [externalizeDepsPlugin()]
|
plugins: [externalizeDepsPlugin()],
|
||||||
},
|
},
|
||||||
renderer: {
|
renderer: {
|
||||||
build: {
|
build: {
|
||||||
sourcemap: true
|
sourcemap: true,
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@renderer": resolve("src/renderer/src"),
|
"@renderer": resolve("src/renderer/src"),
|
||||||
"@locales": resolve("src/locales"),
|
"@locales": resolve("src/locales"),
|
||||||
"@shared": resolve("src/shared")
|
"@shared": resolve("src/shared"),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
plugins: [svgr(), react(), vanillaExtractPlugin(), sentryPlugin]
|
plugins: [svgr(), react(), vanillaExtractPlugin(), sentryPlugin],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
export {
|
export { electron_vite_config_default as default };
|
||||||
electron_vite_config_default as default
|
|
||||||
};
|
|
||||||
|
@ -51,6 +51,10 @@ export class RealDebridDownloader {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (progress === 1) {
|
||||||
|
await this.pauseDownload();
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
numPeers: 0,
|
numPeers: 0,
|
||||||
numSeeds: 0,
|
numSeeds: 0,
|
||||||
@ -67,13 +71,42 @@ export class RealDebridDownloader {
|
|||||||
} as DownloadProgress;
|
} as DownloadProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.realDebridTorrentId && this.downloadingGame) {
|
||||||
|
const torrentInfo = await RealDebridClient.getTorrentInfo(
|
||||||
|
this.realDebridTorrentId
|
||||||
|
);
|
||||||
|
|
||||||
|
const { status } = torrentInfo;
|
||||||
|
|
||||||
|
if (status === "downloaded") {
|
||||||
|
this.startDownload(this.downloadingGame);
|
||||||
|
}
|
||||||
|
|
||||||
|
const progress = torrentInfo.progress / 100;
|
||||||
|
const totalDownloaded = progress * torrentInfo.bytes;
|
||||||
|
|
||||||
|
return {
|
||||||
|
numPeers: 0,
|
||||||
|
numSeeds: torrentInfo.seeders,
|
||||||
|
downloadSpeed: torrentInfo.speed,
|
||||||
|
timeRemaining: calculateETA(
|
||||||
|
torrentInfo.bytes,
|
||||||
|
totalDownloaded,
|
||||||
|
torrentInfo.speed
|
||||||
|
),
|
||||||
|
isDownloadingMetadata: status === "magnet_conversion",
|
||||||
|
} as DownloadProgress;
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static async pauseDownload() {
|
static async pauseDownload() {
|
||||||
HttpDownload.pauseDownload();
|
await HttpDownload.pauseDownload();
|
||||||
|
|
||||||
this.realDebridTorrentId = null;
|
this.realDebridTorrentId = null;
|
||||||
this.downloadingGame = null;
|
this.downloadingGame = null;
|
||||||
|
this.downloads.delete(this.downloadingGame!.id!);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async startDownload(game: Game) {
|
static async startDownload(game: Game) {
|
||||||
|
Loading…
Reference in New Issue
Block a user