Skip to content

Impl/gdrive streaming#1115

Merged
theovilardo merged 2 commits intomasterfrom
impl/gdrive-streaming
Feb 17, 2026
Merged

Impl/gdrive streaming#1115
theovilardo merged 2 commits intomasterfrom
impl/gdrive-streaming

Conversation

@theovilardo
Copy link
Copy Markdown
Owner

No description provided.

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.
@theovilardo theovilardo merged commit 3e50e9e into master Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant