mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-23 06:29:51 +01:00
commit
9f495967e3
10
package.json
10
package.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "altarik-launcher",
|
"name": "altarik-launcher",
|
||||||
"author": "Altarik",
|
"author": "Altarik",
|
||||||
"version": "2.1.8",
|
"version": "2.2.0",
|
||||||
"description": "Altarik Launcher",
|
"description": "Altarik Launcher",
|
||||||
"main": "src/server/main.js",
|
"main": "src/server/main.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@ -35,17 +35,17 @@
|
|||||||
"@electron-forge/maker-zip": "^7.4.0",
|
"@electron-forge/maker-zip": "^7.4.0",
|
||||||
"@electron-forge/plugin-auto-unpack-natives": "^7.4.0",
|
"@electron-forge/plugin-auto-unpack-natives": "^7.4.0",
|
||||||
"@electron-forge/publisher-github": "^7.4.0",
|
"@electron-forge/publisher-github": "^7.4.0",
|
||||||
"electron": "31.1.0",
|
"electron": "32.0.1",
|
||||||
"eslint": "^9.6.0",
|
"eslint": "^9.9.1",
|
||||||
"eslint-config-standard": "^17.1.0",
|
"eslint-config-standard": "^17.1.0",
|
||||||
"eslint-plugin-import": "^2.29.1",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-n": "^17.9.0",
|
"eslint-plugin-n": "^17.9.0",
|
||||||
"eslint-plugin-promise": "^6.2.0"
|
"eslint-plugin-promise": "^6.6.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"decompress": "^4.2.1",
|
"decompress": "^4.2.1",
|
||||||
"electron-is-dev": "^3.0.1",
|
"electron-is-dev": "^3.0.1",
|
||||||
"electron-log": "^5.1.5",
|
"electron-log": "^5.1.7",
|
||||||
"electron-squirrel-startup": "^1.0.1",
|
"electron-squirrel-startup": "^1.0.1",
|
||||||
"extract-zip": "^2.0.1",
|
"extract-zip": "^2.0.1",
|
||||||
"hasha": "^6.0.0",
|
"hasha": "^6.0.0",
|
||||||
|
@ -37,7 +37,7 @@ app = vue.createApp({
|
|||||||
position: 'topRight',
|
position: 'topRight',
|
||||||
resetOnHover: true
|
resetOnHover: true
|
||||||
})
|
})
|
||||||
setInterval(() => {
|
setTimeout(() => {
|
||||||
ipcRenderer.send('pageReady')
|
ipcRenderer.send('pageReady')
|
||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
@ -98,11 +98,20 @@ app = vue.createApp({
|
|||||||
this.displayCredits = 'block'
|
this.displayCredits = 'block'
|
||||||
},
|
},
|
||||||
updateModsInformations (content) {
|
updateModsInformations (content) {
|
||||||
|
if(content === null) {
|
||||||
|
this.modsInformations = []
|
||||||
|
} else {
|
||||||
this.modsInformations = content
|
this.modsInformations = content
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getModsInformations () {
|
getModsInformations () {
|
||||||
return this.modsInformations
|
return this.modsInformations
|
||||||
},
|
},
|
||||||
|
reloadChapters() {
|
||||||
|
this.updateModsInformations(null)
|
||||||
|
this.modsInformationsLoaded = true
|
||||||
|
ipcRenderer.send('pageReady')
|
||||||
|
},
|
||||||
showInfo (title, body) {
|
showInfo (title, body) {
|
||||||
iziToast.info({
|
iziToast.info({
|
||||||
title,
|
title,
|
||||||
|
@ -71,7 +71,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p>
|
|||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<h2>Chapitres</h2>
|
<h2>Chapitres <i v-if="modsInformations.length !== 0 || modsInformationsLoaded === false" v-on:click="reloadChapters()" class="reload-chapter material-icons">sync</i></h2>
|
||||||
<div id="sidebar-content" @change="modsInformations">
|
<div id="sidebar-content" @change="modsInformations">
|
||||||
<div v-if="modsInformationsLoaded === false">Une erreur est survenue lors de la récupération des informations, vérifiez votre connexion internet puis cliquez sur réessayez</div>
|
<div v-if="modsInformationsLoaded === false">Une erreur est survenue lors de la récupération des informations, vérifiez votre connexion internet puis cliquez sur réessayez</div>
|
||||||
<div v-for="(item, index) in modsInformations" v-else-if="modsInformations.length !== 0" v-on:click="changeSelectedChapter(index)" :class="{ selected: isSelected(index) }">
|
<div v-for="(item, index) in modsInformations" v-else-if="modsInformations.length !== 0" v-on:click="changeSelectedChapter(index)" :class="{ selected: isSelected(index) }">
|
||||||
|
@ -20,7 +20,7 @@ export default class Minecraft {
|
|||||||
auth = null
|
auth = null
|
||||||
modsList = undefined
|
modsList = undefined
|
||||||
showNotification = undefined
|
showNotification = undefined
|
||||||
modsInformationsEndpoint = 'https://launcher.altarik.fr'
|
modsInformationsEndpoint = 'https://launcher.altarik.fr/launcher.json'
|
||||||
|
|
||||||
setShowNotification (showNotification) {
|
setShowNotification (showNotification) {
|
||||||
this.showNotification = showNotification
|
this.showNotification = showNotification
|
||||||
@ -145,39 +145,23 @@ export default class Minecraft {
|
|||||||
fs.writeFileSync(file, JSON.stringify(data))
|
fs.writeFileSync(file, JSON.stringify(data))
|
||||||
event.sender.send('modsInformations', this.extractModsInformations(data))
|
event.sender.send('modsInformations', this.extractModsInformations(data))
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
event.sender.send('modsInformations', this.extractModsFromFileSystem())
|
event.sender.send('modsInformations', null)
|
||||||
logger.warn(err)
|
logger.warn(err)
|
||||||
logger.warn('An error occured while trying to connect to server')
|
logger.warn('An error occured while trying to connect to server')
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
logger.warn('Unable to connect to server')
|
logger.warn('Unable to connect to server')
|
||||||
logger.warn(response.status)
|
logger.warn(response.status)
|
||||||
event.sender.send('modsInformations', this.extractModsFromFileSystem())
|
logger.warn(this.modsInformationsEndpoint)
|
||||||
|
event.sender.send('modsInformations', null)
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
logger.warn('Unable to connect to server')
|
logger.warn('Unable to connect to server')
|
||||||
logger.warn(err)
|
logger.warn(err)
|
||||||
event.sender.send('modsInformations', this.extractModsFromFileSystem())
|
event.sender.send('modsInformations', null)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
extractModsFromFileSystem () {
|
|
||||||
const filepath = join(this.localappdata, 'altarik-launcher/data/launcher.json')
|
|
||||||
if (fs.existsSync(filepath)) {
|
|
||||||
const content = fs.readFileSync(filepath)
|
|
||||||
if (content !== null) {
|
|
||||||
this.showNotification('Impossible de récupérer certaines informations en ligne', 'utilisation des dernières données récupérées', 'warning')
|
|
||||||
return this.extractModsInformations(JSON.parse(content))
|
|
||||||
} else {
|
|
||||||
this.showNotification('Impossible de récupérer certaines informations en ligne', 'Veuillez réessayez en cliquant sur le bouton', 'warning')
|
|
||||||
logger.error('Unable to get chapters informations from server or filesystem')
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extractModsInformations (json) {
|
extractModsInformations (json) {
|
||||||
this.modsList = json.chapters
|
this.modsList = json.chapters
|
||||||
return this.modsList
|
return this.modsList
|
||||||
|
Loading…
Reference in New Issue
Block a user