Skip to content

Commit

Permalink
fix/add-context-menu: format code && fix other minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
guibzo committed May 28, 2024
1 parent 1d4c641 commit 4a1967d
Show file tree
Hide file tree
Showing 41 changed files with 275 additions and 456 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ out
*.log*
.env
.vite

1 change: 1 addition & 0 deletions README.be.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
[![ru](https://img.shields.io/badge/lang-ru-yellow.svg)](README.ru.md)
[![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)
[![es](https://img.shields.io/badge/lang-es-red)](README.es.md)

![Hydra Catalogue](./docs/screenshot.png)

Expand Down
2 changes: 1 addition & 1 deletion README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[![pt-BR](https://img.shields.io/badge/lang-pt--BR-green.svg)](README.pt-BR.md)
[![ru](https://img.shields.io/badge/lang-ru-yellow.svg)](README.ru.md)
[![uk-UA](https://img.shields.io/badge/lang-uk--UA-blue)](README.uk-UA.md)
[![es](https://img.shields.io/badge/lang-es-red)](README.es.md)
[![en](https://img.shields.io/badge/lang-en-red.svg)](README.md)

![Hydra Catalogue](./docs/screenshot.png)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
[![pt-BR](https://img.shields.io/badge/lang-pt--BR-green.svg)](README.pt-BR.md)
[![ru](https://img.shields.io/badge/lang-ru-yellow.svg)](README.ru.md)
[![uk-UA](https://img.shields.io/badge/lang-uk--UA-blue)](README.uk-UA.md)
[![es](https://img.shields.io/badge/lang-es-red)](README.es.md)

![Hydra Catalogue](./docs/screenshot.png)

Expand Down
1 change: 1 addition & 0 deletions README.pl.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
[![pt-BR](https://img.shields.io/badge/lang-pt--BR-green.svg)](README.pt-BR.md)
[![ru](https://img.shields.io/badge/lang-ru-yellow.svg)](README.ru.md)
[![uk-UA](https://img.shields.io/badge/lang-uk--UA-blue)](README.uk-UA.md)
[![es](https://img.shields.io/badge/lang-es-red)](README.es.md)

![Hydra Catalogue](./docs/screenshot.png)

Expand Down
2 changes: 2 additions & 0 deletions README.pt-BR.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
[![pl](https://img.shields.io/badge/lang-pl-white)](README.pl.md)
[![ru](https://img.shields.io/badge/lang-ru-yellow.svg)](README.ru.md)
[![uk-UA](https://img.shields.io/badge/lang-uk--UA-blue)](README.uk-UA.md)
[![es](https://img.shields.io/badge/lang-es-red)](README.es.md)

![Hydra Catalogue](./docs/screenshot.png)

</div>
Expand Down
1 change: 1 addition & 0 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
[![pl](https://img.shields.io/badge/lang-pl-white)](README.pl.md)
[![pt-BR](https://img.shields.io/badge/lang-pt--BR-green.svg)](README.pt-BR.md)
[![uk-UA](https://img.shields.io/badge/lang-uk--UA-blue)](README.uk-UA.md)
[![es](https://img.shields.io/badge/lang-es-red)](README.es.md)

![Hydra Catalogue](./docs/screenshot.png)

Expand Down
1 change: 1 addition & 0 deletions README.uk-UA.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
[![pl](https://img.shields.io/badge/lang-pl-white)](README.pl.md)
[![pt-BR](https://img.shields.io/badge/lang-pt--BR-green.svg)](README.pt-BR.md)
[![ru](https://img.shields.io/badge/lang-ru-yellow.svg)](README.ru.md)
[![es](https://img.shields.io/badge/lang-es-red)](README.es.md)

![Hydra Catalogue](./docs/screenshot.png)

Expand Down
Binary file added build/icons/512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ linux:
- AppImage
- snap
- deb
- rpm
maintainer: electronjs.org
category: Utility
category: Game
mimeTypes:
- x-scheme-handler/hydralauncher
appImage:
artifactName: ${name}-${version}.${ext}
npmRebuild: false
Expand Down
Binary file modified hydra.db
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hydralauncher",
"version": "1.2.3",
"version": "1.2.4",
"description": "Hydra",
"main": "./out/main/index.js",
"author": "Los Broxas",
Expand Down Expand Up @@ -50,6 +50,7 @@
"color.js": "^1.2.0",
"date-fns": "^3.6.0",
"easydl": "^1.1.1",
"electron-log": "^5.1.4",
"electron-updater": "^6.1.8",
"fetch-cookie": "^3.0.1",
"flexsearch": "^0.7.43",
Expand All @@ -67,7 +68,6 @@
"react-router-dom": "^6.22.3",
"typeorm": "^0.3.20",
"user-agents": "^1.1.193",
"winston": "^3.13.0",
"yaml": "^2.4.1"
},
"devDependencies": {
Expand Down
9 changes: 2 additions & 7 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"catalogue": "Catalogue",
"downloads": "Downloads",
"search_results": "Search results",
"settings": "Settings"
"settings": "Settings",
"version_available": "Version {{version}} available. Click here to restart and install."
},
"bottom_panel": {
"no_downloads_in_progress": "No downloads in progress",
Expand Down Expand Up @@ -181,11 +182,5 @@
},
"modal": {
"close": "Close button"
},
"splash": {
"downloading_version": "Downloading version {{version}}",
"searching_updates": "Searching for updates",
"update_found": "Update {{version}} found",
"restarting_and_applying": "Restarting and applying update"
}
}
11 changes: 3 additions & 8 deletions src/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"catalogue": "Catálogo",
"downloads": "Descargas",
"search_results": "Resultados de búsqueda",
"settings": "Ajustes"
"settings": "Ajustes",
"version_available": "Version {{version}} disponible. Haga clic aquí para reiniciar e instalar."
},
"bottom_panel": {
"no_downloads_in_progress": "Sin descargas en progreso",
Expand All @@ -57,7 +58,7 @@
"remove": "Eliminar",
"remove_from_list": "Quitar",
"space_left_on_disk": "{{space}} restantes en el disco",
"eta": "Finalizando en {{eta}}",
"eta": "Tiempo restante: {{eta}}",
"downloading_metadata": "Descargando metadatos…",
"checking_files": "Analizando archivos…",
"filter": "Buscar repacks",
Expand Down Expand Up @@ -181,11 +182,5 @@
},
"modal": {
"close": "Botón de cierre"
},
"splash": {
"downloading_version": "Descargando versión {{version}}",
"searching_updates": "Buscando actualizaciones",
"update_found": "Actualización {{version}} encontrada",
"restarting_and_applying": "Reiniciando y aplicando actualización"
}
}
26 changes: 20 additions & 6 deletions src/locales/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"minutes": "minuti",
"amount_hours": "{{amount}} ore",
"amount_minutes": "{{amount}} minuti",
"accuracy": "{{accuratezza}}% di accuratezza",
"accuracy": "{{accuracy}}% di accuratezza",
"add_to_library": "Aggiungi alla libreria",
"remove_from_library": "Rimuovi dalla libreria",
"no_downloads": "Nessun download disponibile",
Expand All @@ -89,7 +89,6 @@
"playing_now": "Stai giocando adesso",
"change": "Aggiorna",
"repacks_modal_description": "Scegli il repack che vuoi scaricare",
"downloads_path": "Percorso dei download",
"select_folder_hint": "Per cambiare la cartella predefinita, accedi alle",
"download_now": "Scarica ora",
"installation_instructions": "Istruzioni di installazione",
Expand All @@ -100,7 +99,14 @@
"copy_to_clipboard": "Copia",
"copied_to_clipboard": "Copiato",
"got_it": "Capito",
"game_executable": "Eseguibile del gioco"
"game_executable": "Eseguibile del gioco",
"no_shop_details": "Impossibile recuperare i dettagli del negozio.",
"download_options": "Opzioni di download",
"download_path": "Percorso di download",
"previous_screenshot": "Screenshot precedente",
"next_screenshot": "Screenshot successivo",
"screenshot": "Screenshot {{number}}",
"open_screenshot": "Apri screenshot {{number}}"
},
"activation": {
"title": "Attiva Hydra",
Expand Down Expand Up @@ -131,8 +137,7 @@
"remove_from_list": "Rimuovi",
"delete_modal_title": "Sei sicuro?",
"delete_modal_description": "Questo rimuoverà tutti i file di installazione dal tuo computer",
"install": "Installa",
"delete_installation_modal_description": "Ciò rimuoverà la cartella in cui è stato scaricato il gioco. Se hai installato il gioco nella stessa posizione in cui lo hai scaricato, verrà eliminato."
"install": "Installa"
},
"settings": {
"downloads_path": "Percorso dei download",
Expand All @@ -141,7 +146,16 @@
"enable_download_notifications": "Quando un download è completo",
"enable_repack_list_notifications": "Quando viene aggiunto un nuovo repack",
"telemetry": "Telemetria",
"telemetry_description": "Abilita statistiche di utilizzo anonime"
"telemetry_description": "Abilita statistiche di utilizzo anonime",
"real_debrid_api_token_label": "Token API Real Debrid",
"quit_app_instead_hiding": "Esci da Hydra invece di nascondere nell'area di notifica",
"launch_with_system": "Apri Hydra all'avvio",
"general": "Generale",
"behavior": "Comportamento",
"enable_real_debrid": "Abilita Real Debrid",
"real_debrid": "Real Debrid",
"real_debrid_api_token_hint": "Puoi trovare la tua chiave API <0>here</0>.",
"save_changes": "Salva modifiche"
},
"notifications": {
"download_complete": "Download completato",
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 @@ -32,7 +32,8 @@
"downloads": "Downloads",
"search_results": "Resultados da busca",
"settings": "Configurações",
"home": "Início"
"home": "Início",
"version_available": "Versão {{version}} disponível. Clique aqui para reiniciar e instalar."
},
"bottom_panel": {
"no_downloads_in_progress": "Sem downloads em andamento",
Expand Down
2 changes: 2 additions & 0 deletions src/main/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export const databasePath = path.join(
"hydra.db"
);

export const logsPath = path.join(app.getPath("appData"), "hydra", "logs");

export const seedsPath = app.isPackaged
? path.join(process.resourcesPath, "seeds")
: path.join(__dirname, "..", "..", "seeds");
2 changes: 1 addition & 1 deletion src/main/entity/game.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class Game {
@Column("int", { default: 0 })
bytesDownloaded: number;

@Column("text", { nullable: true })
@Column("datetime", { nullable: true })
lastTimePlayed: Date | null;

@Column("float", { default: 0 })
Expand Down
22 changes: 4 additions & 18 deletions src/main/events/autoupdater/check-for-updates.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,27 @@
import { AppUpdaterEvents } from "@types";
import { registerEvent } from "../register-event";
import updater, { ProgressInfo, UpdateInfo } from "electron-updater";
import updater, { UpdateInfo } from "electron-updater";
import { WindowManager } from "@main/services";
import { app } from "electron";

const { autoUpdater } = updater;

const sendEvent = (event: AppUpdaterEvents) => {
WindowManager.splashWindow?.webContents.send("autoUpdaterEvent", event);
WindowManager.mainWindow?.webContents.send("autoUpdaterEvent", event);
};

const mockValuesForDebug = async () => {
sendEvent({ type: "update-downloaded" });
sendEvent({ type: "update-available", info: { version: "1.3.0" } });
// sendEvent({ type: "update-downloaded" });
};

const checkForUpdates = async (_event: Electron.IpcMainInvokeEvent) => {
autoUpdater
.addListener("error", () => {
sendEvent({ type: "error" });
})
.addListener("checking-for-update", () => {
sendEvent({ type: "checking-for-updates" });
})
.addListener("update-not-available", () => {
sendEvent({ type: "update-not-available" });
})
.addListener("update-available", (info: UpdateInfo) => {
sendEvent({ type: "update-available", info });
})
.addListener("update-downloaded", () => {
sendEvent({ type: "update-downloaded" });
})
.addListener("download-progress", (info: ProgressInfo) => {
sendEvent({ type: "download-progress", info });
})
.addListener("update-cancelled", () => {
sendEvent({ type: "update-cancelled" });
});

if (app.isPackaged) {
Expand Down
12 changes: 0 additions & 12 deletions src/main/events/autoupdater/continue-to-main-window.ts

This file was deleted.

5 changes: 1 addition & 4 deletions src/main/events/autoupdater/restart-and-install-update.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { app } from "electron";
import { registerEvent } from "../register-event";
import updater from "electron-updater";
import { WindowManager } from "@main/services";

const { autoUpdater } = updater;

const restartAndInstallUpdate = async (_event: Electron.IpcMainInvokeEvent) => {
autoUpdater.removeAllListeners();
if (app.isPackaged) {
autoUpdater.quitAndInstall(true, true);
} else {
autoUpdater.removeAllListeners();
WindowManager.prepareMainWindowAndCloseSplash();
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/main/events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { defaultDownloadsPath } from "@main/constants";
import { app, ipcMain } from "electron";

import "./autoupdater/check-for-updates";
import "./autoupdater/continue-to-main-window";
import "./autoupdater/restart-and-install-update";
import "./catalogue/get-catalogue";
import "./catalogue/get-game-shop-details";
Expand Down Expand Up @@ -30,6 +29,8 @@ import "./torrenting/pause-game-download";
import "./torrenting/resume-game-download";
import "./torrenting/start-game-download";

import "./autoupdater/check-for-updates";
import "./autoupdater/restart-and-install-update";
import "./user-preferences/auto-launch";
import "./user-preferences/get-user-preferences";
import "./user-preferences/update-user-preferences";
Expand Down
2 changes: 1 addition & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ app.whenReady().then(() => {
where: { id: 1 },
});

WindowManager.createSplashScreen();
WindowManager.createMainWindow();
WindowManager.createSystemTray(userPreferences?.language || "en");
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Game } from "@main/entity";
import { MigrationInterface, QueryRunner } from "typeorm";

export class AlterLastTimePlayedToDatime1716776027208
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
// 2024-05-27 02:08:17
// Mon, 27 May 2024 02:08:17 GMT
const updateLastTimePlayedValues = `
UPDATE game SET lastTimePlayed = (SELECT
SUBSTR(lastTimePlayed, 13, 4) || '-' || -- Year
CASE SUBSTR(lastTimePlayed, 9, 3)
WHEN 'Jan' THEN '01'
WHEN 'Feb' THEN '02'
WHEN 'Mar' THEN '03'
WHEN 'Apr' THEN '04'
WHEN 'May' THEN '05'
WHEN 'Jun' THEN '06'
WHEN 'Jul' THEN '07'
WHEN 'Aug' THEN '08'
WHEN 'Sep' THEN '09'
WHEN 'Oct' THEN '10'
WHEN 'Nov' THEN '11'
WHEN 'Dec' THEN '12'
END || '-' || -- Month
SUBSTR(lastTimePlayed, 6, 2) || ' ' || -- Day
SUBSTR(lastTimePlayed, 18, 8) -- hh:mm:ss;
FROM game)
WHERE lastTimePlayed IS NOT NULL;
`;

await queryRunner.query(updateLastTimePlayedValues);
}

public async down(queryRunner: QueryRunner): Promise<void> {
const queryBuilder = queryRunner.manager.createQueryBuilder(Game, "game");

const result = await queryBuilder.getMany();

for (const game of result) {
if (!game.lastTimePlayed) continue;
await queryRunner.query(
`UPDATE game set lastTimePlayed = ? WHERE id = ?;`,
[game.lastTimePlayed.toUTCString(), game.id]
);
}
}
}
Loading

0 comments on commit 4a1967d

Please sign in to comment.