DockOfOurOwn/index.html

64 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title id="streamName">{{name}}</title>
<meta name="author" content="Your Name">
<meta name="description" content="{{description}}">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="">
<link rel="icon" type="image/x-icon" href=""/>
</head>
<body>
<header>
</header>
<main>
<h2 id="streamTitle">{{streamTitle}}</h2>
<p>Stream online? <span id="streamOnline">{{online}}</span></p>
<hr>
<p>Current Viewers: <span id="currentViewers">{{viewerCount}}</span></p>
<p>Session Max Viewers: <span id="sessionMaxViewerCount">{{sessionMaxViewerCount}}</span></p>
<p>Overall Max Viewers: <span id="overallMaxViewerCount">{{overallMaxViewerCount}}</span></p>
<hr>
<p>Current tags: <span id="tags"></span></p>
</main>
<footer>
</footer>
</body>
<script>
async function getEndpoint(url = '') {
const response = await fetch(url, {method:'GET'});
const data = await response.json();
return data;
}
async function uiUpdate() {
window.setInterval(async () => {
data = await getEndpoint('http://127.0.0.1:5000/api/serverstatus');
document.getElementById("streamTitle").innerHTML = data.streamTitle
document.getElementById("currentViewers").innerHTML = data.viewerCount
document.getElementById("sessionMaxViewerCount").innerHTML = data.sessionMaxViewerCount
document.getElementById("overallMaxViewerCount").innerHTML = data.overallMaxViewerCount
document.getElementById("tags").innerHTML = data.tags
}, 1000)
}
async function updateStreamTitle() {
response = await fetch('http://127.0.0.1:5000/api/update/streamtitle',
{
method:'POST',
data:JSON.stringify('a big test')
}
);
const data = await response.json()
return data
}
// uiUpdate()
updateStreamTitle()
</script>
</html>