Skip to content

feat: implement dynamic instance avatar for PeerTube#3

Open
geco wants to merge 4 commits into
futo-org:masterfrom
geco:feature/instance-dynamic-avatar
Open

feat: implement dynamic instance avatar for PeerTube#3
geco wants to merge 4 commits into
futo-org:masterfrom
geco:feature/instance-dynamic-avatar

Conversation

@geco
Copy link
Copy Markdown

@geco geco commented May 11, 2026

feat: implement dynamic instance avatar for PeerTube

Summary

This PR introduces the ability to dynamically fetch and use the avatar of the specific PeerTube instance being imported, instead of relying on a static default icon. It also exposes a helper method to allow Grayjay clients (Desktop and Mobile) to retrieve this dynamic icon.

Changes

  • Dynamic Avatar Fetching: Modified source.enable to fetch the instance configuration from /api/v1/config.
  • Version Compatibility: Added logic to handle different PeerTube API versions:
    • For PeerTube < v6, it uses the instance.avatar.path property.
    • For PeerTube >= v6, it selects the last available avatar from the instance.avatars array.
  • Fallback Mechanism: If no instance avatar is found or the request fails, the plugin gracefully falls back to the default PeerTube logo.
  • Client API Extension: Implemented a getIcon method (exposed via the plugin script) that returns the resolved dynamic avatar URL, enabling Grayjay clients to display instance-specific icons in the UI.

Technical Details

  • The fetched avatar path is appended to the instance's base URL and stored in the state object for persistence.
  • The implementation ensures that there is no breaking change for instances that do not have a custom avatar configured.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants