Skip to content

Commit 03da5c4

Browse files
authored
Update main.js to automatically fetch the latest version name with github api
1 parent 530805f commit 03da5c4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

assets/js/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
document.addEventListener('DOMContentLoaded', function () {
1+
document.addEventListener('DOMContentLoaded', async function () {
22

33
// rather than looking for it all the time, you could just create an enum and change this once than updating every line
44
const github = {
55
repo: 'https://github.com/lapce/lapce',
6-
version: 'v0.2.7',
6+
version: (await (await fetch("https://api.github.com/repos/lapce/lapce/releases/latest")).json()).name,
77
windows: 'Lapce-windows.msi',
88
linux: 'Lapce-linux.tar.gz',
99
macos: 'Lapce-macos.dmg'
@@ -83,4 +83,4 @@ document.addEventListener('DOMContentLoaded', function () {
8383
download.setAttribute("href", `${github.repo}/releases/download/${github.version}/${github.linux}`)
8484
break;
8585
}
86-
});
86+
});

0 commit comments

Comments
 (0)