Log in
Seblog.nl

Seblog.nl

Day 41: IndieAuth in the toolkit

Today, I moved some existing code from my kirby-micropub plugin to my indieweb-toolkit, and then I rewrote it a bit. It is the code that checks for an Authorization: Bearer xxx header and rejects people that have the wrong token.

At this point, my blog just uses tokens.indieauth.com, as it's token endpoint. So, that is what the toolkit uses now too. This is not ideal, and I plan on adding a token endpoint directly to the toolkit. But, everything in steps!

You can now do the following:

indieauth::requireMe();
indieauth::requireScope('create');

// do stuff!

And then the script will exit if there's no Authorization: Bearer in the header with the proper scope and a 'me' value corresponding with the current URL. (You can also pass in a 'me' to check against.) I am still not sure about some things, so I am putting them out here to think about them some more. Feel free to comment.

  • Is 'IndieAuth' the right name for this static class? I think so, because it uses 'me' and 'scope'. But at this point, it's only checking tokens. And when I add a token endpoint, is that token endpoint still IndieAuth?

  • In my code, I now check url::host($token->me) == url::host($requiredMe)). I only compare hosts, so seblog.nl, which works, because seblog.nl/micropub still has the host seblog.nl. Maybe I should drop this 'use the current URL if the $requiredMe is empty' and only go for explicit 'me'-values.

  • Previously, I threw Errors. Now, I just set the HTTP-header and exit the script. I wonder which way is more elegant. The way I do it now, makes sure the right HTTP status is sent, but the way I did it before allows for more customisation. Both ways exit the script, which is the most important part.

Day 40: reverting repost changes

I changed my mind about reposts, again. This is what we call voortschrijdend inzicht in Dutch.

A few days ago, I changed how I display reposts. In an attempt to honor copyright, I only display the first 50 words of a repost. This way, it's more a quote than a full copy of the content, but I can still retweet stuff, since cramming 50 words into 140 characters is doable, but rare.

What's more: I only showed the repost in the feed, not on my permalinked pages. I redirected those permalinks to the original permalink. This way, while I had the original content imported on my site, I wasn't actually re-publishing much of it.


But today I reposted a much reposted post of Aaron, and then it stuck me: I can't send a webmention, in the 'oh look a comment' kind of way, if I don't have a permalinked page with Microformats on it.

In a way, a 302 redirect has the URL of another page on it by using a HTTP Location header, so it does link back to the original page. The question is then: is that a valid link for sending a webmention? And: does a 302 redirect on the source URL to the target URL imply a repost of the target? Not really, I think. It's just a redirect.

So I got rid of the redirect of my permalinks, giving my reposts their page back. I still only display the first 50 words of a repost, making it more a quote than a repost. But aren't reposts just full quotes? It's still the major part of the content of the post. I will keep it that way for now.


Edit 20:17 CET After some discussion on IRC, I decided to also ditch the 50-word-cutoff. Only showing the first 50 words of a repost makes it a quotation, not a repost.

The need for the 50-word-cutoff was born because I felt uneasy reposting a whole article. The solution to that is: don't repost a whole article. The problem was that I already reposted a whole article, because at that time, I found it important to keep it online, in case the original server would collapse under a lot of trafic. The next day, that wasn't a reason to keep it on my site anymore.

So, I changed that single post to a bookmark (replacing only repost-of to bookmark-of in the .txt of my post) and now I'm good again. I removed the code that showed only the first 50 words. If I ever want to quote something, I can use quotation-of, but for now, I'm fine.

Day 39: inquiring about Micropub

I really should get back into #100daysofindieweb again.

Recently I got into writing again, and with writing comes the endless quest for writing apps. My all time favorite is iA Writer, because I use that one since at least 2011 on and off. Another favorite, but newer, is Ulysses. Ulysses is a combination of iA Writers simplicity and Scriveners multi-functionality. (I don't really like Scrivener, however, it's way to much of everything.)

Both iA Writer and Ulysses offer Wordpress and Medium integration from within the app. The sad thing is: I'm not on Wordpress nor Medium.com, so I can't use that feature. I do however support Micropub, which is open and stuff. It would be nice if they did support that.

So today, I wrote both of them an e-mail, asking to add support for Micropub.

I think this barely qualifies for a real Day within the 100days, because I didn't really made stuff, I just talked about things. But I really need to get back at the quest and it's late already. And it would be nice if one of them (or both!) added support for Micropub through this action.

Meer laden