Skip to content

Commit

Permalink
chore: sync with main
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrannychaseroperation committed Apr 19, 2024
2 parents 8120b95 + 3449ac5 commit 84155ad
Show file tree
Hide file tree
Showing 22 changed files with 180 additions and 59 deletions.
16 changes: 2 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,8 @@ jobs:
- name: Install dependencies
run: pip install -r requirements.txt

- name: Build with Nuitka
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
working-directory: torrent-client
script-name: main.py
standalone: true
enable-plugins: libtorrent
output-dir: resources/dist
output-file: hydra-download-manager
windows-icon-from-ico: images/icon.ico

# - name: Build with pyinstaller
# run: pyinstaller torrent-client/main.py --distpath resources/dist --icon=images/icon.ico -n hydra-download-manager
- name: Build with cx_Freeze
run: python torrent-client/setup.py build

- name: Publish
run: yarn run publish
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ yarn start
Build the bittorrent client by using this command:

```bash
pyinstaller torrent-client/main.py --distpath resources/dist --icon=images/icon.ico -n hydra-download-manager
python torrent-client/setup.py build
```

### Build the Electron application
Expand Down
20 changes: 12 additions & 8 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ import { ElectronegativityPlugin } from "@electron-forge/plugin-electronegativit
import { mainConfig } from "./webpack.main.config";
import { rendererConfig } from "./webpack.renderer.config";

const linuxPkgConfig = {
mimeType: ["x-scheme-handler/hydralauncher"],
bin: "./Hydra",
desktopTemplate: "./hydra-launcher.desktop",
icon: "images/icon.png",
genericName: "Games Launcher",
name: "hydra-launcher",
productName: "Hydra"
};

const config: ForgeConfig = {
packagerConfig: {
asar: true,
Expand Down Expand Up @@ -40,16 +50,10 @@ const config: ForgeConfig = {
}),
new MakerZIP({}, ["darwin", "linux"]),
new MakerRpm({
options: {
mimeType: ["x-scheme-handler/hydralauncher"],
bin: "./Hydra",
},
options: linuxPkgConfig
}),
new MakerDeb({
options: {
mimeType: ["x-scheme-handler/hydralauncher"],
bin: "./Hydra",
},
options: linuxPkgConfig
}),
],
publishers: [
Expand Down
11 changes: 11 additions & 0 deletions hydra-launcher.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Name=Hydra
Comment=No bullshit. Just play.
GenericName=Games Launcher
Exec=hydra-launcher %U
Icon=hydra-launcher
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;
MimeType=x-scheme-handler/hydralauncher;
StartupWMClass=Hydra
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
libtorrent
cx_Freeze
cx_Logging; sys_platform == 'win32'
lief; sys_platform == 'win32'
pywin32; sys_platform == 'win32'
5 changes: 3 additions & 2 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"no_results": "No results found"
},
"sidebar": {
"home": "Home",
"catalogue": "Catalogue",
"downloads": "Downloads",
"settings": "Settings",
Expand All @@ -16,7 +15,9 @@
"checking_files": "{{title}} ({{percentage}} - Checking files…)",
"paused": "{{title}} (Paused)",
"downloading": "{{title}} ({{percentage}} - Downloading…)",
"filter": "Filter library"
"filter": "Filter library",
"follow_us": "Follow us",
"home": "Home"
},
"header": {
"search": "Search",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"paused": "{{title}} (Pausado)",
"downloading": "{{title}} ({{percentage}} - Descargando…)",
"filter": "Filtrar biblioteca",
"home": "Hogar"
"home": "Hogar",
"follow_us": "Síganos"
},
"header": {
"search": "Buscar",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"paused": "{{title}} (En pause)",
"downloading": "{{title}} ({{percentage}} - Téléchargement en cours…)",
"filter": "Filtrer la bibliothèque",
"home": "Maison"
"home": "Maison",
"follow_us": "Suivez-nous"
},
"header": {
"search": "Recherche",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"paused": "{{title}} (Pausado)",
"downloading": "{{title}} ({{percentage}} - Baixando…)",
"filter": "Filtrar biblioteca",
"home": "Início"
"home": "Início",
"follow_us": "Acompanhe-nos"
},
"header": {
"search": "Buscar",
Expand Down
37 changes: 19 additions & 18 deletions src/main/events/index.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
import { app, ipcMain } from "electron";
import { defaultDownloadsPath } from "@main/constants";
import { app, ipcMain } from "electron";

import "./library/add-game-to-library";
import "./catalogue/search-games";
import "./catalogue/get-game-shop-details";
import "./catalogue/get-catalogue";
import "./library/get-library";
import "./catalogue/get-game-shop-details";
import "./catalogue/get-games";
import "./catalogue/get-how-long-to-beat";
import "./catalogue/get-random-game";
import "./catalogue/search-games";
import "./hardware/get-disk-free-space";
import "./library/add-game-to-library";
import "./library/close-game";
import "./library/delete-game-folder";
import "./library/get-game-by-object-id";
import "./library/get-library";
import "./library/get-repackers-friendly-names";
import "./library/open-game";
import "./library/open-game-installer";
import "./library/remove-game";
import "./misc/get-or-cache-image";
import "./misc/open-external";
import "./misc/show-open-dialog";
import "./torrenting/cancel-game-download";
import "./torrenting/pause-game-download";
import "./torrenting/resume-game-download";
import "./torrenting/start-game-download";
import "./misc/get-or-cache-image";
import "./user-preferences/update-user-preferences";
import "./user-preferences/get-user-preferences";
import "./library/get-repackers-friendly-names";
import "./library/get-game-by-object-id";
import "./library/open-game-installer";
import "./library/open-game";
import "./library/close-game";
import "./misc/show-open-dialog";
import "./library/remove-game";
import "./library/delete-game-folder";
import "./catalogue/get-random-game";
import "./catalogue/get-how-long-to-beat";
import "./catalogue/get-games";
import "./user-preferences/update-user-preferences";

ipcMain.handle("ping", () => "pong");
ipcMain.handle("getVersion", () => app.getVersion());
Expand Down
9 changes: 9 additions & 0 deletions src/main/events/misc/open-external.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { shell } from "electron";
import { registerEvent } from "../register-event";

const openExternal = async (_event: Electron.IpcMainInvokeEvent, src: string) =>
shell.openExternal(src);

registerEvent(openExternal, {
name: "openExternal",
});
13 changes: 11 additions & 2 deletions src/main/services/torrent-client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import path from "node:path";
import cp from "node:child_process";
import fs from "node:fs";
import * as Sentry from "@sentry/electron/main";
import { Notification, app } from "electron";
import { Notification, app, dialog } from "electron";
import type { QueryDeepPartialEntity } from "typeorm/query-builder/QueryPartialEntity";

import { Game } from "@main/entity";
Expand Down Expand Up @@ -54,6 +55,15 @@ export class TorrentClient {
binaryName
);

if (!fs.existsSync(binaryPath)) {
dialog.showErrorBox(
"Fatal",
"Hydra download manager binary not found. Please check if it has been removed by Windows Defender."
);

app.quit();
}

cp.spawn(binaryPath, commonArgs, {
stdio: "inherit",
windowsHide: true,
Expand Down Expand Up @@ -155,7 +165,6 @@ export class TorrentClient {
}
} catch (err) {
Sentry.captureException(err);
Sentry.captureMessage(message, "error");
}
}
}
1 change: 1 addition & 0 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ contextBridge.exposeInMainWorld("electron", {
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,
Expand Down
1 change: 1 addition & 0 deletions src/renderer/assets/discord-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/renderer/assets/x-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions src/renderer/components/bottom-panel/bottom-panel.css.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SPACING_UNIT, vars } from "../../theme.css";
import { style } from "@vanilla-extract/css";
import { SPACING_UNIT, vars } from "../../theme.css";

export const bottomPanel = style({
width: "100%",
Expand All @@ -14,9 +14,10 @@ export const bottomPanel = style({
});

export const downloadsButton = style({
cursor: "pointer",
color: vars.color.bodyText,
borderBottom: "1px solid transparent",
":hover": {
textDecoration: "underline",
borderBottom: `1px solid ${vars.color.bodyText}`,
cursor: "pointer",
},
});
34 changes: 34 additions & 0 deletions src/renderer/components/sidebar/sidebar.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const sidebar = recipe({
base: {
backgroundColor: vars.color.darkBackground,
color: "#c0c1c7",
flexDirection: "column",
display: "flex",
transition: "opacity ease 0.2s",
borderRight: `solid 1px ${vars.color.borderColor}`,
Expand Down Expand Up @@ -134,3 +135,36 @@ export const section = recipe({
},
},
});

export const sidebarFooter = style({
marginTop: "auto",
padding: `${SPACING_UNIT * 2}px`,
display: "flex",
alignItems: "center",
justifyContent: "space-between",
});

export const footerSocialsContainer = style({
display: "flex",
alignItems: "center",
gap: `${SPACING_UNIT * 1.5}px`,
});

export const footerSocialsItem = style({
color: vars.color.bodyText,
backgroundColor: vars.color.darkBackground,
width: "16px",
height: "16px",
display: "flex",
alignItems: "center",
transition: "all ease 0.15s",
":hover": {
opacity: 0.75,
cursor: "pointer",
},
});

export const footerText = style({
color: vars.color.bodyText,
fontSize: "12px",
});
41 changes: 39 additions & 2 deletions src/renderer/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,32 @@ import { useLocation, useNavigate } from "react-router-dom";

import type { Game } from "@types";

import { useDownload, useLibrary } from "@renderer/hooks";
import { AsyncImage, TextField } from "@renderer/components";
import { useDownload, useLibrary } from "@renderer/hooks";
import { SPACING_UNIT } from "@renderer/theme.css";

import * as styles from "./sidebar.css";
import { routes } from "./routes";

import { MarkGithubIcon } from "@primer/octicons-react";
import DiscordLogo from "@renderer/assets/discord-icon.svg";
import XLogo from "@renderer/assets/x-icon.svg";
import * as styles from "./sidebar.css";

const socials = [
{
url: "https://discord.gg/hydralauncher",
icon: <DiscordLogo />,
},
{
url: "https://twitter.com/hydralauncher",
icon: <XLogo />,
},
{
url: "https://github.com/hydralauncher/hydra",
icon: <MarkGithubIcon size={16} />,
},
];

const SIDEBAR_MIN_WIDTH = 200;
const SIDEBAR_INITIAL_WIDTH = 250;
const SIDEBAR_MAX_WIDTH = 450;
Expand Down Expand Up @@ -212,6 +231,24 @@ export function Sidebar() {
className={styles.handle}
onMouseDown={handleMouseDown}
/>

<footer className={styles.sidebarFooter}>
<div className={styles.footerText}>{t("follow_us")}</div>

<span className={styles.footerSocialsContainer}>
{socials.map((item) => {
return (
<button
key={item.url}
className={styles.footerSocialsItem}
onClick={() => window.electron.openExternal(item.url)}
>
{item.icon}
</button>
);
})}
</span>
</footer>
</aside>
);
}
9 changes: 5 additions & 4 deletions src/renderer/declaration.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type {
CatalogueCategory,
CatalogueEntry,
GameShop,
Game,
CatalogueCategory,
TorrentProgress,
GameShop,
HowLongToBeatCategory,
ShopDetails,
TorrentProgress,
UserPreferences,
HowLongToBeatCategory,
} from "@types";
import type { DiskSpace } from "check-disk-space";

Expand Down Expand Up @@ -78,6 +78,7 @@ declare global {

/* Misc */
getOrCacheImage: (url: string) => Promise<string>;
openExternal: (src: string) => Promise<void>;
getVersion: () => Promise<string>;
ping: () => string;
getDefaultDownloadsPath: () => Promise<string>;
Expand Down
Empty file.
Loading

0 comments on commit 84155ad

Please sign in to comment.