diff --git a/webapp/src/components/SystemInfoView.vue b/webapp/src/components/SystemInfoView.vue index f1ac54a..0e73c57 100644 --- a/webapp/src/components/SystemInfoView.vue +++ b/webapp/src/components/SystemInfoView.vue @@ -51,6 +51,9 @@ export default defineComponent({ resetreason_1: "", cfgsavecount: 0, uptime: 0, + update_text: "", + update_url: "", + update_status: "", // MemoryInfo heap_total: 0, heap_used: 0, @@ -72,8 +75,35 @@ export default defineComponent({ .then((data) => { this.systemDataList = data; this.dataLoading = false; + this.getUpdateInfo(); }) }, + getUpdateInfo() { + const fetchUrl = "https://api.github.com/repos/tbnobody/OpenDTU/compare/" + + this.systemDataList.git_hash?.substring(1) + "...HEAD"; + + fetch(fetchUrl) + .then((response) => { + if (response.ok) { + return response.json() + } + throw new Error('Error fetching version information'); + }) + .then((data) => { + if (data.total_commits > 0) { + this.systemDataList.update_text = "New version available! Show changes!" + this.systemDataList.update_status = "text-bg-danger"; + this.systemDataList.update_url = data.html_url; + } else { + this.systemDataList.update_text = "Up to date!" + this.systemDataList.update_status = "text-bg-success"; + } + }) + .catch((error: Error) => { + this.systemDataList.update_text = error.message; + this.systemDataList.update_status = "text-bg-secondary"; + }); + } }, }); diff --git a/webapp/src/components/partials/FirmwareInfo.vue b/webapp/src/components/partials/FirmwareInfo.vue index c8847b4..8667041 100644 --- a/webapp/src/components/partials/FirmwareInfo.vue +++ b/webapp/src/components/partials/FirmwareInfo.vue @@ -21,7 +21,13 @@