From 02c4f0a0e63691ff27908760b260e7ea5c2414f4 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 11:42:53 -0300 Subject: [PATCH 01/38] feat: Add repack language codes to translation files --- src/locales/en/translation.json | 13 ++++++++++++- src/locales/es/translation.json | 13 ++++++++++++- src/locales/fr/translation.json | 13 ++++++++++++- src/locales/hu/translation.json | 13 ++++++++++++- src/locales/it/translation.json | 13 ++++++++++++- src/locales/pl/translation.json | 13 ++++++++++++- src/locales/pt/translation.json | 13 ++++++++++++- src/locales/ru/translation.json | 13 ++++++++++++- src/locales/tr/translation.json | 15 +++++++++++++-- 9 files changed, 109 insertions(+), 10 deletions(-) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index ccc31520..8f0e6121 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -96,7 +96,18 @@ "dont_show_it_again": "Don't show it again", "copy_to_clipboard": "Copy", "copied_to_clipboard": "Copied", - "got_it": "Got it" + "got_it": "Got it", + "repack_language_code": { + "en": "English", + "es": "Spanish", + "fr": "French", + "hu": "Hungarian", + "it": "Italian", + "pl": "Polish", + "pt": "Portuguese", + "ru": "Russian", + "tr": "Turkish" + } }, "activation": { "title": "Activate Hydra", diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json index 1a8f5d48..92a2aabd 100644 --- a/src/locales/es/translation.json +++ b/src/locales/es/translation.json @@ -90,7 +90,18 @@ "dodi_installation_instruction": "Cuando abras el instalador de DODI, presiona la tecla hacia arriba del teclado <0 /> para iniciar el proceso de instalación:", "dont_show_it_again": "No mostrar de nuevo", "copy_to_clipboard": "Copiar", - "copied_to_clipboard": "Copiado" + "copied_to_clipboard": "Copiado", + "repack_language_code": { + "en": "Inglés", + "es": "Español", + "fr": "Francés", + "hu": "Húngaro", + "it": "Italiano", + "pl": "Polaco", + "pt": "Portugués", + "ru": "Ruso", + "tr": "Turco" + } }, "activation": { "title": "Activar Hydra", diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json index 2e17f492..60edfe04 100644 --- a/src/locales/fr/translation.json +++ b/src/locales/fr/translation.json @@ -75,7 +75,18 @@ "close": "Fermer", "deleting": "Suppression du programme d'installation…", "playing_now": "Jeu en cours", - "last_time_played": "Dernièrement joué {{période}}" + "last_time_played": "Dernièrement joué {{période}}", + "repack_language_code": { + "en": "Anglais", + "es": "Espagnol", + "fr": "Français", + "hu": "Hongrois", + "it": "Italien", + "pl": "Polonais", + "pt": "Portugais", + "ru": "Russe", + "tr": "Turc" + } }, "activation": { "title": "Activer Hydra", diff --git a/src/locales/hu/translation.json b/src/locales/hu/translation.json index 8a370fb2..d75ac902 100644 --- a/src/locales/hu/translation.json +++ b/src/locales/hu/translation.json @@ -84,7 +84,18 @@ "repacks_modal_description": "Choose the repack you want to download", "downloads_path": "Letöltések helye", "select_folder_hint": "Ahhoz, hogy megváltoztasd a helyet, hozzákell férned a", - "download_now": "Töltsd le most" + "download_now": "Töltsd le most", + "repack_language_code": { + "en": "Angol", + "es": "Spanyol", + "fr": "Francia", + "hu": "Magyar", + "it": "Olasz", + "pl": "Lengyel", + "pt": "Portugál", + "ru": "Orosz", + "tr": "Török" + } }, "activation": { "title": "Hydra Aktiválása", diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json index b4ff3723..cb1a3136 100644 --- a/src/locales/it/translation.json +++ b/src/locales/it/translation.json @@ -96,7 +96,18 @@ "dont_show_it_again": "Non mostrarlo più", "copy_to_clipboard": "Copia", "copied_to_clipboard": "Copiato", - "got_it": "Capito" + "got_it": "Capito", + "repack_language_code": { + "en": "Inglese", + "es": "Spagnolo", + "fr": "Francese", + "hu": "Ungherese", + "it": "Italiano", + "pl": "Polacco", + "pt": "Portoghese", + "ru": "Russo", + "tr": "Turco" + } }, "activation": { "title": "Attiva Hydra", diff --git a/src/locales/pl/translation.json b/src/locales/pl/translation.json index 5623c74e..06793a54 100644 --- a/src/locales/pl/translation.json +++ b/src/locales/pl/translation.json @@ -83,7 +83,18 @@ "downloads_path": "Ścieżka pobierania", "select_folder_hint": "Aby zmienić domyślny folder, przejdź do", "settings": "Ustawienia Hydra", - "download_now": "Pobierz teraz" + "download_now": "Pobierz teraz", + "repack_language_code": { + "en": "Angielski", + "es": "Hiszpański", + "fr": "Francuski", + "hu": "Węgierski", + "it": "Włoski", + "pl": "Polski", + "pt": "Portugalski", + "ru": "Rosyjski", + "tr": "Turecki" + } }, "activation": { "title": "Aktywuj Hydra", diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index c5e66c02..00b9340e 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -92,7 +92,18 @@ "dont_show_it_again": "Não mostrar novamente", "copy_to_clipboard": "Copiar", "copied_to_clipboard": "Copiado", - "got_it": "Entendi" + "got_it": "Entendi", + "repack_language_code": { + "en": "Inglês", + "es": "Espanhol", + "fr": "Francês", + "hu": "Húngaro", + "it": "Italiano", + "pl": "Polonês", + "pt": "Português", + "ru": "Russo", + "tr": "Turco" + } }, "activation": { "title": "Ativação", diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json index 5372420d..759792d4 100644 --- a/src/locales/ru/translation.json +++ b/src/locales/ru/translation.json @@ -96,7 +96,18 @@ "dont_show_it_again": "Не показывать это снова", "copy_to_clipboard": "Копировать", "copied_to_clipboard": "Скопировано", - "got_it": "Понятно" + "got_it": "Понятно", + "repack_language_code": { + "en": "Английский", + "es": "Испанский", + "fr": "Французский", + "hu": "Венгерский", + "it": "Итальянский", + "pl": "Польский", + "pt": "Португальский", + "ru": "Русский", + "tr": "Турецкий" + } }, "activation": { "title": "Активировать Hydra", diff --git a/src/locales/tr/translation.json b/src/locales/tr/translation.json index 50edf6cc..8b949ab2 100644 --- a/src/locales/tr/translation.json +++ b/src/locales/tr/translation.json @@ -96,7 +96,18 @@ "dont_show_it_again": "Tekrar gösterme", "copy_to_clipboard": "Kopyala", "copied_to_clipboard": "Kopyalandı", - "got_it": "Tamam" + "got_it": "Tamam", + "repack_language_code": { + "en": "İngilizce", + "es": "İspanyolca", + "fr": "Fransızca", + "hu": "Macarca", + "it": "İtalyanca", + "pl": "Polonyaca", + "pt": "Portekizce", + "ru": "Rusça", + "tr": "Türkçe" + } }, "activation": { "title": "Hydra'yı aktif et", @@ -161,4 +172,4 @@ "close": "Kapat tuşu" } } - + From a0344ea49131208d2ca214d085624caa2120f5ff Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 11:43:36 -0300 Subject: [PATCH 02/38] feat(events): Add new event for getting magnet data --- src/main/events/index.ts | 1 + src/main/events/repacks/magnet-data.ts | 10 ++++++++++ src/preload/index.d.ts | 1 + src/preload/index.ts | 1 + 4 files changed, 13 insertions(+) create mode 100644 src/main/events/repacks/magnet-data.ts diff --git a/src/main/events/index.ts b/src/main/events/index.ts index 822cb9d5..406c4140 100644 --- a/src/main/events/index.ts +++ b/src/main/events/index.ts @@ -27,6 +27,7 @@ import "./torrenting/start-game-download"; import "./user-preferences/get-user-preferences"; import "./user-preferences/update-user-preferences"; import "./user-preferences/auto-launch"; +import "./repacks/magnet-data" ipcMain.handle("ping", () => "pong"); ipcMain.handle("getVersion", () => app.getVersion()); diff --git a/src/main/events/repacks/magnet-data.ts b/src/main/events/repacks/magnet-data.ts new file mode 100644 index 00000000..23c86294 --- /dev/null +++ b/src/main/events/repacks/magnet-data.ts @@ -0,0 +1,10 @@ +import { openWebTorrent } from "@main/services/open-web-torrent" +import { registerEvent } from "../register-event" + +const getMagnetData = async (_event: Electron.IpcMainInvokeEvent, magnet: string) => { + return openWebTorrent.getSeedersAndPeers(magnet) +} + +registerEvent(getMagnetData, { + name: 'getMagnetData' +}) diff --git a/src/preload/index.d.ts b/src/preload/index.d.ts index 51163f1a..94d93e6e 100644 --- a/src/preload/index.d.ts +++ b/src/preload/index.d.ts @@ -102,4 +102,5 @@ contextBridge.exposeInMainWorld("electron", { showOpenDialog: (options: Electron.OpenDialogOptions) => ipcRenderer.invoke("showOpenDialog", options), platform: process.platform, + getMagnetData: (magnet: string) => ipcRenderer.invoke("getMagnetData", magnet), }); diff --git a/src/preload/index.ts b/src/preload/index.ts index 7d5eb7fe..24b1cd54 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -112,4 +112,5 @@ contextBridge.exposeInMainWorld("electron", { showOpenDialog: (options: Electron.OpenDialogOptions) => ipcRenderer.invoke("showOpenDialog", options), platform: process.platform, + getMagnetData: (magnet: string) => ipcRenderer.invoke("getMagnetData", magnet), }); From 08c4906465874759097dc492caad4b51e38808f2 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:09:44 -0300 Subject: [PATCH 03/38] feat: Add new Tag component with styling for tags --- src/renderer/src/components/tag/tag.css.ts | 11 +++++++++++ src/renderer/src/components/tag/tag.tsx | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/renderer/src/components/tag/tag.css.ts create mode 100644 src/renderer/src/components/tag/tag.tsx diff --git a/src/renderer/src/components/tag/tag.css.ts b/src/renderer/src/components/tag/tag.css.ts new file mode 100644 index 00000000..58d8028c --- /dev/null +++ b/src/renderer/src/components/tag/tag.css.ts @@ -0,0 +1,11 @@ +import { style } from "@vanilla-extract/css"; + +export const tagStyle = style({ + borderRadius: '3px', + border: '1px solid #FFFFFF33', + padding: '2px 5px', +}); + +export const tagText = style({ + fontSize: '11px', +}) diff --git a/src/renderer/src/components/tag/tag.tsx b/src/renderer/src/components/tag/tag.tsx new file mode 100644 index 00000000..fa7d0182 --- /dev/null +++ b/src/renderer/src/components/tag/tag.tsx @@ -0,0 +1,9 @@ +import * as styles from "./tag.css"; + +export function Tag({ children }: Readonly<{ children: React.ReactNode }>) { + return ( +
+ {children} +
+ ); +} From 1872ff1d24af490f85304863fc51e4bc6dfd593c Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:09:59 -0300 Subject: [PATCH 04/38] feat: Add tooltip component with styles and visibility logic --- .../src/components/tooltip/tooltip.css.ts | 36 +++++++++++++++++++ .../src/components/tooltip/tooltip.tsx | 22 ++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 src/renderer/src/components/tooltip/tooltip.css.ts create mode 100644 src/renderer/src/components/tooltip/tooltip.tsx diff --git a/src/renderer/src/components/tooltip/tooltip.css.ts b/src/renderer/src/components/tooltip/tooltip.css.ts new file mode 100644 index 00000000..6615e51d --- /dev/null +++ b/src/renderer/src/components/tooltip/tooltip.css.ts @@ -0,0 +1,36 @@ +import { style } from "@vanilla-extract/css"; + +export const tooltipStyle = style({ + position: 'relative', + display: 'flex', + cursor: 'pointer', + alignItems: 'center' +}); + +export const tooltipTextStyle = style({ + visibility: 'hidden', + backgroundColor: '#555', + color: '#fff', + textAlign: 'center', + borderRadius: '6px', + padding: '5px 5px', + position: 'absolute', + zIndex: '1', + bottom: '125%', + left: 'max(0%, min(100%, 50%))', + transform: 'translateX(-50%)', + ':after': { + content: '""', + position: 'absolute', + top: '100%', + left: '50%', + marginLeft: '-5px', + borderWidth: '5px', + borderStyle: 'solid', + borderColor: '#555 transparent transparent transparent', + }, +}); + +export const tooltipVisible = style({ + visibility: 'visible', +}); diff --git a/src/renderer/src/components/tooltip/tooltip.tsx b/src/renderer/src/components/tooltip/tooltip.tsx new file mode 100644 index 00000000..75b0061e --- /dev/null +++ b/src/renderer/src/components/tooltip/tooltip.tsx @@ -0,0 +1,22 @@ +import { useState } from 'react'; +import * as styles from './tooltip.css' + +interface TooltipProps { + children: React.ReactNode; + tooltipText: string; +} + +export function Tooltip({ children, tooltipText }: Readonly) { + const [isVisible, setIsVisible] = useState(false); + + return ( +
setIsVisible(true)} + onMouseLeave={() => setIsVisible(false)} + > + {children} + {tooltipText} +
+ ); +} From 58693fdb0025a20f779a382d5893374a96b05b4e Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:10:08 -0300 Subject: [PATCH 05/38] feat: Add SeedersAndPeers component with skeleton loader --- .../seeders-and-peers-skeleton.tsx | 20 +++++ .../seeders-and-peers/seeders-and-peers.tsx | 54 +++++++++++++ .../game-details/seeders-and-peers/types.ts | 5 ++ .../seeders-and-peers/useMagnetData.tsx | 75 +++++++++++++++++++ 4 files changed, 154 insertions(+) create mode 100644 src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers-skeleton.tsx create mode 100644 src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx create mode 100644 src/renderer/src/pages/game-details/seeders-and-peers/types.ts create mode 100644 src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers-skeleton.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers-skeleton.tsx new file mode 100644 index 00000000..dc0f7381 --- /dev/null +++ b/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers-skeleton.tsx @@ -0,0 +1,20 @@ +import Skeleton from "react-loading-skeleton"; + +export function SeedersAndPeersSkeleton() { + return ( +
+ + +
+ ); +} diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx new file mode 100644 index 00000000..5244d8e4 --- /dev/null +++ b/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx @@ -0,0 +1,54 @@ +import { GameRepack } from "@types"; +import { Sprout, Users } from "lucide-react"; + +import { useMagnetData } from "./useMagnetData"; +import { Tooltip } from "@renderer/components/tooltip/tooltip"; +import { SeedersAndPeersSkeleton } from "./seeders-and-peers-skeleton"; +import { vars } from "@renderer/theme.css"; + +interface SeedersAndPeersProps { + repack: GameRepack; +} + +export function SeedersAndPeers({ repack }: Readonly) { + const { magnetData, isLoading, error } = useMagnetData(repack.magnet); + + if (isLoading) { + return ; + } + + if (error) { + return null; + } + + return ( +
+ + + + {magnetData?.seeders} + + + + + + {magnetData?.peers} + + +
+ ); +} diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/types.ts b/src/renderer/src/pages/game-details/seeders-and-peers/types.ts new file mode 100644 index 00000000..23532807 --- /dev/null +++ b/src/renderer/src/pages/game-details/seeders-and-peers/types.ts @@ -0,0 +1,5 @@ +export type TorrentData = { + seeders: number; + peers: number; + lastTracked?: Date; +}; diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx new file mode 100644 index 00000000..b072ac22 --- /dev/null +++ b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx @@ -0,0 +1,75 @@ +import { useCallback, useEffect, useState } from "react"; +import { TorrentData } from "./types"; + +const cache: Record = {}; + +export function useMagnetData(magnet: string) { + const [magnetData, setMagnetData] = useState(cache[magnet] || null); + const [isLoading, setIsLoading] = useState(() => { + if (cache[magnet]) { + return false; + } + + return true; + }); + const [error, setError] = useState(null); + + useEffect(() => { + if (!magnet) { + return; + } + + if (cache[magnet]) { + setMagnetData(cache[magnet]); + setIsLoading(false); + return; + } + + window.electron.getMagnetData(magnet).then( + (result) => { + if (result) { + setMagnetData(result); + setIsLoading(false); + + cache[magnet] = result; + cache[magnet].lastTracked = new Date(); + } + }, + (error) => { + setError(error); + setIsLoading(false); + } + ); + }, []); + + const invalidateCache = useCallback(() => { + const TWO_MINUTES = 2 * 60 * 1000; + const cacheExpiresIn = TWO_MINUTES; + + Object.keys(cache).forEach((key) => { + const lastTracked = cache[key].lastTracked; + + if (!lastTracked) { + return; + } + + if (Date.now() - lastTracked.getTime() > cacheExpiresIn) { + delete cache[key]; + } + }); + }, []); + + useEffect(() => { + invalidateCache(); + + return () => { + invalidateCache(); + } + }, []); + + return { + magnetData, + isLoading, + error, + }; +} From 2662ba3875a7373a7c8e348e596926e8b81844a4 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:10:22 -0300 Subject: [PATCH 06/38] style: Add styling for tags container in repacks modal --- src/renderer/src/pages/game-details/repacks-modal.css.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/renderer/src/pages/game-details/repacks-modal.css.ts b/src/renderer/src/pages/game-details/repacks-modal.css.ts index 4e15a63a..827fc237 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.css.ts +++ b/src/renderer/src/pages/game-details/repacks-modal.css.ts @@ -16,3 +16,10 @@ export const repackButton = style({ color: vars.color.bodyText, padding: `${SPACING_UNIT * 2}px`, }); + +export const tagsContainer = style({ + display: "flex", + gap: `${SPACING_UNIT}px`, + flexWrap: "wrap", +}); + From ada218cea1797194397c04abf60e516a589c80a8 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:10:28 -0300 Subject: [PATCH 07/38] feat: Add functions for multiplayer repack, multi-language support, and repack language based on repacker --- src/renderer/src/helpers/searcher.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/renderer/src/helpers/searcher.ts diff --git a/src/renderer/src/helpers/searcher.ts b/src/renderer/src/helpers/searcher.ts new file mode 100644 index 00000000..e336617d --- /dev/null +++ b/src/renderer/src/helpers/searcher.ts @@ -0,0 +1,19 @@ +export const isMultiplayerRepack = (title: string) => { + const toLower = title.toLowerCase(); + + return toLower.includes("multiplayer") || toLower.includes("onlinefix") || toLower.includes("online fix") +} + +export const supportMultiLanguage = (title: string) => { + const multiFollowedByDigitsRegex = /multi\d+/; + + return multiFollowedByDigitsRegex.test(title.toLowerCase()); +} + +export const getRepackLanguageBasedOnRepacker = (repacker: string) => { + const repackMap = { + 'xatab': 'ru', + } + + return repackMap[repacker.toLowerCase()] || 'en'; +} From 06ed5e07bf97aad0f9875b3bf517bb3ee232fc51 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:10:43 -0300 Subject: [PATCH 08/38] feat: Add new functionality to display repack language and seeders/peers in RepacksModal --- .../src/pages/game-details/repacks-modal.tsx | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/pages/game-details/repacks-modal.tsx b/src/renderer/src/pages/game-details/repacks-modal.tsx index aebcb071..b5274032 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.tsx +++ b/src/renderer/src/pages/game-details/repacks-modal.tsx @@ -10,6 +10,13 @@ import { useAppSelector } from "@renderer/hooks"; import { SPACING_UNIT } from "../../theme.css"; import { format } from "date-fns"; import { SelectFolderModal } from "./select-folder-modal"; +import { SeedersAndPeers } from "./seeders-and-peers/seeders-and-peers"; +import { + isMultiplayerRepack, + supportMultiLanguage, +} from "@renderer/helpers/searcher"; +import { Tag } from "@renderer/components/tag/tag"; +import {getRepackLanguageBasedOnRepacker} from '../../helpers/searcher'; export interface RepacksModalProps { visible: boolean; @@ -87,12 +94,34 @@ export function RepacksModal({ className={styles.repackButton} >

{repack.title}

-

- {repack.fileSize} - {repackersFriendlyNames[repack.repacker]} -{" "} - {repack.uploadDate - ? format(repack.uploadDate, "dd/MM/yyyy") - : ""} -

+
+
+

+ {repack.fileSize} -{" "} + {repackersFriendlyNames[repack.repacker]} -{" "} + {repack.uploadDate + ? format(repack.uploadDate, "dd/MM/yyyy") + : ""} + {" - " + t(`repack_language_code.${getRepackLanguageBasedOnRepacker(repack.repacker)}`)} +

+
+ +
+
+ {supportMultiLanguage(repack.title) && ( + Multi Language + )} + {isMultiplayerRepack(repack.title) && Multiplayer} +
))} From 09bd7dcc3653ceebf187f72cfc299689c0f3f9e0 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:11:30 -0300 Subject: [PATCH 09/38] feat: Add lucide-react package to dependencies --- package.json | 1 + yarn.lock | 36 ++++++++---------------------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 55b64d05..9a445b34 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "jsdom": "^24.0.0", "lodash-es": "^4.17.21", "lottie-react": "^2.4.0", + "lucide-react": "^0.378.0", "parse-torrent": "^11.0.16", "ps-list": "^8.1.1", "react-i18next": "^14.1.0", diff --git a/yarn.lock b/yarn.lock index 2d18890c..a9ca1bef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4264,6 +4264,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +lucide-react@^0.378.0: + version "0.378.0" + resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.378.0.tgz#232acb99c6baedfa90959a2c0dd11327b058bde8" + integrity sha512-u6EPU8juLUk9ytRcyapkWI18epAv3RU+6+TC23ivjR0e+glWKBobFeSgRwOIJihzktILQuy6E0E80P2jVTDR5g== + magic-string@0.30.8, magic-string@^0.30.5: version "0.30.8" resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz" @@ -5357,16 +5362,7 @@ stat-mode@^1.0.0: resolved "https://registry.npmjs.org/stat-mode/-/stat-mode-1.0.0.tgz" integrity sha512-jH9EhtKIjuXZ2cWxmXS8ZP80XyC3iasQxMDV8jzhNJpfDb7VbQLVW4Wvsxz9QZvzV+G4YoSfBUVKDOyxLzi/sg== -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -5437,14 +5433,7 @@ string_decoder@^1.1.1: dependencies: safe-buffer "~5.2.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -6044,16 +6033,7 @@ word-wrap@^1.2.5: resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== From b84df28f39462eab0fbbc0c3be462020551409a6 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:12:45 -0300 Subject: [PATCH 10/38] feat: Add openWebTorrent service for fetching seeders and peers --- src/main/services/open-web-torrent.ts | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/main/services/open-web-torrent.ts diff --git a/src/main/services/open-web-torrent.ts b/src/main/services/open-web-torrent.ts new file mode 100644 index 00000000..f546ea56 --- /dev/null +++ b/src/main/services/open-web-torrent.ts @@ -0,0 +1,50 @@ +import axios, { AxiosResponse } from "axios"; +import { Agent } from "https"; + +type OpenWebTorrentResponse = + | { + seeds: number; + peers: number; + } + | { + error: { + code: number; + message: string; + }; + }; + +const httpsAgent = new Agent({ + rejectUnauthorized: false, +}); +const axiosRef = axios.create({ + baseURL: "https://checker.openwebtorrent.com", + httpsAgent +}); + +export const openWebTorrent = { + transformResponseError(response: AxiosResponse) { + if ("error" in response.data) { + throw new Error(response.data.error.message); + } + + return response.data; + }, + async getSeedersAndPeers(magnet: string) { + const endpoint = "/check"; + const params = new URLSearchParams(); + params.append("magnet", magnet); + + try { + const response = await axiosRef.get(endpoint, { params }); + const { seeds, peers } = this.transformResponseError(response); + + return { + seeders: seeds, + peers: peers, + }; + } catch (e) { + const error = e as Error; + throw new Error(error.message); + } + }, +}; From 92f35bad9fd503fdbdfb81612a7ff953ac28c1e9 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:14:23 -0300 Subject: [PATCH 11/38] refactor: Update function calls from savePage to saveRepacks in multiple files --- src/main/services/repack-tracker/1337x.ts | 4 ++-- src/main/services/repack-tracker/cpg-repacks.ts | 4 ++-- src/main/services/repack-tracker/gog.ts | 4 ++-- src/main/services/repack-tracker/helpers.ts | 2 +- src/main/services/repack-tracker/online-fix.ts | 4 ++-- src/main/services/repack-tracker/xatab.ts | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/services/repack-tracker/1337x.ts b/src/main/services/repack-tracker/1337x.ts index 8573079b..4f328d09 100644 --- a/src/main/services/repack-tracker/1337x.ts +++ b/src/main/services/repack-tracker/1337x.ts @@ -3,7 +3,7 @@ import { JSDOM } from "jsdom"; import { formatUploadDate } from "@main/helpers"; import { Repack } from "@main/entity"; -import { requestWebPage, savePage } from "./helpers"; +import { requestWebPage, saveRepacks } from "./helpers"; export const request1337x = async (path: string) => requestWebPage(`https://1337xx.to${path}`); @@ -128,7 +128,7 @@ export const getNewRepacksFromUser = async ( if (!newRepacks.length) return; - await savePage(newRepacks); + await saveRepacks(newRepacks); return getNewRepacksFromUser(user, existingRepacks, page + 1); }; diff --git a/src/main/services/repack-tracker/cpg-repacks.ts b/src/main/services/repack-tracker/cpg-repacks.ts index 2b939d08..0c6399a6 100644 --- a/src/main/services/repack-tracker/cpg-repacks.ts +++ b/src/main/services/repack-tracker/cpg-repacks.ts @@ -2,7 +2,7 @@ import { JSDOM } from "jsdom"; import { Repack } from "@main/entity"; -import { requestWebPage, savePage } from "./helpers"; +import { requestWebPage, saveRepacks } from "./helpers"; import { logger } from "../logger"; export const getNewRepacksFromCPG = async ( @@ -58,7 +58,7 @@ export const getNewRepacksFromCPG = async ( if (!newRepacks.length) return; - await savePage(newRepacks); + await saveRepacks(newRepacks); return getNewRepacksFromCPG(existingRepacks, page + 1); }; diff --git a/src/main/services/repack-tracker/gog.ts b/src/main/services/repack-tracker/gog.ts index 00c78e36..a23ff956 100644 --- a/src/main/services/repack-tracker/gog.ts +++ b/src/main/services/repack-tracker/gog.ts @@ -1,5 +1,5 @@ import { JSDOM, VirtualConsole } from "jsdom"; -import { requestWebPage, savePage } from "./helpers"; +import { requestWebPage, saveRepacks } from "./helpers"; import { Repack } from "@main/entity"; import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity"; @@ -66,6 +66,6 @@ export const getNewGOGGames = async (existingRepacks: Repack[] = []) => { } } - if (repacks.length) await savePage(repacks); + if (repacks.length) await saveRepacks(repacks); } }; diff --git a/src/main/services/repack-tracker/helpers.ts b/src/main/services/repack-tracker/helpers.ts index ef2f4945..250b2c2d 100644 --- a/src/main/services/repack-tracker/helpers.ts +++ b/src/main/services/repack-tracker/helpers.ts @@ -5,7 +5,7 @@ import { repackRepository } from "@main/repository"; import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity"; -export const savePage = async (repacks: QueryDeepPartialEntity[]) => +export const saveRepacks = async (repacks: QueryDeepPartialEntity[]) => Promise.all( repacks.map((repack) => repackRepository.insert(repack).catch(() => {})) ); diff --git a/src/main/services/repack-tracker/online-fix.ts b/src/main/services/repack-tracker/online-fix.ts index a473679f..c8fb75b7 100644 --- a/src/main/services/repack-tracker/online-fix.ts +++ b/src/main/services/repack-tracker/online-fix.ts @@ -1,5 +1,5 @@ import { Repack } from "@main/entity"; -import { decodeNonUtf8Response, savePage } from "./helpers"; +import { decodeNonUtf8Response, saveRepacks } from "./helpers"; import { logger } from "../logger"; import parseTorrent, { toMagnetURI, @@ -181,7 +181,7 @@ export const getNewRepacksFromOnlineFix = async ( if (!newRepacks.length) return; if (page === totalPages) return; - await savePage(newRepacks); + await saveRepacks(newRepacks); return getNewRepacksFromOnlineFix(existingRepacks, page + 1, cookieJar); }; diff --git a/src/main/services/repack-tracker/xatab.ts b/src/main/services/repack-tracker/xatab.ts index df075e88..ba44bca5 100644 --- a/src/main/services/repack-tracker/xatab.ts +++ b/src/main/services/repack-tracker/xatab.ts @@ -2,7 +2,7 @@ import { JSDOM } from "jsdom"; import { Repack } from "@main/entity"; import { logger } from "../logger"; -import { requestWebPage, savePage } from "./helpers"; +import { requestWebPage, saveRepacks } from "./helpers"; import createWorker from "@main/workers/torrent-parser.worker?nodeWorker"; import { toMagnetURI } from "parse-torrent"; @@ -95,7 +95,7 @@ export const getNewRepacksFromXatab = async ( if (!newRepacks.length) return; - await savePage(newRepacks); + await saveRepacks(newRepacks); return getNewRepacksFromXatab(existingRepacks, page + 1); }; From ff6a2046861cf61650295a0fcda236bbd468a323 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:17:53 -0300 Subject: [PATCH 12/38] feat: Add getMagnetData function to global declaration --- src/renderer/src/declaration.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/renderer/src/declaration.d.ts b/src/renderer/src/declaration.d.ts index c20afe66..4ab50624 100644 --- a/src/renderer/src/declaration.d.ts +++ b/src/renderer/src/declaration.d.ts @@ -88,6 +88,7 @@ declare global { options: Electron.OpenDialogOptions ) => Promise; platform: NodeJS.Platform; + getMagnetData: (magnet: string) => Promise<{ seeders: number; peers: number }>; } interface Window { From 8f6922fc8a0adf2ce1164321971254a038ee38fd Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Fri, 10 May 2024 12:32:50 -0300 Subject: [PATCH 13/38] feat: Add multi-language and multiplayer tags in RepacksModal --- src/locales/en/translation.json | 4 +- src/locales/es/translation.json | 4 +- src/locales/fr/translation.json | 4 +- src/locales/hu/translation.json | 4 +- src/locales/it/translation.json | 4 +- src/locales/pl/translation.json | 4 +- src/locales/pt/translation.json | 4 +- src/locales/ru/translation.json | 4 +- src/locales/tr/translation.json | 345 +++++++++--------- .../src/pages/game-details/repacks-modal.tsx | 4 +- 10 files changed, 199 insertions(+), 182 deletions(-) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 8f0e6121..53e8480b 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -107,7 +107,9 @@ "pt": "Portuguese", "ru": "Russian", "tr": "Turkish" - } + }, + "multi_language": "Multi Language", + "multi_player": "Multi Player" }, "activation": { "title": "Activate Hydra", diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json index 92a2aabd..f38900ad 100644 --- a/src/locales/es/translation.json +++ b/src/locales/es/translation.json @@ -101,7 +101,9 @@ "pt": "Portugués", "ru": "Ruso", "tr": "Turco" - } + }, + "multi_language": "Multi Idioma", + "multi_player": "Multijugador" }, "activation": { "title": "Activar Hydra", diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json index 60edfe04..7e8c260e 100644 --- a/src/locales/fr/translation.json +++ b/src/locales/fr/translation.json @@ -86,7 +86,9 @@ "pt": "Portugais", "ru": "Russe", "tr": "Turc" - } + }, + "multi_language": "Multilingue", + "multi_player": "Multijoueur" }, "activation": { "title": "Activer Hydra", diff --git a/src/locales/hu/translation.json b/src/locales/hu/translation.json index d75ac902..1805dd6f 100644 --- a/src/locales/hu/translation.json +++ b/src/locales/hu/translation.json @@ -95,7 +95,9 @@ "pt": "Portugál", "ru": "Orosz", "tr": "Török" - } + }, + "multi_language": "Többnyelvű", + "multi_player": "Többjátékos" }, "activation": { "title": "Hydra Aktiválása", diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json index cb1a3136..ea448dd7 100644 --- a/src/locales/it/translation.json +++ b/src/locales/it/translation.json @@ -107,7 +107,9 @@ "pt": "Portoghese", "ru": "Russo", "tr": "Turco" - } + }, + "multi_language": "Multilingua", + "multi_player": "Multigiocatore" }, "activation": { "title": "Attiva Hydra", diff --git a/src/locales/pl/translation.json b/src/locales/pl/translation.json index 06793a54..b24f59b2 100644 --- a/src/locales/pl/translation.json +++ b/src/locales/pl/translation.json @@ -94,7 +94,9 @@ "pt": "Portugalski", "ru": "Rosyjski", "tr": "Turecki" - } + }, + "multi_language": "Wielojęzyczny", + "multi_player": "Wieloosobowy" }, "activation": { "title": "Aktywuj Hydra", diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index 00b9340e..d6e4b540 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -103,7 +103,9 @@ "pt": "Português", "ru": "Russo", "tr": "Turco" - } + }, + "multi_language": "Multi Idioma", + "multi_player": "Multijogador" }, "activation": { "title": "Ativação", diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json index 759792d4..d7268ca3 100644 --- a/src/locales/ru/translation.json +++ b/src/locales/ru/translation.json @@ -107,7 +107,9 @@ "pt": "Португальский", "ru": "Русский", "tr": "Турецкий" - } + }, + "multi_language": "Мультиязычный", + "multi_player": "Многопользовательский" }, "activation": { "title": "Активировать Hydra", diff --git a/src/locales/tr/translation.json b/src/locales/tr/translation.json index 8b949ab2..29325544 100644 --- a/src/locales/tr/translation.json +++ b/src/locales/tr/translation.json @@ -1,175 +1,176 @@ { - "home": { - "featured": "Öne çıkan", - "recently_added": "Son eklenen", - "trending": "Popüler", - "surprise_me": "Şaşırt beni", - "no_results": "Sonuç bulunamadı" + "home": { + "featured": "Öne çıkan", + "recently_added": "Son eklenen", + "trending": "Popüler", + "surprise_me": "Şaşırt beni", + "no_results": "Sonuç bulunamadı" + }, + "sidebar": { + "catalogue": "Katalog", + "downloads": "İndirmeler", + "settings": "Ayarlar", + "my_library": "Kütüphane", + "downloading_metadata": "{{title}} (Metadata indiriliyor…)", + "checking_files": "{{title}} ({{percentage}} - Dosyalar kontrol ediliyor…)", + "paused": "{{title}} (Duraklatıldı)", + "downloading": "{{title}} ({{percentage}} - İndiriliyor…)", + "filter": "Kütüphaneyi filtrele", + "follow_us": "Bizi takip et", + "home": "Ana menü", + "discord": "Discord'umuza katıl", + "x": "X'te bizi takip et", + "github": "GitHub'da bize katkı yap" + }, + "header": { + "search": "Ara", + "home": "Ana menü", + "catalogue": "Katalog", + "downloads": "İndirmeler", + "search_results": "Arama sonuçları", + "settings": "Ayarlar" + }, + "bottom_panel": { + "no_downloads_in_progress": "İndirilen bir şey yok", + "downloading_metadata": "{{title}} metadatası indiriliyor…", + "checking_files": "{{title}} dosyaları kontrol ediliyor… ({{percentage}} tamamlandı)", + "downloading": "{{title}} indiriliyor… ({{percentage}} tamamlandı) - Bitiş {{eta}} - {{speed}}" + }, + "catalogue": { + "next_page": "Sonraki sayfa", + "previous_page": "Önceki sayfa" + }, + "game_details": { + "open_download_options": "İndirme seçeneklerini aç", + "download_options_zero": "İndirme seçeneği yok", + "download_options_one": "{{count}} indirme seçeneği", + "download_options_other": "{{count}} indirme seçeneği", + "updated_at": "{{updated_at}} güncellendi", + "install": "İndir", + "resume": "Devam et", + "pause": "Duraklat", + "cancel": "İptal et", + "remove": "Sil", + "remove_from_list": "Sil", + "space_left_on_disk": "Diskte {{space}} yer kaldı", + "eta": "Bitiş {{eta}}", + "downloading_metadata": "Metadata indiriliyor…", + "checking_files": "Dosyalar kontrol ediliyor…", + "filter": "Repackleri filtrele", + "requirements": "Sistem gereksinimleri", + "minimum": "Minimum", + "recommended": "Önerilen", + "no_minimum_requirements": "{{title}} minimum sistem gereksinim bilgilerini karşılamıyor", + "no_recommended_requirements": "{{title}} önerilen sistem gereksinim bilgilerini karşılamıyor", + "paused_progress": "{{progress}} (Duraklatıldı)", + "release_date": "{{date}} tarihinde çıktı", + "publisher": "{{publisher}} tarihinde yayınlandı", + "copy_link_to_clipboard": "Link'i kopyala", + "copied_link_to_clipboard": "Link kopyalandı", + "hours": "saatler", + "minutes": "dakikalar", + "amount_hours": "{{amount}} saat", + "amount_minutes": "{{amount}} dakika", + "accuracy": "%{{accuracy}} doğruluk", + "add_to_library": "Kütüphaneye ekle", + "remove_from_library": "Kütüphaneden kaldır", + "no_downloads": "İndirme yok", + "play_time": "{{amount}} oynandı", + "last_time_played": "Son oynanan {{period}}", + "not_played_yet": "Bu {{title}} hiç oynanmadı", + "next_suggestion": "Sıradaki öneri", + "play": "Oyna", + "deleting": "Installer siliniyor…", + "close": "Kapat", + "playing_now": "Şimdi oynanıyor", + "change": "Değiştir", + "repacks_modal_description": "İndirmek istediğiiniz repacki seçin", + "downloads_path": "İndirme yolu", + "select_folder_hint": "Varsayılan klasörü değiştirmek için ulaşmanız gereken ayar", + "settings": "Ayarlar", + "download_now": "Şimdi", + "installation_instructions": "Kurulum", + "installation_instructions_description": "Bu oyunu kurmak için ek adımlar gerekiyor", + "online_fix_instruction": "OnlineFix oyunlarını ayıklamak için parola gerekiyor. Gerekli olduğunda bu parolayı kullanın:", + "dodi_installation_instruction": "Dodi installerını açtığınızda, kurulumu başlatmak için bu tuşa basın <0 />:", + "dont_show_it_again": "Tekrar gösterme", + "copy_to_clipboard": "Kopyala", + "copied_to_clipboard": "Kopyalandı", + "got_it": "Tamam", + "repack_language_code": { + "en": "İngilizce", + "es": "İspanyolca", + "fr": "Fransızca", + "hu": "Macarca", + "it": "İtalyanca", + "pl": "Polonyaca", + "pt": "Portekizce", + "ru": "Rusça", + "tr": "Türkçe" }, - "sidebar": { - "catalogue": "Katalog", - "downloads": "İndirmeler", - "settings": "Ayarlar", - "my_library": "Kütüphane", - "downloading_metadata": "{{title}} (Metadata indiriliyor…)", - "checking_files": "{{title}} ({{percentage}} - Dosyalar kontrol ediliyor…)", - "paused": "{{title}} (Duraklatıldı)", - "downloading": "{{title}} ({{percentage}} - İndiriliyor…)", - "filter": "Kütüphaneyi filtrele", - "follow_us": "Bizi takip et", - "home": "Ana menü", - "discord": "Discord'umuza katıl", - "x": "X'te bizi takip et", - "github": "GitHub'da bize katkı yap" - }, - "header": { - "search": "Ara", - "home": "Ana menü", - "catalogue": "Katalog", - "downloads": "İndirmeler", - "search_results": "Arama sonuçları", - "settings": "Ayarlar" - }, - "bottom_panel": { - "no_downloads_in_progress": "İndirilen bir şey yok", - "downloading_metadata": "{{title}} metadatası indiriliyor…", - "checking_files": "{{title}} dosyaları kontrol ediliyor… ({{percentage}} tamamlandı)", - "downloading": "{{title}} indiriliyor… ({{percentage}} tamamlandı) - Bitiş {{eta}} - {{speed}}" - }, - "catalogue": { - "next_page": "Sonraki sayfa", - "previous_page": "Önceki sayfa" - }, - "game_details": { - "open_download_options": "İndirme seçeneklerini aç", - "download_options_zero": "İndirme seçeneği yok", - "download_options_one": "{{count}} indirme seçeneği", - "download_options_other": "{{count}} indirme seçeneği", - "updated_at": "{{updated_at}} güncellendi", - "install": "İndir", - "resume": "Devam et", - "pause": "Duraklat", - "cancel": "İptal et", - "remove": "Sil", - "remove_from_list": "Sil", - "space_left_on_disk": "Diskte {{space}} yer kaldı", - "eta": "Bitiş {{eta}}", - "downloading_metadata": "Metadata indiriliyor…", - "checking_files": "Dosyalar kontrol ediliyor…", - "filter": "Repackleri filtrele", - "requirements": "Sistem gereksinimleri", - "minimum": "Minimum", - "recommended": "Önerilen", - "no_minimum_requirements": "{{title}} minimum sistem gereksinim bilgilerini karşılamıyor", - "no_recommended_requirements": "{{title}} önerilen sistem gereksinim bilgilerini karşılamıyor", - "paused_progress": "{{progress}} (Duraklatıldı)", - "release_date": "{{date}} tarihinde çıktı", - "publisher": "{{publisher}} tarihinde yayınlandı", - "copy_link_to_clipboard": "Link'i kopyala", - "copied_link_to_clipboard": "Link kopyalandı", - "hours": "saatler", - "minutes": "dakikalar", - "amount_hours": "{{amount}} saat", - "amount_minutes": "{{amount}} dakika", - "accuracy": "%{{accuracy}} doğruluk", - "add_to_library": "Kütüphaneye ekle", - "remove_from_library": "Kütüphaneden kaldır", - "no_downloads": "İndirme yok", - "play_time": "{{amount}} oynandı", - "last_time_played": "Son oynanan {{period}}", - "not_played_yet": "Bu {{title}} hiç oynanmadı", - "next_suggestion": "Sıradaki öneri", - "play": "Oyna", - "deleting": "Installer siliniyor…", - "close": "Kapat", - "playing_now": "Şimdi oynanıyor", - "change": "Değiştir", - "repacks_modal_description": "İndirmek istediğiiniz repacki seçin", - "downloads_path": "İndirme yolu", - "select_folder_hint": "Varsayılan klasörü değiştirmek için ulaşmanız gereken ayar", - "settings": "Ayarlar", - "download_now": "Şimdi", - "installation_instructions": "Kurulum", - "installation_instructions_description": "Bu oyunu kurmak için ek adımlar gerekiyor", - "online_fix_instruction": "OnlineFix oyunlarını ayıklamak için parola gerekiyor. Gerekli olduğunda bu parolayı kullanın:", - "dodi_installation_instruction": "Dodi installerını açtığınızda, kurulumu başlatmak için bu tuşa basın <0 />:", - "dont_show_it_again": "Tekrar gösterme", - "copy_to_clipboard": "Kopyala", - "copied_to_clipboard": "Kopyalandı", - "got_it": "Tamam", - "repack_language_code": { - "en": "İngilizce", - "es": "İspanyolca", - "fr": "Fransızca", - "hu": "Macarca", - "it": "İtalyanca", - "pl": "Polonyaca", - "pt": "Portekizce", - "ru": "Rusça", - "tr": "Türkçe" - } - }, - "activation": { - "title": "Hydra'yı aktif et", - "installation_id": "Kurulum ID'si:", - "enter_activation_code": "Aktifleştirme kodunuzu girin", - "message": "Bunu nerede soracağınızı bilmiyorsanız, buna sahip olmamanız gerekiyor.", - "activate": "Aktif et", - "loading": "Yükleniyor…" - }, - "downloads": { - "resume": "Devam et", - "pause": "Duraklat", - "eta": "Bitiş {{eta}}", - "paused": "Duraklatıldı", - "verifying": "Doğrulanıyor…", - "completed_at": "{{date}} tarihinde tamamlanacak", - "completed": "Tamamlandı", - "cancelled": "İptal edildi", - "download_again": "Tekrar indir", - "cancel": "İptal et", - "filter": "Yüklü oyunları filtrele", - "remove": "Kaldır", - "downloading_metadata": "Metadata indiriliyor…", - "checking_files": "Dosyalar kontrol ediliyor…", - "starting_download": "İndirme başlatılıyor…", - "deleting": "Installer siliniyor…", - "delete": "Installer'ı sil", - "remove_from_list": "Kaldır", - "delete_modal_title": "Emin misiniz?", - "delete_modal_description": "Bu bilgisayarınızdan tüm kurulum dosyalarını silecek", - "install": "Kur" - }, - "settings": { - "downloads_path": "İndirme yolu", - "change": "Güncelle", - "notifications": "Bildirimler", - "enable_download_notifications": "Bir indirme bittiğinde", - "enable_repack_list_notifications": "Yeni bir repack eklendiğinde", - "telemetry": "Telemetri", - "telemetry_description": "Anonim kullanım istatistiklerini aktifleştir" - }, - "notifications": { - "download_complete": "İndirme tamamlandı", - "game_ready_to_install": "{{title}} kuruluma hazır", - "repack_list_updated": "Repack listesi güncellendi", - "repack_count_one": "{{count}} yeni repack eklendi", - "repack_count_other": "{{count}} yeni repack eklendi" - }, - "system_tray": { - "open": "Hydra'yı aç", - "quit": "Çık" - }, - "game_card": { - "no_downloads": "İndirme mevcut değil" - }, - "binary_not_found_modal": { - "title": "Programlar yüklü değil", - "description": "Sisteminizde Wine veya Lutris çalıştırılabiliri bulunamadı", - "instructions": "Oyunları düzgün şekilde çalıştırmak için Linux distronuza bunlardan birini nasıl yükleyebileceğinize bakın" - }, - "modal": { - "close": "Kapat tuşu" - } + "multi_language": "Çoklu Dil", + "multi_player": "Çok Oyunculu" + }, + "activation": { + "title": "Hydra'yı aktif et", + "installation_id": "Kurulum ID'si:", + "enter_activation_code": "Aktifleştirme kodunuzu girin", + "message": "Bunu nerede soracağınızı bilmiyorsanız, buna sahip olmamanız gerekiyor.", + "activate": "Aktif et", + "loading": "Yükleniyor…" + }, + "downloads": { + "resume": "Devam et", + "pause": "Duraklat", + "eta": "Bitiş {{eta}}", + "paused": "Duraklatıldı", + "verifying": "Doğrulanıyor…", + "completed_at": "{{date}} tarihinde tamamlanacak", + "completed": "Tamamlandı", + "cancelled": "İptal edildi", + "download_again": "Tekrar indir", + "cancel": "İptal et", + "filter": "Yüklü oyunları filtrele", + "remove": "Kaldır", + "downloading_metadata": "Metadata indiriliyor…", + "checking_files": "Dosyalar kontrol ediliyor…", + "starting_download": "İndirme başlatılıyor…", + "deleting": "Installer siliniyor…", + "delete": "Installer'ı sil", + "remove_from_list": "Kaldır", + "delete_modal_title": "Emin misiniz?", + "delete_modal_description": "Bu bilgisayarınızdan tüm kurulum dosyalarını silecek", + "install": "Kur" + }, + "settings": { + "downloads_path": "İndirme yolu", + "change": "Güncelle", + "notifications": "Bildirimler", + "enable_download_notifications": "Bir indirme bittiğinde", + "enable_repack_list_notifications": "Yeni bir repack eklendiğinde", + "telemetry": "Telemetri", + "telemetry_description": "Anonim kullanım istatistiklerini aktifleştir" + }, + "notifications": { + "download_complete": "İndirme tamamlandı", + "game_ready_to_install": "{{title}} kuruluma hazır", + "repack_list_updated": "Repack listesi güncellendi", + "repack_count_one": "{{count}} yeni repack eklendi", + "repack_count_other": "{{count}} yeni repack eklendi" + }, + "system_tray": { + "open": "Hydra'yı aç", + "quit": "Çık" + }, + "game_card": { + "no_downloads": "İndirme mevcut değil" + }, + "binary_not_found_modal": { + "title": "Programlar yüklü değil", + "description": "Sisteminizde Wine veya Lutris çalıştırılabiliri bulunamadı", + "instructions": "Oyunları düzgün şekilde çalıştırmak için Linux distronuza bunlardan birini nasıl yükleyebileceğinize bakın" + }, + "modal": { + "close": "Kapat tuşu" } - +} diff --git a/src/renderer/src/pages/game-details/repacks-modal.tsx b/src/renderer/src/pages/game-details/repacks-modal.tsx index b5274032..36798668 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.tsx +++ b/src/renderer/src/pages/game-details/repacks-modal.tsx @@ -118,9 +118,9 @@ export function RepacksModal({
{supportMultiLanguage(repack.title) && ( - Multi Language + {t('multi_language')} )} - {isMultiplayerRepack(repack.title) && Multiplayer} + {isMultiplayerRepack(repack.title) && {t('multiplayer')}}
))} From e55d41889d5a6316f7a99144ae9a0aa3cc55138d Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 14:20:17 -0300 Subject: [PATCH 14/38] refactor: Simplify code by removing unnecessary try-catch block --- src/main/services/open-web-torrent.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/main/services/open-web-torrent.ts b/src/main/services/open-web-torrent.ts index f546ea56..fde5922d 100644 --- a/src/main/services/open-web-torrent.ts +++ b/src/main/services/open-web-torrent.ts @@ -18,7 +18,7 @@ const httpsAgent = new Agent({ }); const axiosRef = axios.create({ baseURL: "https://checker.openwebtorrent.com", - httpsAgent + httpsAgent, }); export const openWebTorrent = { @@ -34,17 +34,12 @@ export const openWebTorrent = { const params = new URLSearchParams(); params.append("magnet", magnet); - try { - const response = await axiosRef.get(endpoint, { params }); - const { seeds, peers } = this.transformResponseError(response); + const response = await axiosRef.get(endpoint, { params }); + const { seeds, peers } = this.transformResponseError(response); - return { - seeders: seeds, - peers: peers, - }; - } catch (e) { - const error = e as Error; - throw new Error(error.message); - } + return { + seeders: seeds, + peers: peers, + }; }, }; From 2f0cd24fb8edecac655ac35b7131eaa55ac78cb9 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 14:25:13 -0300 Subject: [PATCH 15/38] refactor: Improve the structure of useMagnetData function --- .../seeders-and-peers/useMagnetData.tsx | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx index b072ac22..77622e81 100644 --- a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx +++ b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx @@ -1,10 +1,12 @@ -import { useCallback, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { TorrentData } from "./types"; const cache: Record = {}; export function useMagnetData(magnet: string) { - const [magnetData, setMagnetData] = useState(cache[magnet] || null); + const [magnetData, setMagnetData] = useState( + cache[magnet] || null + ); const [isLoading, setIsLoading] = useState(() => { if (cache[magnet]) { return false; @@ -40,31 +42,32 @@ export function useMagnetData(magnet: string) { setIsLoading(false); } ); - }, []); + }, [magnet]); - const invalidateCache = useCallback(() => { - const TWO_MINUTES = 2 * 60 * 1000; - const cacheExpiresIn = TWO_MINUTES; - - Object.keys(cache).forEach((key) => { - const lastTracked = cache[key].lastTracked; - - if (!lastTracked) { - return; - } - - if (Date.now() - lastTracked.getTime() > cacheExpiresIn) { - delete cache[key]; - } - }); - }, []); useEffect(() => { + function invalidateCache() { + const TWO_MINUTES = 2 * 60 * 1000; + const cacheExpiresIn = TWO_MINUTES; + + Object.keys(cache).forEach((key) => { + const lastTracked = cache[key].lastTracked; + + if (!lastTracked) { + return; + } + + if (Date.now() - lastTracked.getTime() > cacheExpiresIn) { + delete cache[key]; + } + }); + } + invalidateCache(); return () => { invalidateCache(); - } + }; }, []); return { From 0aa36c5a579f20c89fd44e7182a3554dd15ac1ac Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 20:50:51 -0300 Subject: [PATCH 16/38] fix: update tag styles to match variables --- src/renderer/src/components/index.ts | 1 + src/renderer/src/components/tag/tag.css.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/components/index.ts b/src/renderer/src/components/index.ts index 70777fea..a5ad3a0f 100644 --- a/src/renderer/src/components/index.ts +++ b/src/renderer/src/components/index.ts @@ -8,3 +8,4 @@ export * from "./sidebar/sidebar"; export * from "./text-field/text-field"; export * from "./checkbox-field/checkbox-field"; export * from "./link/link"; +export * from "./tag/tag"; diff --git a/src/renderer/src/components/tag/tag.css.ts b/src/renderer/src/components/tag/tag.css.ts index 58d8028c..6d1076ba 100644 --- a/src/renderer/src/components/tag/tag.css.ts +++ b/src/renderer/src/components/tag/tag.css.ts @@ -1,9 +1,10 @@ +import { SPACING_UNIT, vars } from "../../theme.css"; import { style } from "@vanilla-extract/css"; export const tagStyle = style({ borderRadius: '3px', - border: '1px solid #FFFFFF33', - padding: '2px 5px', + border: `1px solid ${vars.color.border}`, + padding: `${SPACING_UNIT / 4}px ${SPACING_UNIT}px`, }); export const tagText = style({ From 5f468d5b2ec5a44e2d44a592ae616419fa6c9259 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 20:50:55 -0300 Subject: [PATCH 17/38] style: Update translation keys for "multi_player" to "multiplayer" in multiple language files --- src/locales/en/translation.json | 2 +- src/locales/es/translation.json | 2 +- src/locales/fr/translation.json | 2 +- src/locales/hu/translation.json | 2 +- src/locales/it/translation.json | 2 +- src/locales/pl/translation.json | 2 +- src/locales/pt/translation.json | 2 +- src/locales/ru/translation.json | 2 +- src/locales/tr/translation.json | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 37da8545..bbef90bb 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -109,7 +109,7 @@ "tr": "Turkish" }, "multi_language": "Multi Language", - "multi_player": "Multi Player" + "multiplayer": "Multi Player" }, "activation": { "title": "Activate Hydra", diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json index 999de579..df89df82 100644 --- a/src/locales/es/translation.json +++ b/src/locales/es/translation.json @@ -106,7 +106,7 @@ "tr": "Turco" }, "multi_language": "Multi Idioma", - "multi_player": "Multijugador" + "multiplayer": "Multijugador" }, "activation": { "title": "Activar Hydra", diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json index 7e8c260e..064c58e6 100644 --- a/src/locales/fr/translation.json +++ b/src/locales/fr/translation.json @@ -88,7 +88,7 @@ "tr": "Turc" }, "multi_language": "Multilingue", - "multi_player": "Multijoueur" + "multiplayer": "Multijoueur" }, "activation": { "title": "Activer Hydra", diff --git a/src/locales/hu/translation.json b/src/locales/hu/translation.json index 1805dd6f..ff777fba 100644 --- a/src/locales/hu/translation.json +++ b/src/locales/hu/translation.json @@ -97,7 +97,7 @@ "tr": "Török" }, "multi_language": "Többnyelvű", - "multi_player": "Többjátékos" + "multiplayer": "Többjátékos" }, "activation": { "title": "Hydra Aktiválása", diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json index b068c18d..646989bf 100644 --- a/src/locales/it/translation.json +++ b/src/locales/it/translation.json @@ -110,7 +110,7 @@ "tr": "Turco" }, "multi_language": "Multilingua", - "multi_player": "Multigiocatore" + "multiplayer": "Multigiocatore" }, "activation": { "title": "Attiva Hydra", diff --git a/src/locales/pl/translation.json b/src/locales/pl/translation.json index b24f59b2..64c88a82 100644 --- a/src/locales/pl/translation.json +++ b/src/locales/pl/translation.json @@ -96,7 +96,7 @@ "tr": "Turecki" }, "multi_language": "Wielojęzyczny", - "multi_player": "Wieloosobowy" + "multiplayer": "Wieloosobowy" }, "activation": { "title": "Aktywuj Hydra", diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index f652a6f5..42d3b3ba 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -105,7 +105,7 @@ "tr": "Turco" }, "multi_language": "Multi Idioma", - "multi_player": "Multijogador" + "multiplayer": "Multijogador" }, "activation": { "title": "Ativação", diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json index 68351124..4d3c2fc1 100644 --- a/src/locales/ru/translation.json +++ b/src/locales/ru/translation.json @@ -110,7 +110,7 @@ "tr": "Турецкий" }, "multi_language": "Мультиязычный", - "multi_player": "Многопользовательский" + "multiplayer": "Многопользовательский" }, "activation": { "title": "Активировать Hydra", diff --git a/src/locales/tr/translation.json b/src/locales/tr/translation.json index 7a2cb6fa..8162be6b 100644 --- a/src/locales/tr/translation.json +++ b/src/locales/tr/translation.json @@ -109,7 +109,7 @@ "tr": "Türkçe" }, "multi_language": "Çoklu Dil", - "multi_player": "Çok Oyunculu" + "multiplayer": "Çok Oyunculu" }, "activation": { "title": "Hydra'yı aktif et", From 02417dda40efe73580d03d5b1dbfa158dccdce62 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 20:52:04 -0300 Subject: [PATCH 18/38] style: update tag component CSS formatting --- src/renderer/src/components/tag/tag.css.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/components/tag/tag.css.ts b/src/renderer/src/components/tag/tag.css.ts index 6d1076ba..f0c0608f 100644 --- a/src/renderer/src/components/tag/tag.css.ts +++ b/src/renderer/src/components/tag/tag.css.ts @@ -2,11 +2,11 @@ import { SPACING_UNIT, vars } from "../../theme.css"; import { style } from "@vanilla-extract/css"; export const tagStyle = style({ - borderRadius: '3px', + borderRadius: "3px", border: `1px solid ${vars.color.border}`, padding: `${SPACING_UNIT / 4}px ${SPACING_UNIT}px`, }); export const tagText = style({ - fontSize: '11px', -}) + fontSize: "11px", +}); From 4616f69a291077d86b69e198367c3fd0eab26534 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 20:53:58 -0300 Subject: [PATCH 19/38] refactor: Update function names in repack tracker to use 'savePage' instead of 'saveRepacks' --- src/main/services/repack-tracker/1337x.ts | 4 ++-- src/main/services/repack-tracker/cpg-repacks.ts | 4 ++-- src/main/services/repack-tracker/gog.ts | 4 ++-- src/main/services/repack-tracker/helpers.ts | 2 +- src/main/services/repack-tracker/online-fix.ts | 4 ++-- src/main/services/repack-tracker/xatab.ts | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/services/repack-tracker/1337x.ts b/src/main/services/repack-tracker/1337x.ts index acc6b845..5e6ae527 100644 --- a/src/main/services/repack-tracker/1337x.ts +++ b/src/main/services/repack-tracker/1337x.ts @@ -3,7 +3,7 @@ import { JSDOM } from "jsdom"; import { formatUploadDate } from "@main/helpers"; import { Repack } from "@main/entity"; -import { requestWebPage, saveRepacks } from "./helpers"; +import { requestWebPage, savePage } from "./helpers"; export const request1337x = async (path: string) => requestWebPage(`https://1337xx.to${path}`); @@ -114,7 +114,7 @@ export const getNewRepacksFromUser = async ( if (!newRepacks.length) return; - await saveRepacks(newRepacks); + await savePage(newRepacks); return getNewRepacksFromUser(user, existingRepacks, page + 1); }; diff --git a/src/main/services/repack-tracker/cpg-repacks.ts b/src/main/services/repack-tracker/cpg-repacks.ts index 9c81102d..d1ba6cc4 100644 --- a/src/main/services/repack-tracker/cpg-repacks.ts +++ b/src/main/services/repack-tracker/cpg-repacks.ts @@ -2,7 +2,7 @@ import { JSDOM } from "jsdom"; import { Repack } from "@main/entity"; -import { requestWebPage, saveRepacks } from "./helpers"; +import { requestWebPage, savePage } from "./helpers"; import { logger } from "../logger"; import type { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity"; @@ -58,7 +58,7 @@ export const getNewRepacksFromCPG = async ( if (!newRepacks.length) return; - await saveRepacks(newRepacks); + await savePage(newRepacks); return getNewRepacksFromCPG(existingRepacks, page + 1); }; diff --git a/src/main/services/repack-tracker/gog.ts b/src/main/services/repack-tracker/gog.ts index 87422c2f..aa22ee5c 100644 --- a/src/main/services/repack-tracker/gog.ts +++ b/src/main/services/repack-tracker/gog.ts @@ -1,5 +1,5 @@ import { JSDOM, VirtualConsole } from "jsdom"; -import { requestWebPage, saveRepacks } from "./helpers"; +import { requestWebPage, savePage } from "./helpers"; import { Repack } from "@main/entity"; import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity"; @@ -66,6 +66,6 @@ export const getNewGOGGames = async (existingRepacks: Repack[] = []) => { } } - if (repacks.length) await saveRepacks(repacks); + if (repacks.length) await savePage(repacks); } }; diff --git a/src/main/services/repack-tracker/helpers.ts b/src/main/services/repack-tracker/helpers.ts index 250b2c2d..ef2f4945 100644 --- a/src/main/services/repack-tracker/helpers.ts +++ b/src/main/services/repack-tracker/helpers.ts @@ -5,7 +5,7 @@ import { repackRepository } from "@main/repository"; import { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity"; -export const saveRepacks = async (repacks: QueryDeepPartialEntity[]) => +export const savePage = async (repacks: QueryDeepPartialEntity[]) => Promise.all( repacks.map((repack) => repackRepository.insert(repack).catch(() => {})) ); diff --git a/src/main/services/repack-tracker/online-fix.ts b/src/main/services/repack-tracker/online-fix.ts index b45b154e..e73c6cc6 100644 --- a/src/main/services/repack-tracker/online-fix.ts +++ b/src/main/services/repack-tracker/online-fix.ts @@ -1,5 +1,5 @@ import { Repack } from "@main/entity"; -import { decodeNonUtf8Response, saveRepacks } from "./helpers"; +import { decodeNonUtf8Response, savePage } from "./helpers"; import { logger } from "../logger"; import parseTorrent, { toMagnetURI, @@ -179,7 +179,7 @@ export const getNewRepacksFromOnlineFix = async ( if (!newRepacks.length) return; if (page === totalPages) return; - await saveRepacks(newRepacks); + await savePage(newRepacks); return getNewRepacksFromOnlineFix(existingRepacks, page + 1, cookieJar); }; diff --git a/src/main/services/repack-tracker/xatab.ts b/src/main/services/repack-tracker/xatab.ts index 573e2827..1c43327b 100644 --- a/src/main/services/repack-tracker/xatab.ts +++ b/src/main/services/repack-tracker/xatab.ts @@ -2,7 +2,7 @@ import { JSDOM } from "jsdom"; import { Repack } from "@main/entity"; import { logger } from "../logger"; -import { requestWebPage, saveRepacks } from "./helpers"; +import { requestWebPage, savePage } from "./helpers"; import createWorker from "@main/workers/torrent-parser.worker?nodeWorker"; import { toMagnetURI } from "parse-torrent"; @@ -91,7 +91,7 @@ export const getNewRepacksFromXatab = async ( if (!newRepacks.length) return; - await saveRepacks(newRepacks); + await savePage(newRepacks); return getNewRepacksFromXatab(existingRepacks, page + 1); }; From 6b9f902b2c4dd31972484b7f996696989625f3fd Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 21:05:46 -0300 Subject: [PATCH 20/38] feat: Replace OpenWebTorrent service with WebTorrentData service --- src/main/services/open-web-torrent.ts | 45 --------------------------- src/main/services/web-torrent-data.ts | 20 ++++++++++++ 2 files changed, 20 insertions(+), 45 deletions(-) delete mode 100644 src/main/services/open-web-torrent.ts create mode 100644 src/main/services/web-torrent-data.ts diff --git a/src/main/services/open-web-torrent.ts b/src/main/services/open-web-torrent.ts deleted file mode 100644 index fde5922d..00000000 --- a/src/main/services/open-web-torrent.ts +++ /dev/null @@ -1,45 +0,0 @@ -import axios, { AxiosResponse } from "axios"; -import { Agent } from "https"; - -type OpenWebTorrentResponse = - | { - seeds: number; - peers: number; - } - | { - error: { - code: number; - message: string; - }; - }; - -const httpsAgent = new Agent({ - rejectUnauthorized: false, -}); -const axiosRef = axios.create({ - baseURL: "https://checker.openwebtorrent.com", - httpsAgent, -}); - -export const openWebTorrent = { - transformResponseError(response: AxiosResponse) { - if ("error" in response.data) { - throw new Error(response.data.error.message); - } - - return response.data; - }, - async getSeedersAndPeers(magnet: string) { - const endpoint = "/check"; - const params = new URLSearchParams(); - params.append("magnet", magnet); - - const response = await axiosRef.get(endpoint, { params }); - const { seeds, peers } = this.transformResponseError(response); - - return { - seeders: seeds, - peers: peers, - }; - }, -}; diff --git a/src/main/services/web-torrent-data.ts b/src/main/services/web-torrent-data.ts new file mode 100644 index 00000000..e15dbdff --- /dev/null +++ b/src/main/services/web-torrent-data.ts @@ -0,0 +1,20 @@ +import WebTorrentHealth from "webtorrent-health"; + +type WebTorrentHealthData = { + seeds: number; + peers: number; +}; + +export const webTorrentData = { + async getSeedersAndPeers(magnet: string) { + return new Promise((resolve, reject) => { + WebTorrentHealth(magnet, (err: Error, data: WebTorrentHealthData) => { + if (err) { + reject(err); + } else { + resolve(data); + } + }); + }); + }, +}; From 27bff9d2e621b0c5ed0a855902ccaa457aed90ed Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 21:06:02 -0300 Subject: [PATCH 21/38] fix: Replace getMagnetData with getMagnetHealth in references and implementations --- src/main/events/index.ts | 2 +- src/main/events/repacks/get-magnet-health.ts | 10 ++++++++++ src/main/events/repacks/magnet-data.ts | 10 ---------- src/preload/index.d.ts | 2 +- src/preload/index.ts | 2 +- src/renderer/src/declaration.d.ts | 2 +- .../game-details/seeders-and-peers/useMagnetData.tsx | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 src/main/events/repacks/get-magnet-health.ts delete mode 100644 src/main/events/repacks/magnet-data.ts diff --git a/src/main/events/index.ts b/src/main/events/index.ts index 406c4140..d54b23a6 100644 --- a/src/main/events/index.ts +++ b/src/main/events/index.ts @@ -27,7 +27,7 @@ import "./torrenting/start-game-download"; import "./user-preferences/get-user-preferences"; import "./user-preferences/update-user-preferences"; import "./user-preferences/auto-launch"; -import "./repacks/magnet-data" +import "./repacks/get-magnet-health" ipcMain.handle("ping", () => "pong"); ipcMain.handle("getVersion", () => app.getVersion()); diff --git a/src/main/events/repacks/get-magnet-health.ts b/src/main/events/repacks/get-magnet-health.ts new file mode 100644 index 00000000..840f3eb1 --- /dev/null +++ b/src/main/events/repacks/get-magnet-health.ts @@ -0,0 +1,10 @@ +import { webTorrentData } from "@main/services/web-torrent-health" +import { registerEvent } from "../register-event" + +const getMagnetHealth = async (_event: Electron.IpcMainInvokeEvent, magnet: string) => { + return webTorrentData.getSeedersAndPeers(magnet) +} + +registerEvent(getMagnetHealth, { + name: 'getMagnetHealth' +}) diff --git a/src/main/events/repacks/magnet-data.ts b/src/main/events/repacks/magnet-data.ts deleted file mode 100644 index 23c86294..00000000 --- a/src/main/events/repacks/magnet-data.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { openWebTorrent } from "@main/services/open-web-torrent" -import { registerEvent } from "../register-event" - -const getMagnetData = async (_event: Electron.IpcMainInvokeEvent, magnet: string) => { - return openWebTorrent.getSeedersAndPeers(magnet) -} - -registerEvent(getMagnetData, { - name: 'getMagnetData' -}) diff --git a/src/preload/index.d.ts b/src/preload/index.d.ts index 94d93e6e..2ed7ef39 100644 --- a/src/preload/index.d.ts +++ b/src/preload/index.d.ts @@ -102,5 +102,5 @@ contextBridge.exposeInMainWorld("electron", { showOpenDialog: (options: Electron.OpenDialogOptions) => ipcRenderer.invoke("showOpenDialog", options), platform: process.platform, - getMagnetData: (magnet: string) => ipcRenderer.invoke("getMagnetData", magnet), + getMagnetHealth: (magnet: string) => ipcRenderer.invoke("getMagnetHealth", magnet), }); diff --git a/src/preload/index.ts b/src/preload/index.ts index 24b1cd54..778c2065 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -112,5 +112,5 @@ contextBridge.exposeInMainWorld("electron", { showOpenDialog: (options: Electron.OpenDialogOptions) => ipcRenderer.invoke("showOpenDialog", options), platform: process.platform, - getMagnetData: (magnet: string) => ipcRenderer.invoke("getMagnetData", magnet), + getMagnetHealth: (magnet: string) => ipcRenderer.invoke("getMagnetHealth", magnet), }); diff --git a/src/renderer/src/declaration.d.ts b/src/renderer/src/declaration.d.ts index 4ab50624..d18a23b7 100644 --- a/src/renderer/src/declaration.d.ts +++ b/src/renderer/src/declaration.d.ts @@ -88,7 +88,7 @@ declare global { options: Electron.OpenDialogOptions ) => Promise; platform: NodeJS.Platform; - getMagnetData: (magnet: string) => Promise<{ seeders: number; peers: number }>; + getMagnetHealth: (magnet: string) => Promise<{ seeders: number; peers: number }>; } interface Window { diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx index 77622e81..890ab622 100644 --- a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx +++ b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx @@ -27,7 +27,7 @@ export function useMagnetData(magnet: string) { return; } - window.electron.getMagnetData(magnet).then( + window.electron.getMagnetHealth(magnet).then( (result) => { if (result) { setMagnetData(result); From 23ab98294a7b9d77c40d9d78f6148462c77bedf7 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 21:06:05 -0300 Subject: [PATCH 22/38] feat: Add webtorrent-health package to dependencies --- package.json | 1 + yarn.lock | 272 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 267 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 4b64c54d..35d3882d 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "react-router-dom": "^6.22.3", "typeorm": "^0.3.20", "user-agents": "^1.1.193", + "webtorrent-health": "^1.2.0", "winston": "^3.13.0", "yaml": "^2.4.1" }, diff --git a/yarn.lock b/yarn.lock index 82eba219..179693ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1718,6 +1718,11 @@ acorn@^8.11.3, acorn@^8.8.1, acorn@^8.9.0: resolved "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz" integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== +addr-to-ip-port@^1.0.1: + version "1.5.4" + resolved "https://registry.yarnpkg.com/addr-to-ip-port/-/addr-to-ip-port-1.5.4.tgz#9542b1c6219fdb8c9ce6cc72c14ee880ab7ddd88" + integrity sha512-ByxmJgv8vjmDcl3IDToxL2yrWFrRtFpZAToY0f46XFXl8zS081t7El5MXIodwm7RC6DhHBRoOSMLFSPKCtHukg== + agent-base@6: version "6.0.2" resolved "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz" @@ -2006,6 +2011,11 @@ base64-js@^1.3.1, base64-js@^1.5.1: resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== +bencode@^2.0.1, bencode@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/bencode/-/bencode-2.0.3.tgz#89b9c80ea1b8573554915a7d0c15f62b0aa7fc52" + integrity sha512-D/vrAD4dLVX23NalHwb8dSvsUsxeRPO8Y7ToKA015JQYq69MLDOMkC0uGZYA/MPpltLO8rt8eqFC2j8DxjTZ/w== + bencode@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/bencode/-/bencode-4.0.0.tgz" @@ -2013,6 +2023,11 @@ bencode@^4.0.0: dependencies: uint8-util "^2.2.2" +bep53-range@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/bep53-range/-/bep53-range-1.1.1.tgz#20fd125b00a413254a77d42f63a43750ca7e64ac" + integrity sha512-ct6s33iiwRCUPp9KXnJ4QMWDgHIgaw36caK/5XEQ9L8dCzSQlJt1Vk6VmHh1VD4AlGCAI4C2zmtfItifBBPrhQ== + bep53-range@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/bep53-range/-/bep53-range-2.0.0.tgz" @@ -2038,6 +2053,43 @@ bindings@^1.5.0: dependencies: file-uri-to-path "1.0.0" +bittorrent-peerid@^1.3.3: + version "1.3.6" + resolved "https://registry.yarnpkg.com/bittorrent-peerid/-/bittorrent-peerid-1.3.6.tgz#3688705a64937a8176ac2ded1178fc7bd91b61db" + integrity sha512-VyLcUjVMEOdSpHaCG/7odvCdLbAB1y3l9A2V6WIje24uV7FkJPrQrH/RrlFmKxP89pFVDEnE+YlHaFujlFIZsg== + +bittorrent-tracker@^9.19.0: + version "9.19.0" + resolved "https://registry.yarnpkg.com/bittorrent-tracker/-/bittorrent-tracker-9.19.0.tgz#2266bfa8a45a57b09f8d8b184710ba531712d8ef" + integrity sha512-09d0aD2b+MC+zWvWajkUAKkYMynYW4tMbTKiRSthKtJZbafzEoNQSUHyND24SoCe3ZOb2fKfa6fu2INAESL9wA== + dependencies: + bencode "^2.0.1" + bittorrent-peerid "^1.3.3" + bn.js "^5.2.0" + chrome-dgram "^3.0.6" + clone "^2.0.0" + compact2string "^1.4.1" + debug "^4.1.1" + ip "^1.1.5" + lru "^3.1.0" + minimist "^1.2.5" + once "^1.4.0" + queue-microtask "^1.2.3" + random-iterate "^1.0.1" + randombytes "^2.1.0" + run-parallel "^1.2.0" + run-series "^1.1.9" + simple-get "^4.0.0" + simple-peer "^9.11.0" + simple-websocket "^9.1.0" + socks "^2.0.0" + string2compact "^1.3.0" + unordered-array-remove "^1.0.2" + ws "^7.4.5" + optionalDependencies: + bufferutil "^4.0.3" + utf-8-validate "^5.0.5" + bl@^4.0.3: version "4.1.0" resolved "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz" @@ -2047,6 +2099,11 @@ bl@^4.0.3: inherits "^2.0.4" readable-stream "^3.4.0" +blob-to-buffer@^1.2.9: + version "1.2.9" + resolved "https://registry.yarnpkg.com/blob-to-buffer/-/blob-to-buffer-1.2.9.tgz#a17fd6c1c564011408f8971e451544245daaa84a" + integrity sha512-BF033y5fN6OCofD3vgHmNtwZWRcq9NLyyxyILx9hfMy1sXYy4ojFl765hJ2lP0YaN2fuxPaLO2Vzzoxy0FLFFA== + bluebird-lst@^1.0.9: version "1.0.9" resolved "https://registry.npmjs.org/bluebird-lst/-/bluebird-lst-1.0.9.tgz" @@ -2059,6 +2116,11 @@ bluebird@^3.5.5: resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== +bn.js@^5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== + boolean@^3.0.1: version "3.2.0" resolved "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz" @@ -2127,6 +2189,13 @@ buffer@^6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" +bufferutil@^4.0.3: + version "4.0.8" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.8.tgz#1de6a71092d65d7766c4d8a522b261a6e787e8ea" + integrity sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw== + dependencies: + node-gyp-build "^4.3.0" + builder-util-runtime@9.2.4: version "9.2.4" resolved "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-9.2.4.tgz" @@ -2253,6 +2322,14 @@ chownr@^2.0.0: resolved "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz" integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== +chrome-dgram@^3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/chrome-dgram/-/chrome-dgram-3.0.6.tgz#2288b5c7471f66f073691206d36319dda713cf55" + integrity sha512-bqBsUuaOiXiqxXt/zA/jukNJJ4oaOtc7ciwqJpZVEaaXwwxqgI2/ZdG02vXYWUhHGziDlvGMQWk0qObgJwVYKA== + dependencies: + inherits "^2.0.4" + run-series "^1.1.9" + chromium-pickle-js@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz" @@ -2313,6 +2390,11 @@ clone-response@^1.0.2: dependencies: mimic-response "^1.0.0" +clone@^2.0.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" + integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== + color-convert@^1.9.0, color-convert@^1.9.3: version "1.9.3" resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" @@ -2386,6 +2468,13 @@ commander@^5.0.0: resolved "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz" integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== +compact2string@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/compact2string/-/compact2string-1.4.1.tgz#8d34929055f8300a13cfc030ad1832e2e53c2e25" + integrity sha512-3D+EY5nsRhqnOwDxveBv5T8wGo4DEvYxjDtPGmdOX+gfr5gE92c2RC0w2wa+xEefm07QuVqqcF3nZJUZ92l/og== + dependencies: + ipaddr.js ">= 0.1.5" + compare-version@^0.1.2: version "0.1.2" resolved "https://registry.npmjs.org/compare-version/-/compare-version-0.1.2.tgz" @@ -2797,6 +2886,11 @@ err-code@^2.0.2: resolved "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz" integrity sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA== +err-code@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/err-code/-/err-code-3.0.1.tgz#a444c7b992705f2b120ee320b09972eef331c920" + integrity sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA== + error-ex@^1.3.1: version "1.3.2" resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz" @@ -3404,6 +3498,11 @@ gensync@^1.0.0-beta.2: resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== +get-browser-rtc@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/get-browser-rtc/-/get-browser-rtc-1.1.0.tgz#d1494e299b00f33fc8e9d6d3343ba4ba99711a2c" + integrity sha512-MghbMJ61EJrRsDe7w1Bvqt3ZsBuqhce5nrn/XAwgwOXhcsz53/ltdxOse1h/8eKXj5slzxdsz56g5rzOFSGwfQ== + get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" @@ -3420,6 +3519,11 @@ get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.3, get-intrinsic@ has-symbols "^1.0.3" hasown "^2.0.0" +get-stdin@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53" + integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== + get-stdin@^9.0.0: version "9.0.0" resolved "https://registry.npmjs.org/get-stdin/-/get-stdin-9.0.0.tgz" @@ -3785,6 +3889,24 @@ internal-slot@^1.0.7: hasown "^2.0.0" side-channel "^1.0.4" +ip-address@^9.0.5: + version "9.0.5" + resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-9.0.5.tgz#117a960819b08780c3bd1f14ef3c1cc1d3f3ea5a" + integrity sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g== + dependencies: + jsbn "1.1.0" + sprintf-js "^1.1.3" + +ip@^1.1.5: + version "1.1.9" + resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.9.tgz#8dfbcc99a754d07f425310b86a99546b1151e396" + integrity sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ== + +"ipaddr.js@>= 0.1.5", ipaddr.js@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-2.2.0.tgz#d33fa7bac284f4de7af949638c9d68157c6b92e8" + integrity sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA== + is-array-buffer@^3.0.4: version "3.0.4" resolved "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz" @@ -4061,6 +4183,11 @@ js-yaml@^4.1.0: dependencies: argparse "^2.0.1" +jsbn@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040" + integrity sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A== + jsdom@^24.0.0: version "24.0.0" resolved "https://registry.npmjs.org/jsdom/-/jsdom-24.0.0.tgz" @@ -4282,6 +4409,13 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +lru@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lru/-/lru-3.1.0.tgz#ea7fb8546d83733396a13091d76cfeb4c06837d5" + integrity sha512-5OUtoiVIGU4VXBOshidmtOsvBIvcQR6FD/RzWSvaeHyxCGB+PCUCu+52lqMfdc0h/2CLvHhZS4TwUmMQrrMbBQ== + dependencies: + inherits "^2.0.1" + lucide-react@^0.378.0: version "0.378.0" resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.378.0.tgz#232acb99c6baedfa90959a2c0dd11327b058bde8" @@ -4294,6 +4428,14 @@ magic-string@0.30.8, magic-string@^0.30.5: dependencies: "@jridgewell/sourcemap-codec" "^1.4.15" +magnet-uri@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/magnet-uri/-/magnet-uri-6.2.0.tgz#10f7be050bf23452df210838239b118463c3eeff" + integrity sha512-O9AgdDwT771fnUj0giPYu/rACpz8173y8UXCSOdLITjOVfBenZ9H9q3FqQmveK+ORUMuD+BkKNSZP8C3+IMAKQ== + dependencies: + bep53-range "^1.1.0" + thirty-two "^1.0.2" + magnet-uri@^7.0.5: version "7.0.5" resolved "https://registry.npmjs.org/magnet-uri/-/magnet-uri-7.0.5.tgz" @@ -4390,7 +4532,7 @@ minimist@1.2.6: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== -minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.6, minimist@^1.2.8: +minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5, minimist@^1.2.6, minimist@^1.2.8: version "1.2.8" resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -4546,6 +4688,11 @@ node-fetch@^3.3.0: fetch-blob "^3.1.4" formdata-polyfill "^4.0.10" +node-gyp-build@^4.3.0: + version "4.8.1" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.1.tgz#976d3ad905e71b76086f4f0b0d3637fe79b6cda5" + integrity sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw== + node-releases@^2.0.14: version "2.0.14" resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz" @@ -4736,6 +4883,19 @@ parse-torrent@^11.0.16: queue-microtask "^1.2.3" uint8-util "^2.2.4" +parse-torrent@^9.1.5: + version "9.1.5" + resolved "https://registry.yarnpkg.com/parse-torrent/-/parse-torrent-9.1.5.tgz#fcae5f360d9baf617d9a2de68e74d5de4c8099fd" + integrity sha512-K8FXRwTOaZMI0/xuv0dpng1MVHZRtMJ0jRWBJ3qZWVNTrC1MzWUxm9QwaXDz/2qPhV2XC4UIHI92IGHwseAwaA== + dependencies: + bencode "^2.0.2" + blob-to-buffer "^1.2.9" + get-stdin "^8.0.0" + magnet-uri "^6.2.0" + queue-microtask "^1.2.3" + simple-get "^4.0.1" + simple-sha1 "^3.1.0" + parse5-htmlparser2-tree-adapter@^6.0.0: version "6.0.1" resolved "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz" @@ -4945,6 +5105,18 @@ quick-lru@^5.1.1: resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz" integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== +random-iterate@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/random-iterate/-/random-iterate-1.0.1.tgz#f7d97d92dee6665ec5f6da08c7f963cad4b2ac99" + integrity sha512-Jdsdnezu913Ot8qgKgSgs63XkAjEsnMcS1z+cC6D6TNXsUXsMxy0RpclF2pzGZTEiTXL9BiArdGTEexcv4nqcA== + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + rc@^1.2.7: version "1.2.8" resolved "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz" @@ -5192,13 +5364,23 @@ rrweb-cssom@^0.6.0: resolved "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz" integrity sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw== -run-parallel@^1.1.9: +run-parallel@^1.1.9, run-parallel@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== dependencies: queue-microtask "^1.2.2" +run-series@^1.1.9: + version "1.1.9" + resolved "https://registry.yarnpkg.com/run-series/-/run-series-1.1.9.tgz#15ba9cb90e6a6c054e67c98e1dc063df0ecc113a" + integrity sha512-Arc4hUN896vjkqCYrUXquBFtRZdv1PfLbTYP71efP6butxyQ0kWpiNJyAgsxscmQg1cqvHY32/UCBzXedTpU2g== + +rusha@^0.8.13: + version "0.8.14" + resolved "https://registry.yarnpkg.com/rusha/-/rusha-0.8.14.tgz#a977d0de9428406138b7bb90d3de5dcd024e2f68" + integrity sha512-cLgakCUf6PedEu15t8kbsjnwIFFR2D4RfL+W3iWFJ4iac7z4B0ZI8fxy4R3J956kAI68HclCFGL8MPoUVC3qVA== + safe-array-concat@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz" @@ -5209,7 +5391,7 @@ safe-array-concat@^1.1.2: has-symbols "^1.0.3" isarray "^2.0.5" -safe-buffer@^5.0.1, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -5350,7 +5532,7 @@ simple-concat@^1.0.0: resolved "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz" integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== -simple-get@^4.0.0: +simple-get@^4.0.0, simple-get@^4.0.1: version "4.0.1" resolved "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz" integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA== @@ -5359,6 +5541,27 @@ simple-get@^4.0.0: once "^1.3.1" simple-concat "^1.0.0" +simple-peer@^9.11.0: + version "9.11.1" + resolved "https://registry.yarnpkg.com/simple-peer/-/simple-peer-9.11.1.tgz#9814d5723f821b778b7fb011bdefcbd1e788e6cc" + integrity sha512-D1SaWpOW8afq1CZGWB8xTfrT3FekjQmPValrqncJMX7QFl8YwhrPTZvMCANLtgBwwdS+7zURyqxDDEmY558tTw== + dependencies: + buffer "^6.0.3" + debug "^4.3.2" + err-code "^3.0.1" + get-browser-rtc "^1.1.0" + queue-microtask "^1.2.3" + randombytes "^2.1.0" + readable-stream "^3.6.0" + +simple-sha1@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/simple-sha1/-/simple-sha1-3.1.0.tgz#40cac8436dfaf9924332fc46a5c7bca45f656131" + integrity sha512-ArTptMRC1v08H8ihPD6l0wesKvMfF9e8XL5rIHPanI7kGOsSsbY514MwVu6X1PITHCTB2F08zB7cyEbfc4wQjg== + dependencies: + queue-microtask "^1.2.2" + rusha "^0.8.13" + simple-swizzle@^0.2.2: version "0.2.2" resolved "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz" @@ -5373,6 +5576,17 @@ simple-update-notifier@2.0.0: dependencies: semver "^7.5.3" +simple-websocket@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/simple-websocket/-/simple-websocket-9.1.0.tgz#91cbb39eafefbe7e66979da6c639109352786a7f" + integrity sha512-8MJPnjRN6A8UCp1I+H/dSFyjwJhp6wta4hsVRhjf8w9qBHRzxYt14RaOcjvQnhD1N4yKOddEjflwMnQM4VtXjQ== + dependencies: + debug "^4.3.1" + queue-microtask "^1.2.2" + randombytes "^2.1.0" + readable-stream "^3.6.0" + ws "^7.4.2" + slash@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" @@ -5387,7 +5601,7 @@ slice-ansi@^3.0.0: astral-regex "^2.0.0" is-fullwidth-code-point "^3.0.0" -smart-buffer@^4.0.2: +smart-buffer@^4.0.2, smart-buffer@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== @@ -5400,6 +5614,14 @@ snake-case@^3.0.4: dot-case "^3.0.4" tslib "^2.0.3" +socks@^2.0.0: + version "2.8.3" + resolved "https://registry.yarnpkg.com/socks/-/socks-2.8.3.tgz#1ebd0f09c52ba95a09750afe3f3f9f724a800cb5" + integrity sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw== + dependencies: + ip-address "^9.0.5" + smart-buffer "^4.2.0" + source-map-js@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz" @@ -5418,7 +5640,7 @@ source-map@^0.6.0: resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -sprintf-js@^1.1.2: +sprintf-js@^1.1.2, sprintf-js@^1.1.3: version "1.1.3" resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz" integrity sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA== @@ -5497,6 +5719,14 @@ string.prototype.trimstart@^1.0.8: define-properties "^1.2.1" es-object-atoms "^1.0.0" +string2compact@^1.3.0: + version "1.3.2" + resolved "https://registry.yarnpkg.com/string2compact/-/string2compact-1.3.2.tgz#c9d11a13f368404b8025425cc53f9916de1d0b8b" + integrity sha512-3XUxUgwhj7Eqh2djae35QHZZT4mN3fsO7kagZhSGmhhlrQagVvWSFuuFIWnpxFS0CdTB2PlQcaL16RDi14I8uw== + dependencies: + addr-to-ip-port "^1.0.1" + ipaddr.js "^2.0.0" + string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" @@ -5637,6 +5867,11 @@ thenify-all@^1.0.0: dependencies: any-promise "^1.0.0" +thirty-two@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/thirty-two/-/thirty-two-1.0.2.tgz#4ca2fffc02a51290d2744b9e3f557693ca6b627a" + integrity sha512-OEI0IWCe+Dw46019YLl6V10Us5bi574EvlJEOcAkB29IzQ/mYD1A6RyNHLjZPiHCmuodxvgF6U+vZO1L15lxVA== + tmp-promise@^3.0.2: version "3.0.3" resolved "https://registry.npmjs.org/tmp-promise/-/tmp-promise-3.0.3.tgz" @@ -5841,6 +6076,11 @@ universalify@^2.0.0: resolved "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== +unordered-array-remove@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/unordered-array-remove/-/unordered-array-remove-1.0.2.tgz#c546e8f88e317a0cf2644c97ecb57dba66d250ef" + integrity sha512-45YsfD6svkgaCBNyvD+dFHm4qFX9g3wRSIVgWVPtm2OCnphvPxzJoe20ATsiNpNJrmzHifnxm+BN5F7gFT/4gw== + unplugin@1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/unplugin/-/unplugin-1.0.1.tgz" @@ -5891,6 +6131,13 @@ user-agents@^1.1.193: dependencies: lodash.clonedeep "^4.5.0" +utf-8-validate@^5.0.5: + version "5.0.10" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" + integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== + dependencies: + node-gyp-build "^4.3.0" + utf8-byte-length@^1.0.1: version "1.0.4" resolved "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz" @@ -5983,6 +6230,14 @@ webpack-virtual-modules@^0.5.0: resolved "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.5.0.tgz" integrity sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw== +webtorrent-health@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/webtorrent-health/-/webtorrent-health-1.2.0.tgz#f127fe4dba603e3bbed4224c1de8e18034ab02a2" + integrity sha512-id51LF+1IGvqSXhdO9rl9riDLGRPO7e/DrjcNJ/1PhTp5O3+1U50+ogDEJyxQvIISZV//xYX+kMM4Fn9cogfCg== + dependencies: + bittorrent-tracker "^9.19.0" + parse-torrent "^9.1.5" + whatwg-encoding@^3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz" @@ -6132,6 +6387,11 @@ wrappy@1: resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +ws@^7.4.2, ws@^7.4.5: + version "7.5.9" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" + integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== + ws@^8.16.0: version "8.17.0" resolved "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz" From 0333282915e00b6f606ee930ce025dd82a80cab3 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 21:16:15 -0300 Subject: [PATCH 23/38] refactor: Update import paths and improve async function in get-magnet-health --- .../events/{ => catalogue}/repacks/get-magnet-health.ts | 4 ++-- src/main/events/index.ts | 2 +- src/main/services/web-torrent-data.ts | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) rename src/main/events/{ => catalogue}/repacks/get-magnet-health.ts (63%) diff --git a/src/main/events/repacks/get-magnet-health.ts b/src/main/events/catalogue/repacks/get-magnet-health.ts similarity index 63% rename from src/main/events/repacks/get-magnet-health.ts rename to src/main/events/catalogue/repacks/get-magnet-health.ts index 840f3eb1..20679869 100644 --- a/src/main/events/repacks/get-magnet-health.ts +++ b/src/main/events/catalogue/repacks/get-magnet-health.ts @@ -1,5 +1,5 @@ -import { webTorrentData } from "@main/services/web-torrent-health" -import { registerEvent } from "../register-event" +import { webTorrentData } from "@main/services/web-torrent-data" +import { registerEvent } from "../../register-event" const getMagnetHealth = async (_event: Electron.IpcMainInvokeEvent, magnet: string) => { return webTorrentData.getSeedersAndPeers(magnet) diff --git a/src/main/events/index.ts b/src/main/events/index.ts index d54b23a6..c36195c9 100644 --- a/src/main/events/index.ts +++ b/src/main/events/index.ts @@ -7,6 +7,7 @@ import "./catalogue/get-games"; import "./catalogue/get-how-long-to-beat"; import "./catalogue/get-random-game"; import "./catalogue/search-games"; +import "./catalogue/repacks/get-magnet-health" import "./hardware/get-disk-free-space"; import "./library/add-game-to-library"; import "./library/close-game"; @@ -27,7 +28,6 @@ import "./torrenting/start-game-download"; import "./user-preferences/get-user-preferences"; import "./user-preferences/update-user-preferences"; import "./user-preferences/auto-launch"; -import "./repacks/get-magnet-health" ipcMain.handle("ping", () => "pong"); ipcMain.handle("getVersion", () => app.getVersion()); diff --git a/src/main/services/web-torrent-data.ts b/src/main/services/web-torrent-data.ts index e15dbdff..96cc6229 100644 --- a/src/main/services/web-torrent-data.ts +++ b/src/main/services/web-torrent-data.ts @@ -10,10 +10,12 @@ export const webTorrentData = { return new Promise((resolve, reject) => { WebTorrentHealth(magnet, (err: Error, data: WebTorrentHealthData) => { if (err) { - reject(err); - } else { - resolve(data); + return reject(err); } + + const { peers, seeds } = data; + + return resolve({ peers, seeders: seeds }); }); }); }, From 6053b7cd679687a335d863b7a3573e640dc8ce9b Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 21:20:56 -0300 Subject: [PATCH 24/38] refactor: Remove unused "repack_language_code" translations from multiple locale files --- src/locales/en/translation.json | 11 ----------- src/locales/es/translation.json | 11 ----------- src/locales/fr/translation.json | 11 ----------- src/locales/hu/translation.json | 11 ----------- src/locales/it/translation.json | 11 ----------- src/locales/pl/translation.json | 11 ----------- src/locales/pt/translation.json | 11 ----------- src/locales/ru/translation.json | 11 ----------- src/locales/tr/translation.json | 11 ----------- src/renderer/src/helpers/searcher.ts | 17 ++++++++++++++--- .../src/pages/game-details/repacks-modal.tsx | 2 +- .../seeders-and-peers/seeders-and-peers.tsx | 4 ++-- .../{useMagnetData.tsx => useMagnetHealth.tsx} | 2 +- 13 files changed, 18 insertions(+), 106 deletions(-) rename src/renderer/src/pages/game-details/seeders-and-peers/{useMagnetData.tsx => useMagnetHealth.tsx} (96%) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index bbef90bb..8c7e704d 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -97,17 +97,6 @@ "copy_to_clipboard": "Copy", "copied_to_clipboard": "Copied", "got_it": "Got it", - "repack_language_code": { - "en": "English", - "es": "Spanish", - "fr": "French", - "hu": "Hungarian", - "it": "Italian", - "pl": "Polish", - "pt": "Portuguese", - "ru": "Russian", - "tr": "Turkish" - }, "multi_language": "Multi Language", "multiplayer": "Multi Player" }, diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json index df89df82..d2a7d553 100644 --- a/src/locales/es/translation.json +++ b/src/locales/es/translation.json @@ -94,17 +94,6 @@ "dont_show_it_again": "No mostrar de nuevo", "copy_to_clipboard": "Copiar", "copied_to_clipboard": "Copiado", - "repack_language_code": { - "en": "Inglés", - "es": "Español", - "fr": "Francés", - "hu": "Húngaro", - "it": "Italiano", - "pl": "Polaco", - "pt": "Portugués", - "ru": "Ruso", - "tr": "Turco" - }, "multi_language": "Multi Idioma", "multiplayer": "Multijugador" }, diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json index 064c58e6..42e14e1b 100644 --- a/src/locales/fr/translation.json +++ b/src/locales/fr/translation.json @@ -76,17 +76,6 @@ "deleting": "Suppression du programme d'installation…", "playing_now": "Jeu en cours", "last_time_played": "Dernièrement joué {{période}}", - "repack_language_code": { - "en": "Anglais", - "es": "Espagnol", - "fr": "Français", - "hu": "Hongrois", - "it": "Italien", - "pl": "Polonais", - "pt": "Portugais", - "ru": "Russe", - "tr": "Turc" - }, "multi_language": "Multilingue", "multiplayer": "Multijoueur" }, diff --git a/src/locales/hu/translation.json b/src/locales/hu/translation.json index ff777fba..038e6874 100644 --- a/src/locales/hu/translation.json +++ b/src/locales/hu/translation.json @@ -85,17 +85,6 @@ "downloads_path": "Letöltések helye", "select_folder_hint": "Ahhoz, hogy megváltoztasd a helyet, hozzákell férned a", "download_now": "Töltsd le most", - "repack_language_code": { - "en": "Angol", - "es": "Spanyol", - "fr": "Francia", - "hu": "Magyar", - "it": "Olasz", - "pl": "Lengyel", - "pt": "Portugál", - "ru": "Orosz", - "tr": "Török" - }, "multi_language": "Többnyelvű", "multiplayer": "Többjátékos" }, diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json index 646989bf..030c28c1 100644 --- a/src/locales/it/translation.json +++ b/src/locales/it/translation.json @@ -98,17 +98,6 @@ "copy_to_clipboard": "Copia", "copied_to_clipboard": "Copiato", "got_it": "Capito", - "repack_language_code": { - "en": "Inglese", - "es": "Spagnolo", - "fr": "Francese", - "hu": "Ungherese", - "it": "Italiano", - "pl": "Polacco", - "pt": "Portoghese", - "ru": "Russo", - "tr": "Turco" - }, "multi_language": "Multilingua", "multiplayer": "Multigiocatore" }, diff --git a/src/locales/pl/translation.json b/src/locales/pl/translation.json index 64c88a82..34a69633 100644 --- a/src/locales/pl/translation.json +++ b/src/locales/pl/translation.json @@ -84,17 +84,6 @@ "select_folder_hint": "Aby zmienić domyślny folder, przejdź do", "settings": "Ustawienia Hydra", "download_now": "Pobierz teraz", - "repack_language_code": { - "en": "Angielski", - "es": "Hiszpański", - "fr": "Francuski", - "hu": "Węgierski", - "it": "Włoski", - "pl": "Polski", - "pt": "Portugalski", - "ru": "Rosyjski", - "tr": "Turecki" - }, "multi_language": "Wielojęzyczny", "multiplayer": "Wieloosobowy" }, diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index 42d3b3ba..528cd8c7 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -93,17 +93,6 @@ "copy_to_clipboard": "Copiar", "copied_to_clipboard": "Copiado", "got_it": "Entendi", - "repack_language_code": { - "en": "Inglês", - "es": "Espanhol", - "fr": "Francês", - "hu": "Húngaro", - "it": "Italiano", - "pl": "Polonês", - "pt": "Português", - "ru": "Russo", - "tr": "Turco" - }, "multi_language": "Multi Idioma", "multiplayer": "Multijogador" }, diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json index 4d3c2fc1..94258442 100644 --- a/src/locales/ru/translation.json +++ b/src/locales/ru/translation.json @@ -98,17 +98,6 @@ "copy_to_clipboard": "Копировать", "copied_to_clipboard": "Скопировано", "got_it": "Понятно", - "repack_language_code": { - "en": "Английский", - "es": "Испанский", - "fr": "Французский", - "hu": "Венгерский", - "it": "Итальянский", - "pl": "Польский", - "pt": "Португальский", - "ru": "Русский", - "tr": "Турецкий" - }, "multi_language": "Мультиязычный", "multiplayer": "Многопользовательский" }, diff --git a/src/locales/tr/translation.json b/src/locales/tr/translation.json index 8162be6b..a743cce0 100644 --- a/src/locales/tr/translation.json +++ b/src/locales/tr/translation.json @@ -97,17 +97,6 @@ "copy_to_clipboard": "Kopyala", "copied_to_clipboard": "Kopyalandı", "got_it": "Tamam", - "repack_language_code": { - "en": "İngilizce", - "es": "İspanyolca", - "fr": "Fransızca", - "hu": "Macarca", - "it": "İtalyanca", - "pl": "Polonyaca", - "pt": "Portekizce", - "ru": "Rusça", - "tr": "Türkçe" - }, "multi_language": "Çoklu Dil", "multiplayer": "Çok Oyunculu" }, diff --git a/src/renderer/src/helpers/searcher.ts b/src/renderer/src/helpers/searcher.ts index e336617d..d4a81a95 100644 --- a/src/renderer/src/helpers/searcher.ts +++ b/src/renderer/src/helpers/searcher.ts @@ -10,10 +10,21 @@ export const supportMultiLanguage = (title: string) => { return multiFollowedByDigitsRegex.test(title.toLowerCase()); } +// const languageCode = 'en'; +// const displayNames = new Intl.DisplayNames([languageCode], { type: 'language' }); +// const englishLanguage = displayNames.of(languageCode); + +// console.log(englishLanguage); // Output: "English" + + export const getRepackLanguageBasedOnRepacker = (repacker: string) => { - const repackMap = { - 'xatab': 'ru', + const languageCodes = { + xatab: 'ru', } - return repackMap[repacker.toLowerCase()] || 'en'; + const languageCode = languageCodes[repacker.toLowerCase()] || 'en'; + + const displayNames = new Intl.DisplayNames([languageCode], { type: 'language' }); + + return displayNames.of(languageCode); } diff --git a/src/renderer/src/pages/game-details/repacks-modal.tsx b/src/renderer/src/pages/game-details/repacks-modal.tsx index 56217ec4..352d5900 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.tsx +++ b/src/renderer/src/pages/game-details/repacks-modal.tsx @@ -109,7 +109,7 @@ export function RepacksModal({ {repack.uploadDate ? format(repack.uploadDate, "dd/MM/yyyy") : ""} - {" - " + t(`repack_language_code.${getRepackLanguageBasedOnRepacker(repack.repacker)}`)} + {" - " + getRepackLanguageBasedOnRepacker(repack.repacker)}

) { - const { magnetData, isLoading, error } = useMagnetData(repack.magnet); + const { magnetData, isLoading, error } = useMagnetHealth(repack.magnet); if (isLoading) { return ; diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx similarity index 96% rename from src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx rename to src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx index 890ab622..cb87b9d8 100644 --- a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetData.tsx +++ b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx @@ -3,7 +3,7 @@ import { TorrentData } from "./types"; const cache: Record = {}; -export function useMagnetData(magnet: string) { +export function useMagnetHealth(magnet: string) { const [magnetData, setMagnetData] = useState( cache[magnet] || null ); From f9343ca0c24cc3995b42af0a325895addffe8360 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 21:29:06 -0300 Subject: [PATCH 25/38] style: Remove lucide-react icons and replace them with SVG components --- package.json | 1 - src/renderer/src/assets/sprout-icon.svg | 1 + src/renderer/src/assets/users-icon.svg | 1 + .../seeders-and-peers/seeders-and-peers.tsx | 15 ++++++++------- 4 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 src/renderer/src/assets/sprout-icon.svg create mode 100644 src/renderer/src/assets/users-icon.svg diff --git a/package.json b/package.json index 35d3882d..333cf817 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "jsdom": "^24.0.0", "lodash-es": "^4.17.21", "lottie-react": "^2.4.0", - "lucide-react": "^0.378.0", "node-7z-archive": "^1.1.7", "parse-torrent": "^11.0.16", "ps-list": "^8.1.1", diff --git a/src/renderer/src/assets/sprout-icon.svg b/src/renderer/src/assets/sprout-icon.svg new file mode 100644 index 00000000..fb35828a --- /dev/null +++ b/src/renderer/src/assets/sprout-icon.svg @@ -0,0 +1 @@ + diff --git a/src/renderer/src/assets/users-icon.svg b/src/renderer/src/assets/users-icon.svg new file mode 100644 index 00000000..63cb3f98 --- /dev/null +++ b/src/renderer/src/assets/users-icon.svg @@ -0,0 +1 @@ + diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx index c80838f9..e8cc31f2 100644 --- a/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx +++ b/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx @@ -1,10 +1,11 @@ import { GameRepack } from "@types"; -import { Sprout, Users } from "lucide-react"; +import UsersIcon from "@renderer/assets/users-icon.svg?react"; +import SproutIcon from "@renderer/assets/sprout-icon.svg?react"; import { useMagnetHealth } from "./useMagnetHealth"; import { Tooltip } from "@renderer/components/tooltip/tooltip"; import { SeedersAndPeersSkeleton } from "./seeders-and-peers-skeleton"; -import { vars } from "@renderer/theme.css"; +import { SPACING_UNIT, vars } from "@renderer/theme.css"; interface SeedersAndPeersProps { repack: GameRepack; @@ -29,21 +30,21 @@ export function SeedersAndPeers({ repack }: Readonly) { }} > - + {magnetData?.seeders} - + {magnetData?.peers} From 713392ee293b07d6d92c252bfdf48cc8e53f7d88 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 21:34:23 -0300 Subject: [PATCH 26/38] style: Remove unnecessary code in translation.json --- src/locales/tr/translation.json | 157 +------------------------------- 1 file changed, 4 insertions(+), 153 deletions(-) diff --git a/src/locales/tr/translation.json b/src/locales/tr/translation.json index 08324c73..5a5f879e 100644 --- a/src/locales/tr/translation.json +++ b/src/locales/tr/translation.json @@ -19,7 +19,10 @@ "follow_us": "Bizi takip et", "home": "Ana menü", "discord": "Discord'umuza katıl", +<<<<<<< HEAD +======= "telegram": "Telegram'umuza katıl", +>>>>>>> main "x": "X'te bizi takip et", "github": "GitHub'da bize katkı yap" }, @@ -161,158 +164,6 @@ "instructions": "Oyunları düzgün şekilde çalıştırmak için Linux distronuza bunlardan birini nasıl yükleyebileceğinize bakın" }, "modal": { - "close": "Kapat tuşu", - "sidebar": { - "catalogue": "Katalog", - "downloads": "İndirmeler", - "settings": "Ayarlar", - "my_library": "Kütüphane", - "downloading_metadata": "{{title}} (Metadata indiriliyor…)", - "checking_files": "{{title}} ({{percentage}} - Dosyalar kontrol ediliyor…)", - "paused": "{{title}} (Duraklatıldı)", - "downloading": "{{title}} ({{percentage}} - İndiriliyor…)", - "filter": "Kütüphaneyi filtrele", - "follow_us": "Bizi takip et", - "home": "Ana menü", - "discord": "Discord'umuza katıl", - "telegram": "Telegram'umuza katıl", - "x": "X'te bizi takip et", - "github": "GitHub'da bize katkı yap" - }, - "header": { - "search": "Ara", - "home": "Ana menü", - "catalogue": "Katalog", - "downloads": "İndirmeler", - "search_results": "Arama sonuçları", - "settings": "Ayarlar" - }, - "bottom_panel": { - "no_downloads_in_progress": "İndirilen bir şey yok", - "downloading_metadata": "{{title}} metadatası indiriliyor…", - "checking_files": "{{title}} dosyaları kontrol ediliyor… ({{percentage}} tamamlandı)", - "downloading": "{{title}} indiriliyor… ({{percentage}} tamamlandı) - Bitiş {{eta}} - {{speed}}" - }, - "catalogue": { - "next_page": "Sonraki sayfa", - "previous_page": "Önceki sayfa" - }, - "game_details": { - "open_download_options": "İndirme seçeneklerini aç", - "download_options_zero": "İndirme seçeneği yok", - "download_options_one": "{{count}} indirme seçeneği", - "download_options_other": "{{count}} indirme seçeneği", - "updated_at": "{{updated_at}} güncellendi", - "install": "İndir", - "resume": "Devam et", - "pause": "Duraklat", - "cancel": "İptal et", - "remove": "Sil", - "remove_from_list": "Sil", - "space_left_on_disk": "Diskte {{space}} yer kaldı", - "eta": "Bitiş {{eta}}", - "downloading_metadata": "Metadata indiriliyor…", - "checking_files": "Dosyalar kontrol ediliyor…", - "filter": "Repackleri filtrele", - "requirements": "Sistem gereksinimleri", - "minimum": "Minimum", - "recommended": "Önerilen", - "no_minimum_requirements": "{{title}} minimum sistem gereksinim bilgilerini karşılamıyor", - "no_recommended_requirements": "{{title}} önerilen sistem gereksinim bilgilerini karşılamıyor", - "paused_progress": "{{progress}} (Duraklatıldı)", - "release_date": "{{date}} tarihinde çıktı", - "publisher": "{{publisher}} tarihinde yayınlandı", - "copy_link_to_clipboard": "Link'i kopyala", - "copied_link_to_clipboard": "Link kopyalandı", - "hours": "saatler", - "minutes": "dakikalar", - "amount_hours": "{{amount}} saat", - "amount_minutes": "{{amount}} dakika", - "accuracy": "%{{accuracy}} doğruluk", - "add_to_library": "Kütüphaneye ekle", - "remove_from_library": "Kütüphaneden kaldır", - "no_downloads": "İndirme yok", - "play_time": "{{amount}} oynandı", - "last_time_played": "Son oynanan {{period}}", - "not_played_yet": "Bu {{title}} hiç oynanmadı", - "next_suggestion": "Sıradaki öneri", - "play": "Oyna", - "deleting": "Installer siliniyor…", - "close": "Kapat", - "playing_now": "Şimdi oynanıyor", - "change": "Değiştir", - "repacks_modal_description": "İndirmek istediğiiniz repacki seçin", - "downloads_path": "İndirme yolu", - "select_folder_hint": "Varsayılan klasörü değiştirmek için ulaşmanız gereken ayar", - "settings": "Ayarlar", - "download_now": "Şimdi", - "installation_instructions": "Kurulum", - "installation_instructions_description": "Bu oyunu kurmak için ek adımlar gerekiyor", - "online_fix_instruction": "OnlineFix oyunlarını ayıklamak için parola gerekiyor. Gerekli olduğunda bu parolayı kullanın:", - "dodi_installation_instruction": "Dodi installerını açtığınızda, kurulumu başlatmak için bu tuşa basın <0 />:", - "dont_show_it_again": "Tekrar gösterme", - "copy_to_clipboard": "Kopyala", - "copied_to_clipboard": "Kopyalandı", - "got_it": "Tamam" - }, - "activation": { - "title": "Hydra'yı aktif et", - "installation_id": "Kurulum ID'si:", - "enter_activation_code": "Aktifleştirme kodunuzu girin", - "message": "Bunu nerede soracağınızı bilmiyorsanız, buna sahip olmamanız gerekiyor.", - "activate": "Aktif et", - "loading": "Yükleniyor…" - }, - "downloads": { - "resume": "Devam et", - "pause": "Duraklat", - "eta": "Bitiş {{eta}}", - "paused": "Duraklatıldı", - "verifying": "Doğrulanıyor…", - "completed_at": "{{date}} tarihinde tamamlanacak", - "completed": "Tamamlandı", - "cancelled": "İptal edildi", - "download_again": "Tekrar indir", - "cancel": "İptal et", - "filter": "Yüklü oyunları filtrele", - "remove": "Kaldır", - "downloading_metadata": "Metadata indiriliyor…", - "checking_files": "Dosyalar kontrol ediliyor…", - "starting_download": "İndirme başlatılıyor…", - "deleting": "Installer siliniyor…", - "delete": "Installer'ı sil", - "remove_from_list": "Kaldır", - "delete_modal_title": "Emin misiniz?", - "delete_modal_description": "Bu bilgisayarınızdan tüm kurulum dosyalarını silecek", - "install": "Kur" - }, - "settings": { - "downloads_path": "İndirme yolu", - "change": "Güncelle", - "notifications": "Bildirimler", - "enable_download_notifications": "Bir indirme bittiğinde", - "enable_repack_list_notifications": "Yeni bir repack eklendiğinde", - "telemetry": "Telemetri", - "telemetry_description": "Anonim kullanım istatistiklerini aktifleştir" - }, - "notifications": { - "download_complete": "İndirme tamamlandı", - "game_ready_to_install": "{{title}} kuruluma hazır", - "repack_list_updated": "Repack listesi güncellendi", - "repack_count_one": "{{count}} yeni repack eklendi", - "repack_count_other": "{{count}} yeni repack eklendi" - }, - "system_tray": { - "open": "Hydra'yı aç", - "quit": "Çık" - }, - "game_card": { - "no_downloads": "İndirme mevcut değil" - }, - "binary_not_found_modal": { - "title": "Programlar yüklü değil", - "description": "Sisteminizde Wine veya Lutris çalıştırılabiliri bulunamadı", - "instructions": "Oyunları düzgün şekilde çalıştırmak için Linux distronuza bunlardan birini nasıl yükleyebileceğinize bakın" - } + "close": "Kapat tuşu" } } From e6b62399f79b8cefc739a8fa81cd7965a544bea9 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 21:35:07 -0300 Subject: [PATCH 27/38] fix: solve merge conflict markers --- src/locales/tr/translation.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/locales/tr/translation.json b/src/locales/tr/translation.json index 5a5f879e..efeb5fd1 100644 --- a/src/locales/tr/translation.json +++ b/src/locales/tr/translation.json @@ -19,10 +19,7 @@ "follow_us": "Bizi takip et", "home": "Ana menü", "discord": "Discord'umuza katıl", -<<<<<<< HEAD -======= "telegram": "Telegram'umuza katıl", ->>>>>>> main "x": "X'te bizi takip et", "github": "GitHub'da bize katkı yap" }, From f2af65d4cdb2de8f2170ba328264c95694462842 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 21:40:30 -0300 Subject: [PATCH 28/38] style: Update formatting in various files --- .../catalogue/repacks/get-magnet-health.ts | 17 ++++--- src/main/events/index.ts | 2 +- src/preload/index.d.ts | 3 +- src/preload/index.ts | 3 +- .../src/components/tooltip/tooltip.css.ts | 48 +++++++++---------- .../src/components/tooltip/tooltip.tsx | 22 +++++---- src/renderer/src/declaration.d.ts | 4 +- src/renderer/src/helpers/searcher.ts | 23 +++++---- .../pages/game-details/repacks-modal.css.ts | 1 - .../src/pages/game-details/repacks-modal.tsx | 12 ++--- .../seeders-and-peers/seeders-and-peers.tsx | 2 +- .../seeders-and-peers/useMagnetHealth.tsx | 1 - 12 files changed, 76 insertions(+), 62 deletions(-) diff --git a/src/main/events/catalogue/repacks/get-magnet-health.ts b/src/main/events/catalogue/repacks/get-magnet-health.ts index 20679869..86b1466c 100644 --- a/src/main/events/catalogue/repacks/get-magnet-health.ts +++ b/src/main/events/catalogue/repacks/get-magnet-health.ts @@ -1,10 +1,13 @@ -import { webTorrentData } from "@main/services/web-torrent-data" -import { registerEvent } from "../../register-event" +import { webTorrentData } from "@main/services/web-torrent-data"; +import { registerEvent } from "../../register-event"; -const getMagnetHealth = async (_event: Electron.IpcMainInvokeEvent, magnet: string) => { - return webTorrentData.getSeedersAndPeers(magnet) -} +const getMagnetHealth = async ( + _event: Electron.IpcMainInvokeEvent, + magnet: string +) => { + return webTorrentData.getSeedersAndPeers(magnet); +}; registerEvent(getMagnetHealth, { - name: 'getMagnetHealth' -}) + name: "getMagnetHealth", +}); diff --git a/src/main/events/index.ts b/src/main/events/index.ts index c36195c9..4e49dd1b 100644 --- a/src/main/events/index.ts +++ b/src/main/events/index.ts @@ -7,7 +7,7 @@ import "./catalogue/get-games"; import "./catalogue/get-how-long-to-beat"; import "./catalogue/get-random-game"; import "./catalogue/search-games"; -import "./catalogue/repacks/get-magnet-health" +import "./catalogue/repacks/get-magnet-health"; import "./hardware/get-disk-free-space"; import "./library/add-game-to-library"; import "./library/close-game"; diff --git a/src/preload/index.d.ts b/src/preload/index.d.ts index 2ed7ef39..487ac3d1 100644 --- a/src/preload/index.d.ts +++ b/src/preload/index.d.ts @@ -102,5 +102,6 @@ contextBridge.exposeInMainWorld("electron", { showOpenDialog: (options: Electron.OpenDialogOptions) => ipcRenderer.invoke("showOpenDialog", options), platform: process.platform, - getMagnetHealth: (magnet: string) => ipcRenderer.invoke("getMagnetHealth", magnet), + getMagnetHealth: (magnet: string) => + ipcRenderer.invoke("getMagnetHealth", magnet), }); diff --git a/src/preload/index.ts b/src/preload/index.ts index 778c2065..2ba23e61 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -112,5 +112,6 @@ contextBridge.exposeInMainWorld("electron", { showOpenDialog: (options: Electron.OpenDialogOptions) => ipcRenderer.invoke("showOpenDialog", options), platform: process.platform, - getMagnetHealth: (magnet: string) => ipcRenderer.invoke("getMagnetHealth", magnet), + getMagnetHealth: (magnet: string) => + ipcRenderer.invoke("getMagnetHealth", magnet), }); diff --git a/src/renderer/src/components/tooltip/tooltip.css.ts b/src/renderer/src/components/tooltip/tooltip.css.ts index 6615e51d..e478380b 100644 --- a/src/renderer/src/components/tooltip/tooltip.css.ts +++ b/src/renderer/src/components/tooltip/tooltip.css.ts @@ -1,36 +1,36 @@ import { style } from "@vanilla-extract/css"; export const tooltipStyle = style({ - position: 'relative', - display: 'flex', - cursor: 'pointer', - alignItems: 'center' + position: "relative", + display: "flex", + cursor: "pointer", + alignItems: "center", }); export const tooltipTextStyle = style({ - visibility: 'hidden', - backgroundColor: '#555', - color: '#fff', - textAlign: 'center', - borderRadius: '6px', - padding: '5px 5px', - position: 'absolute', - zIndex: '1', - bottom: '125%', - left: 'max(0%, min(100%, 50%))', - transform: 'translateX(-50%)', - ':after': { + visibility: "hidden", + backgroundColor: "#555", + color: "#fff", + textAlign: "center", + borderRadius: "6px", + padding: "5px 5px", + position: "absolute", + zIndex: "1", + bottom: "125%", + left: "max(0%, min(100%, 50%))", + transform: "translateX(-50%)", + ":after": { content: '""', - position: 'absolute', - top: '100%', - left: '50%', - marginLeft: '-5px', - borderWidth: '5px', - borderStyle: 'solid', - borderColor: '#555 transparent transparent transparent', + position: "absolute", + top: "100%", + left: "50%", + marginLeft: "-5px", + borderWidth: "5px", + borderStyle: "solid", + borderColor: "#555 transparent transparent transparent", }, }); export const tooltipVisible = style({ - visibility: 'visible', + visibility: "visible", }); diff --git a/src/renderer/src/components/tooltip/tooltip.tsx b/src/renderer/src/components/tooltip/tooltip.tsx index 75b0061e..50d74f4c 100644 --- a/src/renderer/src/components/tooltip/tooltip.tsx +++ b/src/renderer/src/components/tooltip/tooltip.tsx @@ -1,5 +1,5 @@ -import { useState } from 'react'; -import * as styles from './tooltip.css' +import { useState } from "react"; +import * as styles from "./tooltip.css"; interface TooltipProps { children: React.ReactNode; @@ -11,12 +11,16 @@ export function Tooltip({ children, tooltipText }: Readonly) { return (
setIsVisible(true)} - onMouseLeave={() => setIsVisible(false)} - > - {children} - {tooltipText} -
+ className={styles.tooltipStyle} + onMouseEnter={() => setIsVisible(true)} + onMouseLeave={() => setIsVisible(false)} + > + {children} + + {tooltipText} + + ); } diff --git a/src/renderer/src/declaration.d.ts b/src/renderer/src/declaration.d.ts index d18a23b7..cd2c10db 100644 --- a/src/renderer/src/declaration.d.ts +++ b/src/renderer/src/declaration.d.ts @@ -88,7 +88,9 @@ declare global { options: Electron.OpenDialogOptions ) => Promise; platform: NodeJS.Platform; - getMagnetHealth: (magnet: string) => Promise<{ seeders: number; peers: number }>; + getMagnetHealth: ( + magnet: string + ) => Promise<{ seeders: number; peers: number }>; } interface Window { diff --git a/src/renderer/src/helpers/searcher.ts b/src/renderer/src/helpers/searcher.ts index d4a81a95..52d0cd52 100644 --- a/src/renderer/src/helpers/searcher.ts +++ b/src/renderer/src/helpers/searcher.ts @@ -1,14 +1,18 @@ export const isMultiplayerRepack = (title: string) => { const toLower = title.toLowerCase(); - return toLower.includes("multiplayer") || toLower.includes("onlinefix") || toLower.includes("online fix") -} + return ( + toLower.includes("multiplayer") || + toLower.includes("onlinefix") || + toLower.includes("online fix") + ); +}; export const supportMultiLanguage = (title: string) => { const multiFollowedByDigitsRegex = /multi\d+/; return multiFollowedByDigitsRegex.test(title.toLowerCase()); -} +}; // const languageCode = 'en'; // const displayNames = new Intl.DisplayNames([languageCode], { type: 'language' }); @@ -16,15 +20,16 @@ export const supportMultiLanguage = (title: string) => { // console.log(englishLanguage); // Output: "English" - export const getRepackLanguageBasedOnRepacker = (repacker: string) => { const languageCodes = { - xatab: 'ru', - } + xatab: "ru", + }; - const languageCode = languageCodes[repacker.toLowerCase()] || 'en'; + const languageCode = languageCodes[repacker.toLowerCase()] || "en"; - const displayNames = new Intl.DisplayNames([languageCode], { type: 'language' }); + const displayNames = new Intl.DisplayNames([languageCode], { + type: "language", + }); return displayNames.of(languageCode); -} +}; diff --git a/src/renderer/src/pages/game-details/repacks-modal.css.ts b/src/renderer/src/pages/game-details/repacks-modal.css.ts index 827fc237..472ba934 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.css.ts +++ b/src/renderer/src/pages/game-details/repacks-modal.css.ts @@ -22,4 +22,3 @@ export const tagsContainer = style({ gap: `${SPACING_UNIT}px`, flexWrap: "wrap", }); - diff --git a/src/renderer/src/pages/game-details/repacks-modal.tsx b/src/renderer/src/pages/game-details/repacks-modal.tsx index 352d5900..55ea440b 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.tsx +++ b/src/renderer/src/pages/game-details/repacks-modal.tsx @@ -16,7 +16,7 @@ import { supportMultiLanguage, } from "@renderer/helpers/searcher"; import { Tag } from "@renderer/components/tag/tag"; -import {getRepackLanguageBasedOnRepacker} from '../../helpers/searcher'; +import { getRepackLanguageBasedOnRepacker } from "../../helpers/searcher"; export interface RepacksModalProps { visible: boolean; @@ -112,15 +112,15 @@ export function RepacksModal({ {" - " + getRepackLanguageBasedOnRepacker(repack.repacker)}

