Compare commits

...

2 commits

Author SHA1 Message Date
Leon Grünewald
723b305064 Add AddStreamDialog 2024-09-02 03:20:52 +02:00
Leon Grünewald
306c84c6e0 Update wrangler 2024-09-02 03:20:42 +02:00
5 changed files with 153 additions and 104 deletions

View file

@ -15,6 +15,6 @@
"@sveltejs/vite-plugin-svelte": "4.0.0-next.6",
"svelte": "5.0.0-next.242",
"vite": "^5.4.2",
"wrangler": "^3.67.1"
"wrangler": "^3.73.0"
}
}

View file

@ -21,8 +21,8 @@ importers:
specifier: ^5.4.2
version: 5.4.2(@types/node@22.0.0)
wrangler:
specifier: ^3.67.1
version: 3.67.1
specifier: ^3.73.0
version: 3.73.0
packages:
@ -34,36 +34,40 @@ packages:
resolution: {integrity: sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==}
engines: {node: '>=16.13'}
'@cloudflare/workerd-darwin-64@1.20240718.0':
resolution: {integrity: sha512-BsPZcSCgoGnufog2GIgdPuiKicYTNyO/Dp++HbpLRH+yQdX3x4aWx83M+a0suTl1xv76dO4g9aw7SIB6OSgIyQ==}
'@cloudflare/workerd-darwin-64@1.20240821.1':
resolution: {integrity: sha512-CDBpfZKrSy4YrIdqS84z67r3Tzal2pOhjCsIb63IuCnvVes59/ft1qhczBzk9EffeOE2iTCrA4YBT7Sbn7USew==}
engines: {node: '>=16'}
cpu: [x64]
os: [darwin]
'@cloudflare/workerd-darwin-arm64@1.20240718.0':
resolution: {integrity: sha512-nlr4gaOO5gcJerILJQph3+2rnas/nx/lYsuaot1ntHu4LAPBoQo1q/Pucj2cSIav4UiMzTbDmoDwPlls4Kteog==}
'@cloudflare/workerd-darwin-arm64@1.20240821.1':
resolution: {integrity: sha512-Q+9RedvNbPcEt/dKni1oN94OxbvuNAeJkgHmrLFTGF8zu21wzOhVkQeRNxcYxrMa9mfStc457NAg13OVCj2kHQ==}
engines: {node: '>=16'}
cpu: [arm64]
os: [darwin]
'@cloudflare/workerd-linux-64@1.20240718.0':
resolution: {integrity: sha512-LJ/k3y47pBcjax0ee4K+6ZRrSsqWlfU4lbU8Dn6u5tSC9yzwI4YFNXDrKWInB0vd7RT3w4Yqq1S6ZEbfRrqVUg==}
'@cloudflare/workerd-linux-64@1.20240821.1':
resolution: {integrity: sha512-j6z3KsPtawrscoLuP985LbqFrmsJL6q1mvSXOXTqXGODAHIzGBipHARdOjms3UQqovzvqB2lQaQsZtLBwCZxtA==}
engines: {node: '>=16'}
cpu: [x64]
os: [linux]
'@cloudflare/workerd-linux-arm64@1.20240718.0':
resolution: {integrity: sha512-zBEZvy88EcAMGRGfuVtS00Yl7lJdUM9sH7i651OoL+q0Plv9kphlCC0REQPwzxrEYT1qibSYtWcD9IxQGgx2/g==}
'@cloudflare/workerd-linux-arm64@1.20240821.1':
resolution: {integrity: sha512-I9bHgZOxJQW0CV5gTdilyxzTG7ILzbTirehQWgfPx9X77E/7eIbR9sboOMgyeC69W4he0SKtpx0sYZuTJu4ERw==}
engines: {node: '>=16'}
cpu: [arm64]
os: [linux]
'@cloudflare/workerd-windows-64@1.20240718.0':
resolution: {integrity: sha512-YpCRvvT47XanFum7C3SedOZKK6BfVhqmwdAAVAQFyc4gsCdegZo0JkUkdloC/jwuWlbCACOG2HTADHOqyeolzQ==}
'@cloudflare/workerd-windows-64@1.20240821.1':
resolution: {integrity: sha512-keC97QPArs6LWbPejQM7/Y8Jy8QqyaZow4/ZdsGo+QjlOLiZRDpAenfZx3CBUoWwEeFwQTl2FLO+8hV1SWFFYw==}
engines: {node: '>=16'}
cpu: [x64]
os: [win32]
'@cloudflare/workers-shared@0.4.1':
resolution: {integrity: sha512-nYh4r8JwOOjYIdH2zub++CmIKlkYFlpxI1nBHimoiHcytJXD/b7ldJ21TtfzUZMCgI78mxVlymMHA/ReaOxKlA==}
engines: {node: '>=16.7.0'}
'@cspotcode/source-map-support@0.8.1':
resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}
engines: {node: '>=12'}
@ -523,10 +527,6 @@ packages:
resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
engines: {node: '>= 8.10.0'}
consola@3.2.3:
resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==}
engines: {node: ^14.18.0 || >=16.10.0}
cookie@0.5.0:
resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==}
engines: {node: '>= 0.6'}
@ -651,8 +651,8 @@ packages:
engines: {node: '>=10.0.0'}
hasBin: true
miniflare@3.20240718.1:
resolution: {integrity: sha512-mn3MjGnpgYvarCRTfz4TQyVyY8yW0zz7f8LOAPVai78IGC/lcVcyskZcuIr7Zovb2i+IERmmsJAiEPeZHIIKbA==}
miniflare@3.20240821.0:
resolution: {integrity: sha512-4BhLGpssQxM/O6TZmJ10GkT3wBJK6emFkZ3V87/HyvQmVt8zMxEBvyw5uv6kdtp+7F54Nw6IKFJjPUL8rFVQrQ==}
engines: {node: '>=16.13'}
hasBin: true
@ -668,9 +668,6 @@ packages:
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
node-fetch-native@1.6.4:
resolution: {integrity: sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==}
node-forge@1.3.1:
resolution: {integrity: sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==}
engines: {node: '>= 6.13.0'}
@ -679,6 +676,9 @@ packages:
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
engines: {node: '>=0.10.0'}
ohash@1.1.3:
resolution: {integrity: sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==}
path-parse@1.0.7:
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
@ -777,8 +777,8 @@ packages:
resolution: {integrity: sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==}
engines: {node: '>=14.0'}
unenv-nightly@1.10.0-1717606461.a117952:
resolution: {integrity: sha512-u3TfBX02WzbHTpaEfWEKwDijDSFAHcgXkayUZ+MVDrjhLFvgAJzFGTSTmwlEhwWi2exyRQey23ah9wELMM6etg==}
unenv-nightly@2.0.0-1724863496.70db6f1:
resolution: {integrity: sha512-r+VIl1gnsI4WQxluruSQhy8alpAf1AsLRLm4sEKp3otCyTIVD6I6wHEYzeQnwsyWgaD4+3BD4A/eqrgOpdTzhw==}
vite@5.4.2:
resolution: {integrity: sha512-dDrQTRHp5C1fTFzcSaMxjk6vdpKvT+2/mIdE07Gw2ykehT49O0z/VHS3zZ8iV/Gh8BJJKHWOe5RjaNrW5xf/GA==}
@ -819,17 +819,17 @@ packages:
vite:
optional: true
workerd@1.20240718.0:
resolution: {integrity: sha512-w7lOLRy0XecQTg/ujTLWBiJJuoQvzB3CdQ6/8Wgex3QxFhV9Pbnh3UbwIuUfMw3OCCPQc4o7y+1P+mISAgp6yg==}
workerd@1.20240821.1:
resolution: {integrity: sha512-y4phjCnEG96u8ZkgkkHB+gSw0i6uMNo23rBmixylWpjxDklB+LWD8dztasvsu7xGaZbLoTxQESdEw956F7VJDA==}
engines: {node: '>=16'}
hasBin: true
wrangler@3.67.1:
resolution: {integrity: sha512-lLVJxq/OZMfntvZ79WQJNC1OKfxOCs6PLfogqDBuPFEQ3L/Mwqvd9IZ0bB8ahrwUN/K3lSdDPXynk9HfcGZxVw==}
wrangler@3.73.0:
resolution: {integrity: sha512-VrdDR2OpvsCQp+r5Of3rDP1W64cNN/LHLVx1roULOlPS8PZiv7rUYgkwhdCQ61+HICAaeSxWYIzkL5+B9+8W3g==}
engines: {node: '>=16.17.0'}
hasBin: true
peerDependencies:
'@cloudflare/workers-types': ^4.20240718.0
'@cloudflare/workers-types': ^4.20240821.1
peerDependenciesMeta:
'@cloudflare/workers-types':
optional: true
@ -869,21 +869,23 @@ snapshots:
dependencies:
mime: 3.0.0
'@cloudflare/workerd-darwin-64@1.20240718.0':
'@cloudflare/workerd-darwin-64@1.20240821.1':
optional: true
'@cloudflare/workerd-darwin-arm64@1.20240718.0':
'@cloudflare/workerd-darwin-arm64@1.20240821.1':
optional: true
'@cloudflare/workerd-linux-64@1.20240718.0':
'@cloudflare/workerd-linux-64@1.20240821.1':
optional: true
'@cloudflare/workerd-linux-arm64@1.20240718.0':
'@cloudflare/workerd-linux-arm64@1.20240821.1':
optional: true
'@cloudflare/workerd-windows-64@1.20240718.0':
'@cloudflare/workerd-windows-64@1.20240821.1':
optional: true
'@cloudflare/workers-shared@0.4.1': {}
'@cspotcode/source-map-support@0.8.1':
dependencies:
'@jridgewell/trace-mapping': 0.3.9
@ -1189,8 +1191,6 @@ snapshots:
optionalDependencies:
fsevents: 2.3.3
consola@3.2.3: {}
cookie@0.5.0: {}
data-uri-to-buffer@2.0.2: {}
@ -1329,7 +1329,7 @@ snapshots:
mime@3.0.0: {}
miniflare@3.20240718.1:
miniflare@3.20240821.0:
dependencies:
'@cspotcode/source-map-support': 0.8.1
acorn: 8.12.1
@ -1339,7 +1339,7 @@ snapshots:
glob-to-regexp: 0.4.1
stoppable: 1.1.0
undici: 5.28.4
workerd: 1.20240718.0
workerd: 1.20240821.1
ws: 8.18.0
youch: 3.3.3
zod: 3.23.8
@ -1354,12 +1354,12 @@ snapshots:
nanoid@3.3.7: {}
node-fetch-native@1.6.4: {}
node-forge@1.3.1: {}
normalize-path@3.0.0: {}
ohash@1.1.3: {}
path-parse@1.0.7: {}
path-to-regexp@6.2.2: {}
@ -1476,12 +1476,10 @@ snapshots:
dependencies:
'@fastify/busboy': 2.1.1
unenv-nightly@1.10.0-1717606461.a117952:
unenv-nightly@2.0.0-1724863496.70db6f1:
dependencies:
consola: 3.2.3
defu: 6.1.4
mime: 3.0.0
node-fetch-native: 1.6.4
ohash: 1.1.3
pathe: 1.1.2
ufo: 1.5.4
@ -1498,32 +1496,33 @@ snapshots:
optionalDependencies:
vite: 5.4.2(@types/node@22.0.0)
workerd@1.20240718.0:
workerd@1.20240821.1:
optionalDependencies:
'@cloudflare/workerd-darwin-64': 1.20240718.0
'@cloudflare/workerd-darwin-arm64': 1.20240718.0
'@cloudflare/workerd-linux-64': 1.20240718.0
'@cloudflare/workerd-linux-arm64': 1.20240718.0
'@cloudflare/workerd-windows-64': 1.20240718.0
'@cloudflare/workerd-darwin-64': 1.20240821.1
'@cloudflare/workerd-darwin-arm64': 1.20240821.1
'@cloudflare/workerd-linux-64': 1.20240821.1
'@cloudflare/workerd-linux-arm64': 1.20240821.1
'@cloudflare/workerd-windows-64': 1.20240821.1
wrangler@3.67.1:
wrangler@3.73.0:
dependencies:
'@cloudflare/kv-asset-handler': 0.3.4
'@cloudflare/workers-shared': 0.4.1
'@esbuild-plugins/node-globals-polyfill': 0.2.3(esbuild@0.17.19)
'@esbuild-plugins/node-modules-polyfill': 0.2.2(esbuild@0.17.19)
blake3-wasm: 2.1.5
chokidar: 3.6.0
date-fns: 3.6.0
esbuild: 0.17.19
miniflare: 3.20240718.1
miniflare: 3.20240821.0
nanoid: 3.3.7
path-to-regexp: 6.2.2
resolve: 1.22.8
resolve.exports: 2.0.2
selfsigned: 2.4.1
source-map: 0.6.1
unenv: unenv-nightly@1.10.0-1717606461.a117952
workerd: 1.20240718.0
unenv: unenv-nightly@2.0.0-1724863496.70db6f1
workerd: 1.20240821.1
xxhash-wasm: 1.0.2
optionalDependencies:
fsevents: 2.3.3

