+
{
+ if (e.key == "Enter") {
+ sendSong()
+ }
+ }}
+ {disabled}
+ />
+ {#if disabled}
+
+
+
+ {/if}
+
diff --git a/frontend/src/lib/types.ts b/frontend/src/lib/types.ts
index c0d4155..87182fc 100644
--- a/frontend/src/lib/types.ts
+++ b/frontend/src/lib/types.ts
@@ -10,19 +10,19 @@ const SongSchema = z.object({
})
export type Song = z.infer
-export const parseSong = async function(song: any): Promise {
+export const parseSong = async function (song: any): Promise {
let resp = await SongSchema.parseAsync(song)
return resp
}
-export const createEmptySong = function(): Song {
+export const createEmptySong = function (): Song {
return {
uuid: "-1",
title: "",
artist: "",
tags: [""],
image_id: "",
- youtube_id: 0,
+ youtube_id: "",
}
}
@@ -31,7 +31,7 @@ const SuggestionSchema = SongSchema.extend({
})
export type Suggestion = z.infer
-export const parseSuggestion = async function(sugg: any): Promise {
+export const parseSuggestion = async function (sugg: any): Promise {
let resp = await SuggestionSchema.parseAsync(sugg)
return resp
}
@@ -46,7 +46,7 @@ const RoomSchema = z.object({
})
export type Room = z.infer
-export const parseRoom = async function(room: any): Promise {
+export const parseRoom = async function (room: any): Promise {
let resp = await RoomSchema.parseAsync(room)
return resp
}
diff --git a/frontend/src/routes/admin/[id]/+page.svelte b/frontend/src/routes/admin/[id]/+page.svelte
index e017cc5..c579bed 100644
--- a/frontend/src/routes/admin/[id]/+page.svelte
+++ b/frontend/src/routes/admin/[id]/+page.svelte
@@ -19,7 +19,7 @@
let url = await getStreamingUrl(currentPlaying.uuid)
if (audioController) {
audioController.src = url
- audioController.play()
+ await audioController.play()
}
}
@@ -29,11 +29,10 @@
queueSongs = songs
playingIndex = index
+ })
- if (audioController) {
- audioController.src = await getStreamingUrl(currentPlaying.uuid)
- audioController.play()
- }
+ $effect(() => {
+ playOnEnd()
})
async function playNext() {
@@ -53,6 +52,6 @@
{/if}
diff --git a/frontend/src/routes/room/[id]/+page.svelte b/frontend/src/routes/room/[id]/+page.svelte
index 6237b13..95acdf5 100644
--- a/frontend/src/routes/room/[id]/+page.svelte
+++ b/frontend/src/routes/room/[id]/+page.svelte
@@ -8,6 +8,8 @@
import { getQueueSongs, getSuggestions, joinRoom } from "$lib/utils.js"
import type { FetchError } from "$lib/types.js"
import { io, Socket } from "socket.io-client"
+ import { get_coords } from "$lib/gps.js"
+ import type { Coordinates } from "$lib/gps.js"
let { data } = $props()
@@ -23,8 +25,14 @@
onMount(async () => {
// Join the room
+ let { coords, error } = await get_coords()
+ if (error || coords == null) {
+ // Default to Lido
+ coords = { latitude: 46.6769043, longitude: 11.1851585 }
+ }
+
let sugg, queue, index
- ;[returnError] = await joinRoom(data.roomId)
+ ;[returnError] = await joinRoom(data.roomId, coords.latitude, coords.longitude)
if (returnError) {
return
}
@@ -69,7 +77,7 @@
{#if returnError}
{:else}
-
+
diff --git a/frontend/static/favicon.ico b/frontend/static/favicon.ico
new file mode 100644
index 0000000..f5208bb
Binary files /dev/null and b/frontend/static/favicon.ico differ
diff --git a/frontend/static/favicon.svg b/frontend/static/favicon.svg
deleted file mode 100644
index cc5dc66..0000000
--- a/frontend/static/favicon.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file