From 03da5c42f2f0f8779548060c612e0ee0971069c2 Mon Sep 17 00:00:00 2001 From: Kelbaz <81097895+kelbazz@users.noreply.github.com> Date: Sat, 1 Apr 2023 15:06:44 +0200 Subject: [PATCH] Update main.js to automatically fetch the latest version name with github api --- assets/js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/main.js b/assets/js/main.js index b111b06..0f76711 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -1,9 +1,9 @@ -document.addEventListener('DOMContentLoaded', function () { +document.addEventListener('DOMContentLoaded', async function () { // rather than looking for it all the time, you could just create an enum and change this once than updating every line const github = { repo: 'https://github.com/lapce/lapce', - version: 'v0.2.7', + version: (await (await fetch("https://api.github.com/repos/lapce/lapce/releases/latest")).json()).name, windows: 'Lapce-windows.msi', linux: 'Lapce-linux.tar.gz', macos: 'Lapce-macos.dmg' @@ -83,4 +83,4 @@ document.addEventListener('DOMContentLoaded', function () { download.setAttribute("href", `${github.repo}/releases/download/${github.version}/${github.linux}`) break; } -}); \ No newline at end of file +});