☂️ Adds dynamic location service

This commit is contained in:
Rune Harlyk
2023-05-13 16:52:27 +02:00
parent 531945397c
commit 89bf6527b5
3 changed files with 7 additions and 2 deletions
+2 -1
View File
@@ -4,9 +4,10 @@
import { connect } from './lib/socket';
import Stream from './components/Views/Stream.svelte';
import Controls from './components/Controls.svelte';
import location from './lib/location';
onMount(() => {
connect('ws://leika.local');
connect(`ws://${location}`);
});
</script>
+2 -1
View File
@@ -1,7 +1,8 @@
<script lang="ts">
import { onDestroy } from 'svelte';
import location from '../../lib/location';
let videoStream = '//leika.local/stream';
let videoStream = `//${location}/stream`;
onDestroy(() => {
videoStream = '#';
+3
View File
@@ -0,0 +1,3 @@
const location = import.meta.env.DEV ? "leika.local" : window.location.host
export default location;