mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-25 06:49:51 +01:00
Improved ram selection + improved UX + added CI (may not work)
This commit is contained in:
parent
6b2d233887
commit
66be046adc
27
.github/workflows/electron.yml
vendored
Normal file
27
.github/workflows/electron.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
name: CI
|
||||||
|
on: [ push ]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Use Node.js 14
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 14.x
|
||||||
|
- name: Get npm cache directory
|
||||||
|
id: npm-cache
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=dir::$(npm config get cache)"
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ steps.npm-cache.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
- name: Intall dependencies
|
||||||
|
run: npm ci
|
||||||
|
- run: npm run make --if-present
|
@ -1,8 +1,14 @@
|
|||||||
|
var os = require('os');
|
||||||
let launchBtn = document.querySelector('#launch-btn');
|
let launchBtn = document.querySelector('#launch-btn');
|
||||||
let fullProgressBar = document.querySelector('#fullprogressbar')
|
let fullProgressBar = document.querySelector('#fullprogressbar')
|
||||||
let progressBar = document.querySelector('#progressbar')
|
let progressBar = document.querySelector('#progressbar')
|
||||||
let loadingMessage = document.querySelector('#loading-message')
|
let loadingMessage = document.querySelector('#loading-message')
|
||||||
let disconnectBtn = document.querySelector('#disconnect-btn')
|
let disconnectBtn = document.querySelector('#disconnect-btn')
|
||||||
|
let minMem = document.querySelector('#minMem')
|
||||||
|
let maxMem = document.querySelector('#maxMem')
|
||||||
|
let outputMinMem = document.querySelector('#outputMinMem')
|
||||||
|
let outputMaxMem = document.querySelector('#outputMaxMem')
|
||||||
|
let totalMem = os.totalmem() / (1.049 * Math.pow(10, 6))
|
||||||
|
|
||||||
ipcRenderer.on("nick", (event, args) => {
|
ipcRenderer.on("nick", (event, args) => {
|
||||||
console.log(args)
|
console.log(args)
|
||||||
@ -13,15 +19,23 @@ launchBtn.addEventListener("click", e => {
|
|||||||
launchBtn.classList.add('hidden');
|
launchBtn.classList.add('hidden');
|
||||||
fullProgressBar.classList.remove('hidden');
|
fullProgressBar.classList.remove('hidden');
|
||||||
loadingMessage.classList.remove('hidden');
|
loadingMessage.classList.remove('hidden');
|
||||||
|
if(Number(minMem.value) <= Number(maxMem.value)){
|
||||||
ipcRenderer.send('launch', {
|
ipcRenderer.send('launch', {
|
||||||
minMem: document.querySelector('#minMem').value,
|
minMem: minMem.value + "M",
|
||||||
maxMem: document.querySelector('#maxMem').value
|
maxMem: maxMem.value + "M"
|
||||||
})
|
})
|
||||||
launchBtn.disabled = true
|
launchBtn.disabled = true
|
||||||
if(document.querySelector('#minMem').value.trim() && document.querySelector('#maxMem').value.trim()){
|
if(minMem.value && maxMem.value){
|
||||||
localStorage.setItem("minMem", document.querySelector('#minMem').value.trim())
|
localStorage.setItem("minMem", minMem.value)
|
||||||
localStorage.setItem("maxMem", document.querySelector('#maxMem').value.trim())
|
localStorage.setItem("maxMem", maxMem.value)
|
||||||
}
|
}
|
||||||
|
} else{
|
||||||
|
ipcRenderer.send('notification', {
|
||||||
|
title: "Erreur de lancement",
|
||||||
|
body: "La mémoire minimale doit être inférieure ou égale à la mémoire maximale"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcRenderer.on("progress", (e, args) => {
|
ipcRenderer.on("progress", (e, args) => {
|
||||||
@ -43,6 +57,19 @@ disconnectBtn.addEventListener('click', e => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
document.querySelector('#minMem').value = localStorage.getItem("minMem") != null ? localStorage.getItem("minMem") : "2G"
|
minMem.value = localStorage.getItem("minMem") != null ? Number(localStorage.getItem("minMem")) : 1024
|
||||||
document.querySelector('#maxMem').value = localStorage.getItem("maxMem") != null ? localStorage.getItem("maxMem") : "4G"
|
minMem.max = totalMem
|
||||||
|
outputMinMem.innerHTML = minMem.value
|
||||||
|
maxMem.value = localStorage.getItem("maxMem") != null ? Number(localStorage.getItem("maxMem")) : 2048
|
||||||
|
maxMem.max = totalMem
|
||||||
|
outputMaxMem.innerHTML = maxMem.value
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
minMem.addEventListener("input", (e) => {
|
||||||
|
outputMinMem.innerHTML = e.target.value
|
||||||
|
})
|
||||||
|
|
||||||
|
maxMem.addEventListener("input", (e) => {
|
||||||
|
outputMaxMem.innerHTML = e.target.value
|
||||||
})
|
})
|
@ -26,10 +26,10 @@
|
|||||||
<h3>Modifier la configuration</h3>
|
<h3>Modifier la configuration</h3>
|
||||||
<hr>
|
<hr>
|
||||||
<h4>Allocation mémoire</h4>
|
<h4>Allocation mémoire</h4>
|
||||||
<label for="minMem">mémoire minimale</label>
|
<label for="minMem">mémoire minimale : <div id="outputMinMem"></div></label>
|
||||||
<input type="text" id="minMem" value="2G">
|
<input type="range" min="1024" max="2048" step="128" value="1" class="slider" id="minMem">
|
||||||
<label for="minMem">mémoire maximale</label>
|
<label for="minMem">mémoire maximale : <div id="outputMaxMem"></div></label>
|
||||||
<input type="text" id="maxMem" value="4G">
|
<input type="range" min="1024" max="2048" step="128" value="1" class="slider" id="maxMem">
|
||||||
</div>
|
</div>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<img id="main-img" src="include/maxresdefault.jpg">
|
<img id="main-img" src="include/maxresdefault.jpg">
|
||||||
|
Loading…
Reference in New Issue
Block a user