Skip to content

feat: support dynamic Peertube source icons via grayjay-plugin-peertube implementation#3297

Open
geco wants to merge 2 commits into
futo-org:masterfrom
geco:feature/dynamic-source-icons
Open

feat: support dynamic Peertube source icons via grayjay-plugin-peertube implementation#3297
geco wants to merge 2 commits into
futo-org:masterfrom
geco:feature/dynamic-source-icons

Conversation

@geco
Copy link
Copy Markdown

@geco geco commented May 13, 2026

Pull Request Proposal (Android)

Title

feat: support dynamic Peertube source icons via grayjay-plugin-peertube implementation

Description

Currently, source icons are static and derived solely from the iconUrl defined in the plugin's configuration JSON. This prevents plugins from displaying icons that are dynamically configured on the instance side (e.g., custom branding on a PeerTube instance).

This PR implements a bridge that allows the Android app to request a dynamic icon by invoking a getIcon() method within the plugin's JavaScript implementation.

Changes

  • Engine: Added executeString() in V8Plugin.kt to provide a convenient way to invoke JS functions and retrieve string results.
  • State Management: Introduced getDynamicIcon(id) in StatePlugins.kt to handle the asynchronous retrieval of the icon URL from the plugin instance on a background thread.
  • UI Integration: Updated SourceHeaderView.kt to use a coroutine that attempts to load the dynamic icon first.
  • Fallback Logic: The system maintains a robust fallback mechanism: if the plugin does not implement getIcon() or the call fails, it reverts to the static absoluteIconUrl derived from the JSON config.

Use Case: PeerTube

This feature is primarily designed to support the PeerTube plugin, enabling it to fetch and display the specific icon configured on the target PeerTube instance.
The plugin-side implementation can be reviewed here:
👉 futo-org/grayjay-plugin-peertube#3

Testing

  • Verified that the app successfully calls the JS method when available and updates the UI on the Main thread.
  • Verified that standard plugins (without getIcon) still display their static icons without any regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants