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

Media Endpoint Support #11

Open
grantcodes opened this issue Sep 23, 2017 · 3 comments
Open

Media Endpoint Support #11

grantcodes opened this issue Sep 23, 2017 · 3 comments

Comments

@grantcodes
Copy link

I've been trying to get media endpoint support working on my site. I ran into the problem that micropub-express only supports video, photo and audio upload fields. Also the checks that require certain micropub fields don't apply to the media endpoint.

I managed to hack together support, so can create a pull request but it's really not good. I think ideally there would be a mediaHandler option, but I'm not sure how to create it myself.

Cheers,
Grant

@voxpelli
Copy link
Owner

voxpelli commented Nov 17, 2017

Just adding PR here for reference: #12

I agree that a media endpoint should be supported in some way. Unfortunately I'm short of time at the moment.

If someone else could try out #12 and give feedback, then that would be 👍 👍 👍

@paulrobertlloyd
Copy link

paulrobertlloyd commented Feb 3, 2018

Okay, I’ll take up the challenge! I’ve got a proof of concept going over on this branch (diff).

I’ve updated my dependency to point to @grantcodes updated node-micropub-express package. For the mediaHandler option, I’ve replicated the code used for the standard handler, the thinking being that this already includes support for uploading media.

I have managed to advertise a media-endpoint (based on a new config variable, which in my case I’m pointing straight back to this endpoint), however testing these changes using Micropub.rocks, I get the following results when trying to upload a photo:

✖️ Returned HTTP 201
✖️ Returned a Location header

HTTP/1.1 500 Internal Server Error
Server: Cowboy
Connection: keep-alive
Content-Security-Policy: default-src 'self'
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 148
Date: Sat, 03 Feb 2018 20:08:13 GMT
Via: 1.1 vegur

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Internal Server Error</pre>
</body>
</html>

I suspect that means duplicating handler was wishful thinking. Where am I going wrong, any clues?

@paulrobertlloyd
Copy link

paulrobertlloyd commented Feb 7, 2018

Hmmm, I can find a references to Location header in the tests for the existing handler, but it’s not clear what code is sending that. Could you give point me in the direction where this header gets set (and might need to be set in the mediaHandler) please @voxpelli? Are headers governed by another dependancy?

joshbeckman added a commit to joshbeckman/webpage-micropub-to-github that referenced this issue May 14, 2018
jeffwatkins pushed a commit to jeffwatkins/webpage-micropub-to-github that referenced this issue Jul 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants