import { PlayerClient } from '$lib/proto/player.client'; import { fail } from '@sveltejs/kit'; import { protoTransport } from '../../../hooks.server'; import type { Actions } from './$types'; import { serializable } from '$lib/proto'; import type { PlayTrackResponse } from '$lib/proto/player'; export const actions = { play: async ({ params }) => { const client = new PlayerClient(protoTransport); const response = await client.playTrack({ hash: params.hash }); if (response.response.track === undefined) { return fail(500); } return serializable(response.response); } } satisfies Actions;