Merged
Conversation
This commit introduces a new cloud music source: Google Drive. Users can now sign in with their Google account, add music folders from their Drive, and stream songs directly within the app.
- **Google Drive Integration**:
- **Authentication**: Implements Google Sign-In using the Credential Manager API. The server-side auth code flow is used to obtain access and refresh tokens for the Google Drive API.
- **API Service**: Adds `GDriveApiService`, a lightweight OkHttp client for interacting with the Google Drive REST API v3 (listing files/folders, creating folders, token management).
- **Repository**: Introduces `GDriveRepository` to manage authentication state, API calls, and local database caching. It handles token persistence and refresh logic.
- **Database**:
- Adds `gdrive_songs` and `gdrive_folders` tables to the database with a new `MIGRATION_21_22`.
- Adds `GDriveDao` for accessing GDrive-specific data.
- Updates `MusicDao` to support clearing GDrive songs from the unified library.
- **Unified Library Sync**: GDrive songs are parsed and integrated into the main music library, with stable IDs generated for songs, albums, and artists. Sync logic correctly handles additions and deletions.
- **Streaming & Security**:
- **GDrive Stream Proxy**: Adds `GDriveStreamProxy`, a local Ktor-based server that handles `gdrive://` URIs. It proxies requests to the Drive API, attaching the necessary `Authorization` header and automatically refreshing expired tokens.
- **Cloud Stream Security**:
- Creates a shared `CloudStreamSecurity` object to centralize validation logic for all cloud streaming proxies (Google Drive, Netease, Telegram).
- Implements robust validation for `Range` headers, content length, content types, and upstream URLs to prevent SSRF and other potential proxy abuse.
- Hardens existing `NeteaseStreamProxy` and `TelegramStreamProxy` by applying the new security checks.
- **UI & UX**:
- **Login Flow**: Adds a new `GDriveLoginActivity` with a guided flow for signing in, browsing Drive folders, creating a dedicated "PixelPlay Music" folder, and selecting a source folder.
- **Dashboard**: Creates a `GDriveDashboardScreen` for managing synced folders, initiating manual syncs, and logging out.
- Updates `Song` model and `SongEntity` to recognize `gdrive://` content URIs.
- **Dependencies**:
- Adds Google Sign-In libraries (`androidx.credentials`, `credentials-play-services-auth`, `com.google.android.libraries.identity.googleid`).
- **ConnectivityStateHolder**:
- Update logic to clear Bluetooth audio devices and reset names when Bluetooth is disabled.
- Improve `updateBluetoothName` to prefer a name from the connected audio devices list.
- Sanitize device names in `updateAudioDevices` by trimming and filtering empty strings.
- Remove redundant GATT profile device fetching.
- Ensure `updateAudioDevices` is called immediately when Bluetooth is toggled on.
- **CastBottomSheet**:
- Sanitize and deduplicate Bluetooth device names before rendering.
- Align active device detection logic to ensure consistent naming and icon selection between Bluetooth and local playback.
- Improve null-safety and casting session identification in `activeDevice` UI state.
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.
No description provided.