zedshaw.games/pages/live/index.html
2025-09-17 11:49:19 -04:00

62 lines
2 KiB
HTML

<script src="https://player.twitch.tv/js/embed/v1.js"></script>
<div class="flex-col w-full"
x-init="Stream = await GetJson('/api/stream/1')" x-data="{Stream: {}}">
<div id="twitch-player" class="aspect-video">
</div>
<h2>Links Found in Chat</h2>
<grid class="two-panel">
<div>
<table class="w-full" x-init="links = await GetJson('/api/stream/1/links')" x-data="{links: {}}">
<tr class="table-header"><th>URL</th><th>Description</th></tr>
<template x-for="item in links">
<tr class="table-row">
<td class="p-2"><a x-text="item.url" x-bind:href="item.url" target="_blank"></a></td>
<td class="p-2" x-text="item.description"></td>
</tr>
</template>
</table>
</div>
<div class="flex flex-col"
x-data="{auth: false}"
x-init="auth = await GetJson('/api/authcheck')">
<template x-if="auth.is_authed">
<form action="/api/link" method="POST">
<card class="card">
<top>Submit a Link</top>
<middle>
<input id="stream_id" name="stream_id" type="hidden" value="1">
<input id="url" name="url" type="text" placeholder="Link Url">
<input id="description" name="description" type="text" placeholder="Description">
</middle>
<bottom>
<button id="submit" type="submit">Send It</button>
</bottom>
</card>
</form>
</template>
<template x-if="!auth.is_authed">
<aside>
<p><mark>Post Links</mark> You can post links after you <a href="/login/">Login</a>. If you want an account simply <a href="/register/">Register</a>.</p>
</aside>
</template>
</div>
</grid>
</div>
<script>
var options = {
width: "100%",
height: "100%",
autoplay: false,
muted: true,
channel: "zedashaw"
};
var player = new Twitch.Player("twitch-player", options);
player.setVolume(0.5);
</script>