[WIP] Fix hardcoded URL in Party Mode for API requests#9
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot stopped work on behalf of
Wilooper due to an error
March 9, 2026 12:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lib/audio-context.tsx:PARTY_SERVERconstant from env varpartyHostIdstate variablepartyHostIdtoAudioContextTypeinterfacegetPartyUsernamefrom@/lib/storagestartPartyto use new party server APIstopPartyto call DELETE on party serveraddToPartyQueueto use new party server APIuseEffectto use new party server APIuseEffectfor syncing current song to party server when host changes songpartyHostIdin provider valueapp/party/[id]/page.tsx:PARTY_SERVERconstantPOST /party/:id/joinGET /party/:idfrom party serveraddSongto usePOST /party/:id/queueon party server/api/partyOriginal prompt
Problem
Party Mode is broken because
lib/audio-context.tsxhardcodeshttps://jsonblob.com/api/jsonBlobURLs instead of using theNEXT_PUBLIC_PARTY_SERVERenvironment variable defined in.env.local(currently set tohttps://y-brown-two.vercel.app).The env var
NEXT_PUBLIC_PARTY_SERVERis never referenced anywhere in the codebase. All party functions need to be rewritten to use the actual party server API.Party Server API Documentation (Full Reference)
The party server is deployed at the URL in
NEXT_PUBLIC_PARTY_SERVER. Here is the complete API:Health check
Create a party (host)
Get party state (anyone)
Update currently playing song (host only)
Guest adds a song to the queue
Returns
409if the same song is already waiting in the queue.Host polls + flushes the queue (host only)
This returns all pending guest-queued songs and clears them in one step. The host should call this every ~5 seconds.
Guest joins party
Increments guestCount and returns current party state so the guest immediately knows what song is playing without a second request.
End party (host only)
Song data structure
{ "id": "videoId", "title": "Song Title", "artist": "Artist Name", "thumbnail": "https://...", "type": "musiva", "videoId": "videoId", "duration": "3:45" }Required Changes
1.
lib/audio-context.tsx— Party Mode LogicThis is the main file that needs changes. Define a base URL constant:
a)
startPartyfunction (currently at ~line 729)Current: Calls
https://jsonblob.com/api/jsonBlobwith POST, readsLocationheader.Fix: Call
POST ${PARTY_SERVER}/partywith{ currentSong }body. The response returns{ id, hostId, partyUrl }. StoreidaspartyIdand storehostIdin a new state variablepartyHostId(this is SECRET, used for host-only operations). Also need to add a new state:const [partyHostId, setPartyHostId] = useState<string | null>(null).b)
addToPartyQueuefunction (currently at ~line 762)Current: Fetches from
jsonblob.com, pushes song, PUTs back.Fix: Call
POST ${PARTY_SERVER}/party/${partyId}/queuewith{ song, guestName }.c) Host polling interval (currently at ~line 779)
Current: Polls
jsonblob.com, reads songs, clears blob.Fix: Call
GET ${PARTY_SERVER}/party/${partyId}/queue?hostId=${partyHostId}. This returns{ songs: Song[] }and auto-clears the queue on the server. Poll every 5 seconds.