2.2.0-beta3

- added a notification when the game has been installed
- removed windows compilation because we will never use it
- added background picture parsing using the game's API

Thanks Maroxy for all these enhancements
+ issue #1
+ pull request #2
This commit is contained in:
Observer KRypt0n_ 2021-10-17 13:28:37 +02:00
parent d19f29eec1
commit 812e0c5f18
No known key found for this signature in database
GPG key ID: DC5D4EC1303465DA
9 changed files with 39 additions and 66 deletions

View file

@ -6,14 +6,14 @@
# Status
### Launcher is in the beta state; patch is currently stable.
| Game version | Launcher version | Patch version |
| :---: | :---: | :---: |
| 2.2.0 | 2.2.0-beta2 | 2.2.0-stable |
| 2.2.0 | 2.2.0-beta3 ⚠️ | 2.2.0-stable ✅ |
Download from [Releases](https://notabug.org/nobody/an-anime-game-launcher/releases)
> ⚠️ Launcher is currently in development
# Requirements
To work this launcher requires
@ -28,7 +28,7 @@ To work this launcher requires
## Build from source
```sh
npm run build:linux
npm run build
```
## Run from source
@ -42,13 +42,12 @@ npm start
To 2.2.0-release1
* <s>Fix AppImage builds</s>
* Parse background banners from the game's API ([#1](https://notabug.org/nobody/an-anime-game-launcher/issues/1))
* <s>Parse background banners from the game's API ([issue #1](https://notabug.org/nobody/an-anime-game-launcher/issues/1), [pull request #2](https://notabug.org/nobody/an-anime-game-launcher/pulls/2))</s>
* Make Proton-GE default compatibility tool and fix game input issues
* Add additional telemetry checking
* Add preferences menu
* Add launcher updates notifications
I've found a reason why do AppImages don't work, and I don't want to say it, but I have to rewrite half a project lmao
* Cache launcher background picture
<br>

View file

@ -6,6 +6,13 @@ let mainWindow;
ipcMain.handle('hide-window', () => mainWindow.hide());
ipcMain.handle('show-window', () => mainWindow.show());
ipcMain.on('notification', (event, args) => {
new Notification({
title: args.title,
body: args.content
}).show();
});
function createWindow ()
{
// https://www.electronjs.org/docs/latest/api/browser-window/#class-browserwindow
@ -13,8 +20,6 @@ function createWindow ()
width: 1280,
height: 728,
webPreferences: {
// Is not safety
// Use it to have access to the node modules inside html files
nodeIntegration: true,
contextIsolation: false
},
@ -51,7 +56,3 @@ app.on('window-all-closed', () => {
if (process.platform !== 'darwin')
app.quit();
});
ipcMain.on('notification', (event, args) => {
new Notification({ title: args.title, body: args.content }).show();
});

View file

@ -1,6 +1,6 @@
{
"name": "an-anime-game-linux-launcher",
"version": "2.2.0-beta2",
"version": "2.2.0-beta3",
"description": "An Anime Game Linux Launcher",
"author": "Nikita Podvirnyy",
"license": "GPL-3.0",
@ -8,8 +8,7 @@
"scripts": {
"dev": "tsc && sass src/sass:public/css -s compressed --no-source-map",
"start": "npm run dev && electron .",
"build:win": "npm run dev && electron-builder --win",
"build:linux": "npm run dev && electron-builder --linux"
"build": "npm run dev && electron-builder --linux"
},
"build": {
"productName": "An Anime Game Linux Launcher",
@ -22,25 +21,6 @@
"public/**/*",
"entry.js"
],
"win": {
"icon": "public/images/icon512.png",
"target": [
{
"target": "nsis",
"arch": [
"x64",
"ia32"
]
},
{
"target": "portable",
"arch": [
"x64",
"ia32"
]
}
]
},
"linux": {
"icon": "public/images/icon512.png",
"category": "Utility",
@ -53,13 +33,6 @@
]
}
]
},
"nsis": {
"oneClick": false,
"perMachine": true,
"artifactName": "${productName}-${os}-${version}-setup.${ext}",
"deleteAppDataOnUninstall": true,
"allowToChangeInstallationDirectory": true
}
},
"devDependencies": {

File diff suppressed because one or more lines are too long

View file

@ -7,7 +7,6 @@
<!-- CSS styles -->
<link rel="stylesheet" href="../css/index.css">
<link rel="stylesheet" href="../css/layout.min.css">
<link rel="stylesheet" href="../css/hint.min.css">
<!-- JS scripts -->
@ -29,9 +28,7 @@
</div>
</div>
<div id="launchcontent">
</div>
<div id="launchcontent"></div>
<button class="button" id="launch">Launch</button>
</body>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

View file

@ -86,9 +86,11 @@ export class Genshinlib
public static async getBackgroundUri (): Promise<string>
{
let bg = '';
await fetch(`https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/content?filter_adv=true&launcher_id=10&language=${ this.lang.launcher }`)
.then((res) => res.json())
.then((resdone) => { bg = resdone.data.adv.background });
await fetch(`https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/content?filter_adv=true&launcher_id=10&language=${this.lang.launcher}`)
.then(res => res.json())
.then(resdone => bg = resdone.data.adv.background);
return bg;
}

View file

@ -15,24 +15,22 @@ $(() => {
if (Genshinlib.version !== null)
document.title = 'Genshin Impact Linux Launcher - ' + Genshinlib.version;
Genshinlib.getBackgroundUri().then( uri => $('body').css('background-image', `url(${ uri })`) );
Genshinlib.getBackgroundUri().then(uri => $('body').css('background-image', `url(${ uri })`));
fetch(`https://genshin.mihoyo.com/launcher/10/${ Genshinlib.getConfig().lang.launcher }?api_url=https%3A%2F%2Fapi-os-takumi.mihoyo.com%2Fhk4e_global&prev=false`)
.then((res) => res.text())
.then((body) => {
// Get the element which should have the launchers content.
let container = document.getElementById('launchcontent');
// Don't really think we need this, but maybe in future~~
// Parse the HTML and append the HTML from the site to the div.
let parser = new DOMParser();
let converted = parser.parseFromString(body, 'text/html');
container!.appendChild(converted.getElementById('__layout')!);
/*fetch(`https://genshin.mihoyo.com/launcher/10/${ Genshinlib.getConfig().lang.launcher }?api_url=https%3A%2F%2Fapi-os-takumi.mihoyo.com%2Fhk4e_global&prev=false`)
.then(res => res.text())
.then(body => {
$(body).appendTo('#launchcontent');
// Get the home container to remove the functions that don't work currently.
let home = container!.getElementsByClassName('home__main')[0];
home.removeChild(home.getElementsByClassName('home-swiper-wrap')[0]);
home.removeChild(home.getElementsByClassName('home-news')[0]);
});
// $('.home__main').detach('.home-swiper-wrap')
// Get the home container to remove the functions that don't work currently.
// let home = container!.getElementsByClassName('home__main')[0];
// home.removeChild(home.getElementsByClassName('home-swiper-wrap')[0]);
// home.removeChild(home.getElementsByClassName('home-news')[0]);
});*/
Genshinlib.getData().then(data => {
// Update available
@ -237,7 +235,11 @@ $(() => {
Genshinlib.applyPatch(() => {
LauncherUI.setState('game-launch-available');
ipcRenderer.send('notification', { title: document.title, content: 'Finished downloading game.' });
ipcRenderer.send('notification', {
title: document.title,
content: 'Game was succesfully installed'
});
}, (data) => console.log(data.toString()));
}