Add version

This commit is contained in:
0d0acre 2024-09-21 01:44:24 +02:00
parent 1db8e3c51a
commit 447317ac0c
2 changed files with 29 additions and 1 deletions

View file

@ -17,6 +17,20 @@
></script>
<link rel="stylesheet" href="/css/map.css" />
<style>
#version {
position: absolute;
font-family: monospace;
bottom: 0;
left: 0;
padding: 10px;
z-index: 9999;
background: white;
border-top-right-radius: 15px;
}
</style>
<!-- importa control.locate senza cdn -->
<link rel="stylesheet" href="./js/dist/L.Control.Locate.css" />
<title>RuscoMap</title>
@ -89,6 +103,9 @@
</div>
</div>
<div id="version">
</div>
<script>
function closePopup() {
const popup = document.getElementById("popup");
@ -97,7 +114,13 @@
// Popup si chiude automaticamente dopo 13 secondi
setTimeout(closePopup, 13000);
window.addEventListener('load', () => {
window.addEventListener('load', async () => {
const response = await fetch(`/version`);
const {version} = await response.json()
const domVersion = document.querySelector('#version');
domVersion.innerHTML = `v${version}`;
/*
// Add a click event listener to the button
const gpsButton = document.getElementById("gps-button");

View file

@ -44,6 +44,11 @@ const configureRoutes = (app) => {
res.status(200).json(rows);
});
});
app.get("/version", (req, res) => {
const {version} = require('./package.json');
res.json({version})
});
};
const configureExpress = () => {