diff --git a/Music/AGENTS.md b/Music/AGENTS.md index 3c17996..c308e96 100644 --- a/Music/AGENTS.md +++ b/Music/AGENTS.md @@ -8,7 +8,7 @@ The iOS client is closed source for now. It targets iOS only and uses SwiftUI fo ## Product and user flows to mirror -- **Authentication:** unauthenticated users are sent to sign in. Sign-in accepts email and password; there is no “remember me” option. The current web sign-in page says registration is closed, even though registration endpoints/helpers remain in the backend. Do not expose sign-up unless the web product opens registration. A sign-out API/helper exists, but the current web UI has no visible sign-out or account-management flow; do not invent profile management or account settings. +- **Authentication:** unauthenticated users are sent to sign in. Sign-in accepts email and password; the web UI has no “remember me” control. On iOS, request the backend's persistent refresh cookie (`remember: true`) and rely on secure cookie storage to restore sessions across launches; do not expose a remember toggle. The current web sign-in page says registration is closed, even though registration endpoints/helpers remain in the backend. Do not expose sign-up unless the web product opens registration. A sign-out API/helper exists, but the current web UI has no visible sign-out or account-management flow; do not invent profile management or account settings. - **Home and discovery:** the Home screen presents album carousels grouped by a selection of random genres. Selecting an album opens its detail page. There are no dedicated genre browsing/detail screens in the current web UI. - **Search:** the shared navigation search opens Search and updates results as the query changes. Search covers tracks, albums, and artists, with a short debounce; the backend also searches track names and lyric text. Empty search and no-result states show up to nine recently played tracks stored locally in the browser on the web app. Selecting a track plays it; selecting an album or artist opens its detail page. - **Catalog pages:** album pages show artwork, title, artists, Play and Shuffle actions, and the album’s tracks. Artist pages show artist artwork/name, Play and Shuffle actions, the artist’s tracks, and albums. A separate artist Songs page lists that artist’s tracks. Tracks link to their album and artist pages. diff --git a/Music/API/MusicAPI.swift b/Music/API/MusicAPI.swift index 68a378d..fa72872 100644 --- a/Music/API/MusicAPI.swift +++ b/Music/API/MusicAPI.swift @@ -11,9 +11,10 @@ public struct MusicAPI: Sendable { q([("limit", limit.map(String.init)), ("skip", skip.map(String.init))]) } - public func signIn(email: String, password: String) async throws { + public func signIn(email: String, password: String, remember: Bool = true) async throws { let _: APIClient.EmptyResponse = try await client.request( - "POST", path: "auth/signin", body: Credentials(email: email, password: password)) + "POST", path: "auth/signin", + body: Credentials(email: email, password: password, remember: remember)) guard try await sessionStatus().authenticated else { throw APIError.http( status: 401, message: "The server did not establish an authenticated session.") @@ -123,5 +124,6 @@ public struct MusicAPI: Sendable { nonisolated private struct Credentials: Encodable, Sendable { let email: String let password: String + let remember: Bool } nonisolated public struct SignOutResponse: Decodable, Sendable { public let success: Bool? }