Mise a jours

This commit is contained in:
FullGreenDev 2020-12-01 21:31:32 +01:00
parent fc056b4c32
commit 660a972d45
3 changed files with 36 additions and 36 deletions

View File

@ -5,13 +5,13 @@
* modules, excluding dependencies.
*/
// Requirements
const $ = require('jquery')
const {ipcRenderer, remote, shell, webFrame} = require('electron')
const isDev = require('./assets/js/isdev')
const LoggerUtil = require('./assets/js/loggerutil')
const $ = require('jquery')
const { ipcRenderer, remote, shell, webFrame } = require('electron')
const isDev = require('./assets/js/isdev')
const LoggerUtil = require('./assets/js/loggerutil')
const loggerUICore = LoggerUtil('%c[UICore]', 'color: #000668; font-weight: bold')
const loggerAutoUpdater = LoggerUtil('%c[AutoUpdater]', 'color: #000668; font-weight: bold')
const loggerUICore = LoggerUtil('%c[UICore]', 'color: #000668; font-weight: bold')
const loggerAutoUpdater = LoggerUtil('%c[AutoUpdater]', 'color: #000668; font-weight: bold')
const loggerAutoUpdaterSuccess = LoggerUtil('%c[AutoUpdater]', 'color: #209b07; font-weight: bold')
// Log deprecation and process warnings.
@ -20,15 +20,15 @@ process.traceDeprecation = true
// Disable eval function.
// eslint-disable-next-line
window.eval = global.eval = function () {
window.eval = global.eval = function() {
throw new Error('Sorry, this app does not support window.eval().')
}
// Display warning when devtools window is opened.
remote.getCurrentWebContents().on('devtools-opened', () => {
console.log('%cThe console is dark and full of terrors.', 'color: white; -webkit-text-stroke: 4px #a02d2a; font-size: 60px; font-weight: bold')
console.log('%cIf you\'ve been told to paste something here, you\'re being scammed.', 'font-size: 16px')
console.log('%cUnless you know exactly what you\'re doing, close this window.', 'font-size: 16px')
console.log('%cLa console est sombre et pleine de terreurs.', 'color: white; -webkit-text-stroke: 4px #a02d2a; font-size: 60px; font-weight: bold')
console.log('%cSi on vous a dit de coller quelque chose ici, vous êtes victime d\'une arnaque.', 'font-size: 16px')
console.log('%cSauf si vous savez exactement ce que vous faites, fermez cette fenêtre.', 'font-size: 16px')
})
// Disable zoom, needed for darwin.
@ -37,27 +37,27 @@ webFrame.setVisualZoomLevelLimits(1, 1)
// Initialize auto updates in production environments.
let updateCheckListener
if(!isDev){
if (!isDev) {
ipcRenderer.on('autoUpdateNotification', (event, arg, info) => {
switch(arg){
switch (arg) {
case 'checking-for-update':
loggerAutoUpdater.log('Checking for update..')
settingsUpdateButtonStatus('Checking for Updates..', true)
loggerAutoUpdater.log('Vérification de la mise à jour..')
settingsUpdateButtonStatus('Vérification des mises à jour..', true)
break
case 'update-available':
loggerAutoUpdaterSuccess.log('New update available', info.version)
if(process.platform === 'darwin'){
loggerAutoUpdaterSuccess.log('Nouvelle mise à jour disponible', info.version)
if (process.platform === 'darwin') {
info.darwindownload = `https://github.com/dscalzi/HeliosLauncher/releases/download/v${info.version}/helioslauncher-setup-${info.version}.dmg`
showUpdateUI(info)
}
populateSettingsUpdateInformation(info)
break
case 'update-downloaded':
loggerAutoUpdaterSuccess.log('Update ' + info.version + ' ready to be installed.')
settingsUpdateButtonStatus('Install Now', false, () => {
if(!isDev){
loggerAutoUpdaterSuccess.log('Mise à jour ' + info.version + ' prêt à être installé.')
settingsUpdateButtonStatus('Installer maintenant', false, () => {
if (!isDev) {
ipcRenderer.send('autoUpdateAction', 'installUpdateNow')
}
})
@ -74,10 +74,10 @@ if(!isDev){
ipcRenderer.send('autoUpdateAction', 'checkForUpdate')
break
case 'realerror':
if(info != null && info.code != null){
if(info.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){
if (info != null && info.code != null) {
if (info.code === 'ERR_UPDATER_INVALID_RELEASE_FEED') {
loggerAutoUpdater.log('No suitable releases found.')
} else if(info.code === 'ERR_XML_MISSED_ELEMENT'){
} else if (info.code === 'ERR_XML_MISSED_ELEMENT') {
loggerAutoUpdater.log('No releases found.')
} else {
loggerAutoUpdater.error('Error during update check..', info)
@ -100,11 +100,11 @@ if(!isDev){
*
* @param {boolean} val The new allow prerelease value.
*/
function changeAllowPrerelease(val){
function changeAllowPrerelease(val) {
ipcRenderer.send('autoUpdateAction', 'allowPrereleaseChange', val)
}
function showUpdateUI(info){
function showUpdateUI(info) {
//TODO Make this message a bit more informative `${info.version}`
document.getElementById('image_seal_container').setAttribute('update', true)
document.getElementById('image_seal_container').onclick = () => {
@ -132,8 +132,8 @@ $(function(){
loggerUICore.log('UICore Initialized');
})*/
document.addEventListener('readystatechange', function () {
if (document.readyState === 'interactive'){
document.addEventListener('readystatechange', function() {
if (document.readyState === 'interactive') {
loggerUICore.log('UICore Initializing..')
// Bind close button.
@ -148,7 +148,7 @@ document.addEventListener('readystatechange', function () {
Array.from(document.getElementsByClassName('fRb')).map((val) => {
val.addEventListener('click', e => {
const window = remote.getCurrentWindow()
if(window.isMaximized()){
if (window.isMaximized()) {
window.unmaximize()
} else {
window.maximize()
@ -173,7 +173,7 @@ document.addEventListener('readystatechange', function () {
})
})
} else if(document.readyState === 'complete'){
} else if (document.readyState === 'complete') {
//266.01
//170.8
@ -187,7 +187,7 @@ document.addEventListener('readystatechange', function () {
document.getElementById('launch_progress').style.width = 170.8
document.getElementById('launch_details_right').style.maxWidth = 170.8
document.getElementById('launch_progress_label').style.width = 53.21
}
}, false)
@ -205,8 +205,8 @@ $(document).on('click', 'a[href^="http"]', function(event) {
* This will crash the program if you are using multiple
* DevTools, for example the chrome debugger in VS Code.
*/
document.addEventListener('keydown', function (e) {
if((e.key === 'I' || e.key === 'i') && e.ctrlKey && e.shiftKey){
document.addEventListener('keydown', function(e) {
if ((e.key === 'I' || e.key === 'i') && e.ctrlKey && e.shiftKey) {
let window = remote.getCurrentWindow()
window.toggleDevTools()
}

View File

@ -21,7 +21,7 @@ builder.build({
appId: 'skygameslauncher',
productName: 'SkyGames Launcher',
artifactName: '${productName}-setup-${version}.${ext}',
copyright: 'Copyright © 2018-2020 Daniel Scalzi',
copyright: 'Copyright © 2019-2020 SkyGames',
directories: {
buildResources: 'build',
output: 'dist'

View File

@ -1,6 +1,6 @@
{
"name": "skygameslauncher",
"version": "1.1.2",
"version": "1.1.4",
"productName": "SkyGames Launcher",
"description": "SkyGames Launcher",
"author": "FullGreen (https://github.com/dscalzi/)",
@ -49,4 +49,4 @@
"type": "git",
"url": "git+https://github.com/FullGreenDev/SkyGamesLauncher.git"
}
}
}