mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-11-16 04:45:34 +00:00
update function and settings option
This commit is contained in:
parent
b555457e5b
commit
bbccfd83d4
@ -1,5 +1,5 @@
|
||||
{
|
||||
"applicationId": "js.grassclipper.app",
|
||||
"version": "0.4.6",
|
||||
"resourcesURL": "https://github.com/Grasscutters/GrassClipper/releases/latest/download/manifest.json"
|
||||
"resourcesURL": "https://github.com/Grasscutters/GrassClipper/releases/latest/download/resources.neu"
|
||||
}
|
@ -50,9 +50,9 @@
|
||||
<div class="settingsRow">
|
||||
<div class="settingSection">
|
||||
<span class="settingLabel">Update</span>
|
||||
<button class="smolBtn disabled" onclick="checkForUpdatesAndShow()" disabled>Update</button>
|
||||
<button class="smolBtn disabled" onclick="updateResources()" id="updateBtn" disabled>Update</button>
|
||||
</div>
|
||||
<span class="settingSubtitle">
|
||||
<span class="settingSubtitle" id="updateSubtitle">
|
||||
Checking for updates...
|
||||
</span>
|
||||
</div>
|
||||
|
@ -10,6 +10,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
setBackgroundImage();
|
||||
displayGenshinFolder();
|
||||
|
||||
// Set title version
|
||||
document.querySelector('#version').innerHTML = NL_APPVERSION
|
||||
|
||||
const config = await getCfg()
|
||||
const ipArr = await getFavIps()
|
||||
|
||||
@ -349,6 +352,9 @@ async function openSettings() {
|
||||
const killSwitch = document.querySelector('#killswitchOption')
|
||||
|
||||
killSwitch.checked = config.enableKillswitch
|
||||
|
||||
// Check for updates
|
||||
checkForUpdatesAndShow()
|
||||
}
|
||||
|
||||
async function closeSettings() {
|
||||
@ -385,6 +391,26 @@ async function runInstallScript() {
|
||||
closeFirstTimePopup()
|
||||
}
|
||||
|
||||
async function updateResources() {
|
||||
|
||||
}
|
||||
|
||||
async function checkForUpdatesAndShow() {
|
||||
const updateBtn = document.querySelector('#updateBtn')
|
||||
const subtitle = document.querySelector('#updateSubtitle')
|
||||
const url = 'https://github.com/Grasscutters/GrassClipper/releases/latest/download/'
|
||||
const manifest = await Neutralino.updater.checkForUpdates(url)
|
||||
|
||||
// Version mismatch? Update!
|
||||
if (manifest?.version !== NL_APPVERSION) {
|
||||
subtitle.innerHTML = "New update available!"
|
||||
updateBtn.classList.remove('disabled')
|
||||
} else {
|
||||
subtitle.innerHTML = "You are on the latest version! :)"
|
||||
updateBtn.classList.add('disabled')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the game folder by opening a folder picker
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user