Merge branch 'term' of Maroxy/an-ordinary-launcher into main

This commit is contained in:
nobody 2021-10-24 10:11:01 +00:00 committed by Gogs
commit eb1ea84af9
9 changed files with 82 additions and 163 deletions

View file

@ -9,7 +9,8 @@ const {
const path = require('path'); const path = require('path');
const { Genshinlib } = require('./public/js/Genshinlib'); const Store = require('electron-store');
Store.initRenderer();
let mainWindow; let mainWindow;
@ -70,8 +71,6 @@ function createWindow ()
// mainWindow.webContents.openDevTools(); // mainWindow.webContents.openDevTools();
} }
// Set language on start
app.commandLine.appendSwitch('lang', Genshinlib.lang.launcher ?? 'en-us');
// This method will be called when Electron has finished // This method will be called when Electron has finished
// initialization and is ready to create browser windows. // initialization and is ready to create browser windows.
@ -89,8 +88,6 @@ app.whenReady().then(() => {
// This has to be here otherwise webContents is invalid // This has to be here otherwise webContents is invalid
ipcMain.on('change-lang', (event, args) => { ipcMain.on('change-lang', (event, args) => {
app.commandLine.appendSwitch('lang', Genshinlib.lang.launcher);
mainWindow.webContents.send('change-lang', { 'lang': args.lang }); mainWindow.webContents.send('change-lang', { 'lang': args.lang });
}); });

View file

@ -46,6 +46,7 @@
"dependencies": { "dependencies": {
"cash-dom": "^8.1.0", "cash-dom": "^8.1.0",
"discord-rpc": "^4.0.1", "discord-rpc": "^4.0.1",
"electron-store": "^8.0.1",
"follow-redirects": "^1.14.4" "follow-redirects": "^1.14.4"
} }
} }

View file

@ -126,11 +126,6 @@ body
border-radius: 12px border-radius: 12px
cursor: pointer
&:hover
background-color: #eff2ff
.checkbox-mark .checkbox-mark
display: flex display: flex
@ -151,8 +146,6 @@ body
width: 12px width: 12px
.checkbox-active .checkbox-active
background-color: #eff2ff
.checkbox-mark .checkbox-mark
background-color: #657ef8 background-color: #657ef8

View file