View file

@ -2,13 +2,14 @@
import { onMount } from "svelte";
import Header from "./lib/Header.svelte";
import Stream from "./lib/Stream.svelte";
import AddStreamDialog from "./lib/AddStreamDialog.svelte";
let streams = [];
let fracsX = 0;
let fracsY = 0;
let containerElement;
let showButtons = false;
let showSettings = false;
let streams = $state([]);
let fracsX = $state(0);
let fracsY = $state(0);
let showButtons = $state(false);
let currentDialog = $state(null);
let containerElement = $state(null);
onMount(() => {
const urlSearchParams = new URLSearchParams(window.location.search);
@ -16,7 +17,9 @@
type,
streamId,
}));
});
$effect(() => {
switch (streams.length) {
case 1:
fracsX = 1;
@ -36,32 +39,37 @@
fracsY = 3;
}
});
function onKeyDown() {}
</script>
<svelte:body on:keydown={onKeyDown} />
<main>
{#if containerElement}
<Header {containerElement} bind:showSettings />
<Header {containerElement} bind:currentDialog />
{/if}
{#if showSettings}
<div class="settings">
<h2>Settings</h2>
<form>
<label>
Stream
<input type="text" name="url" />
</label>
<input type="submit" />
</form>
<div>
{#each streams as stream}
<button on:click={() => {}}>{stream.streamId}</button>
{/each}
</div>
</div>
{#if currentDialog === "add-stream"}
<AddStreamDialog
add={(newStream) => {
currentDialog = null;
streams.push(newStream);
const newUrl = new URL(window.location.toString());
newUrl.searchParams.append(newStream.type, newStream.streamId);
window.history.pushState({}, null, newUrl);
}}
></AddStreamDialog>
{/if}
<!--{#if currentDialog === "remove-stream"}
<RemoveStreamDialog
remove={(streamId) => {
const searchParams = new URLSearchParams();
for (const stream of streams) {
searchParams.append(stream.type, stream.streamId);
}
const newUrl = new URL(window.location);
window.location.search = searchParams.toString();
}}
></AddStreamDialog>
{/if}-->
<div
bind:this={containerElement}
class="streams"
@ -89,15 +97,4 @@
height: 100vh;
width: 100vw;
}
.settings {
padding: 1rem;
background-color: #0000000a;
position: absolute;
width: 50vh;
height: 50vh;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>

View file

@ -0,0 +1,57 @@
<script>
let { add } = $props();
let step = $state(0);
let type = null;
let streamId = $state("doggoat");
</script>
<div class="add-stream-dialog">
{#if step === 0}
<div>
<h2>Add stream</h2>
<button
onclick={() => {
type = "vdo";
step = 1;
}}>vdo.ninja</button
>
<button
onclick={() => {
type = "twitch";
step = 1;
}}>Twitch</button
>
</div>
{/if}
{#if step === 1}
<div>
<p>
Example:<br />
https://vdo.ninja/?view=<strong>doggoat</strong
>&bitrate=4500&proaudio<br />
https://www.twitch.tv/<strong>saltybet</strong>
</p>
<label>Stream ID: <input bind:value={streamId} /></label>
<button
onclick={() => {
add({ type, streamId });
step = 0;
}}>Add</button
>
</div>
{/if}
</div>
<style>
.add-stream-dialog {
padding: 1rem;
background-color: #0000000a;
position: absolute;
width: 50vh;
height: 50vh;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>

View file

@ -1,29 +1,25 @@
<script>
let showButtons = false;
export let showSettings;
export let containerElement;
let showButtons = $state(false);
let {
currentDialog = $bindable(null),
containerElement = $bindable(null),
} = $props();
</script>
<header>
<button
on:click={() => {
onclick={() => {
showButtons = !showButtons;
}}>[{showButtons ? "<" : ">"}]</button
>
{#if showButtons}
<button
on:click={() => {
showSettings = !showSettings;
onclick={() => {
currentDialog = "add-stream";
}}
>
Settings</button
Add Stream</button
>
<button
on:click={() => {
if (containerElement) containerElement.requestFullscreen();
}}>Fullscreen</button
>
<!--<button>Placeholder</button>-->
{/if}
</header>