janboddez / share-on-mastodon

Easily share WordPress posts on Mastodon.
https://jan.boddez.net/wordpress/share-on-mastodon
GNU General Public License v3.0
39 stars 5 forks source link

Micropub syndication targets #26

Closed janboddez closed 1 year ago

janboddez commented 2 years ago

Why not add compatibility with the Micropub plugin? Most users wouldn't even notice, and the few that would could disable it (this is probably technical enough that it can go behind a filter).

janboddez commented 2 years ago

Like, if we know the instance URL and user name (which we can get from /api/v1/accounts/verify_credentials?), we could do something like:

add_filter( 'micropub_syndicate-to', function( $syndicate_to, $user_id ) {
    $syndicate_to[] = array(
        'uid'  => 'https://<instance-url>/@<username>',
        'name' => 'Mastodon',
    );

    return $syndicate_to;
}, 10, 2 );
janboddez commented 1 year ago

So, it isn't the prettiest implementation, but I added this here: 3c38700