Skip to content

Conversation

@sij411
Copy link
Contributor

@sij411 sij411 commented Oct 19, 2025

Summary

This PR adds a LitePub-compatible ActivityPub relay implementation to the
@fedify/relay package, complementing the existing Mastodon relay implementation.

Related Issue

#359

Changes

  • Added LitePubRelay class in packages/relay/src/relay.ts:321-585 that implements
    the LitePub relay protocol
  • Implemented LitePub-specific activity handling:
    • Wraps incoming Create, Update, Move, and Delete activities in Announce
      activities before forwarding
    • Uses Application actor type instead of Mastodon's Service type
    • Sends announcements to PUBLIC_COLLECTION for broader visibility
  • Added comprehensive test suite for LitePubRelay in
    packages/relay/src/relay.test.ts:455-832 covering:
    • Relay initialization and configuration
    • Actor endpoint behavior (Application type)
    • Followers collection management
    • Subscription handler integration
    • Follow/Undo activity processing
    • Multiple follower support

Benefits

  • Protocol compatibility: Enables Fedify relay instances to work with
    LitePub-compatible fediverse software, which expects activities to be wrapped in
    Announce rather than directly forwarded
  • Broader reach: Using PUBLIC_COLLECTION as the audience for announces ensures
    better visibility across the fediverse
  • Developer choice: Developers can now choose between Mastodon-style
    (MastodonRelay) and LitePub-style (LitePubRelay) relay implementations based on
    their target ecosystem
  • Consistent API: Both relay implementations share the same Relay interface, making
    it easy to switch between protocols

Checklist

  • Did you add a changelog entry to the CHANGES.md?
  • Did you write some relevant docs about this change (if it's a new feature)?
  • Did you write a regression test to reproduce the bug (if it's a bug fix)?
  • Did you write some tests for this change (if it's a new feature)?
  • Did you run deno task test-all on your machine?

Additional Notes

Key differences between LitePub and Mastodon relay protocols:

  1. Actor type: LitePub uses Application, Mastodon uses Service
  2. Activity forwarding:
    - LitePub wraps activities in Announce objects with relay as actor
    - Mastodon forwards activities directly using ctx.forwardActivity()
  3. Audience: LitePub sends to PUBLIC_COLLECTION for maximum visibility

The implementation follows the same subscription management and key pair handling
as MastodonRelay, ensuring consistent behavior for core relay functionality like
follower management and subscription approvals.

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