-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publishing from OwnYourSwarm has been unsuccessful #56
Comments
thanks for filing, and sorry for the trouble! can you check if OwnYourSwarm is passing an auth token in its HTTP request, in either the |
Is there any way I can see that? I checked the access and error logs on my server, but I don't seem to see anything about such a request. Or is that something I would need to ask @aaronpk? |
sure! if OwnYourSwarm includes the token in the request body, put if OwnYourSwarm uses the @aaronpk usually includes good debugging features in his projects. i suspect OwnYourSwarm might have a way to see its own full micropub requests...? |
When I turn on the debug option and have ownyourswarm try again, I get this:
I am guessing that doesn't say anything we didn't already know. The ownyourswarm doc page says this:
I don't believe there is anything else on the OwnYourSwarm page about the entire request sent. There's the home page, with a brief description, the Dashboard, which has the information I pasted to you earlier, and the Docs page, which has a bit about how to set up indieauth, the part I pasted above, and some more information about the kind of data it sends after auth. I see from his web site that @aaronpk looks to be attending a conference, so that may be why I haven't gotten any further replies from him on the issue I put in on that project (aaronpk/OwnYourSwarm#16). His initial reply said he checked the logs, but I'm not sure which logs. |
thanks for the detail from their docs! looks like the here's where the plugin looks it up: @tamaracks, any chance your web server or hosting provider are stripping the |
WordPress 4.7.4 Running php -v from the command line on my host gets
As for the host stripping the header, that's a good question, but I am not sure. I did find a thread on the member support forum where a similar question was asked: (The user jdw is one of the people who runs the NearlyFreeSpeech hosting service.) But that thread is from 2015, so I don't know if the answer is still pertinent. And I am not quite sure how to interpret the answer (maybe it will make more sense to you). |
Oh, and this is the result of creating a php web page on my site that outputs phpinfo(). I was trying to remember how to get that. |
I can switch my web site between PHP 5.6 and 7.1 on my host's admin panel. I tried 7.1, but it didn't seem to make a difference in the result for this case (didn't seem to break anything with WordPress either yet, so that's good). I have to step away from my keyboard for a while now, but if you have any other suggestions of what I can try, I'll be happy to do so when I get back. I can submit a question on the host's member forum if you think it would help. |
thanks for all the info! based on all of this, i still do suspect the error_log( 'Micropub HTTP headers: ' . serialize( getallheaders() ) ); ...then get OwnYourSwarm to try again and see if the |
Hi! I was away from my computer the last 2 days, just catching up now. Now that you mention it, I do remember hearing about some web servers removing the It looks like for Apache, some people are having luck adding this line to their
If that doesn't solve it, or if the host isn't using Apache, you'll need to contact someone there to ask how to allow the header through. |
I tried that htaccess command, @aaronpk, but no dice, alas. The webserver is Apache, afaict. @snarfed, I did try the extra debugging. Output below. The first block was after I started debugging, but it appeared that the site-icon-extended plugin might have been getting in the way. I deactivated it, and tried again, so this first set of logs may not be so useful, but I included it just in case.
This is the request I had OwnYourSwarm try after I deactivated the other plugin:
Let me know what you think. If it's time for me to contact the host, do you think there's any merit to the suggestion from that forum post about renaming the header:
Even if it wouldn't be useful for actually getting this all to work, is there a way we can test to see if the authorization token really does come through when it's renamed? It might be helpful to know when it comes to contacting them. |
thanks for doing all this extra debugging. yup, confirmed, the header isn't coming through. the logged headers before and after deactivating that plugin were the same, and don't include
you're welcome to try renaming it if you want! the micropub plugin won't currently find it if it's named something else, but we could definitely make that configurable in a future release. |
If I put the rename line in there, would it show up in the same line in debug.log if it worked? |
yup! |
Hmm, then it doesn't seem to come through then either. 😠 How odd. |
The output of the header debug line seems to have been the same for everything I've tried. Any chance it's something about Wordpress that's causing it? Do you know for sure that others using the wordpress micropub plugin have had success with a request that includes an authorization header? |
good questions! i suspect it's getting stripped before wordpress sees it. it's definitely worked for other people, e.g. the micropub.rocks validator: https://micropub.rocks/implementation-reports/servers/27/Ouvg5VCJrclDWHUtQHXA |
Thanks for the help. Before I contact the host, I am trying to see if I can break it down into a simple test to check for the Authorization header without Wordpress or anything else in the mix. Can you tell me if the following should work? I created a page called authtest.php with these contents:
I tried sending this curl command from my Mac:
|
yup! i don't really know PHP, surprisingly, but that looks good to me. |
Lol, thanks. So far with that script I have been unable to get an authorization header in the output. I'll give this a try when I communicate with the host.
… On May 4, 2017, at 8:58 PM, Ryan Barrett ***@***.***> wrote:
yup! i don't really know PHP, surprisingly, but that looks good to me.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Well, I have an initial answer from my host. The rule in the .htaccess file puts that value into the $_SERVER variable, but not as a header, so that's why the initial PHP script I had put together wasn't returning it. .htaccess rule I am currently using, for reference:
I rewrote my test script to echo everything in the $_SERVER array, and I did find the renamed variable, under $_SERVER['MY_AUTHORIZATION']. (I could name the variable something else via the rule above, of course.) If this is as much as I can get from the host, is that something that could be available to the micropub plugin if it was modified to find it? I have replied to him to see if I can get more information about what actually happens to the header, because it still doesn't seem clear to me. He had said that the presence of an AUTH_TYPE variable in the $_SERVER array would indicate that Apache had processed the header, but as far as I can tell, that variable isn't present. For reference, my current test script:
My current curl request (I passed an Authorization header that I believe would look more like the Bearer token request just to be closer to the micropub request):
And the latest output from that script:
|
Well, I was bored, so I poked at it a bit. I got it to be able to recognize the token by giving my renamed server variable a four-letter plus underscore prefix and modifying line 911 of micropub.php. I chose MENV_ (so MENV_AUTHORIZATION) and changed line 911 to
so that it would pick up my variable in addition to the HTTP_ variables. I have no idea if this is a good way to solve it, but it works, for some value of works. Unfortunately, the plugin endpoint doesn't seem to know what to do with most of the data that OwnYourSwarm throws at it. Most of it doesn't get imported, like I think anything in the "checkin" section of the h-entry object, which is a bunch of the location stuff. Also, it fails to post if no comment was added because then it's missing content, title, and excerpt fields. I am not really sure where to start to try to solve this part. I don't sufficiently understand how micropub.php intakes the data, what kind of data it expects, and what it does with it to put it into WP. |
So it sounds like the host is specifically blacklisting the As for the other issues, I think I want to provide a better fallback behavior for Micropub endpoints that don't support the |
Something is definitely blocking any environment variable called HHTP_AUTHORIZATION, no matter how I try to set it in .htaccess. I assume it's some security measure, but I am waiting to hear back from them in case there is anything to do about it. Or at least to get an idea what is actually happening.
If anybody else runs into a similar issue, then I guess they would have to solve it similarly. Perhaps the plugin could tell them what to name the variable and how.
I'll enter the issue for OwnYourSwarm. I have another question about that project as to what could be done with event info. I saw in the OwnYourSwarm dashboard that the Swarm object had picked it up in one of my checkins. It would be cool if that could also be incorporated somehow.
|
thanks again for the detailed sleuthing, all! re the checkin object, @aaronpk's idea for a fallback is good, since it's not yet part of either the micropub or microformats2 spec, but OwnYourSwarm is a valuable service, so I'm happy to add support for it anyway. I'll track that in this issue. |
hey @tamaracks, if you're up for switching your plugin to the code at github head, it now handles OwnYourSwarm's checkin objects and auto-generates content. feel free to try it! otherwise i'll test it and cut a release soon. |
That was quick! And it seems to work! I copied the raw code for micropub.php and pasted it into micropub.php on my server (and added back my little modification to catch the authorization), and had OwnYourSwarm resend the last checkin. OYS got a successful response and I got a post in WP that says "Checked into Starbucks." With custom fields filled in for geo_address, geo_longitude, and geo_latitude. Would it make sense to add a link to the checkin itself in there somewhere? I know it's stored in the syndication links, but I would think that would be hard to display on the final page because even if it's accessible to the theme, other links may get added later. And this also leads me to something else I've been thinking of for the micropub plugin. Is it possible to add some kind of default slug for posts with no title? I really dislike having the Wordpress post ID in the permalink, because it seems like a particularly meaningless piece of data. Even something date-based, like '%Y-%m-%d-%H%M' as the slug would be preferable (bonus if it could be user-configurable). Similarly, it seems like the Post Kind is set correctly, but it would be cool if the WP post format could also be set to something other than standard for a title-less post, like aside. I am pretty sure that my theme (SenPress, child of SemPress) is basing the template on post format, and aside prevents an ugly title link based on post ID. This isn't as vital as above, because it's relatively easy to change later, unlike the permalink, which can get shared right away by syndication, but it would be handy. I can open new issues for any of these if you'd prefer. |
hey, thanks for testing! i can definitely link to the checkin, but the OYS docs say the link isn't public, it's only visible to your friends on foursquare - https://ownyourswarm.p3k.io/docs#checkins - which is why i omitted it for now. let me know what you think. as for slug, i think you can actually configure the default on your own wordpress instance...? assuming so, i'd probably defer to that instead of setting the slug explicitly in the plugin. as for post kinds, i'm actually not too familiar with them, and they're part of a separate plugin, so i'm just going to cc @dshanske and step back... |
Ah ha, that's probably a good point about the checkin link. I don't think you can configure how the slug works. At least not that I can see or find reference to. You can set a permalink style in WP settings that wouldn't use the slug (called %postname% in WP terminology) or post title, but I don't want to change the permalink style. I like using the title as part of the permalink. It's only a problem when posting something that isn't given a title. Which, for indieweb happens with things like notes. But Wordpress, if you put a title for the post, it auto-generates a slug based on the title. And if you don't put a title, it sets the post ID as the slug. Which you can change in the add/edit post screen, but if syndication is set up, then by the time you go back and change it, the initial permalink is already out there in the world. And I didn't mean setting the post kind, I meant setting the post format, which is part of Wordpress itself. (I do wish something would tie post kind and post format together, but that's definitely outside the scope of this discussion.) Although looking closer, I guess that the posts coming in the micropub endpoint may just be using the setting that the Post Kinds plugin has for the default kind on new posts. But in any case, I mean the Post Format. |
thanks for the clarifications! and sorry, should have read more carefully originally. :P i get your point about posts without title using post id for slug. it's a bit orthogonal, though - it affects all posts, not just ones created via micropub, and it's somewhat personal preference - so it may be more appropriate for a separate plugin? as for post format, makes sense. any idea how that should work? ie would you pass in post format as a custom mf2 property inside the micropub request? or just always use a specific format for title-less posts? |
You're probably right. I'm a little surprised there doesn't seem to be one already, but if there is I can't find it. I am trying my hand at writing one. It should be fairly simple, and I think I found something that gives me a starting point, but I don't know anything about writing a Wordpress plugin, so the data passed into it and where to hook in are the tricky part. It could all end in tears. 😉 Personally, it's really just title-less posts that I am concerned about, because if given the right format (and depending on the theme), you can refrain from displaying a title at all, rather than WP showing a title with the post ID. The problem with using an mf2 property is that you're depending on the source of the submission. If you can control it, that's great, but when it comes to an external source, like OwnYourSwarm, or perhaps a client that doesn't support it, that's harder. |
Hey, hey, I got my plugin to work! In a very rudimentary way, anyway. So far, it seems that it runs every time a post is saved, not just the first time. It should only matter if the title is added or removed. Or if I check for the post name first, then it won't run at all when creating a title-less post in the Wordpress post editor, because if you don't put a title there, Wordpress puts 'auto-draft' in the slug field. Anyway, it works well enough to take care of my need here, as far as the post name/slug goes. Presumably, I could write something similar for controlling post format, but I haven't been able to discover where that data is stored in the post array. |
One other thing that occurred to me while testing. If a Swarm checkin has an accompanying text status update entered by the user, then the line you added about checking in at the place with a link isn't included. I can see this being kind of tricky, because how far do you go in adding content? You could add the "Checked into..." line to the end of the post content that came through. It might be that not everyone would want that. But without it, there's no way to get that link later or add it oneself. |
congrats on getting your plugin working! when micropub creates or edits a post, it stores the full original mf2 in post meta, so you can get the venue and checkin link (etc) later in code. regardless, i can definitely still include the Checked into... line when there's content and also a |
I was also able to cobble together a rather hacky plugin to set category and format automatically on these posts, based on finding the text 'Checked into <a' in the content. So I think I've got that part covered as well, if you don't think it belongs in micropub.php. Maybe some day I can figure out a way to make it more generalized and flexible, but it serves for now. Thus, I would appreciate the change that adds the checked into line when there's content. 😉 Maybe there's a more robust way to identify those posts, but I haven't thought of it yet. |
@tamaracks If you push the code you have for setting the format to @dshanske I suspect he could roll it into Post Kinds (which also automatically sets the Post Format) so that it's covered for everyone else who may have this issue. |
@chrisaldrich It's really just a basic check that the post category is uncategorized (ID 1, technically), and that the content contains 'Checked into <a', which matches the default content that @snarfed added for OwnYourSwarm posts. I am not sure it's worth sharing at this stage. 😀 Understanding Post Kinds better is on my list, because I am not sure that I have seen it do anything automatically yet, so I don't really know what it is supposed to do. I don't know if I am missing something or what. |
@tamaracks There's no need to explicitly set a Post Format in WordPress as it will automatically be set based on the Post Kind setting in Post Kinds on initial publish. (You can also tweak them by hand if necessary, so for example when using the I also think @dshanske fixed the proper kind settings on micropub in the latest development branch of post kinds as well. dshanske/indieweb-post-kinds#87 (Hopefully this should take care of checkins as well.) |
@chrisaldrich I have not found that to be true at all for me. I routinely get posts with a kind of Note and a format of Standard. I guess I should check in over on that project to see what's up. |
@tamaracks i remembered why the micropub plugin omits the auto-generated Checked into ... if there's content. it omits it if you also have the Post Kinds plugin or an mf2-aware theme installed, since those want to handle rendering mf2 properties themselves. @dshanske, do you have any plans to support OwnYourSwarm's |
not sure this will stay. depends on discussion in #56 (comment)
@tamaracks the code at HEAD now includes the Checked into... text even with the Post Kinds plugin. feel free to try it! |
I have plans to build check-ins into Post Kinds. They are a future plan as of now |
@snarfed Thanks for the update! I missed it earlier. Just pasted the new code into the PHP file. Haven't tested it yet, I'll see what happens with the next checkin. 😄 |
tentatively closing. feel free to reopen! |
Sorry, I meant to update. I have been getting the checked into line, thanks! I still have the original issue with the authentication header, although I can understand it might be a very narrow problem that is hard to have a good solution on this end. I am certainly capable of continuing to make the change I mentioned above when I update the plugin. I still hold out hope that it might be a bug, but I haven't heard back from my host one way or the other. |
thanks again for the detailed debugging! and i'm totally open to merging a PR with your workaround so you don't have to maintain it separately. maybe with the |
I set up OwnYourSwarm, but it hasn't been able to publish anything to my Wordpress micropub endpoint yet. I do have version 1.1 of the plugin installed.
When I try have OwnYourSwarm try again for the last checkin from the dashboard, it shows this response:
It also shows a Swarm Checkin Object:
and an h-entry checkin object:
The text was updated successfully, but these errors were encountered: