diff --git a/src/client/assets/js/index.js b/src/client/assets/js/index.js
index 5922650..8e07644 100644
--- a/src/client/assets/js/index.js
+++ b/src/client/assets/js/index.js
@@ -12,6 +12,8 @@ const outputMinMem = document.querySelector('#outputMinMem')
const outputMaxMem = document.querySelector('#outputMaxMem')
const totalMem = os.totalmem() / (1.049 * Math.pow(10, 6))
const sidebar = document.querySelector("#sidebar-content")
+const invalidateButton = document.querySelector("#invalidateData")
+let gameLaunching = false
let selectedChapter = -1;
@@ -43,6 +45,7 @@ launchBtn.addEventListener("click", e => {
launchBtn.disabled = true
localStorage.setItem("minMem", minMem.value)
localStorage.setItem("maxMem", maxMem.value)
+ gameLaunching = true
} else{
ipcRenderer.send('notification', {
title: "Erreur de lancement",
@@ -57,7 +60,8 @@ document.querySelector("#web").addEventListener("click", e => {
})
document.querySelector("#options").addEventListener("click", e => {
- fullscreen.style.display = "block"
+ if(!gameLaunching)
+ fullscreen.style.display = "block"
})
document.querySelector("#discord").addEventListener("click", e => {
@@ -68,6 +72,17 @@ document.querySelector("#close").addEventListener("click", e => {
fullscreen.style.display = "none"
});
+invalidateButton.addEventListener("click", e => {
+ invalidateButton.disabled = true
+ invalidateButton.childNodes[0].nodeValue = "Opération en cours"
+ ipcRenderer.send('invalidateData')
+})
+
+ipcRenderer.on("invalidated", e => {
+ invalidateButton.disabled = false
+ invalidateButton.childNodes[0].nodeValue = "Supprimer et retélécharger les bibliothèques"
+})
+
ipcRenderer.on("progress", (e, args) => {
progressBar.style.width = (args.task / Math.max(args.total, args.task)) * 100 + "%"
loadingMessage.innerHTML = "Téléchargement de " + args.type + ": " + args.task + " sur " + Math.max(args.total, args.task)
@@ -80,6 +95,7 @@ ipcRenderer.on("close", (e, args) => {
loadingMessage.innerHTML = "Chargement de Minecraft en cours..."
progressBar.style.width = "0"
launchBtn.disabled = false
+ gameLaunching = false
})
ipcRenderer.on('launch', (e, args) => {
diff --git a/src/client/assets/js/login.js b/src/client/assets/js/login.js
index 3214a52..e62d4bc 100644
--- a/src/client/assets/js/login.js
+++ b/src/client/assets/js/login.js
@@ -1,9 +1,12 @@
-user = document.querySelector('#nickname')
-password = document.querySelector('#password')
+const form = document.querySelector('#login-form')
+const user = document.querySelector('#nickname')
+const password = document.querySelector('#password')
-document.querySelector('#login-form').addEventListener("submit", (e) => {
+
+form.addEventListener("submit", (e) => {
e.preventDefault()
- if(user.value){
+ form.disabled = true
+ if(user.value) {
ipcRenderer.send("login", {
user: user.value,
pass: password.value
@@ -16,3 +19,7 @@ document.querySelector('#login-form').addEventListener("submit", (e) => {
}
})
+
+ipcRenderer.on("loginError", event => {
+ form.disabled = false
+})
\ No newline at end of file
diff --git a/src/client/index.html b/src/client/index.html
index edd206d..5abed92 100644
--- a/src/client/index.html
+++ b/src/client/index.html
@@ -28,6 +28,8 @@
+