Skip to content

Commit

Permalink
Merge pull request #25 from Lazap-Development/nightly
Browse files Browse the repository at this point in the history
Bug Fixes
  • Loading branch information
p0ryae authored Feb 4, 2022
2 parents 5cdb6cb + 27e3e29 commit 1833e9b
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 15 deletions.
Binary file added img/EAappInstaller.exe
Binary file not shown.
23 changes: 16 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable indent */
require('v8-compile-cache');
const electron = require('electron');
const { ipcMain, Tray } = require('electron');
const { ipcMain, Tray, Menu } = require('electron');
const app = electron.app;
const fs = require('fs');
const axios = require('axios').default;
Expand All @@ -21,6 +21,8 @@ rpcClient.login({ clientId: '932504287337148417' });

handleHardwareAcceleration();

let tray = null;

app.on('ready', () => {
const mainWindow = new electron.BrowserWindow({
width: 1150,
Expand Down Expand Up @@ -103,15 +105,22 @@ app.on('ready', () => {
});
ipcMain.on('min-tray', () => {
if (JSON.parse(fs.readFileSync('./storage/Settings/LauncherData.json').toString())?.trayMinLaunch === true) {
const tray = new Tray('icon.ico');
tray = new Tray(__dirname + '/icon.ico');
tray.setToolTip('Lazap');

const contextMenu = Menu.buildFromTemplate([
{ label: 'Show', type: 'normal', click: () => {
mainWindow.show()
tray.destroy()
} },
{ label: 'Exit', type: 'normal', click: () => mainWindow.close() }
])
tray.setContextMenu(contextMenu)

tray.on('click', () => {
if (mainWindow.isVisible()) {
mainWindow.hide();
}
else {
if (!mainWindow.isVisible()) {
mainWindow.show();
tray.destroy();
}
});

Expand Down Expand Up @@ -164,7 +173,7 @@ ipcMain.on('updateSetting', (e, key, bool) => {
break;
}
case 'launchOnStartup': {
ipcMain.emit('rpcUpdate', bool);
ipcMain.emit('setLaunchOnStartup', bool);
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lazap",
"version": "0.1.0",
"version": "0.1.1-nightly",
"description": "A cross platform launcher - All your games at one library",
"main": "./index.js",
"scripts": {
Expand All @@ -24,7 +24,7 @@
"!src/js/launchers/LinuxGames.js",
"!src/js/launchers/RockstarGames.js"
],
"productName": "Lazap",
"productName": "Lazap Beta",
"forceCodeSigning": false,
"nsis": {
"license": "./LICENSE.md",
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h1>
</div>

<foot>
v0.1
v0.1.1
</foot>
</div>
</div>
Expand Down
16 changes: 13 additions & 3 deletions src/js/launchers/find-games.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async function loadAllGames() {
if (fs.existsSync(Constants.GAME_BANNERS_BASE_PATH)) {
const dirs = fs.readdirSync(Constants.GAME_BANNERS_BASE_PATH);
const img = dirs.find(x => x === `${md5(game.DisplayName)}.png`);
banner = img ? `../storage/Cache/Games/Images/${img}` : '../icon.ico';
banner = img ? `${APP_BASE_PATH}/storage/Cache/Games/Images/${img}` : '../icon.ico';
}
else {
banner = '../icon.ico';
Expand Down Expand Up @@ -103,18 +103,28 @@ async function loadAllGames() {

gameBanner.addEventListener('mouseover', () => {
const x = gameElement.getElementsByClassName('star');
const isFavourite = JSON.parse(fs.readFileSync(APP_BASE_PATH + '/storage/Cache/Games/Data.json').toString()).Games.find(y => y.GameID === game.GameID && y.LauncherName === game.LauncherName && y.Favourite);
for (let i = 0; i < x.length; i++) {
starIcon.classList.add('fade');
x[i].style.visibility = 'visible';
if (isFavourite) {
starIcon.style.content = 'url("../img/star-solid.svg")';
starIcon.style.filter = 'invert(77%) sepia(68%) saturate(616%) hue-rotate(358deg) brightness(100%) contrast(104%)';
}
}
});

gameBanner.addEventListener('mouseout', () => {
const x = gameElement.getElementsByClassName('star');
const isFavourite = JSON.parse(fs.readFileSync(APP_BASE_PATH + '/storage/Cache/Games/Data.json').toString()).Games.find(y => y.GameID === game.GameID && y.LauncherName === game.LauncherName && y.Favourite);
for (let i = 0; i < x.length; i++) {
if (!x[i].matches(':hover')) {
starIcon.classList.remove('fade');
x[i].style.visibility = 'hidden';
if (!isFavourite) {
starIcon.style.content = 'url("../img/star-empty.svg")';
starIcon.style.filter = 'invert(100%) sepia(0%) saturate(1489%) hue-rotate(35deg) brightness(116%) contrast(100%)';
}
}
}
});
Expand Down Expand Up @@ -164,7 +174,7 @@ function loadFavouriteGames() {
if (fs.existsSync(Constants.GAME_BANNERS_BASE_PATH)) {
const dirs = fs.readdirSync(Constants.GAME_BANNERS_BASE_PATH);
const img = dirs.find(x => x === `${md5(game.DisplayName)}.png`);
banner = img ? `../storage/Cache/Games/Images/${img}` : '../icon.ico';
banner = img ? `${APP_BASE_PATH}/storage/Cache/Games/Images/${img}` : '../icon.ico';
}
else {
banner = '../icon.ico';
Expand Down Expand Up @@ -227,7 +237,7 @@ function loadRecentGames() {
if (fs.existsSync(Constants.GAME_BANNERS_BASE_PATH)) {
const dirs = fs.readdirSync(Constants.GAME_BANNERS_BASE_PATH);
const img = dirs.find(x => x === `${md5(game.DisplayName)}.png`);
banner = img ? `../storage/Cache/Games/Images/${img}` : '../icon.ico';
banner = img ? `${APP_BASE_PATH}/storage/Cache/Games/Images/${img}` : '../icon.ico';
}
else {
banner = '../icon.ico';
Expand Down

0 comments on commit 1833e9b

Please sign in to comment.