#dev 2021-08-14
2021-08-14 UTC
nertzy, rockorager, Seirdy, hendursaga, jeremycherfas, hendursa1, tetov-irc and diegov joined the channel
# capjamesg[d] Suppose I want to support micropub on my static site. I'm thinking about making a git commit every time I want to upload a post. Is that acceptable?
# capjamesg[d] I was thinking of using os.system() in Python (with appropriate security precautions taken to clean input).
# capjamesg[d] (using os.system() to commit the file, not for anything else)
# capjamesg[d] Perfect! Thanks Zegnat.
# capjamesg[d] sknebel good call.
# capjamesg[d] I am very new to Micropub (although calumryan gave an excellent introduction at HWC a few weeks ago calumryan++).
# capjamesg[d] Yeah, there aren't many good Python git libraries.
# capjamesg[d] Which is a shame.
# capjamesg[d] Also, for authentication. Because this is my own micropub endpoint, can I just do user/password auth rather than setting up IndieAuth for my site?
# capjamesg[d] As a v1.
# capjamesg[d] What if I am building my own 😄
# capjamesg[d] I only want to support micropub for sharing what coffees I am drinking on my blog.
# capjamesg[d] Thus, I'm happy creating the web form for that. And I already have boilerplate user/password auth from other applications.
# Zegnat A spec-compliant Micropub endpoint must accept a bearer token: https://micropub.spec.indieweb.org/#authentication-and-authorization But where that token comes from, or if it is just some sort of preshared user/password combination (like basic auth is Base64 of user:password) is not something the spec cares about.
# capjamesg[d] Good to know. I have the spec open now but I haven't gotten to authentication.
# capjamesg[d] I would like to look at IndieAuth but I need to really sit down and focus on it.
# capjamesg[d] Regarding token, that's interesting.
# capjamesg[d] I hadn't thought about that.
# capjamesg[d] So I could have something like user / pass auth to secure the client web page(s) and include a "token" in the form that must be submitted to the client.
nertzy and rockorager joined the channel
# rockorager capjamesg: Are you committing locally or to something like Github?
# rockorager The github API is pretty easy to navigate, if for some reason you need to commit multiple files in a single commit though it's a little tricky
# Zegnat There is a Micropub server that uses the GitHub API, I think... https://github.com/voxpelli/webpage-micropub-to-github
# rockorager Basically you create a blob for each file, add it to an array (called a tree), create the tree in github through the API, create a commit that references current commit SHA and new tree SHA, and then update the HEAD ref
# rockorager But for creating or updating a single file, there is only one API call (CreateOrUpdateFileContents i think)
rockorager, chenghiz_ and jamietanna joined the channel
# jamietanna barryfrost's Vibrancy is another example of the GitHub API for Micropub https://github.com/barryf/vibrancy/blob/b5281074454e999ad86f0d0195f8570223882163/src/events/write-file/github.js
# jamietanna I know GitLab's API allows updating multiple files - it'd be a shame if GitHub's didn't and required them to be separate commits
# capjamesg[d] PyGithub is amazing for uploading files.
# capjamesg[d] You can create a file in one line of code (after configuring PyGithub, of course).
# jamietanna Useful API for what, sknebel? :)
unrelentingtech, hendursa1, jeremycherfas, mgdm, jjuran, KartikPrabhu, tetov-irc and hendursaga joined the channel