akirk / enable-mastodon-apps Goto Github PK
View Code? Open in Web Editor NEWAllow accessing your WordPress blog with Mastodon clients
License: GNU General Public License v2.0
Allow accessing your WordPress blog with Mastodon clients
License: GNU General Public License v2.0
With the Ice Cubes auth (+IndieWeb conflict?) issues behind us, posting from the Ice Cubes app as my site user is possible. However, there are about 10 separate toots being rendered out for the single toot I test-posted, and the reply to said test-toot from my standard user account also shows up about as many times.
I'm curious if could you make it so you can specify what CPT a new post should use, having these show up as "posts" with a post format of status is nice but having them in a different CPT would work well for my needs. Any thoughts on this?
I'm getting "Permission Denied - Either you don't have permission to access this or it is no longer available"
Here is the login sequence from Ivory after typing in jasontucker.blog in ivory it opens the web browser to login to the site using indieauth and then go back to Ivory and displays this error.
I do end up getting this notice in the dashboard from Rank Math:
SEO Notice: A previously published term has been moved to trash. You may redirect https://jasontucker.blog/?mastodon-app=xxxxxxxxxxxxxxxxxxxx to a new url.
Looking in Settings > Mastodon Apps I see the login attempts and the access tokens and apps listed.
[2023-05-16 17:49:09.889] POST /api/v1/apps
params array (
'client_name' => 'Ivory for Mac',
'redirect_uris' => 'com.tapbots.IvoryMac.13181:/request_token/xxxx-xxxx-xxxx-xxx-xxxx',
'scopes' => 'read write follow push',
'website' => 'https://tapbots.com/',
)
user_agent 'Ivory/13181 CFNetwork/1406.0.4 Darwin/22.4.0'
I ran a tail on the server and captured the access, error and debug logs for you
tail -f *.log
'
XXX.XXX.XXX.XXX - - [16/May/2023:10:58:06 -0700] "POST /api/v1/apps HTTP/2.0" 200 312 "-" "Ivory/13181 CFNetwork/1406.0.4 Darwin/22.4.0"
XXX.XXX.XXX.XXX - - [16/May/2023:10:58:06 -0700] "POST /oauth/token HTTP/2.0" 200 149 "-" "Ivory/13181 CFNetwork/1406.0.4 Darwin/22.4.0"
XXX.XXX.XXX.XXX - - [16/May/2023:10:58:09 -0700] "GET /oauth/authorize?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&redirect_uri=com.tapbots.IvoryMac.13181%3A%2Frequest_token%2FXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX&response_type=code&scope=read%20write%20follow%20push HTTP/2.0" 302 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
XXX.XXX.XXX.XXX - - [16/May/2023:10:58:09 -0700] "GET /wp-login.php?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&redirect_uri=com.tapbots.IvoryMac.13181%3A%2Frequest_token%2FXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX&response_type=code&scope=read%20write%20follow%20push&action=enable-mastodon-apps-authenticate HTTP/2.0" 200 1839 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
XXX.XXX.XXX.XXX - - [16/May/2023:10:58:09 -0700] "GET /ads.txt HTTP/2.0" 404 21657 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
XXX.XXX.XXX.XXX - - [16/May/2023:10:58:10 -0700] "POST /oauth/authorize HTTP/2.0" 302 0 "https://jasontucker.blog/wp-login.php?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&redirect_uri=com.tapbots.IvoryMac.13181%3A%2Frequest_token%2FXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX&response_type=code&scope=read%20write%20follow%20push&action=enable-mastodon-apps-authenticate" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
XXX.XXX.XXX.XXX - - [16/May/2023:10:58:10 -0700] "POST /oauth/token HTTP/2.0" 200 150 "-" "Ivory/13181 CFNetwork/1406.0.4 Darwin/22.4.0"
==> debug.log <==
[16-May-2023 17:58:10 UTC] IndieAuth Error: 401 invalid_token - Invalid access token {"error":"invalid_token","error_description":"Invalid access token"}
[16-May-2023 17:58:10 UTC] IndieAuth Error: 401 invalid_token - Invalid access token {"error":"invalid_token","error_description":"Invalid access token"}
[16-May-2023 17:58:10 UTC] IndieAuth Error: 401 invalid_token - Invalid access token {"error":"invalid_token","error_description":"Invalid access token"}
[16-May-2023 17:58:10 UTC] REST request: /enable-mastodon-apps/api/v1/accounts/verify_credentials: [](Header Present)
[16-May-2023 17:58:10 UTC] REST result: : {"code":"invalid_token","message":"Invalid access token","data":{"status":401,"data":[]}}(401) - [](User ID: 0)
==> access.log <==
XXX.XXX.XXX.XXX - - [16/May/2023:10:58:11 -0700] "GET /api/v1/accounts/verify_credentials HTTP/2.0" 401 89 "-" "Ivory/13181 CFNetwork/1406.0.4 Darwin/22.4.0"
`
Also then document how to use a filter to change the post type of new posts.
I enabled the app, went to my endpoint and all I got:
Warning: file_exists(): open_basedir restriction in effect. File(/.htaccess) is not within the allowed path(s): (###) in /srv/###/wp-admin/includes/misc.php on line 278
in fact the whole setup was affected, the error log drowned with this message. With error reporting turned off, the plugin works reasonably well, but this is not acceptable.
I would propose to remove all dependencies to third party plugins like ActivityPub and Friends and to focus on actions/filters, that can be then implemented by the Friends and ActivityPub plugin.
This would make the handling easier and provide a more solid base for others to build on top.
When a feed is subscribe through a virtual user, this doesn't show up appropriately.
In the account that follows the one hosted on WP in all the toots there appears a link to the blog post representing these toots. Since what I see there is exactly the contents of the toot I consider this link as not necessary. If it is there for some reason I do not know I'd wish for an option in settings to suppress it.
Please consider this as a suggestion or wish not an essential bug.
If I set this up and have a working account from my WordPress blog, does migrating work to send existing followers to this account, as if it were another Mastodon account?
Thanks!
Starting with 0.6.3 I noticed that images and videos on posts that were visible on the web were missing in Ivory and the default Mastodon app.
After some digging I traced it to this change and its removal of all Gutenberg tags also removing things like wp:image
.
Hi Alex,
I finally had some time do some further debugging on why apps like Mona or Ivory can't connect to my WordPress instance. When turning debugging on in wp-config.php and have Mastodon-Apps log too I get the following additional information. I hope this helps in further debugging.
Best,
Camiel
Deprecated: Implicit conversion from float 16963225818901.12 to int loses precision in /home/deb59542n6/domains/schoonens.blog/public_html/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-app.php on line 145
Deprecated: Implicit conversion from float 16963225829980.43 to int loses precision in /home/deb59542n6/domains/schoonens.blog/public_html/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-app.php on line 145
Deprecated: Implicit conversion from float 16963225852317.021 to int loses precision in /home/deb59542n6/domains/schoonens.blog/public_html/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-app.php on line 145
Deprecated: Implicit conversion from float 1696322581.890112 to int loses precision in /home/deb59542n6/domains/schoonens.blog/public_html/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php on line 521
Deprecated: Implicit conversion from float 1696322582.998043 to int loses precision in /home/deb59542n6/domains/schoonens.blog/public_html/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php on line 521
Deprecated: Implicit conversion from float 1696322585.231702 to int loses precision in /home/deb59542n6/domains/schoonens.blog/public_html/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php on line 521
Recently Logged Requests
Debugger [2023-10-03 08:43:01.890]
Warning: Undefined array key "status" in /home/deb59542n6/domains/schoonens.blog/public_html/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-admin.php on line 344
200 POST [/api/v1/apps](https://schoonens.blog/api/v1/apps?_wpnonce=40b5d9ea0e&_pretty=1)
params array (
'scopes' => 'read write push follow',
'redirect_uris' => 'com.jonny.mona://oauth',
'client_name' => 'Mona for iPhone',
'website' => 'https://mastodon.social/@MonaApp',
)
current_user 0
user_agent 'Mozilla/5.0 Macintosh Intel Mac OS X 10_15_7 AppleWebKit/605.1.15 KHTML like Gecko Version/17.0 Safari/605.1.15'
app Enable_Mastodon_Apps\Mastodon_App::__set_state(array(
'term' =>
WP_Term::__set_state(array(
'term_id' => 246,
'name' => 'enable-mastodon-apps',
'slug' => 'enable-mastodon-apps',
'term_group' => 0,
'term_taxonomy_id' => 246,
'taxonomy' => 'mastodon-app',
'description' => '',
'parent' => 0,
'count' => 0,
'filter' => 'raw',
'meta' =>
array (
),
)),
))
Apologies if I'm not understanding fully, hoping someone can help explain. Below are my issues/questions. Maybe this would've been better as a discussion item but I didn't see a discussion area to post this.
I was able and to login to my Wordpress site with Ivory, Metatext, Elk (originally - more below), Mona (Beta), and Ice Cubes but not Mammoth or the official Mastodon app. There are issues for sure, and some are the same for all of them while some have unique issues.
So my question is, what is the purpose of this app? Is it just to post status updates from a native Mastodon app and that is all, because that is essentially the only function that's working for me from any of the various apps.
If that is the case, it does not offer a better experience than updating statuses from Wordpress.
Hoping these are just bugs because it's so new because I had super high interest in this project and in fact was one of the only reasons I began migrating from Micro.blog to Wordpress.
When logging in with my WordPress account my Mastodon handle is "@admin@my-wordpress".
It would be great if I could easily change my user handle.
I had tested it in Mona. I'm using standard posts.
Any ideas for debugging?
Wordpress Post Title created in WordPress are not showing in Mona too.
Ps: great work!
Hello Alex,
still a great work.
When trying to follow someone in Mona for IOS, I get an error message. However, the followed person appears in the Friends plugin on Wordpress. I also can't see the user's posts and followers in profile view.
In general, I only see my posts and the replies to them in timeline.
Our blog makes use of the ActivityPub-WordPress plugin. It's great, and we want to be able to use that integration in conjunction with this one.
There's just one problem: clients used will instead post as the logged-in user, rather than the special blog user created by the plugin. In other words, if the ActivityPub plugin opts to post everything via @[email protected]
, posting with a client will instead post with @[email protected]
Over at We Distribute, we're super interested in talking a Fediverse-native approach to publishing. One thing we want to experiment with is using ActivityPub to post articles, podcast episodes, and status updates. In the future, it might be worthwhile to get rid of our Mastodon account, and instead post everything from our blog Actor.
This API integration would allow our team to use whatever Mastodon apps we prefer, maybe even a team app like Buffer. We could basically do everything we need to do in one place.
The plugin could offer a checkbox to defer to a predefined Actor upon login. I could see this working in one of two ways:
Admin
role could log in via a Mastodon client, and anything they post goes to that ActorTried to delete posts in Tusky and in Pinafore but without success. In both cases the post was not deleted in WP backend. In Pinafore did not happen nothing even though deletion was confirmed. In Tusky the toot at least disappeared from the timeline. Would have expected this in both apps and furthermore that it will be deleted in WP backend as well and thus won't appear nowhere anymore.
After installing the app I registered various apps - Fedilab, Pinafore, Tusky - successfully and the toots of people the account follows are displayed in all of these. But that's it. I neither can post - toots and direct messages are not shown in the timelines of my followers - nor can I follow new people. The ones I follow right now I added through the friends plugin. The apps also do not show how many people I follow or follow me and neither who they are.
Trying to find out if changes in the settings might alter this behavior I got during saving these changes an error message and an email describing the error.
Error-Details
==============
An Error of Typ E_ERROR occured at line 93 of the file /home/webpages/xxx/yyy/WordPress_01/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-app.php. Error message: Uncaught TypeError: Cannot access offset of type string on string in /home/webpages/xxx/yyy/WordPress_01/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-app.php:93
Stack trace:
#0 /home/webpages/xxx/yyy/WordPress_01/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-app/includes/class-mastodon-admin.php(166): Enable_Mastodon_Apps\Mastodon_App->set_post_formats(Array)
#1 /home/webpages/xxx/yyy/WordPress_01/wp-includes/class-wp-hook.php(308): Enable_Mastodon_Apps\Mastodon_Admin->process_admin('')
#2 /home/webpages/xxx/yyy/WordPress_01/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#3 /home/webpages/xxx/yyy/WordPress_01/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /home/webpages/xxx/yyy/WordPress_01/wp-admin/admin.php(237): do_action('load-settings_p...')
#5 /home/webpages/xxx/yyy/WordPress_01/wp-admin/options-general.php(10): require_once('/home/webpages/...')
#6 {main}
thrown
WordPress-Version 6.2
Plugin-Version: Enable Mastodon Apps (Version 0.1.1)
PHP-Version 8.1.17
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:
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`
Posting toots with picture(s) that have a media description fails. Fedilabs error message said that it failed to upload media and Pinafore reports "Unable to post toot: NetworError when attempting to fetch resource." Without the description the toots were posted correctly.
Receiving this error when trying to update (add/delete/modify) widgets on WordPress 6.3.1 using the Gutenberg editor.
I turned on WP_DEBUG and received the following error when loading the widget editor:
function wp_enqueue_script was called incorrectly
I disabled all other plugins and turned them on one by one. When I turned on this one, I started getting the error again.
Tried to create lists with through Fedilab but always failed with an error message that said that an error occurred.
Hi, I’ve tried to connect to my WordPress website using multiple clients (Ivory, ELK, IceCubes). Only IceCubes is able to connect but does behave buggy (e.g. doesn’t refresh posts, avatars get mixed up).
I did some debugging this morning through the logging function when connecting.
With Ivory I get the following result at this api endpoint when trying to connect the app: https://schoonens.nl/api/v1/apps?_wpnonce=1bb4308bdb&_pretty=1
{ "code": "rest_no_route", "message": "No route was found matching the URL and request method.", "data": { "status": 404 } }
When going through the logs for IceCubes I get the following empty result when refreshing the home timeline through this api endpoint: https://schoonens.nl/api/v1/timelines/home?_wpnonce=1bb4308bdb&_pretty=1
[]
The website is a vanilla WordPress install for testing purposes, I have five plugins activated:
I'm not sure since which version 'cause I jumped some - it might be 0.3.0 or 0.3.1 - Fedilab has problems showing toots. In the beginning no new toots were downloaded at all, in the moment they are but nothing before the problem occured. And if I look at my own profile no toot is shown, not even new ones.
Although authentication with my WordPress instance appears to be successful, when I try to post using Elk or Pinafore (and I think Tusky, though it's harder to see the codes and responses), I'm getting a number of 401 responses with "Invalid Access Token."
{
"code": "invalid_token",
"message": "Invalid access token",
"data": {
"status": 401,
"data": []
}
}
Previously I was also receiving a number of CORS errors but I believe those are resolved. Notably, the 'instance' and 'authentication' endpoints are returning this response. There are others like 'filters' and 'custom_emojis', but I know those are not yet implemented.
The token is listen on the Mastodon Apps page and ActivityPub and Friends are installed.
ActivityPub V2 was just released and it looks like it breaks compatibility with this plugin as the timeline generates an "internal server error" on clients and you cannot connect a client.
After #30, posts boosted by a virtual user are not attributed to them correctly, it appears as if the person who is boosted did the boosting themself.
Greetings,
I'm attempting to use Ivory, Elk and Pinafore to connect to my website wpwatercooler.com I have ActivityPub, Friends and this plugin installed and when I attempt to connect to wpwatercooler.com as an instance I get "contacting server" "client error please try again" in Ivory and Elk and Pinafore "login" but nothing works and I start getting app specific errors. Elk - "ERROR: TypeError: Failed to fetch". Pinafore - "Internet request failed. Showing offline content"
How should I start by debugging this?
The username for the account is wpwatercooler that I'm logging into on wpwatercooler.com
From the apache error log
[Mon Feb 19 19:19:29.212129 2024] [proxy_fcgi:error] [pid 932895] [client xxx:33754] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /domain.com/public_html/blog/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-api.php:1291
Stack trace:
#0 /domain.com/public_html/blog/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-api.php(980): Enable_Mastodon_Apps\Mastodon_API->get_status_array()
#1 /domain.com/public_html/blog/wp-content/plugins/enable-mastodon-apps/includes/class-mastodon-api.php(1694): Enable_Mastodon_Apps\Mastodon_API->get_posts()
#2 /domain.com/public_html/blog/wp-includes/rest-api/class-wp-rest-server.php(1193): Enable_Mastodon_Apps\Mastodon_API->api_public_timeline()
#3 /domain.com/public_html/blog/wp-includes/rest-api/class-wp-rest-server.php(1041): WP_REST_Server->respond_to_request()
#4 /domain.com/public_html/blog/wp-includes/rest-api/class-wp-rest-server.php(431): WP_REST_Server->dispatch()
#5 /domain.com/public_html/blog/wp-includes/rest-api.php(424): WP_REST_Ser...'
While the Enable Mastodon Apps plugin works with a number of other Mastodon clients, Ivory for iOS still can't connect. Let's use this issue for debugging.
Helpful for debugging would be:
Thanks!
Reopen this one as a new issue since it is not fixed for me. And thanks for fixing some of the other bugs I had reported.
There is one more thing I noticed. Looking at my own profile page I don't get the correct data displayed. Actually the data displayed differs with the account I come from. If I go to the page from my own (WP) account, both follows and followers are said to be zero, which not is true. Clicking the respective tabs causes an error. Pinafore is more specific with the error message and says: Error: Request failed: 404. Do I go the profile from another account on another server the number of Follower is always shown correctly, the number of accounts I follow is always show to be zero. Only exception, when I go to the profile from the account I follow back.
I've 0.31 installed right now.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.