Files
reactShop/public/index.html

40 lines
1.5 KiB
HTML

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Growheads - Dein Anlaufpunkt für alles rund um den Grow in Dresden. Substrate, Dünger, Steckling & Seeds, Lampen, Lüfter, Filter, Growboxen">
<base href="/">
<title>GrowHeads.de</title>
<link rel="icon" type="image/x-icon" href="/favicon.ico">
</head>
<body style="overflow-y: scroll;">
<div id="root"></div>
<script>
// Get git commit from meta tag
window.gitCommit = document.querySelector('meta[name="git-commit"]')?.content || 'unknown';
console.log('Git commit:', window.gitCommit);
function checkForUpdates() {
fetch('/?nocache=' + new Date().getTime())
.then(response => response.text())
.then(html => {
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const metaCommit = doc.querySelector('meta[name="git-commit"]')?.content;
if (metaCommit && metaCommit !== window.gitCommit) {
console.log('New version available (from HTML meta), refreshing...');
window.location.reload();
}
})
.catch(error => console.error('Update check via HTML failed:', error));
}
// Check for updates every 5 minutes
//setInterval(checkForUpdates, 30 * 1000);
// Also check once shortly after page load
setTimeout(checkForUpdates, 1000 * 1000);
</script>
</body>
</html>