keithjgrant / omnibear

A Micropub browser extension
MIT License
36 stars 8 forks source link

Replace syndication targets with the response from the endpoint #68

Closed pstuifzand closed 6 years ago

pstuifzand commented 6 years ago

I put back the original fetchSyndicationTargets function. The response doesn't contain "ok", as the micropub helper returns the json object.

keithjgrant commented 6 years ago

Does the micropub helper always return an array? Or should we still typecheck that and store an empty array otherwise?

pstuifzand commented 6 years ago

https://github.com/grantcodes/micropub/blob/master/src/main.js#L505

It returns the json object itself when it is ok. It will call reject on error.

It could be a problem when the config endpoint doesn't return the right thing, but I'm not sure if this should be checked.

keithjgrant commented 6 years ago

The MP spec says:

If no endpoints are defined, the value of the syndicate-to object SHOULD be an empty JSON array [].

But doesn’t say it MUST, so we should probably coerce a non-array to []

pstuifzand commented 6 years ago

That would mean that only the "response.ok" part should be removed from the if.

keithjgrant commented 6 years ago

Yeah, looks like. If you want to do that, I'll merge in the change.

pstuifzand commented 6 years ago

I tested it: Omnibear loads the syndication endpoints https://p83.nl/p/655

keithjgrant commented 6 years ago

Thanks!