mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: adding authorization to rpc
This commit is contained in:
parent
96e96cd8aa
commit
363bcf16a4
6 changed files with 166 additions and 49 deletions
|
|
@ -22,13 +22,14 @@ export function useDownload() {
|
|||
);
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const startDownload = (payload: StartGameDownloadPayload) =>
|
||||
const startDownload = (payload: StartGameDownloadPayload) => {
|
||||
dispatch(clearDownload());
|
||||
window.electron.startGameDownload(payload).then((game) => {
|
||||
dispatch(clearDownload());
|
||||
updateLibrary();
|
||||
|
||||
return game;
|
||||
});
|
||||
};
|
||||
|
||||
const pauseDownload = async (gameId: number) => {
|
||||
await window.electron.pauseGameDownload(gameId);
|
||||
|
|
@ -65,7 +66,7 @@ export function useDownload() {
|
|||
updateLibrary();
|
||||
});
|
||||
|
||||
const getETA = () => {
|
||||
const calculateETA = () => {
|
||||
if (!lastPacket || lastPacket.timeRemaining < 0) return "";
|
||||
|
||||
try {
|
||||
|
|
@ -87,7 +88,7 @@ export function useDownload() {
|
|||
downloadSpeed: `${formatBytes(lastPacket?.downloadSpeed ?? 0)}/s`,
|
||||
progress: formatDownloadProgress(lastPacket?.progress ?? 0),
|
||||
lastPacket,
|
||||
eta: getETA(),
|
||||
eta: calculateETA(),
|
||||
startDownload,
|
||||
pauseDownload,
|
||||
resumeDownload,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue