show build version in html

This commit is contained in:
2024-03-02 14:01:48 +01:00
7 changed files with 70 additions and 12 deletions

View File

@@ -33,5 +33,23 @@ export function uploadFile() {
ajax.send(file);
}
interface VersionInfo{
git_hash:string,
build_time: string
}
let file1Upload = document.getElementById("file1") as HTMLInputElement;
file1Upload.onchange = uploadFile;
let firmware_buildtime = document.getElementById("firmware_buildtime") as HTMLDivElement;
let firmware_githash = document.getElementById("firmware_githash") as HTMLDivElement;
document.addEventListener('DOMContentLoaded', function() {
fetch("/version")
.then(response => response.json())
.then(json => json as VersionInfo)
.then(versionInfo => {
firmware_buildtime.innerText = versionInfo.build_time;
firmware_githash.innerText = versionInfo.git_hash;
})
}, false);