Add version number to UI

This commit is contained in:
Juanjo Diaz
2019-07-19 14:21:40 +03:00
committed by Lauri Kasanen
parent 4fd1f19f3b
commit 71fa476514
3 changed files with 26 additions and 0 deletions

View File

@@ -82,6 +82,17 @@ const UI = {
// Translate the DOM
l10n.translateDOM();
WebUtil.fetchJSON('../package.json')
.then((packageInfo) => {
Array.from(document.getElementsByClassName('noVNC_version')).forEach(el => el.innerText = packageInfo.version);
})
.catch(err => {
Log.Error("Couldn't fetch package.json: " + err);
Array.from(document.getElementsByClassName('noVNC_version_wrapper'))
.concat(Array.from(document.getElementsByClassName('noVNC_version_separator')))
.forEach(el => el.style.display = 'none');
});
// Adapt the interface for touch screen devices
if (isTouchDevice) {
document.documentElement.classList.add("noVNC_touch");