akirk / enable-mastodon-apps

Allow accessing your WordPress blog with Mastodon clients
https://wordpress.org/plugins/enable-mastodon-apps
GNU General Public License v2.0
36 stars 6 forks source link

Critical Error on Saving Changes, Part 2 #7

Closed tomfinitely closed 1 year ago

tomfinitely commented 1 year ago

After enabling the app, I attempted to log in via Ice Cubes and then Ivory, to no avail. I checked the plugin settings page, clicked the 'Save' button and encountered the following error:

`Error Details

An error of type E_ERROR was caused in line 406 of the file /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps-main/includes/class-mastodon-admin.php. Error message: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps-main/includes/class-mastodon-admin.php:406 Stack trace:

0 /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps-main/includes/class-mastodon-admin.php(406): implode('', '')

1 /nas/content/live/mysiteurl/wp-includes/class-wp-hook.php(308): Enable_Mastodon_Apps\Mastodon_Admin->admin_page('')

2 /nas/content/live/mysiteurl/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)

3 /nas/content/live/mysiteurl/wp-includes/plugin.php(517): WP_Hook->do_action(Array)

4 /nas/content/live/mysiteurl/wp-admin/admin.php(259): do_action('settings_page_e...')

5 /nas/content/live/mysiteurl/wp-admin/options-general.php(10): require_once('/nas/content/li...')

6 {main}

thrown`

knut-hildebrandt commented 1 year ago

For me this was fixed with version 0.2

tomfinitely commented 1 year ago

@knut-hildebrandt this was in version 0.2 – sorry I should have specified that for @akirk – good looking out

tomfinitely commented 1 year ago

The 0.2.1 update has resolved the issue above.

akirk commented 1 year ago

Does it work with Ivory? I haven't yet managed to get Icecubes to work

tomfinitely commented 1 year ago

So after your 0.2.1 patch the error message went away, and subsequently I was able to see my server with Ice Cubes. But authentication with every iOS app I have (Mastodon official, Ivory, and Ice Cubes) all still fail.

Ice Cubes: image

After this stage it just asks me to authenticate but nothing happens on the app side:

image

Ivory

image

Mastodon

image

image

akirk commented 1 year ago

Thanks, @electricbrick for testing! I just pushed some more fixes that make Icecubes load more me. Since you already tried 0.2.1 without me releasing it to the plugin directory, you might be able to test these latest changes again without me making a new release? The version is still 0.2.1 but the latest commit is 00d1e684932586acf032c25e4cbcfeabb490f5ac. Thanks!

tomfinitely commented 1 year ago

