Add current time and last Gitea update to index.html
This commit is contained in:
36
index.html
36
index.html
@@ -50,6 +50,11 @@
|
||||
border-left: 5px solid #FFC107;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.footer-info {
|
||||
margin-top: 30px;
|
||||
font-size: 0.8em;
|
||||
color: #aaa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -75,6 +80,37 @@
|
||||
</ul>
|
||||
<p>For detailed usage instructions and to understand how to deploy these overlays, please refer to the <a href="https://gitea.ramforth.net/ramforth/Overlays/src/branch/main/azuracast/README.md">Azuracast README.md</a> within the Gitea repository.</p>
|
||||
|
||||
<div class="footer-info">
|
||||
<p>Current Time: <span id="current-time"></span></p>
|
||||
<p>Last Gitea Update: <span id="last-gitea-update"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Update current time
|
||||
function updateCurrentTime() {
|
||||
const now = new Date();
|
||||
document.getElementById('current-time').textContent = now.toLocaleString();
|
||||
}
|
||||
setInterval(updateCurrentTime, 1000);
|
||||
updateCurrentTime();
|
||||
|
||||
// Fetch last Gitea update
|
||||
const giteaApiUrl = 'https://gitea.ramforth.net/api/v1/repos/ramforth/Overlays/commits?limit=1';
|
||||
fetch(giteaApiUrl)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data && data.length > 0) {
|
||||
const lastCommitDate = new Date(data[0].commit.committer.date);
|
||||
document.getElementById('last-gitea-update').textContent = lastCommitDate.toLocaleString();
|
||||
} else {
|
||||
document.getElementById('last-gitea-update').textContent = 'N/A';
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching Gitea commit info:', error);
|
||||
document.getElementById('last-gitea-update').textContent = 'Error fetching data';
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user