Skip to content

Commit a5d6772

Browse files
committed
Add stats block with server-side sharepic image generation
Introduces an `activitypub/stats` block that displays annual Fediverse statistics as a card or shareable image. The image mode uses a REST endpoint (`/activitypub/v1/stats/image/{user_id}/{year}`) to generate a 1200x630 PNG server-side via GD, making it accessible to social media platforms for OG/link preview cards. Based on the wrapped block from the fediverse-wrapped-block branch, renamed from "wrapped" to "stats" for clarity as a standalone feature.
1 parent 430e892 commit a5d6772

8 files changed

Lines changed: 980 additions & 0 deletions

File tree

activitypub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function rest_init() {
5555
( new Rest\Admin\Actions_Controller() )->register_routes();
5656
( new Rest\Admin\Statistics_Controller() )->register_routes();
5757
( new Rest\Application_Controller() )->register_routes();
58+
( new Rest\Stats_Image_Controller() )->register_routes();
5859
( new Rest\Collections_Controller() )->register_routes();
5960
( new Rest\Comments_Controller() )->register_routes();
6061
( new Rest\Followers_Controller() )->register_routes();

includes/class-blocks.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ public static function register_blocks() {
143143
\register_block_type_from_metadata( ACTIVITYPUB_PLUGIN_DIR . '/build/follow-me' );
144144
\register_block_type_from_metadata( ACTIVITYPUB_PLUGIN_DIR . '/build/followers' );
145145
\register_block_type_from_metadata( ACTIVITYPUB_PLUGIN_DIR . '/build/posts-and-replies' );
146+
\register_block_type_from_metadata( ACTIVITYPUB_PLUGIN_DIR . '/build/stats' );
146147

147148
// Only register the Following block if the Following feature is enabled.
148149
if ( '1' === \get_option( 'activitypub_following_ui', '0' ) ) {

0 commit comments

Comments
 (0)