Skip to content
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

Support Syndication Targets #28

Closed
dshanske opened this issue Jul 6, 2016 · 15 comments
Closed

Support Syndication Targets #28

dshanske opened this issue Jul 6, 2016 · 15 comments

Comments

@dshanske
Copy link
Member

dshanske commented Jul 6, 2016

https://www.w3.org/TR/micropub/#syndication-targets

The goal is to improve the plugin to the point it can support a path from a Micropub client to a POSSE plugin.

_The endpoint MUST return the response in [JSON] format, with a key of syndicate-to and the values being objects descriptive of the supported syndication targets.

At a minimum, a syndication destination MUST have uid and name properties. The uid property is opaque to the client, and is the value the client sends in the Micropub request to indicate the targets to syndicate to. The name property is the value the client can display to the user. The name should be unambiguously descriptive of the destination, so that if for example there are two destinations on the same service, the name can disambiguate them.

The Micropub server MAY also include additional information about the destination service and user account. This is accomplished with the additional properties service and user, both of which can have three properties, name (a human-readable name), url and photo (both URLs).

The client may use the service and user properties to enhance the display of the syndication options, for example by including the user or service photos on the syndication buttons._

So, the current implementation of syndication target is not in JSON. But the specification has moved toward JSON for some things, and the current plugin design doesn't support that.

But the issue is the support for multiple POSSE plugins. The easiest way is the UID, except if you have multiple different plugins, they could set the same UID. So, this is what I am thinking...

  1. The UIDs have to be managed by the Micropub plugin, as opposed to the individual POSSE plugins...otherwise there could be a collision.
  2. The Micropub plugin needs a function that adds in the syndication targets, replacing the existing system, so it can require all parts be filed in.

I'm going to try to put something together, and then add support to Bridgy Publish, my simple plugin for Bridgy Publish support. But it needs to be clear how to add support in any arbitrary POSSE plugin, and that has to be documented in the Micropub literature.

Looking for ideas.

@snarfed
Copy link
Member

snarfed commented Jul 6, 2016

this will be great! definitely ambitious though. fortunately we can take a few incremental steps along the way first, each independently, eg JSON input/output, compliance with the current spec, notably query param names, and simple syndicate-to support, without any uid or target management. (and unit tests as we go. :P)

@dshanske
Copy link
Member Author

dshanske commented Jul 6, 2016

I can't use Micropub without POSSE support. So I need to move in the direction of adding the features that I need to fully adopt.

@dshanske
Copy link
Member Author

dshanske commented Jul 6, 2016

Just to mirror what I noted in #25 , plan is to rearrange just enough the query from the post at the start of the process, and then enhance that element to support the specification as I get the syndicate-to working.

@davidmead
Copy link

davidmead commented Jul 18, 2016

@dshanske @snarfed I assume this is so that the plugin can support things like Quill? I asked @aaronpk about that, as I couldn't get Quill to syndicate when using it with my WP blog.

Happy to beta test if you get something going :-)

@dshanske
Copy link
Member Author

The idea is that it would allow a POSSE plugin to support being triggered by the Micropub plugin. Since the only POSSE plugin I personally control is the Bridgy Publish one...I was going to test with that. If that works, I could try to get other developers to either add code, or accept a PR.

@davidmead
Copy link

@dshanske i didn't know you had a Bridgy Publish plugin. I'll have to give that a spin :-)

@dshanske
Copy link
Member Author

It basically just adds a checkbox and sends webmentions to Bridgy Publish.

@davidmead
Copy link

That might solve an issue I'm having. When I post in Instagram and PESOS it to my blog, I have an IFTTT recipe that posts it to Twitter, but I don't get the Twitter syndication link on my blog, just the Instagram one. I have to add the Twitter one manually. Looking for a way to overcome that.

@snarfed
Copy link
Member

snarfed commented Oct 10, 2016

with all the recent work i've done on bringing this up to the current spec, i think this is pretty much done.

  • it calls a micropub_syndicate-to filter that collects and returns syndication targets to queries.
  • it calls before_micropub and after_micropub actions and passes both the input mf2 and WP_Post args. syndication plugins could hook into after_micropub to POSSE.
  • it stores and returns mf2 properties in mf2_* post meta values, which can include syndication.

tentatively closing. feel free to ask q's or reopen!

@snarfed snarfed closed this as completed Oct 10, 2016
@miklb
Copy link

miklb commented Jul 16, 2017

@snarfed my php-fu is failing me, could you provide an example of how I can pass a new syndicate-to target using the filter? I want to add GitHub using silo.pub. I was going to use the existing access token provided to test. I have the uuid set to https://silo.pub/micropub?access_token=abc123 and name set in a array, but I'm missing the step of getting that into the filter.

I'm not even sure where to debug, just the new syndicate-to doesn't appear in Quill along with the bridy ones from the bridgy plugin.

Any tips greatly appreciated.

@dshanske
Copy link
Member Author

Look at the code in Bridgy Publish.

@miklb
Copy link

miklb commented Jul 16, 2017

Look at the code in Bridgy Publish.

thanks, I did try mimicking that code 1st, but to no avail.

@snarfed
Copy link
Member

snarfed commented Jul 17, 2017

@miklb sure! should be something like this:

function micropub_syndicate_to_github($synd_urls, $user_id) {
  $synd_urls[] = 'https://silo.pub/micropub?access_token=abc123';
  return $synd_urls;
}
add_filter('micropub_syndicate-to', 'micropub_syndicate_to_github');

@miklb
Copy link

miklb commented Jul 17, 2017

Thanks! I was missing the return.

In case anyone else comes across this, for Quill at least, I had to make it an array with the uuid and name

function micropub_syndicate_to_github($synd_urls, $user_id) {

  $synd_urls[] = array(
 'uid' => 'https://silo.pub/micropub?access_token=abc123',
 'name' => 'GitHub',
);
  return $synd_urls;
}
add_filter('micropub_syndicate-to', 'micropub_syndicate_to_github');

@chrisbeckstrom
Copy link

hey all! Thanks for your hard work on this. I know this is an old closed issue, I'd be happy to open a new one if you think that would be best.
I'm trying to figure out how to configure a "post to mastodon" plugin as a micropub "syndicate-to" choice. I've read through this thread but I'm really grokking it.
I thought that if I set the Mastodon Auto-poster to "post to mastodon on new posts" that when I make a new post with a micropub client that it would be triggered. However, that's not the case. I don't know if that's an issue with the Mastodon Auto-poster plugin or what. Wondering if it would be better to simply learn how to add new syndication destinations... so here I am :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants