- 06 Nov, 2026 1 commit
-
-
Aryan Noshirvnai authored
HTTP_PROXY/HTTPS_PROXY only affect HTTP client libraries - Pyrogram talks to Telegram's datacenters over raw MTProto/TCP, which never respected those env vars. On a network that can't reach Telegram directly, every Client() call hung in an infinite "Connection timed out" retry loop - exactly what made Telegram linking "get stuck" on prod. Added a TELEGRAM_PROXY config (opt-in via TELEGRAM_PROXY_HOST, unset by default so dev's direct access needs no change) and passed it into all four pyrogram.Client() construction sites. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 03 Nov, 2026 1 commit
-
-
Aryan Noshirvnai authored
database.py read os.getenv("DATABASE_URL") at import time, relying on config.py's load_dotenv() having already run first. Anything that imports database.py directly - alembic/env.py, the standalone Telegram bot's init_db() - never loads .env at all and silently falls back to the sqlite:///./stax.db default, no matter what .env actually says. Found while deploying to a fresh prod server: alembic kept migrating a stale leftover database instead of the one set up for it. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 13 Oct, 2026 1 commit
-
-
Aryan Noshirvnai authored
GET /soundmarks/song-library backs SongPicker's "Public Library" tab, which RadioManageTab's "Add song" reuses for any station owner - but the endpoint was still gated get_current_business_admin from when only the business/admin panels used this picker. A plain user got a silent 403 (SongPicker swallows fetch errors into an empty "No songs found" state), so nothing looked broken, search just never returned anything. Relaxed to get_current_user, matching the earlier geocode/reverse-geocode fix for the identical reason - a plain title/artist search has nothing business-admin-specific about it. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 12 Oct, 2026 3 commits
-
-
Aryan Noshirvnai authored
The old /radio/{id}/stream always served the file from byte 0 and relied on the frontend seeking afterward once it knew the duration - a visible delay before any audio played, and meaningless for a live broadcast with no stable timeline to seek within anyway. stream_audio_from_offset uses ffmpeg's demuxer-level -ss (seeks before decoding, -acodec copy avoids a re-encode) so the response itself starts exactly where the station actually is right now. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
Channels shipped a backend nobody built UI for (vibe sets/stories/showcase had zero frontend); removed outright rather than left half-built. Radio replaces it: creator-run stations tuned via a band (SM/SF/SR) + 50-200.0 frequency dial, worldwide or local-radius broadcast, a queue that loops forever. No scheduler or background job anywhere in this codebase, so "now playing" is fully stateless - elapsed-time-since-creation modulo the queue's total duration maps deterministically to a (song, offset) pair, computed fresh on every request. LibrarySong gained duration_seconds (probed via pydub at tag/upload/claim/remix time, lazily backfilled for older rows) to make that math possible. Also relaxes /soundmarks/geocode and /reverse-geocode from business-admin-only to any authenticated user, needed by the new location picker and never actually business-specific.
-
Aryan Noshirvnai authored
Rooms were open-join-by-id only with no geo features, despite that being the intended design. Generates a unique invite code server-side on every create, adds an optional PIN (hashed like account passwords, rate-limited on guesses via a third reuse of AuthAttempt) gating join/stream/websocket alike, and adds optional lat/lon with a haversine-sorted nearby lookup (haversine itself extracted to a shared geo service once a second caller needed it).
-
- 10 Oct, 2026 1 commit
-
-
Aryan Noshirvnai authored
Remix is shelved until after beta launch: new REMIX_ENABLED config flag (off by default) returns 403 from both /remix endpoints, mirroring the frontend's existing VITE_ENABLE_REMIX gate. Full test coverage on the underlying pipeline is preserved via an autouse fixture that force- enables the flag for every existing test except the two new ones covering the disabled response. Admins can now moderate accounts: new User.is_active and suspended_until columns back a soft-delete design (no FK cascades exist anywhere in this schema, so a real row delete would orphan 20+ tables) enforced everywhere identity is resolved - login, refresh, every authenticated request, and websockets - not just at login. New endpoints extend the existing admin user list: username search, rename, deactivate/reactivate, suspend/unsuspend, and password reset. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 08 Oct, 2026 1 commit
-
-
Aryan Noshirvnai authored
Nothing previously distinguished a brand-new account from one that's used Stax for months - /auth/register and /auth/login returned byte-identical responses. Adds User.has_completed_onboarding (server_default=true, so every existing/historical row is already onboarded - only /auth/register explicitly passes False for a genuinely new account), exposes it on GET /auth/me, and adds an idempotent POST /auth/onboarding/complete for the frontend's OnboardingOverlay to call on skip/finish. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 07 Oct, 2026 2 commits
-
-
Aryan Noshirvnai authored
Uploaded mp3s carry an ID3v2 tag that's almost entirely embedded cover art - tens to hundreds of KB a player must get through before reaching the first real audio frame, even though the player already gets artwork from the separate coverart field and never touches the embedded copy. Adds a shared stream_audio_file() helper that computes the tag's byte offset and serves everything after it as the logical resource (Range math included, so seeking is unaffected), and wires it into all 5 playback-stream endpoints that previously used plain FileResponse. Also adds a long-lived Cache-Control, since every file lives at a unique generated path and is never rewritten after upload. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
Every section (New Songs, New Albums, Suggestions) is now deduped by (title, artist)/(album, artist) identity - the same song or album tagged by several different users used to eat one display slot per uploader, now shows once. Albums merge across uploaders by picking a single representative copy (the caller's own if they have one, so the card still navigates directly instead of needing a claim; otherwise the most recent) - never literally merging different people's track data together. No uploader identity (username) is attached to any global-feed entry anymore - the feed reads as one shared pool of music. New `is_liked` field lets the frontend show a real favorite heart on Home rows; the helper that computes it (liked_song_ids) moved out of library.py into services/favorites.py so home.py can reuse it without importing another router's private function, same reasoning give_from_shared_library was already split out for. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 06 Oct, 2026 1 commit
-
-
Aryan Noshirvnai authored
Playlist gains a structurally-flagged is_liked_playlist column, lazily created per user on first favorite; is_liked is computed (not stored) and threaded through every endpoint that returns the caller's own songs. New GET /home/feed powers a global landing feed (latest songs, new albums, lightweight non-personalized suggestions) distinct from the per-user Library page. Library search gains album matching, a recency modifier, a curated mood/genre synonym table, and a difflib-based typo-tolerance fallback - deliberately rules-based rather than an LLM call, per direction to build it the way search worked before AI. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 13 Sep, 2026 1 commit
-
-
Aryan Noshirvnai authored
Rooms chat now persists to a room_messages table instead of an in-memory deque that was discarded the instant a room emptied. Two new opt-in privacy flags on UserProfile (share_location_enabled, allow_direct_messages) gate live-location visibility and a new 1-on-1 direct-messaging feature, closing a real gap where LiveLocation rows were visible to any authenticated user with zero consent check. The Rooms websocket's connection-registry logic was extracted into a shared ConnectionManager so DMs reuse the same JWT-over-query-param transport instead of a second implementation. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 06 Sep, 2026 1 commit
-
-
Aryan Noshirvnai authored
Every library query was scoped to the caller's own songs - there was no way to search what other users have already tagged. New search endpoint matches title/artist/genre across every user's library (same matching as the existing owner-scoped search), deduped by (title, artist) so a song several users separately uploaded doesn't show up once per owner, and excludes anything the caller already has by that same identity - the point is surfacing music that's new to them, not re-offering their own library back at them. Claiming a result reuses give_from_shared_library - the exact mechanism already backing Discovery's "identified something someone else has, give me a copy" flow - moved out of discovery.py into a new shared services module so both routers call the same code instead of one importing the other's private function. Picked up a drive-by fix in the move: it wasn't copying track_number, so a claimed song silently lost its real album order. Also fixed two unrelated pre-existing test collisions surfaced while adding these tests: the session-scoped test DB (no per-test rollback) meant test_music.py, test_discovery.py, and this file's own new tests all used identical "Shared Song"/"Shared Artist"-style literals, and a global (no user_id) title/artist lookup could resolve to the wrong test's leftover row depending on run order. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 03 Sep, 2026 3 commits
-
-
Aryan Noshirvnai authored
main only ever advances by merging already-tested dev commits - re-running pytest there duplicated work for no benefit and just delayed the actual deploy. test now only runs on dev; deploy_prod on main fires right away with nothing to wait on. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
# Conflicts: # .gitlab-ci.yml
-
Aryan Noshirvnai authored
Re-enables the deploy_prod job (and its stage) that's been fully built and ready since the read-only-rootfs fix, just deliberately left off until now. Fires automatically once the test job passes on main; deploy.sh itself handles the rest (bootstrap or update, migrations, systemd restart, health check). Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 01 Sep, 2026 3 commits
-
-
Aryan Noshirvnai authored
identify_audio() (and the IdentifiedTrack cache) always computed a track number, but LibrarySong had no column to store it in - so an album's tracks had no real order to sort by anywhere they were shown. Adds the column (+ migration), persists it in _identify_tag_and_store, and adds GET /library/album?album=&artist= which returns one album's songs sorted by it (numberless tracks last, then alphabetically) for the frontend's new dedicated album detail page. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
Frontend no longer needs it (Upload's result card now offers add-to- playlist/play instead of a download link), and it was pointing at the unauthenticated /downloads static mount - anyone who saw or guessed a path could pull another user's file. Same access-control class as the remix download_url fixed earlier. Playback goes through the already auth-scoped /library/stream/{id} instead. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
Shazam's hit was always appended before AcoustID's, so every caller (discovery_listen, _identify_tag_and_store) taking candidates[0] as "the" match was really just picking "whichever source responded first" - a lower-confidence Shazam hit would silently beat a higher-scoring AcoustID one from the same batch. Now sorted by confidence descending before returning, fixing ranking for Discovery, Upload, and Telegram tagging at once since they all share this one function. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 31 Aug, 2026 2 commits
-
-
Aryan Noshirvnai authored
The synced-lyrics lookup was only attempted when the identification candidate had no plain lyrics of its own - but Shazam and Gemini can both independently return a plain snippet as part of identification, which was short-circuiting the sync fetch entirely and silently discarding real timing data that was actually available. Now always attempted, with synced data (when found) always winning over whatever plain-text source identification provided. Also fixes the Discovery "give from shared library" path, which copied a source song's plain lyrics but not its synced_lyrics - copies given via Discovery were silently losing sync data even when the source had it. Existing tests never caught this because they always constructed a candidate with lyrics already stripped out; also fixes a shared mutable test fixture (FAKE_CANDIDATE) that the code under test mutates in place, which was silently leaking state between tests. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
fetch_lyrics() now tries syncedlyrics with synced_only=True first (a real line-by-line-timed hit, not a fuzzy fallback) and only drops to plain-text search if nothing timed exists anywhere. Previously it always stripped timestamps immediately, throwing away data the frontend now needs for a real Spotify-style highlighted lyrics view. New synced_lyrics column (LibrarySong + IdentifiedTrack cache), JSON-encoded [[seconds, text], ...], threaded through the shared _identify_tag_and_store pipeline (upload, tag, and the Telegram bulk-scan job all go through it) and exposed via GET /library/lyrics/{file_id}. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 28 Aug, 2026 2 commits
-
-
Aryan Noshirvnai authored
Genre fallback (music.py), Discovery's AI identification (music_identification.py), remix planning (remix_engine.py), and the Telegram bot's remix recipe parser (ai_remix.py) all move to the current flash model. Verified gemini-3.7-flash is a real, listed model for this API key via a live generateContent call before switching (returned a transient 503 "high demand" on first probe, not a 429/403 access-denial - confirmed the key itself is fine with a control call against the old model in the same window). Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
Discovery hits now check the whole app's library (not just the caller's own) - if someone else (including a super-admin seed upload) already has the song, the finder gets their own LibrarySong row immediately, reusing the existing file_path rather than duplicating audio on disk. The library is built entirely from real uploads, never anything auto-downloaded, so this stays clear of the copyright concern raised earlier. AcoustID's match score and a fixed value for Shazam are now a real queryable confidence field on DiscoveredSong instead of embedded in a source string. POST /remix had no rate limiting despite being the one genuinely expensive endpoint (real Gemini spend + CPU-bound Demucs per call) - added the same DB-backed limiter pattern used elsewhere, reusing RemixJob.created_at as its own counter. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 23 Aug, 2026 1 commit
-
-
Aryan Noshirvnai authored
Lets a user audition a found chat song before deciding to save it. Trims with ffmpeg's -t flag so cost doesn't scale with the source file's real length, and reuses the existing token-in-query-param stream auth so a plain <audio src> can play it directly.
-
- 22 Aug, 2026 4 commits
-
-
Aryan Noshirvnai authored
A finished remix was already auto-added to the caller's library as a real LibrarySong (that part was never the problem) - but GET /remix/{job_id} also handed back a public, unauthenticated /downloads/{filename} URL. Anyone with or guessing that URL could fetch the file with no auth check at all, regardless of who owns it. Removed that field entirely; the result is only reachable the same way everything else in the library is - streamed through the authenticated /library endpoints via library_song_id. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
songs_info already skipped a fresh identify_audio() call for library-sourced songs (using the already-known title/artist directly), but dropped genre even though LibrarySong has it. Genre is now threaded through into plan_remix's Gemini prompt as an explicit hint per song - one more piece of already-verified metadata informing the arrangement, on top of the real audio preview and detected BPM/key it already used. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
GET /discovery/history now matches each hit against the caller's own library (title+artist, case-insensitive) and includes library_song_id when found - computed live on every read rather than persisted, so it stays correct if the library changes later (a song added after the hit, or later deleted) instead of going stale like a stored link would. POST /library/search is now a real universal search: songs (existing title/artist/genre match) plus albums, a derived (album, artist) grouping of the caller's own songs - there's no separate Album table, so an album only appears when it has a name and at least one matching song. Albums match on album name or artist, not song title, so searching one track doesn't surface an unrelated album. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
GET /soundmarks/reverse-geocode?lat=&lon= mirrors the existing forward /geocode proxy (same Nominatim server-side-proxy reasoning, same business_admin+ gate) but for coordinates -> address instead of address -> coordinates. Lets the location picker pre-fill its search field from the browser's own location instead of just placing a pin with no readable address next to it. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 19 Aug, 2026 1 commit
-
-
Aryan Noshirvnai authored
New foundation for scanning a whole chat instead of one song at a time: ApprovedChat (opt a chat in) and ChatScanJob (a background job that lists a chat's music, then downloads+identifies+tags+saves each song via the same pipeline /music/tag already uses per song). Mirrors RemixJob's proven pattern - a status column + BackgroundTasks, no new task-queue infrastructure - rather than inventing a new one. Deliberately on-demand (user approves a chat, then triggers one scan) rather than automatic background polling, which needs a materially different architecture (persistent per-user Telegram connections or a scheduler) not worth building until on-demand proves out the feature. Guardrails baked in from the start rather than bolted on later: a 50-message cap per scan, a 5-scans/day per-user cap, no two concurrent scans of the same chat, and a 1.5s pause between songs so a scan reads like a real user, not a script hammering Telegram/AcoustID/Gemini. Per-song outcomes (saved/skipped_duplicate/failed) are tracked individually in results_json, not just one pass/fail for the whole job. _identify_tag_and_store's request param is now optional so the background job can call it without a live HTTP request in scope - same reasoning as RemixJob storing a bare filename instead of a full URL. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 18 Aug, 2026 4 commits
-
-
Aryan Noshirvnai authored
get_chat_music() called search_messages(filter="audio") - a plain string - but Pyrogram's filter param is a MessagesFilter enum and internally reads filter.value, so every chat scan crashed the moment a user tapped a chat. Use MessagesFilter.AUDIO instead. Added a unit test that mocks pyrogram.Client and asserts the exact enum is passed, since the existing router tests only mocked get_chat_music() itself and never exercised this line. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
Accounts with a Telegram cloud password enabled couldn't link at all - sign_in() raised SessionPasswordNeeded and the endpoint surfaced it as a generic 400. /auth/telegram/login now returns 412 in that case (not 401, so apiFetch's access-token-refresh retry doesn't swallow it), and a new /auth/telegram/password endpoint finishes the same in-progress Pyrogram auth session with the password, via a shared _link_telegram_session helper so both paths attach to the caller identically. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
It was documented as an account-linking flow (attach a Telegram session to the already-logged-in user) but the code never changed to match - it still created/looked up a *separate* User row keyed by Telegram's own numeric user_id and issued that identity a fresh token pair, same as the old Telegram-is-the-login design it was supposed to replace. Silently pointless: nothing actually got linked to whoever was logged in. Now requires an authenticated caller and attaches telegram_session_string + phone_number directly to current_user, no new tokens issued (the caller already has valid ones). Returns 409 if that Telegram account is already linked to a different Stax user. Found and fixed while helping the user actually test the chat-scanning feature against their real account. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
DELETE /library/{id} - removes a song, its file on disk, and any PlaylistTrack rows pointing at it (owner-scoped). DELETE /playlists/{id} - removes a playlist and its tracks (owner-scoped). DELETE /playlists/{id}/tracks/{song_id} - removes one track from a playlist without deleting the song itself (owner-scoped). Also adds rate limiting to POST /discovery/listen (20 identify calls per user per 10 minutes, new DiscoveryAttempt table + migration 9f6585c71f80) - each call is a real, billable Shazam + AcoustID request and was previously uncapped. Counts every attempt, not just successful ones (a failed identification still costs the same external API call, and only successful ones create a DiscoveredSong row). Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 16 Aug, 2026 2 commits
-
-
Aryan Noshirvnai authored
Username/password login had zero rate limiting since it shipped - unlimited guesses against any account from anywhere. Adds a username column to the existing AuthAttempt table (migration d22ca64d291e) and reuses the same DB-backed approach already protecting /auth/telegram/request_code: 10 attempts per account per 15 minutes, 100 per source per hour. Kept independent of the Telegram rate limit despite sharing a table - both _check_rate_limit and the new _check_login_rate_limit filter on their own column (phone_number.isnot(None) / username.isnot(None)) so hammering one endpoint never burns the other's budget. Verified live: 10 wrong-password attempts succeed with 401, the 11th (even with the correct password) gets 429; a telegram request_code call immediately after is unaffected. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
The existing playlist endpoints (list, create, add-track) had no way to actually view what's in a playlist - GET /playlists only returns the playlist rows themselves, not their tracks. Joins PlaylistTrack to LibrarySong, ordered by track order, scoped to the owner. Needed to build a real Playlist UI on the frontend (playlists have had a working backend with zero UI since they were added). Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 15 Aug, 2026 5 commits
-
-
Aryan Noshirvnai authored
Every stream endpoint (library, soundmarks, posts, live-location, rooms) only accepted the access token via an Authorization header - fine for apiFetch, but <audio src="..."> can't send custom headers, so the frontend was fetching the entire file as a blob before playback could even start (no progressive playback, no seeking). Added get_current_user_for_stream, which accepts the token as a ?token= query param too (same reasoning as the Rooms websocket fix), and switched all five stream endpoints to it. FileResponse already supports Range requests natively, so a direct <audio src> now gets real 206 Partial Content responses - confirmed live (curl -H "Range: ..." against /library/stream/1?token=...). Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
POST /remix and GET /remix/{job_id} previously had no authentication at all - user_id was a raw client-supplied form field, and job status was fetchable by guessing sequential ids (IDOR). Both endpoints now require a logged-in user; RemixJob gets a new user_id column (migration 347da5d41656) so job status is scoped to its owner. Also closed an adjacent IDOR found while fixing this: library_song_ids sourcing now scopes to the caller's own library, not any song id. WS /social/rooms/{room_id}/ws took user_id as an unauthenticated query param - anyone could connect claiming to be any user. It now takes a JWT access token instead (browsers can't set WS headers, so it travels as a query param) and verifies it - signature, expiry, real user row - before accepting the connection. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
Adds POST /auth/register and POST /auth/login (username/password, PBKDF2-hashed stdlib-only, no new dependency). The former phone/code Telegram flow moves to /auth/telegram/{request_code,login,chats,chats/{id}/music} - it now links a Telegram account (for the chat-scanning music-tagging feature) to an already-authenticated user rather than being the identity mechanism itself. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
GeoDrop was a one-off "drop a song at this exact point" pin, permanent once created. Redesigning it as a live broadcast instead: one row per user, continuously overwritten as their position and currently-playing song change, so nearby people see what you're listening to right now, not a static pin you left once. - LiveLocation model: unique per user_id, upserted on every meaningful location/song change plus a periodic heartbeat while sharing is on. - PUT /social/live-location - upsert (song_id nullable: sharing your position doesn't require actively playing something). - DELETE /social/live-location - stop sharing. - GET /social/live-location/nearby - other users' live positions within a radius, self-excluded, enriched with song/username, sorted by distance. Filters out anything not updated in the last 5 minutes (LIVE_LOCATION_STALE_AFTER) - there's no reliable way for a closing browser tab to notify the server with an authenticated request, so staleness expiry is the actual "they stopped sharing" mechanism, not a clean disconnect signal. - GET /social/live-location/{user_id}/stream - stream whatever a nearby user is currently playing, same cross-user reasoning as the other social stream endpoints. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
A post's song_id isn't necessarily the poster's own library song, so playing it needed the same not-scoped-to-caller stream endpoint pattern already used for rooms, geo-drops, and soundmarks. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-