diff --git a/manifest.json b/manifest.json index 0ebb50d..51786c6 100644 --- a/manifest.json +++ b/manifest.json @@ -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" } \ No newline at end of file diff --git a/resources/index.html b/resources/index.html index 38f96d5..7885456 100644 --- a/resources/index.html +++ b/resources/index.html @@ -50,9 +50,9 @@
Update - +
- + Checking for updates...
diff --git a/resources/js/index.js b/resources/js/index.js index 1b26a64..681d12f 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -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 */