@ -2,9 +2,7 @@ const path = require('path');
const fs = require('fs'); const fs = require('fs');
const { exec } = require('child_process'); const { exec } = require('child_process');
const { ipcRenderer } = require('electron'); const { ipcRenderer } = require('electron');
import $ from 'cash-dom'; import $ from 'cash-dom';
import { i18n } from './lib/i18n';
import { Genshinlib } from './lib/Genshinlib'; import { Genshinlib } from './lib/Genshinlib';
import { LauncherUI } from './lib/LauncherUI'; import { LauncherUI } from './lib/LauncherUI';
@ -24,8 +22,9 @@ $(() => {
if (Genshinlib.version !== null) if (Genshinlib.version !== null)
document.title = 'Genshin Impact Linux Launcher - ' + Genshinlib.version; document.title = 'Genshin Impact Linux Launcher - ' + Genshinlib.version;
// On Start configuration of LauncherUI
LauncherUI.updateLang(Genshinlib.getConfig('lang.launcher') ?? 'en-us');
LauncherUI.setState('game-launch-available'); LauncherUI.setState('game-launch-available');
LauncherUI.updateBackground(); LauncherUI.updateBackground();
LauncherUI.updateSocial(); LauncherUI.updateSocial();
@ -53,7 +52,7 @@ $(() => {
let old; let old;
for (let i = 0; i < data.game.latest.voice_packs.length; ++i) for (let i = 0; i < data.game.latest.voice_packs.length; ++i)
if (data.game.latest.voice_packs[i].language == Genshinlib.lang.voice) if (data.game.latest.voice_packs[i].language == Genshinlib.getConfig('lang.voice'))
{ {
voicePack = data.game.latest.voice_packs[i]; voicePack = data.game.latest.voice_packs[i];
@ -80,14 +79,14 @@ $(() => {
// For some reason this keeps breaking and locking up most of the time. // For some reason this keeps breaking and locking up most of the time.
Tools.downloadFile(voicePack.path, path.join(Genshinlib.launcherDir, voicePack.name), (current: number, total: number, difference: number) => { Tools.downloadFile(voicePack.path, path.join(Genshinlib.launcherDir, voicePack.name), (current: number, total: number, difference: number) => {
LauncherUI.updateProgressBar(i18n.translate('Downloading'), current, total, difference); LauncherUI.updateProgressBar(LauncherUI.i18n.translate('Downloading'), current, total, difference);
}).then(() => { }).then(() => {
console.log(`%c> Unpacking voice data...`, 'font-size: 16px'); console.log(`%c> Unpacking voice data...`, 'font-size: 16px');
LauncherUI.initProgressBar(); LauncherUI.initProgressBar();
Tools.unzip(path.join(Genshinlib.launcherDir, voicePack.name), Genshinlib.gameDir, (current: number, total: number, difference: number) => { Tools.unzip(path.join(Genshinlib.launcherDir, voicePack.name), Genshinlib.gameDir, (current: number, total: number, difference: number) => {
LauncherUI.updateProgressBar(i18n.translate('Unpack'), current, total, difference); LauncherUI.updateProgressBar(LauncherUI.i18n.translate('Unpack'), current, total, difference);
}).then(() => { }).then(() => {
fs.unlinkSync(path.join(Genshinlib.launcherDir, voicePack.name)); fs.unlinkSync(path.join(Genshinlib.launcherDir, voicePack.name));
LauncherUI.setState('game-launch-available'); LauncherUI.setState('game-launch-available');
@ -166,7 +165,7 @@ $(() => {
} }
// Launching game // Launching game
if ($('#launch').text() == i18n.translate('Launch')) if ($('#launch').text() == LauncherUI.i18n.translate('Launch'))
{ {
console.log(`%c> Starting the game...`, 'font-size: 16px'); console.log(`%c> Starting the game...`, 'font-size: 16px');
@ -197,9 +196,7 @@ $(() => {
{ {
wineExeutable = 'wine'; wineExeutable = 'wine';
Genshinlib.updateConfig({ Genshinlib.updateConfig('runner', null);
runner: null
});
} }
} }
@ -244,7 +241,7 @@ $(() => {
} }
// Apply test patch // Apply test patch
else if ($('#launch').text() == i18n.translate('TestPatch')) else if ($('#launch').text() == LauncherUI.i18n.translate('TestPatch'))
{ {
console.log(`%c> Applying patch...`, 'font-size: 16px'); console.log(`%c> Applying patch...`, 'font-size: 16px');
@ -284,7 +281,7 @@ $(() => {
LauncherUI.initProgressBar(); LauncherUI.initProgressBar();
Tools.downloadFile(diff.path, path.join(Genshinlib.launcherDir, diff.name), (current: number, total: number, difference: number) => { Tools.downloadFile(diff.path, path.join(Genshinlib.launcherDir, diff.name), (current: number, total: number, difference: number) => {
LauncherUI.updateProgressBar(i18n.translate('Downloading'), current, total, difference); LauncherUI.updateProgressBar(LauncherUI.i18n.translate('Downloading'), current, total, difference);
}).then(() => { }).then(() => {
/** /**
* Unpacking downloaded game * Unpacking downloaded game
@ -298,7 +295,7 @@ $(() => {
LauncherUI.initProgressBar(); LauncherUI.initProgressBar();
Tools.unzip(path.join(Genshinlib.launcherDir, diff.name), Genshinlib.gameDir, (current: number, total: number, difference: number) => { Tools.unzip(path.join(Genshinlib.launcherDir, diff.name), Genshinlib.gameDir, (current: number, total: number, difference: number) => {
LauncherUI.updateProgressBar(i18n.translate('Unpack'), current, total, difference); LauncherUI.updateProgressBar(LauncherUI.i18n.translate('Unpack'), current, total, difference);
}).then(() => { }).then(() => {
/** /**
* Downloading voice data * Downloading voice data
@ -311,7 +308,7 @@ $(() => {
let voicePack = diff.voice_packs[1]; // en-us let voicePack = diff.voice_packs[1]; // en-us
for (let i = 0; i < diff.voice_packs.length; ++i) for (let i = 0; i < diff.voice_packs.length; ++i)
if (diff.voice_packs[i].language == Genshinlib.lang.voice) if (diff.voice_packs[i].language == Genshinlib.getConfig('lang.voice'))
{ {
voicePack = diff.voice_packs[i]; voicePack = diff.voice_packs[i];
@ -321,7 +318,7 @@ $(() => {
LauncherUI.initProgressBar(); LauncherUI.initProgressBar();
Tools.downloadFile(voicePack.path, path.join(Genshinlib.launcherDir, voicePack.name), (current: number, total: number, difference: number) => { Tools.downloadFile(voicePack.path, path.join(Genshinlib.launcherDir, voicePack.name), (current: number, total: number, difference: number) => {
LauncherUI.updateProgressBar(i18n.translate('Downloading'), current, total, difference); LauncherUI.updateProgressBar(LauncherUI.i18n.translate('Downloading'), current, total, difference);
}).then(() => { }).then(() => {
/** /**
* Unpacking downloaded game * Unpacking downloaded game
@ -332,13 +329,11 @@ $(() => {
LauncherUI.initProgressBar(); LauncherUI.initProgressBar();
Tools.unzip(path.join(Genshinlib.launcherDir, voicePack.name), Genshinlib.gameDir, (current: number, total: number, difference: number) => { Tools.unzip(path.join(Genshinlib.launcherDir, voicePack.name), Genshinlib.gameDir, (current: number, total: number, difference: number) => {
LauncherUI.updateProgressBar(i18n.translate('Unpack'), current, total, difference); LauncherUI.updateProgressBar(LauncherUI.i18n.translate('Unpack'), current, total, difference);
}).then(() => { }).then(() => {
fs.unlinkSync(path.join(Genshinlib.launcherDir, voicePack.name)); fs.unlinkSync(path.join(Genshinlib.launcherDir, voicePack.name));
Genshinlib.updateConfig({ Genshinlib.updateConfig('version', data.game.latest.version);
version: data.game.latest.version
});
// Patch available // Patch available
if (Genshinlib.getPatchInfo().version === data.game.latest.version) if (Genshinlib.getPatchInfo().version === data.game.latest.version)
@ -348,14 +343,14 @@ $(() => {
console.log(`%c> Applying patch...`, 'font-size: 16px'); console.log(`%c> Applying patch...`, 'font-size: 16px');
// patch-applying state changes only button text // patch-applying state changes only button text
$('#downloaded').text(i18n.translate('ApplyPatch')); $('#downloaded').text(LauncherUI.i18n.translate('ApplyPatch'));
Genshinlib.patchGame(data.game.latest.version, () => { Genshinlib.patchGame(data.game.latest.version, () => {
LauncherUI.setState('game-launch-available'); LauncherUI.setState('game-launch-available');
ipcRenderer.send('notification', { ipcRenderer.send('notification', {
title: document.title, title: document.title,
body: i18n.translate('GameDownloaded') body: LauncherUI.i18n.translate('GameDownloaded')
}); });
}, (data) => console.log(data.toString())); }, (data) => console.log(data.toString()));
} }

View file

@ -1,5 +1,6 @@
import GIJSON from './GIJSON'; import GIJSON from '../types/GIJSON';
import { Tools } from './Tools'; import { Tools } from './Tools';
const Store = require('electron-store');
const https = require('follow-redirects').https; const https = require('follow-redirects').https;
@ -9,6 +10,23 @@ const os = require('os');
const { spawn, exec } = require('child_process'); const { spawn, exec } = require('child_process');
const dns = require('dns'); const dns = require('dns');
const config = new Store({
defaults: {
lang: {
launcher: 'en-us',
voice: 'en-us'
},
background: {
time: null,
file: null
},
version: null,
patch: null,
runner: null,
rpc: false,
},
});
type Runner = { type Runner = {
name: string, // Runner title which will be showed in the list name: string, // Runner title which will be showed in the list
version: string, // Runner version version: string, // Runner version
@ -24,38 +42,12 @@ type DXVK = {
uri: string uri: string
}; };
type Config = {
lang: {
launcher: 'en-us' | 'ru-ru' | 'fr-fr' | 'id-id' | 'de-de' | 'es-es' | 'pt-pt' | 'th-th' | 'vi-vn' | 'ko-kr' | 'ja-jp' | 'zh-tw' | 'zh-cn',
voice: 'en-us' | 'ko-kr' | 'ja-jp' | 'zh-cn'
},
background: {
time: string|null,
file: string|null
},
version: string|null,
patch: {
version: string|null,
state: 'testing' | 'stable'
},
runner: null | {
name: string,
folder: string,
executable: string
},
dxvk: string|null,
rpc: boolean
};
export class Genshinlib export class Genshinlib
{ {
public static readonly patchDir: string = path.join(path.dirname(__dirname), '..', 'patch'); public static readonly patchDir: string = path.join(path.dirname(__dirname), '..', 'patch');
public static readonly patchJson: string = path.join(this.patchDir, 'patch.json'); public static readonly patchJson: string = path.join(this.patchDir, 'patch.json');
public static readonly patchSh = path.join(this.patchDir, 'patch.sh');
public static readonly patchAntiCrashSh = path.join(this.patchDir, 'patch_anti_logincrash.sh');
public static readonly launcherDir: string = path.join(os.homedir(), 'genshin-impact-launcher'); public static readonly launcherDir: string = path.join(os.homedir(), 'genshin-impact-launcher');
public static readonly launcherJson: string = path.join(this.launcherDir, 'launcher.json');
public static readonly tmpPatchDir: string = path.join(this.launcherDir, 'gi-on-linux'); public static readonly tmpPatchDir: string = path.join(this.launcherDir, 'gi-on-linux');
@ -70,16 +62,11 @@ export class Genshinlib
protected static readonly runnersUri: string = 'https://notabug.org/nobody/an-anime-game-launcher/raw/main/runners.json'; protected static readonly runnersUri: string = 'https://notabug.org/nobody/an-anime-game-launcher/raw/main/runners.json';
protected static readonly dxvksUri: string = 'https://notabug.org/nobody/an-anime-game-launcher/raw/main/dxvks.json'; protected static readonly dxvksUri: string = 'https://notabug.org/nobody/an-anime-game-launcher/raw/main/dxvks.json';
public static get version(): Config['version'] public static get version(): string|null
{ {
return this.getConfig('version'); return this.getConfig('version');
} }
public static get lang(): Config['lang']
{
return this.getConfig('lang');
}
public static getRunners (): Promise<[{ title: string, runners: Runner[] }]> public static getRunners (): Promise<[{ title: string, runners: Runner[] }]>
{ {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -104,51 +91,15 @@ export class Genshinlib
public static getConfig (property: string|null = null, splitProperty: boolean = true): any public static getConfig (property: string|null = null, splitProperty: boolean = true): any
{ {
if (!fs.existsSync(this.launcherJson))
fs.writeFileSync(this.launcherJson, JSON.stringify({
lang: {
launcher: 'en-us',
voice: 'en-us'
},
background: {
time: null,
file: null
},
version: null,
patch: null,
runner: null,
rpc: false
}, null, 4));
let config = JSON.parse(fs.readFileSync(this.launcherJson));
if (property === null) if (property === null)
return config; return config;
else return config.get(property)
{
if (!splitProperty)
return config[property];
property.split('.').forEach(prop => config = config[prop]);
return config;
}
} }
public static setConfig (info: Config): Genshinlib public static updateConfig (cname: string, value: string|boolean|null|number): Genshinlib
{ {
fs.writeFileSync(this.launcherJson, JSON.stringify(info, null, 4)); return config.set(cname, value);
return this;
}
public static updateConfig (config: any): Genshinlib
{
return this.setConfig({
...this.getConfig(),
...config
});
} }
public static async getData (): Promise<any> public static async getData (): Promise<any>
@ -174,17 +125,13 @@ export class Genshinlib
if (!this.getConfig('background.time') || new Date(new Date().setHours(0,0,0,0)).setDate(new Date(new Date().setHours(0,0,0,0)).getDate()).toString() >= this.getConfig('background.time')!) if (!this.getConfig('background.time') || new Date(new Date().setHours(0,0,0,0)).setDate(new Date(new Date().setHours(0,0,0,0)).getDate()).toString() >= this.getConfig('background.time')!)
{ {
await fetch(this.backgroundUri + this.lang.launcher) await fetch(this.backgroundUri + this.getConfig('lang.launcher'))
.then(res => res.json()) .then(res => res.json())
.then(async resdone => { .then(async resdone => {
let prevBackground = this.getConfig('background.file'); let prevBackground = this.getConfig('background.file');
this.updateConfig({ this.updateConfig('background.time', new Date(new Date().setHours(0,0,0,0)).setDate(new Date(new Date().setHours(0,0,0,0)).getDate() + 7).toString());
background: { this.updateConfig('background.file', resdone.data.adv.background.replace(/.*\//, ''));
time: new Date(new Date().setHours(0,0,0,0)).setDate(new Date(new Date().setHours(0,0,0,0)).getDate() + 7).toString(),
file: resdone.data.adv.background.replace(/.*\//, '')
}
});
if (fs.existsSync(path.join(this.launcherDir, this.getConfig('background.file')))) if (fs.existsSync(path.join(this.launcherDir, this.getConfig('background.file'))))
background = path.join(this.launcherDir, this.getConfig('background.file')); background = path.join(this.launcherDir, this.getConfig('background.file'));

View file

@ -13,12 +13,20 @@ type LauncherState =
export class LauncherUI export class LauncherUI
{ {
protected static _launcherState: LauncherState = 'game-launch-available'; protected static _launcherState: LauncherState = 'game-launch-available';
protected static _i18n: any;
public static get launcherState(): LauncherState public static get launcherState(): LauncherState
{ {
return this._launcherState; return this._launcherState;
} }
public static get i18n(): any
{
if (!this._i18n)
this._i18n = i18n;
return this._i18n;
}
public static setState (state: LauncherState) public static setState (state: LauncherState)
{ {
$('#downloader-panel').css('display', 'none'); $('#downloader-panel').css('display', 'none');
@ -27,40 +35,40 @@ export class LauncherUI
switch (state) switch (state)
{ {
case 'patch-unavailable': case 'patch-unavailable':
$('#launch').text(i18n.translate('PatchRequired')); $('#launch').text(this.i18n.translate('PatchRequired'));
$('#launch').attr('disabled', 'disabled'); $('#launch').attr('disabled', 'disabled');
$('#launch').addClass('hint--top') $('#launch').addClass('hint--top')
.addClass('hint--medium'); .addClass('hint--medium');
$('#launch').attr('data-hint', i18n.translate('PatchRequiredHint')); $('#launch').attr('data-hint', this.i18n.translate('PatchRequiredHint'));
break; break;
case 'test-patch-available': case 'test-patch-available':
$('#launch').text(i18n.translate('TestPatch')); $('#launch').text(this.i18n.translate('TestPatch'));
$('#launch').addClass('button-blue') $('#launch').addClass('button-blue')
.addClass('hint--top') .addClass('hint--top')
.addClass('hint--large'); .addClass('hint--large');
$('#launch').attr('data-hint', i18n.translate('TestPatchHint')); $('#launch').attr('data-hint', this.i18n.translate('TestPatchHint'));
break; break;
case 'patch-applying': case 'patch-applying':
$('#launch').text(i18n.translate('ApplyPatch')); $('#launch').text(this.i18n.translate('ApplyPatch'));
$('#launch').attr('disabled', 'disabled'); $('#launch').attr('disabled', 'disabled');
break; break;
case 'game-update-available': case 'game-update-available':
$('#launch').text(i18n.translate('Update')); $('#launch').text(this.i18n.translate('Update'));
break; break;
case 'game-installation-available': case 'game-installation-available':
$('#launch').text(i18n.translate('Install')); $('#launch').text(this.i18n.translate('Install'));
break; break;
@ -73,7 +81,7 @@ export class LauncherUI
.removeClass('hint--medium') .removeClass('hint--medium')
.removeClass('hint--large'); .removeClass('hint--large');
$('#launch').text(i18n.translate('Launch')); $('#launch').text(this.i18n.translate('Launch'));
break; break;
} }
@ -158,7 +166,7 @@ export class LauncherUI
public static updateSocial (): void public static updateSocial (): void
{ {
fetch(`https://genshin.mihoyo.com/launcher/10/${Genshinlib.lang.launcher}?api_url=https%3A%2F%2Fapi-os-takumi.mihoyo.com%2Fhk4e_global&prev=false`) 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(res => res.text())
.then(body => { .then(body => {
$('#__layout').remove(); $('#__layout').remove();
@ -172,10 +180,10 @@ export class LauncherUI
public static updateLang (lang: string|null = null): void public static updateLang (lang: string|null = null): void
{ {
if (lang !== null) if (lang !== null)
i18n.setLang(lang); this.i18n.setLang(lang);
$('*[i18id]').each((i, element) => { $('*[i18id]').each((i, element) => {
element.innerText = i18n.translate(element.getAttribute('i18id')!); element.innerText = this.i18n.translate(element.getAttribute('i18id')!);
}); });
} }
} }

View file

@ -4,15 +4,17 @@ const { ipcRenderer } = require('electron');
const { exec } = require('child_process'); const { exec } = require('child_process');
import $ from 'cash-dom'; import $ from 'cash-dom';
import { i18n } from './lib/i18n';
import { Genshinlib } from './lib/Genshinlib'; import { Genshinlib } from './lib/Genshinlib';
import { LauncherUI } from './lib/LauncherUI'; import { LauncherUI } from './lib/LauncherUI';
import { Tools } from './lib/Tools'; import { Tools } from './lib/Tools';
$(() => { $(() => {
// Make sure settings is shown in correct language.
LauncherUI.updateLang(Genshinlib.getConfig('lang.launcher') ?? 'en-us');
$('*[i18id]').each((i, element) => { $('*[i18id]').each((i, element) => {
element.innerText = i18n.translate(element.getAttribute('i18id')?.toString()!); element.innerText = LauncherUI.i18n.translate(element.getAttribute('i18id')?.toString()!);
}); });
$('.menu-item').on('click', (e) => { $('.menu-item').on('click', (e) => {
@ -29,7 +31,7 @@ $(() => {
$(`.menu-item[anchor=${anchor}]`).addClass('menu-item-active'); $(`.menu-item[anchor=${anchor}]`).addClass('menu-item-active');
}); });
$('.checkbox').on('click', (e) => { $('.checkbox-mark').on('click', (e) => {
let item = $(e.target); let item = $(e.target);
while (!item.hasClass('checkbox')) while (!item.hasClass('checkbox'))
@ -39,31 +41,24 @@ $(() => {
}); });
// Select the saved options in launcher.json on load // Select the saved options in launcher.json on load
$(`#voice-list option[value="${Genshinlib.lang.voice}"]`).prop('selected', true); $(`#voice-list option[value="${Genshinlib.getConfig('lang.voice')}"]`).prop('selected', true);
$(`#language-list option[value="${Genshinlib.lang.launcher}"]`).prop('selected', true); $(`#language-list option[value="${Genshinlib.getConfig('lang.launcher')}"]`).prop('selected', true);
if (Genshinlib.getConfig('rpc')) if (Genshinlib.getConfig('rpc'))
$('#discord-rpc').addClass('checkbox-active'); $('#discord-rpc').addClass('checkbox-active');
$('#discord-rpc').on('classChange', () => { $('#discord-rpc').on('classChange', () => {
Genshinlib.updateConfig({ Genshinlib.updateConfig('rpc', $('#discord-rpc').hasClass('checkbox-active'));
rpc: $('#discord-rpc').hasClass('checkbox-active')
});
ipcRenderer.send('rpc-toggle'); ipcRenderer.send('rpc-toggle');
}); });
$('#voice-list').on('change', (e) => { $('#voice-list').on('change', (e) => {
let activeVP = Genshinlib.lang.voice; let activeVP = Genshinlib.getConfig('voice');
if (activeVP != e.target.value) if (activeVP != e.target.value)
{ {
Genshinlib.updateConfig({ Genshinlib.updateConfig('lang.voice', e.target.value);
lang: {
launcher: Genshinlib.lang.launcher,
voice: e.target.value
}
});
ipcRenderer.send('updateVP', { 'oldvp': activeVP }); ipcRenderer.send('updateVP', { 'oldvp': activeVP });
@ -75,23 +70,12 @@ $(() => {
}); });
$('#language-list').on('change', (e) => { $('#language-list').on('change', (e) => {
let activeLang = Genshinlib.lang.launcher; let activeLang = Genshinlib.getConfig('lang.launcher');
if (activeLang != e.target.value) if (activeLang != e.target.value)
{ {
Genshinlib.updateConfig({ Genshinlib.updateConfig('lang.launcher', e.target.value);
lang: { Genshinlib.updateConfig('background.time', null);
launcher: e.target.value,
voice: Genshinlib.lang.voice
},
// This is required as the file name changes on the API but since we don't call the API before checking
// if the time is null or expired we set time to null here.
background: {
time: null,
file: Genshinlib.getConfig('background.file')
}
});
LauncherUI.updateLang(e.target.value); LauncherUI.updateLang(e.target.value);
@ -160,13 +144,9 @@ $(() => {
if (item.find('div').css('display') === 'none') if (item.find('div').css('display') === 'none')
{ {
Genshinlib.updateConfig({ Genshinlib.updateConfig('runner.name', runner.name);
runner: { Genshinlib.updateConfig('runner.folder', runner.folder);
name: runner.name, Genshinlib.updateConfig('runner.executable', runner.executable);
folder: runner.folder,
executable: runner.executable
}
});
$('#runners-list > .list-item').removeClass('list-item-active'); $('#runners-list > .list-item').removeClass('list-item-active');
item.addClass('list-item-active'); item.addClass('list-item-active');
@ -239,9 +219,7 @@ $(() => {
}); });
installer.on('close', () => { installer.on('close', () => {
Genshinlib.updateConfig({ Genshinlib.updateConfig('dxvk', dxvk.version);
dxvk: dxvk.version
});
$('#dxvk-list > .list-item').removeClass('list-item-active'); $('#dxvk-list > .list-item').removeClass('list-item-active');
item.addClass('list-item-active'); item.addClass('list-item-active');

View file

@ -9,6 +9,6 @@
"removeComments": true, "removeComments": true,
"outDir": "public/js" "outDir": "public/js"
}, },
"include": ["src/ts/*", "src/ts/lib/*"], "include": ["src/ts/*", "src/ts/lib/*", "src/ts/types/*"],
"exclude": ["node_modules", "**/*.spec.ts"] "exclude": ["node_modules", "**/*.spec.ts"]
} }