@akirk I pushed the update but am still seeing the sort of recursive authorize look where nothing happens in Ice Cubes (my expectation would be some sort of "success!" or confirmation screen after pressing the "Authorize" button on my WordPress-based login screen. I'm in a bit of a rush so all I can provide is a screenshot of my EMA dashboard. It's definitely creating tokens but seems like the "handshake" isn't being completed.

Screenshot 2023-04-16 at 13-46-09 Mastodon Apps ‹ Tom Finley — WordPress

Here are my error logs:

[Sun Apr 16 17:44:19.010496 2023] [php:error] [pid 32616] [client 70.108.24.242:0] PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php:406\nStack trace:\n#0 /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php(406): implode('
', '')\n#1 /nas/content/live/mysiteurl/wp-includes/class-wp-hook.php(308): Enable_Mastodon_Apps\Mastodon_Admin->admin_page('')\n#2 /nas/content/live/mysiteurl/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)\n#3 /nas/content/live/mysiteurl/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#4 /nas/content/live/mysiteurl/wp-admin/admin.php(259): do_action('settings_page_e...')\n#5 /nas/content/live/mysiteurl/wp-admin/options-general.php(10): require_once('/nas/content/li...')\n#6 {main}\n thrown in /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php on line 406, referer: https://mysiteurl.com/wp-admin/plugins.php?plugin_status=all&paged=1&s

[Sun Apr 16 17:44:24.400392 2023] [php:error] [pid 32616] [client 70.108.24.242:0] PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php:406\nStack trace:\n#0 /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php(406): implode('
', '')\n#1 /nas/content/live/mysiteurl/wp-includes/class-wp-hook.php(308): Enable_Mastodon_Apps\Mastodon_Admin->admin_page('')\n#2 /nas/content/live/mysiteurl/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)\n#3 /nas/content/live/mysiteurl/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#4 /nas/content/live/mysiteurl/wp-admin/admin.php(259): do_action('settings_page_e...')\n#5 /nas/content/live/mysiteurl/wp-admin/options-general.php(10): require_once('/nas/content/li...')\n#6 {main}\n thrown in /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php on line 406, referer: https://mysiteurl.com/wp-admin/options-general.php?page=enable-mastodon-apps

[Sun Apr 16 17:44:26.966218 2023] [php:error] [pid 2688] [client 70.108.24.242:0] PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php:406\nStack trace:\n#0 /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php(406): implode('
', '')\n#1 /nas/content/live/mysiteurl/wp-includes/class-wp-hook.php(308): Enable_Mastodon_Apps\Mastodon_Admin->admin_page('')\n#2 /nas/content/live/mysiteurl/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)\n#3 /nas/content/live/mysiteurl/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#4 /nas/content/live/mysiteurl/wp-admin/admin.php(259): do_action('settings_page_e...')\n#5 /nas/content/live/mysiteurl/wp-admin/options-general.php(10): require_once('/nas/content/li...')\n#6 {main}\n thrown in /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php on line 406, referer: https://mysiteurl.com/wp-admin/options-general.php?page=enable-mastodon-apps

[Sun Apr 16 17:45:09.513677 2023] [php:notice] [pid 1472] [client 70.108.24.242:0] wpe_cache_plugin:info: event=clear-all-cache, referer: https://mysiteurl.com/wp-admin/admin.php?page=wpengine-common&tab=caching [Sun Apr 16 17:45:43.497392 2023] [php:error] [pid 2688] [client 70.108.24.242:0] PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php:406\nStack trace:\n#0 /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php(406): implode('
', '')\n#1 /nas/content/live/mysiteurl/wp-includes/class-wp-hook.php(308): Enable_Mastodon_Apps\Mastodon_Admin->admin_page('')\n#2 /nas/content/live/mysiteurl/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)\n#3 /nas/content/live/mysiteurl/wp-includes/plugin.php(517): WP_Hook->do_action(Array)\n#4 /nas/content/live/mysiteurl/wp-admin/admin.php(259): do_action('settings_page_e...')\n#5 /nas/content/live/mysiteurl/wp-admin/options-general.php(10): require_once('/nas/content/li...')\n#6 {main}\n thrown in /nas/content/live/mysiteurl/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php on line 406, referer: https://mysiteurl.com/wp-admin/options-general.php?page=share-on-mastodon

Might also be worth mentioning that I'm using WP Engine's Global Edge Security which means the site lives behind some form of Cloudflare protection + CDN. After the patch push I was sure to clear my caches just in case.

akirk commented 1 year ago

Thank you, ther errors are just about the admin page, I fixed that bug in 0a333a2d1ace7ffe01229aa08625811d04f70c26.

The Swift apps are really picky about the correct JSON response format, I had to run Icecubes locally and add some debug code to find out what's wrong.

So, the bug above is about the redirect_uri(s) handling which I got slightly wrong and hope that I have fixed now (Mastodon seems a bit peculiar in that it allows multiple uris).

But the reason the apps are not booting is that they are not happy with the response from the server and are (from what I experienced so far) not very chatty about what it exactly is they don't like. So I am trying to fill the holes (that I can discover) until they are happy.

I have done another iteration of fixes, maybe this makes it work for you? Thanks for checking again and again!

tomfinitely commented 1 year ago

@akirk my pleasure — it's you we should be thanking for taking this on. When it's all working it will be quite an achievement. Soooo many thanks.

The last update didn't change any results for me. Mastodon proper, Mammoth, Ice Cubes, and Ivory all still refuse to authenticate.

image

tomfinitely commented 1 year ago

@akirk I disabled the following IndieWeb plugins and have successfully authenticated Ice Cubes to my site-hosted Mastodon account.

Screenshot 2023-04-17 at 14-24-48 Plugins ‹ Tom Finley — WordPress

akirk commented 1 year ago

Oh! IndieAuth! I submitted a PR to IndieAuth to make it compatible, it was recently merged so it will work again in the next version: https://github.com/indieweb/wordpress-indieauth/pull/245