- +
{supportMultiLanguage(repack.title) && ( - {t('multi_language')} + {t("multi_language")} + )} + {isMultiplayerRepack(repack.title) && ( + {t("multiplayer")} )} - {isMultiplayerRepack(repack.title) && {t('multiplayer')}}
))} diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx index e8cc31f2..ba33abfe 100644 --- a/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx +++ b/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx @@ -34,7 +34,7 @@ export function SeedersAndPeers({ repack }: Readonly) { {magnetData?.seeders} diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx index cb87b9d8..6ea55a27 100644 --- a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx +++ b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx @@ -44,7 +44,6 @@ export function useMagnetHealth(magnet: string) { ); }, [magnet]); - useEffect(() => { function invalidateCache() { const TWO_MINUTES = 2 * 60 * 1000; From 26db88966f9c09d036a1b191a0c579e9a48af58e Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Sun, 12 May 2024 21:54:03 -0300 Subject: [PATCH 29/38] refactor: Update getRepackLanguageBasedOnRepacker function parameters and use user preferences --- src/renderer/src/helpers/searcher.ts | 15 ++++------ .../src/pages/game-details/repacks-modal.tsx | 13 ++++++++- .../seeders-and-peers/useMagnetHealth.tsx | 29 ++++++++++--------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/renderer/src/helpers/searcher.ts b/src/renderer/src/helpers/searcher.ts index 52d0cd52..899b2691 100644 --- a/src/renderer/src/helpers/searcher.ts +++ b/src/renderer/src/helpers/searcher.ts @@ -14,20 +14,17 @@ export const supportMultiLanguage = (title: string) => { return multiFollowedByDigitsRegex.test(title.toLowerCase()); }; -// const languageCode = 'en'; -// const displayNames = new Intl.DisplayNames([languageCode], { type: 'language' }); -// const englishLanguage = displayNames.of(languageCode); - -// console.log(englishLanguage); // Output: "English" - -export const getRepackLanguageBasedOnRepacker = (repacker: string) => { +export const getRepackLanguageBasedOnRepacker = ( + repacker: string, + userLanguage: string +) => { const languageCodes = { xatab: "ru", }; - const languageCode = languageCodes[repacker.toLowerCase()] || "en"; + const languageCode = languageCodes[repacker.toLowerCase()] || userLanguage; - const displayNames = new Intl.DisplayNames([languageCode], { + const displayNames = new Intl.DisplayNames([userLanguage.slice(0, 2)], { type: "language", }); diff --git a/src/renderer/src/pages/game-details/repacks-modal.tsx b/src/renderer/src/pages/game-details/repacks-modal.tsx index 55ea440b..525e10bb 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.tsx +++ b/src/renderer/src/pages/game-details/repacks-modal.tsx @@ -34,6 +34,9 @@ export function RepacksModal({ const [filteredRepacks, setFilteredRepacks] = useState([]); const [repack, setRepack] = useState(null); const [showSelectFolderModal, setShowSelectFolderModal] = useState(false); + const { value: userPreferences } = useAppSelector( + (state) => state.userPreferences + ); const repackersFriendlyNames = useAppSelector( (state) => state.repackersFriendlyNames.value @@ -109,7 +112,15 @@ export function RepacksModal({ {repack.uploadDate ? format(repack.uploadDate, "dd/MM/yyyy") : ""} - {" - " + getRepackLanguageBasedOnRepacker(repack.repacker)} + {userPreferences?.language && ( + <> + {" - " + + getRepackLanguageBasedOnRepacker( + repack.repacker, + userPreferences?.language + )} + + )}

diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx index 6ea55a27..67e6f21e 100644 --- a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx +++ b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx @@ -27,21 +27,24 @@ export function useMagnetHealth(magnet: string) { return; } - window.electron.getMagnetHealth(magnet).then( - (result) => { - if (result) { - setMagnetData(result); - setIsLoading(false); + window.electron + .getMagnetHealth(magnet) + .then( + (result) => { + if (result) { + setMagnetData(result); + setIsLoading(false); - cache[magnet] = result; - cache[magnet].lastTracked = new Date(); + cache[magnet] = result; + cache[magnet].lastTracked = new Date(); + } + }, + (error) => { + setError(error); + setIsLoading(false); } - }, - (error) => { - setError(error); - setIsLoading(false); - } - ); + ) + .catch(() => {}); }, [magnet]); useEffect(() => { From 1c56227fa33f5e3d0a27987324a7900ab6d6c0fc Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Mon, 13 May 2024 22:14:38 -0300 Subject: [PATCH 30/38] feat(searcher): Add repacker check to isMultiplayerRepack function --- src/locales/ru/translation.json | 2 +- src/renderer/src/helpers/searcher.ts | 13 ++++++++----- .../src/pages/game-details/repacks-modal.tsx | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json index d2d03c5b..01235662 100644 --- a/src/locales/ru/translation.json +++ b/src/locales/ru/translation.json @@ -97,7 +97,7 @@ "copied_to_clipboard": "Скопировано", "got_it": "Понятно", "multi_language": "Мультиязычный", - "multiplayer": "Многопользовательский" + "multiplayer": "Многопользовательский", "no_shop_details": "Не удалось получить описание", "download_options": "Вариантов загрузки", "download_path": "Путь для загрузок", diff --git a/src/renderer/src/helpers/searcher.ts b/src/renderer/src/helpers/searcher.ts index 899b2691..8229e6b9 100644 --- a/src/renderer/src/helpers/searcher.ts +++ b/src/renderer/src/helpers/searcher.ts @@ -1,10 +1,13 @@ -export const isMultiplayerRepack = (title: string) => { - const toLower = title.toLowerCase(); +export const isMultiplayerRepack = (title: string, repacker: string) => { + const titleToLower = title.toLowerCase(); + const repackerToLower = repacker.toLowerCase(); return ( - toLower.includes("multiplayer") || - toLower.includes("onlinefix") || - toLower.includes("online fix") + titleToLower.includes("multiplayer") || + titleToLower.includes("onlinefix") || + titleToLower.includes("online fix") || + repackerToLower.includes("onlinefix") || + repackerToLower.includes("online fix") ); }; diff --git a/src/renderer/src/pages/game-details/repacks-modal.tsx b/src/renderer/src/pages/game-details/repacks-modal.tsx index 1ee4bd4b..5c6d1e22 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.tsx +++ b/src/renderer/src/pages/game-details/repacks-modal.tsx @@ -128,7 +128,7 @@ export function RepacksModal({ {supportMultiLanguage(repack.title) && ( {t("multi_language")} )} - {isMultiplayerRepack(repack.title) && ( + {isMultiplayerRepack(repack.title, repack.repacker) && ( {t("multiplayer")} )} From 4e9e9deec199f24089b33f44bea9bb4c35e18b73 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Mon, 13 May 2024 22:15:44 -0300 Subject: [PATCH 31/38] style: Remove unnecessary whitespace and newline in translation.json --- README.pt-BR.md | 1 - src/locales/ar/translation.json | 110 ++++++++++++++++---------------- 2 files changed, 55 insertions(+), 56 deletions(-) diff --git a/README.pt-BR.md b/README.pt-BR.md index b91e4adb..5d04e48b 100644 --- a/README.pt-BR.md +++ b/README.pt-BR.md @@ -19,7 +19,6 @@ [![uk-UA](https://img.shields.io/badge/lang-uk--UA-blue)](README.uk-UA.md) [![be](https://img.shields.io/badge/lang-be-orange)](README.be.md) - ![Hydra Catalogue](./docs/screenshot.png) diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.json index d5e3cb83..3ea46b4f 100644 --- a/src/locales/ar/translation.json +++ b/src/locales/ar/translation.json @@ -55,62 +55,62 @@ "remove_from_list": "إزالة", "space_left_on_disk": "{{space}} متبقية على القرص", "eta": "الوقت المتبقي {{eta}}", - "downloading_metadata": "جاري تنزيل البيانات الوصفية...", - "checking_files": "جاري التحقق من الملفات...", - "filter": "تصفية حزم إعادة التجميع", - "requirements": "متطلبات النظام", - "minimum": "الحد الأدنى", - "recommended": "موصى به", - "no_minimum_requirements": "{{title}} لا تتوفر معلومات عن الحد الأدنى للمتطلبات", - "no_recommended_requirements": "{{title}} لا تتوفر معلومات عن المتطلبات الموصى بها", - "paused_progress": "{{progress}} (متوقف)", - "release_date": "تم الإصدار في {{date}}", - "publisher": "نشر بواسطة {{publisher}}", - "copy_link_to_clipboard": "نسخ الرابط", - "copied_link_to_clipboard": "تم نسخ الرابط", - "hours": "ساعات", - "minutes": "دقائق", - "amount_hours": "{{amount}} ساعات", - "amount_minutes": "{{amount}} دقائق", - "accuracy": "دقة {{accuracy}}%", - "add_to_library": "إضافة إلى المكتبة", - "remove_from_library": "إزالة من المكتبة", - "no_downloads": "لا توجد تنزيلات متاحة", - "play_time": "تم اللعب لمدة {{amount}}", - "last_time_played": "آخر مرة لعبت {{period}}", - "not_played_yet": "لم تلعب {{title}} بعد", - "next_suggestion": "الاقتراح التالي", - "play": "لعب", - "deleting": "جاري حذف المثبت...", - "close": "إغلاق", - "playing_now": "قيد التشغيل الآن", - "change": "تغيير", - "repacks_modal_description": "اختر الحزمة التي تريد تنزيلها", - "select_folder_hint": "لتغيير المجلد الافتراضي، انتقل إلى الإعدادات", - "download_now": "تنزيل الآن", - "installation_instructions": "إرشادات التثبيت", - "installation_instructions_description": "هناك خطوات إضافية مطلوبة لتثبيت هذه اللعبة", - "online_fix_instruction": "تتطلب ألعاب OnlineFix كلمة مرور لاستخراجها. عند الحاجة، استخدم كلمة المرور التالية:", - "dodi_installation_instruction": "عند فتح مثبت DODI، اضغط على مفتاح التشغيل لأعلى <0 /> لبدء عملية التثبيت:", - "dont_show_it_again": "لا تعرضها مرة أخرى", - "copy_to_clipboard": "نسخ", - "copied_to_clipboard": "تم النسخ", - "got_it": "حسنأ", - "no_shop_details": "لم يتم استرداد تفاصيل المتجر.", - "download_options": "خيارات التنزيل", - "download_path": "مسار التنزيل", - "previous_screenshot": "لقطة الشاشة السابقة", - "next_screenshot": "لقطة الشاشة التالية", - "screenshot": "لقطة شاشة {{number}}", - "open_screenshot": "افتح لقطة الشاشة {{number}}" + "downloading_metadata": "جاري تنزيل البيانات الوصفية...", + "checking_files": "جاري التحقق من الملفات...", + "filter": "تصفية حزم إعادة التجميع", + "requirements": "متطلبات النظام", + "minimum": "الحد الأدنى", + "recommended": "موصى به", + "no_minimum_requirements": "{{title}} لا تتوفر معلومات عن الحد الأدنى للمتطلبات", + "no_recommended_requirements": "{{title}} لا تتوفر معلومات عن المتطلبات الموصى بها", + "paused_progress": "{{progress}} (متوقف)", + "release_date": "تم الإصدار في {{date}}", + "publisher": "نشر بواسطة {{publisher}}", + "copy_link_to_clipboard": "نسخ الرابط", + "copied_link_to_clipboard": "تم نسخ الرابط", + "hours": "ساعات", + "minutes": "دقائق", + "amount_hours": "{{amount}} ساعات", + "amount_minutes": "{{amount}} دقائق", + "accuracy": "دقة {{accuracy}}%", + "add_to_library": "إضافة إلى المكتبة", + "remove_from_library": "إزالة من المكتبة", + "no_downloads": "لا توجد تنزيلات متاحة", + "play_time": "تم اللعب لمدة {{amount}}", + "last_time_played": "آخر مرة لعبت {{period}}", + "not_played_yet": "لم تلعب {{title}} بعد", + "next_suggestion": "الاقتراح التالي", + "play": "لعب", + "deleting": "جاري حذف المثبت...", + "close": "إغلاق", + "playing_now": "قيد التشغيل الآن", + "change": "تغيير", + "repacks_modal_description": "اختر الحزمة التي تريد تنزيلها", + "select_folder_hint": "لتغيير المجلد الافتراضي، انتقل إلى الإعدادات", + "download_now": "تنزيل الآن", + "installation_instructions": "إرشادات التثبيت", + "installation_instructions_description": "هناك خطوات إضافية مطلوبة لتثبيت هذه اللعبة", + "online_fix_instruction": "تتطلب ألعاب OnlineFix كلمة مرور لاستخراجها. عند الحاجة، استخدم كلمة المرور التالية:", + "dodi_installation_instruction": "عند فتح مثبت DODI، اضغط على مفتاح التشغيل لأعلى <0 /> لبدء عملية التثبيت:", + "dont_show_it_again": "لا تعرضها مرة أخرى", + "copy_to_clipboard": "نسخ", + "copied_to_clipboard": "تم النسخ", + "got_it": "حسنأ", + "no_shop_details": "لم يتم استرداد تفاصيل المتجر.", + "download_options": "خيارات التنزيل", + "download_path": "مسار التنزيل", + "previous_screenshot": "لقطة الشاشة السابقة", + "next_screenshot": "لقطة الشاشة التالية", + "screenshot": "لقطة شاشة {{number}}", + "open_screenshot": "افتح لقطة الشاشة {{number}}" }, "activation": { - "title": "تفعيل هايدرا", - "installation_id": "معرف التثبيت:", - "enter_activation_code": "أدخل رمز التفعيل الخاص بك", - "message": "إذا كنت لا تعرف أين تسأل عن هذا ، فلا يجب أن يكون لديك هذا.", + "title": "تفعيل هايدرا", + "installation_id": "معرف التثبيت:", + "enter_activation_code": "أدخل رمز التفعيل الخاص بك", + "message": "إذا كنت لا تعرف أين تسأل عن هذا ، فلا يجب أن يكون لديك هذا.", "activate": "تفعيل", - "loading": "جار التحميل…" + "loading": "جار التحميل…" }, "downloads": { "resume": "استئناف", @@ -146,7 +146,7 @@ "telemetry": "القياس عن بعد", "telemetry_description": "تفعيل إحصائيات الاستخدام مجهولة المصدر", "real_debrid_api_token_label": "رمز واجهة برمجة التطبيقات (API) لـReal Debrid ", - "quit_app_instead_hiding": "إنهاء هايدرا بدلاً من التصغير الى شريط الحالة", + "quit_app_instead_hiding": "إنهاء هايدرا بدلاً من التصغير الى شريط الحالة", "launch_with_system": "تشغيل هايدرا عند بدء تشغيل النظام", "general": "عام", "behavior": "السلوك", @@ -177,4 +177,4 @@ "modal": { "close": "زر إغلاق" } -} \ No newline at end of file +} From 9c261551c3dc9e711c17ce43eed24c15d582a70b Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Mon, 13 May 2024 22:28:34 -0300 Subject: [PATCH 32/38] feat: Add toCapitalize function for capitalizing strings --- src/renderer/src/helpers/searcher.ts | 10 +++++++--- src/renderer/src/helpers/string.ts | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 src/renderer/src/helpers/string.ts diff --git a/src/renderer/src/helpers/searcher.ts b/src/renderer/src/helpers/searcher.ts index 8229e6b9..8f2f4890 100644 --- a/src/renderer/src/helpers/searcher.ts +++ b/src/renderer/src/helpers/searcher.ts @@ -1,3 +1,5 @@ +import { toCapitalize } from "./string"; + export const isMultiplayerRepack = (title: string, repacker: string) => { const titleToLower = title.toLowerCase(); const repackerToLower = repacker.toLowerCase(); @@ -25,11 +27,13 @@ export const getRepackLanguageBasedOnRepacker = ( xatab: "ru", }; - const languageCode = languageCodes[repacker.toLowerCase()] || userLanguage; + const languageCode = languageCodes[repacker.toLowerCase()] || "en"; - const displayNames = new Intl.DisplayNames([userLanguage.slice(0, 2)], { + const displayNames = new Intl.DisplayNames([userLanguage], { type: "language", }); - return displayNames.of(languageCode); + const language = displayNames.of(languageCode); + + return language ? toCapitalize(language) : "English"; }; diff --git a/src/renderer/src/helpers/string.ts b/src/renderer/src/helpers/string.ts new file mode 100644 index 00000000..eb18b8b2 --- /dev/null +++ b/src/renderer/src/helpers/string.ts @@ -0,0 +1,3 @@ +export function toCapitalize(str: string) { + return str.charAt(0).toUpperCase() + str.slice(1); +} From 7a2b693397ef051ec50aee0a8428d824b11a567e Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Wed, 15 May 2024 20:06:09 -0300 Subject: [PATCH 33/38] refactor: Improve error handling and retry logic in getSeedersAndPeers function --- src/main/services/web-torrent-data.ts | 28 ++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/main/services/web-torrent-data.ts b/src/main/services/web-torrent-data.ts index 96cc6229..4f97276d 100644 --- a/src/main/services/web-torrent-data.ts +++ b/src/main/services/web-torrent-data.ts @@ -6,17 +6,27 @@ type WebTorrentHealthData = { }; export const webTorrentData = { - async getSeedersAndPeers(magnet: string) { + async getSeedersAndPeers(magnet: string, retry = 0, timeout = 1500) { return new Promise((resolve, reject) => { - WebTorrentHealth(magnet, (err: Error, data: WebTorrentHealthData) => { - if (err) { - return reject(err); + WebTorrentHealth( + magnet, + { timeout }, + (err: Error, data: WebTorrentHealthData) => { + if (err) { + return reject(err); + } + + const { peers, seeds } = data; + + if ((!peers || !seeds) && retry < 3) { + return resolve( + webTorrentData.getSeedersAndPeers(magnet, retry + 1, timeout * 2) + ); + } + + return resolve({ peers, seeders: seeds }); } - - const { peers, seeds } = data; - - return resolve({ peers, seeders: seeds }); - }); + ); }); }, }; From 539f444ab516dff510b11ff8415e425d37776331 Mon Sep 17 00:00:00 2001 From: ChristoferMendes Date: Thu, 16 May 2024 08:34:42 -0300 Subject: [PATCH 34/38] feat(webTorrentHealth): update recursive function with a loop --- src/main/services/web-torrent-data.ts | 39 +++++++++++++-------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/main/services/web-torrent-data.ts b/src/main/services/web-torrent-data.ts index 4f97276d..7d5ec34d 100644 --- a/src/main/services/web-torrent-data.ts +++ b/src/main/services/web-torrent-data.ts @@ -1,4 +1,4 @@ -import WebTorrentHealth from "webtorrent-health"; +import webTorrentHealth from "webtorrent-health"; type WebTorrentHealthData = { seeds: number; @@ -6,27 +6,26 @@ type WebTorrentHealthData = { }; export const webTorrentData = { - async getSeedersAndPeers(magnet: string, retry = 0, timeout = 1500) { - return new Promise((resolve, reject) => { - WebTorrentHealth( - magnet, - { timeout }, - (err: Error, data: WebTorrentHealthData) => { - if (err) { - return reject(err); - } + async getSeedersAndPeers( + magnet: string + ): Promise<{ seeders: number; peers: number }> { + let peers = 0; + let seeds = 0; + let retry = 0; - const { peers, seeds } = data; + while (retry < 3 && (!peers || !seeds)) { + try { + const data: WebTorrentHealthData = await webTorrentHealth(magnet, { + timeout: 1500 * (retry + 1), + }); - if ((!peers || !seeds) && retry < 3) { - return resolve( - webTorrentData.getSeedersAndPeers(magnet, retry + 1, timeout * 2) - ); - } + peers = data.peers; + seeds = data.seeds; + } catch (e) { + retry++; + } + } - return resolve({ peers, seeders: seeds }); - } - ); - }); + return { peers, seeders: seeds }; }, }; From d924c64710c0eac738c7d6ac58eed9e49f3dadef Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Sat, 18 May 2024 14:55:56 -0300 Subject: [PATCH 35/38] Update web-torrent-data.ts Small adjustment to webTorrentData logic --- src/main/services/web-torrent-data.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/services/web-torrent-data.ts b/src/main/services/web-torrent-data.ts index 7d5ec34d..72f29be6 100644 --- a/src/main/services/web-torrent-data.ts +++ b/src/main/services/web-torrent-data.ts @@ -5,25 +5,34 @@ type WebTorrentHealthData = { peers: number; }; +const MILLISECONDS = 1000; +const SECONDS = 1.5; + export const webTorrentData = { async getSeedersAndPeers( magnet: string - ): Promise<{ seeders: number; peers: number }> { + ): Promise<{ seeders: number; peers: number } | null> { let peers = 0; let seeds = 0; let retry = 0; + let timeout = SECONDS * MILLISECONDS; - while (retry < 3 && (!peers || !seeds)) { + while (retry < 3) { try { const data: WebTorrentHealthData = await webTorrentHealth(magnet, { - timeout: 1500 * (retry + 1), + timeout, }); peers = data.peers; seeds = data.seeds; + + if (peers || seeds) break; } catch (e) { - retry++; + return null; } + + timeout *= 2; + retry++; } return { peers, seeders: seeds }; From 250c6901b73f84b2d0563d4f3d641d9acfc63046 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Sat, 18 May 2024 15:04:54 -0300 Subject: [PATCH 36/38] feat: replace disableHardwareAcceleration with --no-sandbox --- src/main/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/index.ts b/src/main/index.ts index 0d04a355..dabdeb4e 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -19,7 +19,7 @@ autoUpdater.setFeedURL({ const gotTheLock = app.requestSingleInstanceLock(); if (!gotTheLock) app.quit(); -app.disableHardwareAcceleration(); +app.commandLine.appendSwitch("--no-sandbox"); i18n.init({ resources, From 2cb76a9ad46c2785b7b5fff72ce67ad1ca816b71 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Sat, 18 May 2024 16:26:16 -0300 Subject: [PATCH 37/38] Revert "More friendly experience when presenting repack options" --- package.json | 1 - src/locales/en/translation.json | 2 - src/locales/es/translation.json | 2 - src/locales/fr/translation.json | 4 +- src/locales/hu/translation.json | 4 +- src/locales/it/translation.json | 4 +- src/locales/pl/translation.json | 3 - src/locales/pt/translation.json | 2 - src/locales/ru/translation.json | 2 - src/locales/tr/translation.json | 4 +- .../catalogue/repacks/get-magnet-health.ts | 11 - src/main/events/index.ts | 1 - src/main/services/web-torrent-data.ts | 40 --- src/preload/index.d.ts | 107 ------- src/preload/index.ts | 2 - src/renderer/src/assets/sprout-icon.svg | 1 - src/renderer/src/assets/users-icon.svg | 1 - src/renderer/src/components/index.ts | 1 - src/renderer/src/components/tag/tag.css.ts | 12 - src/renderer/src/components/tag/tag.tsx | 9 - .../src/components/tooltip/tooltip.css.ts | 36 --- .../src/components/tooltip/tooltip.tsx | 26 -- src/renderer/src/declaration.d.ts | 3 - src/renderer/src/helpers/searcher.ts | 39 --- src/renderer/src/helpers/string.ts | 3 - .../pages/game-details/repacks-modal.css.ts | 6 - .../src/pages/game-details/repacks-modal.tsx | 52 +--- .../seeders-and-peers-skeleton.tsx | 20 -- .../seeders-and-peers/seeders-and-peers.tsx | 55 ---- .../game-details/seeders-and-peers/types.ts | 5 - .../seeders-and-peers/useMagnetHealth.tsx | 80 ------ yarn.lock | 272 +----------------- 32 files changed, 16 insertions(+), 794 deletions(-) delete mode 100644 src/main/events/catalogue/repacks/get-magnet-health.ts delete mode 100644 src/main/services/web-torrent-data.ts delete mode 100644 src/preload/index.d.ts delete mode 100644 src/renderer/src/assets/sprout-icon.svg delete mode 100644 src/renderer/src/assets/users-icon.svg delete mode 100644 src/renderer/src/components/tag/tag.css.ts delete mode 100644 src/renderer/src/components/tag/tag.tsx delete mode 100644 src/renderer/src/components/tooltip/tooltip.css.ts delete mode 100644 src/renderer/src/components/tooltip/tooltip.tsx delete mode 100644 src/renderer/src/helpers/searcher.ts delete mode 100644 src/renderer/src/helpers/string.ts delete mode 100644 src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers-skeleton.tsx delete mode 100644 src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx delete mode 100644 src/renderer/src/pages/game-details/seeders-and-peers/types.ts delete mode 100644 src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx diff --git a/package.json b/package.json index 5ebeab83..6cb748ac 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,6 @@ "react-router-dom": "^6.22.3", "typeorm": "^0.3.20", "user-agents": "^1.1.193", - "webtorrent-health": "^1.2.0", "winston": "^3.13.0", "yaml": "^2.4.1" }, diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 19efb4d8..7b54b889 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -96,8 +96,6 @@ "copy_to_clipboard": "Copy", "copied_to_clipboard": "Copied", "got_it": "Got it", - "multi_language": "Multi Language", - "multiplayer": "Multi Player", "no_shop_details": "Could not retrieve shop details.", "download_options": "Download options", "download_path": "Download path", diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json index eeb9e103..d3f90cb6 100644 --- a/src/locales/es/translation.json +++ b/src/locales/es/translation.json @@ -95,8 +95,6 @@ "dont_show_it_again": "No mostrar de nuevo", "copy_to_clipboard": "Copiar", "copied_to_clipboard": "Copiado", - "multi_language": "Multi Idioma", - "multiplayer": "Multijugador", "got_it": "Entendido", "no_shop_details": "No se pudieron obtener detalles de la tienda.", "download_options": "Opciones de descarga", diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json index 42e14e1b..2e17f492 100644 --- a/src/locales/fr/translation.json +++ b/src/locales/fr/translation.json @@ -75,9 +75,7 @@ "close": "Fermer", "deleting": "Suppression du programme d'installation…", "playing_now": "Jeu en cours", - "last_time_played": "Dernièrement joué {{période}}", - "multi_language": "Multilingue", - "multiplayer": "Multijoueur" + "last_time_played": "Dernièrement joué {{période}}" }, "activation": { "title": "Activer Hydra", diff --git a/src/locales/hu/translation.json b/src/locales/hu/translation.json index 038e6874..8a370fb2 100644 --- a/src/locales/hu/translation.json +++ b/src/locales/hu/translation.json @@ -84,9 +84,7 @@ "repacks_modal_description": "Choose the repack you want to download", "downloads_path": "Letöltések helye", "select_folder_hint": "Ahhoz, hogy megváltoztasd a helyet, hozzákell férned a", - "download_now": "Töltsd le most", - "multi_language": "Többnyelvű", - "multiplayer": "Többjátékos" + "download_now": "Töltsd le most" }, "activation": { "title": "Hydra Aktiválása", diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json index 554001d3..57706dc9 100644 --- a/src/locales/it/translation.json +++ b/src/locales/it/translation.json @@ -96,9 +96,7 @@ "dont_show_it_again": "Non mostrarlo più", "copy_to_clipboard": "Copia", "copied_to_clipboard": "Copiato", - "got_it": "Capito", - "multi_language": "Multilingua", - "multiplayer": "Multigiocatore" + "got_it": "Capito" }, "activation": { "title": "Attiva Hydra", diff --git a/src/locales/pl/translation.json b/src/locales/pl/translation.json index 6ec38502..d629d1f3 100644 --- a/src/locales/pl/translation.json +++ b/src/locales/pl/translation.json @@ -87,9 +87,6 @@ "change": "Zmień", "repacks_modal_description": "Wybierz repack, który chcesz pobrać", "select_folder_hint": "Aby zmienić domyślny folder, przejdź do", - "settings": "Ustawienia Hydra", - "multi_language": "Wielojęzyczny", - "multiplayer": "Wieloosobowy", "download_now": "Pobierz teraz", "installation_instructions": "Instrukcja instalacji", "installation_instructions_description": "Do zainstalowania tej gry wymagane są dodatkowe kroki", diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index d14e480e..57ec0470 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -92,8 +92,6 @@ "copy_to_clipboard": "Copiar", "copied_to_clipboard": "Copiado", "got_it": "Entendi", - "multi_language": "Multi Idioma", - "multiplayer": "Multijogador", "no_shop_details": "Não foi possível obter os detalhes da loja.", "download_options": "Opções de download", "download_path": "Diretório de download", diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json index 24eb5cb0..f7a80771 100644 --- a/src/locales/ru/translation.json +++ b/src/locales/ru/translation.json @@ -96,8 +96,6 @@ "copy_to_clipboard": "Копировать", "copied_to_clipboard": "Скопировано", "got_it": "Понятно", - "multi_language": "Мультиязычный", - "multiplayer": "Многопользовательский", "no_shop_details": "Не удалось получить описание", "download_options": "Вариантов загрузки", "download_path": "Путь для загрузок", diff --git a/src/locales/tr/translation.json b/src/locales/tr/translation.json index c9d1479b..be40e013 100644 --- a/src/locales/tr/translation.json +++ b/src/locales/tr/translation.json @@ -96,9 +96,7 @@ "dont_show_it_again": "Tekrar gösterme", "copy_to_clipboard": "Kopyala", "copied_to_clipboard": "Kopyalandı", - "got_it": "Tamam", - "multi_language": "Çoklu Dil", - "multiplayer": "Çok Oyunculu" + "got_it": "Tamam" }, "activation": { "title": "Hydra'yı aktif et", diff --git a/src/main/events/catalogue/repacks/get-magnet-health.ts b/src/main/events/catalogue/repacks/get-magnet-health.ts deleted file mode 100644 index 6c8b3ded..00000000 --- a/src/main/events/catalogue/repacks/get-magnet-health.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { webTorrentData } from "@main/services/web-torrent-data"; -import { registerEvent } from "../../register-event"; - -const getMagnetHealth = async ( - _event: Electron.IpcMainInvokeEvent, - magnet: string -) => { - return webTorrentData.getSeedersAndPeers(magnet); -}; - -registerEvent("getMagnetHealth", getMagnetHealth); diff --git a/src/main/events/index.ts b/src/main/events/index.ts index 0bdb184f..5d721c62 100644 --- a/src/main/events/index.ts +++ b/src/main/events/index.ts @@ -7,7 +7,6 @@ import "./catalogue/get-games"; import "./catalogue/get-how-long-to-beat"; import "./catalogue/get-random-game"; import "./catalogue/search-games"; -import "./catalogue/repacks/get-magnet-health"; import "./catalogue/search-game-repacks"; import "./hardware/get-disk-free-space"; import "./library/add-game-to-library"; diff --git a/src/main/services/web-torrent-data.ts b/src/main/services/web-torrent-data.ts deleted file mode 100644 index 72f29be6..00000000 --- a/src/main/services/web-torrent-data.ts +++ /dev/null @@ -1,40 +0,0 @@ -import webTorrentHealth from "webtorrent-health"; - -type WebTorrentHealthData = { - seeds: number; - peers: number; -}; - -const MILLISECONDS = 1000; -const SECONDS = 1.5; - -export const webTorrentData = { - async getSeedersAndPeers( - magnet: string - ): Promise<{ seeders: number; peers: number } | null> { - let peers = 0; - let seeds = 0; - let retry = 0; - let timeout = SECONDS * MILLISECONDS; - - while (retry < 3) { - try { - const data: WebTorrentHealthData = await webTorrentHealth(magnet, { - timeout, - }); - - peers = data.peers; - seeds = data.seeds; - - if (peers || seeds) break; - } catch (e) { - return null; - } - - timeout *= 2; - retry++; - } - - return { peers, seeders: seeds }; - }, -}; diff --git a/src/preload/index.d.ts b/src/preload/index.d.ts deleted file mode 100644 index 487ac3d1..00000000 --- a/src/preload/index.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -// See the Electron documentation for details on how to use preload scripts: -// https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts -import { contextBridge, ipcRenderer } from "electron"; - -import type { - CatalogueCategory, - GameShop, - TorrentProgress, - UserPreferences, -} from "@types"; - -contextBridge.exposeInMainWorld("electron", { - /* Torrenting */ - startGameDownload: ( - repackId: number, - objectID: string, - title: string, - shop: GameShop - ) => ipcRenderer.invoke("startGameDownload", repackId, objectID, title, shop), - cancelGameDownload: (gameId: number) => - ipcRenderer.invoke("cancelGameDownload", gameId), - pauseGameDownload: (gameId: number) => - ipcRenderer.invoke("pauseGameDownload", gameId), - resumeGameDownload: (gameId: number) => - ipcRenderer.invoke("resumeGameDownload", gameId), - onDownloadProgress: (cb: (value: TorrentProgress) => void) => { - const listener = ( - _event: Electron.IpcRendererEvent, - value: TorrentProgress - ) => cb(value); - ipcRenderer.on("on-download-progress", listener); - return () => ipcRenderer.removeListener("on-download-progress", listener); - }, - - /* Catalogue */ - searchGames: (query: string) => ipcRenderer.invoke("searchGames", query), - getCatalogue: (category: CatalogueCategory) => - ipcRenderer.invoke("getCatalogue", category), - getGameShopDetails: (objectID: string, shop: GameShop, language: string) => - ipcRenderer.invoke("getGameShopDetails", objectID, shop, language), - getRandomGame: () => ipcRenderer.invoke("getRandomGame"), - getHowLongToBeat: (objectID: string, shop: GameShop, title: string) => - ipcRenderer.invoke("getHowLongToBeat", objectID, shop, title), - getGames: (take?: number, prevCursor?: number) => - ipcRenderer.invoke("getGames", take, prevCursor), - - /* User preferences */ - getUserPreferences: () => ipcRenderer.invoke("getUserPreferences"), - updateUserPreferences: (preferences: UserPreferences) => - ipcRenderer.invoke("updateUserPreferences", preferences), - autoLaunch: (enabled: boolean) => ipcRenderer.invoke("autoLaunch", enabled), - - /* Library */ - addGameToLibrary: ( - objectID: string, - title: string, - shop: GameShop, - executablePath: string - ) => - ipcRenderer.invoke( - "addGameToLibrary", - objectID, - title, - shop, - executablePath - ), - getLibrary: () => ipcRenderer.invoke("getLibrary"), - getRepackersFriendlyNames: () => - ipcRenderer.invoke("getRepackersFriendlyNames"), - openGameInstaller: (gameId: number) => - ipcRenderer.invoke("openGameInstaller", gameId), - openGame: (gameId: number, executablePath: string) => - ipcRenderer.invoke("openGame", gameId, executablePath), - closeGame: (gameId: number) => ipcRenderer.invoke("closeGame", gameId), - removeGameFromLibrary: (gameId: number) => - ipcRenderer.invoke("removeGameFromLibrary", gameId), - deleteGameFolder: (gameId: number) => - ipcRenderer.invoke("deleteGameFolder", gameId), - getGameByObjectID: (objectID: string) => - ipcRenderer.invoke("getGameByObjectID", objectID), - onPlaytime: (cb: (gameId: number) => void) => { - const listener = (_event: Electron.IpcRendererEvent, gameId: number) => - cb(gameId); - ipcRenderer.on("on-playtime", listener); - return () => ipcRenderer.removeListener("on-playtime", listener); - }, - onGameClose: (cb: (gameId: number) => void) => { - const listener = (_event: Electron.IpcRendererEvent, gameId: number) => - cb(gameId); - ipcRenderer.on("on-game-close", listener); - return () => ipcRenderer.removeListener("on-game-close", listener); - }, - - /* Hardware */ - getDiskFreeSpace: () => ipcRenderer.invoke("getDiskFreeSpace"), - - /* Misc */ - ping: () => ipcRenderer.invoke("ping"), - getVersion: () => ipcRenderer.invoke("getVersion"), - getDefaultDownloadsPath: () => ipcRenderer.invoke("getDefaultDownloadsPath"), - openExternal: (src: string) => ipcRenderer.invoke("openExternal", src), - showOpenDialog: (options: Electron.OpenDialogOptions) => - ipcRenderer.invoke("showOpenDialog", options), - platform: process.platform, - getMagnetHealth: (magnet: string) => - ipcRenderer.invoke("getMagnetHealth", magnet), -}); diff --git a/src/preload/index.ts b/src/preload/index.ts index 4176f1a3..6a209787 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -112,6 +112,4 @@ contextBridge.exposeInMainWorld("electron", { showOpenDialog: (options: Electron.OpenDialogOptions) => ipcRenderer.invoke("showOpenDialog", options), platform: process.platform, - getMagnetHealth: (magnet: string) => - ipcRenderer.invoke("getMagnetHealth", magnet), }); diff --git a/src/renderer/src/assets/sprout-icon.svg b/src/renderer/src/assets/sprout-icon.svg deleted file mode 100644 index fb35828a..00000000 --- a/src/renderer/src/assets/sprout-icon.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/renderer/src/assets/users-icon.svg b/src/renderer/src/assets/users-icon.svg deleted file mode 100644 index 63cb3f98..00000000 --- a/src/renderer/src/assets/users-icon.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/renderer/src/components/index.ts b/src/renderer/src/components/index.ts index a5ad3a0f..70777fea 100644 --- a/src/renderer/src/components/index.ts +++ b/src/renderer/src/components/index.ts @@ -8,4 +8,3 @@ export * from "./sidebar/sidebar"; export * from "./text-field/text-field"; export * from "./checkbox-field/checkbox-field"; export * from "./link/link"; -export * from "./tag/tag"; diff --git a/src/renderer/src/components/tag/tag.css.ts b/src/renderer/src/components/tag/tag.css.ts deleted file mode 100644 index f0c0608f..00000000 --- a/src/renderer/src/components/tag/tag.css.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SPACING_UNIT, vars } from "../../theme.css"; -import { style } from "@vanilla-extract/css"; - -export const tagStyle = style({ - borderRadius: "3px", - border: `1px solid ${vars.color.border}`, - padding: `${SPACING_UNIT / 4}px ${SPACING_UNIT}px`, -}); - -export const tagText = style({ - fontSize: "11px", -}); diff --git a/src/renderer/src/components/tag/tag.tsx b/src/renderer/src/components/tag/tag.tsx deleted file mode 100644 index fa7d0182..00000000 --- a/src/renderer/src/components/tag/tag.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import * as styles from "./tag.css"; - -export function Tag({ children }: Readonly<{ children: React.ReactNode }>) { - return ( -
- {children} -
- ); -} diff --git a/src/renderer/src/components/tooltip/tooltip.css.ts b/src/renderer/src/components/tooltip/tooltip.css.ts deleted file mode 100644 index e478380b..00000000 --- a/src/renderer/src/components/tooltip/tooltip.css.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { style } from "@vanilla-extract/css"; - -export const tooltipStyle = style({ - position: "relative", - display: "flex", - cursor: "pointer", - alignItems: "center", -}); - -export const tooltipTextStyle = style({ - visibility: "hidden", - backgroundColor: "#555", - color: "#fff", - textAlign: "center", - borderRadius: "6px", - padding: "5px 5px", - position: "absolute", - zIndex: "1", - bottom: "125%", - left: "max(0%, min(100%, 50%))", - transform: "translateX(-50%)", - ":after": { - content: '""', - position: "absolute", - top: "100%", - left: "50%", - marginLeft: "-5px", - borderWidth: "5px", - borderStyle: "solid", - borderColor: "#555 transparent transparent transparent", - }, -}); - -export const tooltipVisible = style({ - visibility: "visible", -}); diff --git a/src/renderer/src/components/tooltip/tooltip.tsx b/src/renderer/src/components/tooltip/tooltip.tsx deleted file mode 100644 index 50d74f4c..00000000 --- a/src/renderer/src/components/tooltip/tooltip.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { useState } from "react"; -import * as styles from "./tooltip.css"; - -interface TooltipProps { - children: React.ReactNode; - tooltipText: string; -} - -export function Tooltip({ children, tooltipText }: Readonly) { - const [isVisible, setIsVisible] = useState(false); - - return ( -
setIsVisible(true)} - onMouseLeave={() => setIsVisible(false)} - > - {children} - - {tooltipText} - -
- ); -} diff --git a/src/renderer/src/declaration.d.ts b/src/renderer/src/declaration.d.ts index f03cc6cb..045915bb 100644 --- a/src/renderer/src/declaration.d.ts +++ b/src/renderer/src/declaration.d.ts @@ -90,9 +90,6 @@ declare global { options: Electron.OpenDialogOptions ) => Promise; platform: NodeJS.Platform; - getMagnetHealth: ( - magnet: string - ) => Promise<{ seeders: number; peers: number }>; } interface Window { diff --git a/src/renderer/src/helpers/searcher.ts b/src/renderer/src/helpers/searcher.ts deleted file mode 100644 index 8f2f4890..00000000 --- a/src/renderer/src/helpers/searcher.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { toCapitalize } from "./string"; - -export const isMultiplayerRepack = (title: string, repacker: string) => { - const titleToLower = title.toLowerCase(); - const repackerToLower = repacker.toLowerCase(); - - return ( - titleToLower.includes("multiplayer") || - titleToLower.includes("onlinefix") || - titleToLower.includes("online fix") || - repackerToLower.includes("onlinefix") || - repackerToLower.includes("online fix") - ); -}; - -export const supportMultiLanguage = (title: string) => { - const multiFollowedByDigitsRegex = /multi\d+/; - - return multiFollowedByDigitsRegex.test(title.toLowerCase()); -}; - -export const getRepackLanguageBasedOnRepacker = ( - repacker: string, - userLanguage: string -) => { - const languageCodes = { - xatab: "ru", - }; - - const languageCode = languageCodes[repacker.toLowerCase()] || "en"; - - const displayNames = new Intl.DisplayNames([userLanguage], { - type: "language", - }); - - const language = displayNames.of(languageCode); - - return language ? toCapitalize(language) : "English"; -}; diff --git a/src/renderer/src/helpers/string.ts b/src/renderer/src/helpers/string.ts deleted file mode 100644 index eb18b8b2..00000000 --- a/src/renderer/src/helpers/string.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function toCapitalize(str: string) { - return str.charAt(0).toUpperCase() + str.slice(1); -} diff --git a/src/renderer/src/pages/game-details/repacks-modal.css.ts b/src/renderer/src/pages/game-details/repacks-modal.css.ts index 472ba934..4e15a63a 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.css.ts +++ b/src/renderer/src/pages/game-details/repacks-modal.css.ts @@ -16,9 +16,3 @@ export const repackButton = style({ color: vars.color.bodyText, padding: `${SPACING_UNIT * 2}px`, }); - -export const tagsContainer = style({ - display: "flex", - gap: `${SPACING_UNIT}px`, - flexWrap: "wrap", -}); diff --git a/src/renderer/src/pages/game-details/repacks-modal.tsx b/src/renderer/src/pages/game-details/repacks-modal.tsx index b33d5bb8..4bb92408 100644 --- a/src/renderer/src/pages/game-details/repacks-modal.tsx +++ b/src/renderer/src/pages/game-details/repacks-modal.tsx @@ -9,14 +9,6 @@ import * as styles from "./repacks-modal.css"; import { SPACING_UNIT } from "../../theme.css"; import { format } from "date-fns"; import { SelectFolderModal } from "./select-folder-modal"; -import { SeedersAndPeers } from "./seeders-and-peers/seeders-and-peers"; -import { - isMultiplayerRepack, - supportMultiLanguage, -} from "@renderer/helpers/searcher"; -import { Tag } from "@renderer/components/tag/tag"; -import { getRepackLanguageBasedOnRepacker } from "../../helpers/searcher"; -import { useAppSelector } from "@renderer/hooks"; export interface RepacksModalProps { visible: boolean; @@ -34,9 +26,6 @@ export function RepacksModal({ const [filteredRepacks, setFilteredRepacks] = useState([]); const [repack, setRepack] = useState(null); const [showSelectFolderModal, setShowSelectFolderModal] = useState(false); - const { value: userPreferences } = useAppSelector( - (state) => state.userPreferences - ); const { t } = useTranslation("game_details"); @@ -94,41 +83,12 @@ export function RepacksModal({

{repack.title}

-
-
-

- {repack.fileSize} - {repack.repacker} -{" "} - {repack.uploadDate - ? format(repack.uploadDate, "dd/MM/yyyy") - : ""} - {userPreferences?.language && ( - <> - {" - " + - getRepackLanguageBasedOnRepacker( - repack.repacker, - userPreferences?.language - )} - - )} -

-
- -
-
- {supportMultiLanguage(repack.title) && ( - {t("multi_language")} - )} - {isMultiplayerRepack(repack.title, repack.repacker) && ( - {t("multiplayer")} - )} -
+

+ {repack.fileSize} - {repack.repacker} -{" "} + {repack.uploadDate + ? format(repack.uploadDate, "dd/MM/yyyy") + : ""} +

))} diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers-skeleton.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers-skeleton.tsx deleted file mode 100644 index dc0f7381..00000000 --- a/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers-skeleton.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import Skeleton from "react-loading-skeleton"; - -export function SeedersAndPeersSkeleton() { - return ( -
- - -
- ); -} diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx deleted file mode 100644 index ba33abfe..00000000 --- a/src/renderer/src/pages/game-details/seeders-and-peers/seeders-and-peers.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { GameRepack } from "@types"; -import UsersIcon from "@renderer/assets/users-icon.svg?react"; -import SproutIcon from "@renderer/assets/sprout-icon.svg?react"; - -import { useMagnetHealth } from "./useMagnetHealth"; -import { Tooltip } from "@renderer/components/tooltip/tooltip"; -import { SeedersAndPeersSkeleton } from "./seeders-and-peers-skeleton"; -import { SPACING_UNIT, vars } from "@renderer/theme.css"; - -interface SeedersAndPeersProps { - repack: GameRepack; -} - -export function SeedersAndPeers({ repack }: Readonly) { - const { magnetData, isLoading, error } = useMagnetHealth(repack.magnet); - - if (isLoading) { - return ; - } - - if (error) { - return null; - } - - return ( -
- - - - {magnetData?.seeders} - - - - - - {magnetData?.peers} - - -
- ); -} diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/types.ts b/src/renderer/src/pages/game-details/seeders-and-peers/types.ts deleted file mode 100644 index 23532807..00000000 --- a/src/renderer/src/pages/game-details/seeders-and-peers/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type TorrentData = { - seeders: number; - peers: number; - lastTracked?: Date; -}; diff --git a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx b/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx deleted file mode 100644 index 67e6f21e..00000000 --- a/src/renderer/src/pages/game-details/seeders-and-peers/useMagnetHealth.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import { useEffect, useState } from "react"; -import { TorrentData } from "./types"; - -const cache: Record = {}; - -export function useMagnetHealth(magnet: string) { - const [magnetData, setMagnetData] = useState( - cache[magnet] || null - ); - const [isLoading, setIsLoading] = useState(() => { - if (cache[magnet]) { - return false; - } - - return true; - }); - const [error, setError] = useState(null); - - useEffect(() => { - if (!magnet) { - return; - } - - if (cache[magnet]) { - setMagnetData(cache[magnet]); - setIsLoading(false); - return; - } - - window.electron - .getMagnetHealth(magnet) - .then( - (result) => { - if (result) { - setMagnetData(result); - setIsLoading(false); - - cache[magnet] = result; - cache[magnet].lastTracked = new Date(); - } - }, - (error) => { - setError(error); - setIsLoading(false); - } - ) - .catch(() => {}); - }, [magnet]); - - useEffect(() => { - function invalidateCache() { - const TWO_MINUTES = 2 * 60 * 1000; - const cacheExpiresIn = TWO_MINUTES; - - Object.keys(cache).forEach((key) => { - const lastTracked = cache[key].lastTracked; - - if (!lastTracked) { - return; - } - - if (Date.now() - lastTracked.getTime() > cacheExpiresIn) { - delete cache[key]; - } - }); - } - - invalidateCache(); - - return () => { - invalidateCache(); - }; - }, []); - - return { - magnetData, - isLoading, - error, - }; -} diff --git a/yarn.lock b/yarn.lock index edd68514..76e0d8ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1609,11 +1609,6 @@ acorn@^8.11.3, acorn@^8.9.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== -addr-to-ip-port@^1.0.1: - version "1.5.4" - resolved "https://registry.yarnpkg.com/addr-to-ip-port/-/addr-to-ip-port-1.5.4.tgz#9542b1c6219fdb8c9ce6cc72c14ee880ab7ddd88" - integrity sha512-ByxmJgv8vjmDcl3IDToxL2yrWFrRtFpZAToY0f46XFXl8zS081t7El5MXIodwm7RC6DhHBRoOSMLFSPKCtHukg== - agent-base@6: version "6.0.2" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" @@ -1933,11 +1928,6 @@ base64-js@^1.3.1, base64-js@^1.5.1: resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -bencode@^2.0.1, bencode@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/bencode/-/bencode-2.0.3.tgz#89b9c80ea1b8573554915a7d0c15f62b0aa7fc52" - integrity sha512-D/vrAD4dLVX23NalHwb8dSvsUsxeRPO8Y7ToKA015JQYq69MLDOMkC0uGZYA/MPpltLO8rt8eqFC2j8DxjTZ/w== - bencode@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/bencode/-/bencode-4.0.0.tgz#36ca0bc366290dad002215fc52fc74edf4eb0625" @@ -1945,11 +1935,6 @@ bencode@^4.0.0: dependencies: uint8-util "^2.2.2" -bep53-range@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/bep53-range/-/bep53-range-1.1.1.tgz#20fd125b00a413254a77d42f63a43750ca7e64ac" - integrity sha512-ct6s33iiwRCUPp9KXnJ4QMWDgHIgaw36caK/5XEQ9L8dCzSQlJt1Vk6VmHh1VD4AlGCAI4C2zmtfItifBBPrhQ== - bep53-range@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/bep53-range/-/bep53-range-2.0.0.tgz#a1770475661b4b814c4359e4b66f7cbd88de2b10" @@ -1970,43 +1955,6 @@ bindings@^1.5.0: dependencies: file-uri-to-path "1.0.0" -bittorrent-peerid@^1.3.3: - version "1.3.6" - resolved "https://registry.yarnpkg.com/bittorrent-peerid/-/bittorrent-peerid-1.3.6.tgz#3688705a64937a8176ac2ded1178fc7bd91b61db" - integrity sha512-VyLcUjVMEOdSpHaCG/7odvCdLbAB1y3l9A2V6WIje24uV7FkJPrQrH/RrlFmKxP89pFVDEnE+YlHaFujlFIZsg== - -bittorrent-tracker@^9.19.0: - version "9.19.0" - resolved "https://registry.yarnpkg.com/bittorrent-tracker/-/bittorrent-tracker-9.19.0.tgz#2266bfa8a45a57b09f8d8b184710ba531712d8ef" - integrity sha512-09d0aD2b+MC+zWvWajkUAKkYMynYW4tMbTKiRSthKtJZbafzEoNQSUHyND24SoCe3ZOb2fKfa6fu2INAESL9wA== - dependencies: - bencode "^2.0.1" - bittorrent-peerid "^1.3.3" - bn.js "^5.2.0" - chrome-dgram "^3.0.6" - clone "^2.0.0" - compact2string "^1.4.1" - debug "^4.1.1" - ip "^1.1.5" - lru "^3.1.0" - minimist "^1.2.5" - once "^1.4.0" - queue-microtask "^1.2.3" - random-iterate "^1.0.1" - randombytes "^2.1.0" - run-parallel "^1.2.0" - run-series "^1.1.9" - simple-get "^4.0.0" - simple-peer "^9.11.0" - simple-websocket "^9.1.0" - socks "^2.0.0" - string2compact "^1.3.0" - unordered-array-remove "^1.0.2" - ws "^7.4.5" - optionalDependencies: - bufferutil "^4.0.3" - utf-8-validate "^5.0.5" - bl@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" @@ -2016,11 +1964,6 @@ bl@^4.0.3: inherits "^2.0.4" readable-stream "^3.4.0" -blob-to-buffer@^1.2.9: - version "1.2.9" - resolved "https://registry.yarnpkg.com/blob-to-buffer/-/blob-to-buffer-1.2.9.tgz#a17fd6c1c564011408f8971e451544245daaa84a" - integrity sha512-BF033y5fN6OCofD3vgHmNtwZWRcq9NLyyxyILx9hfMy1sXYy4ojFl765hJ2lP0YaN2fuxPaLO2Vzzoxy0FLFFA== - bluebird-lst@^1.0.9: version "1.0.9" resolved "https://registry.yarnpkg.com/bluebird-lst/-/bluebird-lst-1.0.9.tgz#a64a0e4365658b9ab5fe875eb9dfb694189bb41c" @@ -2033,11 +1976,6 @@ bluebird@^3.5.5: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -bn.js@^5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" - integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== - boolean@^3.0.1: version "3.2.0" resolved "https://registry.yarnpkg.com/boolean/-/boolean-3.2.0.tgz#9e5294af4e98314494cbb17979fa54ca159f116b" @@ -2106,13 +2044,6 @@ buffer@^6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" -bufferutil@^4.0.3: - version "4.0.8" - resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.8.tgz#1de6a71092d65d7766c4d8a522b261a6e787e8ea" - integrity sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw== - dependencies: - node-gyp-build "^4.3.0" - builder-util-runtime@9.2.3: version "9.2.3" resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-9.2.3.tgz#0a82c7aca8eadef46d67b353c638f052c206b83c" @@ -2237,14 +2168,6 @@ chownr@^2.0.0: resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ== -chrome-dgram@^3.0.6: - version "3.0.6" - resolved "https://registry.yarnpkg.com/chrome-dgram/-/chrome-dgram-3.0.6.tgz#2288b5c7471f66f073691206d36319dda713cf55" - integrity sha512-bqBsUuaOiXiqxXt/zA/jukNJJ4oaOtc7ciwqJpZVEaaXwwxqgI2/ZdG02vXYWUhHGziDlvGMQWk0qObgJwVYKA== - dependencies: - inherits "^2.0.4" - run-series "^1.1.9" - chromium-pickle-js@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz#04a106672c18b085ab774d983dfa3ea138f22205" @@ -2305,11 +2228,6 @@ clone-response@^1.0.2: dependencies: mimic-response "^1.0.0" -clone@^2.0.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== - color-convert@^1.9.0, color-convert@^1.9.3: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -2383,13 +2301,6 @@ commander@^5.0.0: resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== -compact2string@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/compact2string/-/compact2string-1.4.1.tgz#8d34929055f8300a13cfc030ad1832e2e53c2e25" - integrity sha512-3D+EY5nsRhqnOwDxveBv5T8wGo4DEvYxjDtPGmdOX+gfr5gE92c2RC0w2wa+xEefm07QuVqqcF3nZJUZ92l/og== - dependencies: - ipaddr.js ">= 0.1.5" - compare-func@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/compare-func/-/compare-func-2.0.0.tgz#fb65e75edbddfd2e568554e8b5b05fff7a51fcb3" @@ -2886,11 +2797,6 @@ err-code@^2.0.2: resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.3.tgz#23c2f3b756ffdfc608d30e27c9a941024807e7f9" integrity sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA== -err-code@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/err-code/-/err-code-3.0.1.tgz#a444c7b992705f2b120ee320b09972eef331c920" - integrity sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA== - error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -3544,11 +3450,6 @@ gensync@^1.0.0-beta.2: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -get-browser-rtc@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/get-browser-rtc/-/get-browser-rtc-1.1.0.tgz#d1494e299b00f33fc8e9d6d3343ba4ba99711a2c" - integrity sha512-MghbMJ61EJrRsDe7w1Bvqt3ZsBuqhce5nrn/XAwgwOXhcsz53/ltdxOse1h/8eKXj5slzxdsz56g5rzOFSGwfQ== - get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" @@ -3565,11 +3466,6 @@ get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.3, get-intrinsic@ has-symbols "^1.0.3" hasown "^2.0.0" -get-stdin@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53" - integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== - get-stdin@^9.0.0: version "9.0.0" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-9.0.0.tgz#3983ff82e03d56f1b2ea0d3e60325f39d703a575" @@ -3954,24 +3850,6 @@ internal-slot@^1.0.7: hasown "^2.0.0" side-channel "^1.0.4" -ip-address@^9.0.5: - version "9.0.5" - resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-9.0.5.tgz#117a960819b08780c3bd1f14ef3c1cc1d3f3ea5a" - integrity sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g== - dependencies: - jsbn "1.1.0" - sprintf-js "^1.1.3" - -ip@^1.1.5: - version "1.1.9" - resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.9.tgz#8dfbcc99a754d07f425310b86a99546b1151e396" - integrity sha512-cyRxvOEpNHNtchU3Ln9KC/auJgup87llfQpQ+t5ghoC/UhL16SWzbueiCsdTnWmqAWl7LadfuwhlqmtOaqMHdQ== - -"ipaddr.js@>= 0.1.5", ipaddr.js@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-2.2.0.tgz#d33fa7bac284f4de7af949638c9d68157c6b92e8" - integrity sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA== - is-array-buffer@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.4.tgz#7a1f92b3d61edd2bc65d24f130530ea93d7fae98" @@ -4263,11 +4141,6 @@ js-yaml@^4.1.0: dependencies: argparse "^2.0.1" -jsbn@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-1.1.0.tgz#b01307cb29b618a1ed26ec79e911f803c4da0040" - integrity sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A== - jsdom@^24.0.0: version "24.0.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-24.0.0.tgz#e2dc04e4c79da368481659818ee2b0cd7c39007c" @@ -4554,13 +4427,6 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -lru@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lru/-/lru-3.1.0.tgz#ea7fb8546d83733396a13091d76cfeb4c06837d5" - integrity sha512-5OUtoiVIGU4VXBOshidmtOsvBIvcQR6FD/RzWSvaeHyxCGB+PCUCu+52lqMfdc0h/2CLvHhZS4TwUmMQrrMbBQ== - dependencies: - inherits "^2.0.1" - magic-string@^0.30.5: version "0.30.10" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.10.tgz#123d9c41a0cb5640c892b041d4cfb3bd0aa4b39e" @@ -4568,14 +4434,6 @@ magic-string@^0.30.5: dependencies: "@jridgewell/sourcemap-codec" "^1.4.15" -magnet-uri@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/magnet-uri/-/magnet-uri-6.2.0.tgz#10f7be050bf23452df210838239b118463c3eeff" - integrity sha512-O9AgdDwT771fnUj0giPYu/rACpz8173y8UXCSOdLITjOVfBenZ9H9q3FqQmveK+ORUMuD+BkKNSZP8C3+IMAKQ== - dependencies: - bep53-range "^1.1.0" - thirty-two "^1.0.2" - magnet-uri@^7.0.5: version "7.0.5" resolved "https://registry.yarnpkg.com/magnet-uri/-/magnet-uri-7.0.5.tgz#7b5143fd5527f3f612959eeeae264d6f4aeff37b" @@ -4687,7 +4545,7 @@ minimist@1.2.6: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== -minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.5, minimist@^1.2.6, minimist@^1.2.8: +minimist@^1.2.0, minimist@^1.2.3, minimist@^1.2.6, minimist@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -4843,11 +4701,6 @@ node-fetch@^3.3.0: fetch-blob "^3.1.4" formdata-polyfill "^4.0.10" -node-gyp-build@^4.3.0: - version "4.8.1" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.1.tgz#976d3ad905e71b76086f4f0b0d3637fe79b6cda5" - integrity sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw== - node-releases@^2.0.14: version "2.0.14" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" @@ -5061,19 +4914,6 @@ parse-torrent@^11.0.16: queue-microtask "^1.2.3" uint8-util "^2.2.4" -parse-torrent@^9.1.5: - version "9.1.5" - resolved "https://registry.yarnpkg.com/parse-torrent/-/parse-torrent-9.1.5.tgz#fcae5f360d9baf617d9a2de68e74d5de4c8099fd" - integrity sha512-K8FXRwTOaZMI0/xuv0dpng1MVHZRtMJ0jRWBJ3qZWVNTrC1MzWUxm9QwaXDz/2qPhV2XC4UIHI92IGHwseAwaA== - dependencies: - bencode "^2.0.2" - blob-to-buffer "^1.2.9" - get-stdin "^8.0.0" - magnet-uri "^6.2.0" - queue-microtask "^1.2.3" - simple-get "^4.0.1" - simple-sha1 "^3.1.0" - parse5-htmlparser2-tree-adapter@^6.0.0: version "6.0.1" resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" @@ -5293,18 +5133,6 @@ quick-lru@^5.1.1: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== -random-iterate@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/random-iterate/-/random-iterate-1.0.1.tgz#f7d97d92dee6665ec5f6da08c7f963cad4b2ac99" - integrity sha512-Jdsdnezu913Ot8qgKgSgs63XkAjEsnMcS1z+cC6D6TNXsUXsMxy0RpclF2pzGZTEiTXL9BiArdGTEexcv4nqcA== - -randombytes@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - rc@^1.2.7: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" @@ -5555,23 +5383,13 @@ rrweb-cssom@^0.6.0: resolved "https://registry.yarnpkg.com/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz#ed298055b97cbddcdeb278f904857629dec5e0e1" integrity sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw== -run-parallel@^1.1.9, run-parallel@^1.2.0: +run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== dependencies: queue-microtask "^1.2.2" -run-series@^1.1.9: - version "1.1.9" - resolved "https://registry.yarnpkg.com/run-series/-/run-series-1.1.9.tgz#15ba9cb90e6a6c054e67c98e1dc063df0ecc113a" - integrity sha512-Arc4hUN896vjkqCYrUXquBFtRZdv1PfLbTYP71efP6butxyQ0kWpiNJyAgsxscmQg1cqvHY32/UCBzXedTpU2g== - -rusha@^0.8.13: - version "0.8.14" - resolved "https://registry.yarnpkg.com/rusha/-/rusha-0.8.14.tgz#a977d0de9428406138b7bb90d3de5dcd024e2f68" - integrity sha512-cLgakCUf6PedEu15t8kbsjnwIFFR2D4RfL+W3iWFJ4iac7z4B0ZI8fxy4R3J956kAI68HclCFGL8MPoUVC3qVA== - safe-array-concat@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.1.2.tgz#81d77ee0c4e8b863635227c721278dd524c20edb" @@ -5582,7 +5400,7 @@ safe-array-concat@^1.1.2: has-symbols "^1.0.3" isarray "^2.0.5" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -5721,7 +5539,7 @@ simple-concat@^1.0.0: resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== -simple-get@^4.0.0, simple-get@^4.0.1: +simple-get@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-4.0.1.tgz#4a39db549287c979d352112fa03fd99fd6bc3543" integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA== @@ -5730,27 +5548,6 @@ simple-get@^4.0.0, simple-get@^4.0.1: once "^1.3.1" simple-concat "^1.0.0" -simple-peer@^9.11.0: - version "9.11.1" - resolved "https://registry.yarnpkg.com/simple-peer/-/simple-peer-9.11.1.tgz#9814d5723f821b778b7fb011bdefcbd1e788e6cc" - integrity sha512-D1SaWpOW8afq1CZGWB8xTfrT3FekjQmPValrqncJMX7QFl8YwhrPTZvMCANLtgBwwdS+7zURyqxDDEmY558tTw== - dependencies: - buffer "^6.0.3" - debug "^4.3.2" - err-code "^3.0.1" - get-browser-rtc "^1.1.0" - queue-microtask "^1.2.3" - randombytes "^2.1.0" - readable-stream "^3.6.0" - -simple-sha1@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/simple-sha1/-/simple-sha1-3.1.0.tgz#40cac8436dfaf9924332fc46a5c7bca45f656131" - integrity sha512-ArTptMRC1v08H8ihPD6l0wesKvMfF9e8XL5rIHPanI7kGOsSsbY514MwVu6X1PITHCTB2F08zB7cyEbfc4wQjg== - dependencies: - queue-microtask "^1.2.2" - rusha "^0.8.13" - simple-swizzle@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" @@ -5765,17 +5562,6 @@ simple-update-notifier@2.0.0: dependencies: semver "^7.5.3" -simple-websocket@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/simple-websocket/-/simple-websocket-9.1.0.tgz#91cbb39eafefbe7e66979da6c639109352786a7f" - integrity sha512-8MJPnjRN6A8UCp1I+H/dSFyjwJhp6wta4hsVRhjf8w9qBHRzxYt14RaOcjvQnhD1N4yKOddEjflwMnQM4VtXjQ== - dependencies: - debug "^4.3.1" - queue-microtask "^1.2.2" - randombytes "^2.1.0" - readable-stream "^3.6.0" - ws "^7.4.2" - slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -5790,7 +5576,7 @@ slice-ansi@^3.0.0: astral-regex "^2.0.0" is-fullwidth-code-point "^3.0.0" -smart-buffer@^4.0.2, smart-buffer@^4.2.0: +smart-buffer@^4.0.2: version "4.2.0" resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== @@ -5803,14 +5589,6 @@ snake-case@^3.0.4: dot-case "^3.0.4" tslib "^2.0.3" -socks@^2.0.0: - version "2.8.3" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.8.3.tgz#1ebd0f09c52ba95a09750afe3f3f9f724a800cb5" - integrity sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw== - dependencies: - ip-address "^9.0.5" - smart-buffer "^4.2.0" - source-map-js@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" @@ -5834,7 +5612,7 @@ split2@^4.0.0: resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== -sprintf-js@^1.1.2, sprintf-js@^1.1.3: +sprintf-js@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.3.tgz#4914b903a2f8b685d17fdf78a70e917e872e444a" integrity sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA== @@ -5922,14 +5700,6 @@ string.prototype.trimstart@^1.0.8: define-properties "^1.2.1" es-object-atoms "^1.0.0" -string2compact@^1.3.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/string2compact/-/string2compact-1.3.2.tgz#c9d11a13f368404b8025425cc53f9916de1d0b8b" - integrity sha512-3XUxUgwhj7Eqh2djae35QHZZT4mN3fsO7kagZhSGmhhlrQagVvWSFuuFIWnpxFS0CdTB2PlQcaL16RDi14I8uw== - dependencies: - addr-to-ip-port "^1.0.1" - ipaddr.js "^2.0.0" - string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -6087,11 +5857,6 @@ thenify-all@^1.0.0: dependencies: any-promise "^1.0.0" -thirty-two@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/thirty-two/-/thirty-two-1.0.2.tgz#4ca2fffc02a51290d2744b9e3f557693ca6b627a" - integrity sha512-OEI0IWCe+Dw46019YLl6V10Us5bi574EvlJEOcAkB29IzQ/mYD1A6RyNHLjZPiHCmuodxvgF6U+vZO1L15lxVA== - "through@>=2.2.7 <3": version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -6311,11 +6076,6 @@ universalify@^2.0.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== -unordered-array-remove@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/unordered-array-remove/-/unordered-array-remove-1.0.2.tgz#c546e8f88e317a0cf2644c97ecb57dba66d250ef" - integrity sha512-45YsfD6svkgaCBNyvD+dFHm4qFX9g3wRSIVgWVPtm2OCnphvPxzJoe20ATsiNpNJrmzHifnxm+BN5F7gFT/4gw== - untildify@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/untildify/-/untildify-3.0.3.tgz#1e7b42b140bcfd922b22e70ca1265bfe3634c7c9" @@ -6356,13 +6116,6 @@ user-agents@^1.1.193: dependencies: lodash.clonedeep "^4.5.0" -utf-8-validate@^5.0.5: - version "5.0.10" - resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" - integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== - dependencies: - node-gyp-build "^4.3.0" - utf8-byte-length@^1.0.1: version "1.0.5" resolved "https://registry.yarnpkg.com/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz#f9f63910d15536ee2b2d5dd4665389715eac5c1e" @@ -6445,14 +6198,6 @@ webidl-conversions@^7.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== -webtorrent-health@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/webtorrent-health/-/webtorrent-health-1.2.0.tgz#f127fe4dba603e3bbed4224c1de8e18034ab02a2" - integrity sha512-id51LF+1IGvqSXhdO9rl9riDLGRPO7e/DrjcNJ/1PhTp5O3+1U50+ogDEJyxQvIISZV//xYX+kMM4Fn9cogfCg== - dependencies: - bittorrent-tracker "^9.19.0" - parse-torrent "^9.1.5" - whatwg-encoding@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz#d0f4ef769905d426e1688f3e34381a99b60b76e5" @@ -6611,11 +6356,6 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -ws@^7.4.2, ws@^7.4.5: - version "7.5.9" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" - integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== - ws@^8.16.0: version "8.17.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.0.tgz#d145d18eca2ed25aaf791a183903f7be5e295fea" From d98a01df2f804f40ab4b04af5e6e493a914f1969 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Sat, 18 May 2024 16:28:44 -0300 Subject: [PATCH 38/38] creares release workflow and change build workflow to run on PR --- .github/workflows/build.yml | 22 +-------- .github/workflows/release.yml | 86 +++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2862e97..07188035 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,6 @@ name: Build -on: - push: - branches: main +on: [pull_request] jobs: build: @@ -66,21 +64,3 @@ jobs: dist/*.tar.gz dist/*.yml dist/*.blockmap - - - name: Release - uses: softprops/action-gh-release@v1 - with: - draft: true - files: | - dist/*.exe - dist/*.zip - dist/*.dmg - dist/*.AppImage - dist/*.snap - dist/*.deb - dist/*.rpm - dist/*.tar.gz - dist/*.yml - dist/*.blockmap - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b2862e97 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,86 @@ +name: Build + +on: + push: + branches: main + +jobs: + build: + strategy: + matrix: + os: [windows-latest, ubuntu-latest] + + runs-on: ${{ matrix.os }} + + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.11.1 + + - name: Install dependencies + run: yarn + + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: 3.9 + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Build with cx_Freeze + run: python torrent-client/setup.py build + + - name: Build Linux + if: matrix.os == 'ubuntu-latest' + run: yarn build:linux + env: + MAIN_VITE_STEAMGRIDDB_API_KEY: ${{ secrets.STEAMGRIDDB_API_KEY }} + MAIN_VITE_ONLINEFIX_USERNAME: ${{ secrets.ONLINEFIX_USERNAME }} + MAIN_VITE_ONLINEFIX_PASSWORD: ${{ secrets.ONLINEFIX_PASSWORD }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Windows + if: matrix.os == 'windows-latest' + run: yarn build:win + env: + MAIN_VITE_STEAMGRIDDB_API_KEY: ${{ secrets.STEAMGRIDDB_API_KEY }} + MAIN_VITE_ONLINEFIX_USERNAME: ${{ secrets.ONLINEFIX_USERNAME }} + MAIN_VITE_ONLINEFIX_PASSWORD: ${{ secrets.ONLINEFIX_PASSWORD }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create artifact + uses: actions/upload-artifact@v4 + with: + name: Build-${{ matrix.os }} + path: | + dist/*.exe + dist/*.zip + dist/*.dmg + dist/*.deb + dist/*.rpm + dist/*.tar.gz + dist/*.yml + dist/*.blockmap + + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + files: | + dist/*.exe + dist/*.zip + dist/*.dmg + dist/*.AppImage + dist/*.snap + dist/*.deb + dist/*.rpm + dist/*.tar.gz + dist/*.yml + dist/*.blockmap + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}