mauricerenck / indieConnector

A Kirby Webmention Plugin
MIT License
30 stars 3 forks source link

Documentation Inconsistencies with Mastodon options #14

Closed inhji closed 2 months ago

inhji commented 2 months ago

First of all, thank you for this plugin.

I've integrated my website into the Indieweb before and I know that this can quite involved, so hat tip to you for your work!

I have tried setting up the mastodon functionality on Plugin Version 2.1.1 and noticed some inconsistencies with the names and paths of the options for mastodon:

$this->enabled = $enabled ?? option('mauricerenck.indieConnector.mastodon.enabled', false);
$this->instanceUrl = $instanceUrl ?? option('mauricerenck.indieConnector.mastodon.instance-url', false);
$this->token = $token ?? option('mauricerenck.indieConnector.mastodon.bearer', false);

https://github.com/mauricerenck/indieConnector/blob/dc876b2369fd228b666bd65dee37db885f27d995/lib/MastodonSender.php#L18C8-L20C95

In the code, the path to the options is mauricerenck.indieConnector.mastodon. This is also reflected in docs/options.md.

In docs/mastodon.md, the path is documented as: mauricerenck.indieConnector.post.mastodon.


Currently, both ways do not work. If you set the options at mauricerenck.indieConnector.mastodon, you get a error that no Token is set. If you set the options at mauricerenck.indieConnector.post.mastodon, nothing happens because the 'missing' enabled flag causes an early exit.

mauricerenck commented 2 months ago

Oh man, what a mess… Sorry for that, probably a classic copy & paste fail… Here's the setup which I use on my website:

    'mauricerenck.indieConnector' => [
        'post' => [
            'textfields' => ['mastodon', 'intro', 'text'],
            'allowedTemplates' => ['article', 'bookmark', 'note'],
        ],
        'mastodon' => [
            'enabled' => true,
            'instance-url' => 'https://mastodon.online',
            'bearer' => 'XYZ',
        ],
    ]

Can your try this with your data? This should work. Whenever you change a page status from draft to published, it should try sending.

inhji commented 2 months ago

I've tried creating and publishing a post with this configuration. The bearer is saved in the env.php on the server, that's why it's not showing up here. I don't get an error, but no mastodon post is created.

  'mauricerenck.indieConnector' => [
    'sqlitePath' => 'content/.sqlite/',
    'stats.enabled' => false,
    'post' => [
      'textfields' => ['text', 'content'],
      'allowedTemplates' => ['micro_post', 'wiki_post', 'blog_post']
    ],
    'mastodon' => [
      'enabled' => true,
      'instance-url' => 'https://chaos.social'
    ],
  ],

The json file next to post in kirby indicates an error.

{"version":2,"webmentions":[],"posts":[{"url":null,"status":"error","target":"mastodon","date":"2024-09-10 16:26:42","retries":0}]}

Maybe this is still an error on my side, I will check my settings again and report back.

inhji commented 2 months ago

Ok, nevermind, it works now, there was a problem with my Mastodon token.