#dev 2017-09-03
2017-09-03 UTC
eli_oat, snarfed1, snarfed and KartikPrabhu joined the channel
# bear the result is a 302 but with what looks like a relative url of /page/2dcbSEKTnlZahlLF3yIY
# bear ok, I must not be seeing something... the target url of https://webmention.rocks/test/23/page has a 302 response and the Location header is "page/2dcbSEKTnlZahlLF3yIY"
# bear that's tell me that the new target url should be https://webmention.rocks/page/2dcbSEKTnlZahlLF3yIY but that is returning a 404
# aaronpk so resolving that URL should give /test/23/page/2dcb...
# bear the browser ends up at https://webmention.rocks/test/23/page/L4Ht4L3qH3iKGBHjPrJf
# bear it has been recently - https://tools.ietf.org/html/rfc7231#section-7.1.2
# KartikPrabhu urljoin
# KartikPrabhu from urlparse lib
tantek joined the channel
tantek, tantek_, gRegorLove, KartikPrabhu, jeremycherfas and [kevinmarks] joined the channel
# [kevinmarks] The "what fake username for my domain" problem reminds me of the himself@neilgaiman.com email address.
# [kevinmarks] The other precedent is @me in opensocial etc so me@domain.com
# Zegnat jeremycherfas if you are looking into PHP HTTP clients, may I nudge you a little towards http://httplug.io/ ? They have created a fixed interface for doing HTTP requests, and you can swap out the backend (Guzzle, or just cURL, or any other lib) without having to change your own code.
# jeremycherfas Youb may! I will take a look now.
# jeremycherfas I don’t really understand that. Currently not using any libraries at all.
# jeremycherfas But of course I could.
# jeremycherfas Right now, I want to understand authentication.
# jeremycherfas The Known API examples all use user name and endpoint to create a “password”.
# jeremycherfas Or I can use gimme-a-token, I think.
# jeremycherfas But I don’t understand what gimme wants under client_id
# Zegnat E.g. if Twitter was requesting a token so they could post to your site, they would put https://twitter.com as client_id
# jeremycherfas So if I am currently working in localhost:8888/RSS-thing/index.php — is that the client_id?
# Zegnat Or OwnYourGram uses https://ownyourgram.com ; from the example on https://indieweb.org/obtaining-an-access-token#Examples
# Zegnat Sure. Or just https://www.jeremycherfas.net. You don’t really care, you are going to accept it anyway because you know it is you making the request
# jeremycherfas See, that blows my mind. I can put anything in there, because when it sends me to the Known page to authroise, I am going to authroise it, whatever.
# jeremycherfas I just wonder whether that is for some reason preferable to calculating the known-username and known-signature from scratch each time the app runs.
# jeremycherfas Just making a gist to show what I mean.
# jeremycherfas Actually, no need. This https://github.com/danito/KnownApiForward/blob/09978c6fe67148ef12bf7682977ae7ba25499ce4/index.php#L15 is the sort of thing I could put in my app
# jeremycherfas Well, that’s my other question I’m not sure I understand. I’ve been thinking only about posting bookmarks to KNown. And doing that directly by POSTing to Known’s endpoint.
# jeremycherfas But is there a way I can post to, say, Quill and then have Quill post to Known?
# jeremycherfas Thank you. That is very helpful and stops me thinking there might be an easier way. :)
# jeremycherfas As for opening up fully, I’d like to get this thing working very specifically, and then see.
# jeremycherfas So for now I will make it Known only.
# jeremycherfas That’s advice from mapcyka https://www.marcus-povey.co.uk/2015/05/28/using-the-known-api/
# jeremycherfas That little bit of code does calculate the values I need. Now to see whether they work.
# jeremycherfas Yes, and I am slowly getting there. For a while I was scared bout calculating the signature each time I run the program, but I now think that’s the easiest.
jeremycherfas, snarfed and r11 joined the channel
# jeremycherfas To get everything after a regex match, to the end of the string, do I have to use a lookahead? Or is there some simpler method to get everything after the match to the end of the string?
# jeremycherfas Aha! Thanks. Now I can use capture group 2 as my replace.
[kevinmarks] and snarfed joined the channel
# jeremycherfas Is preg_replace() the right function though? I’m having terrible difficulty with it.
# jeremycherfas For example echo preg_replace('(^.+?\/p\/[^\/]+\/)(.*)', '$2', 'https://www.reading.am/p/4Nix/http://www.nejm.org/doi/full/10.1056/NEJMsa1202099#t=article');
# jeremycherfas Apparently does nothing.
# jeremycherfas But I know the Regex works, and I thought $2 would be the bit that I want.
# Zegnat echo preg_replace('/(^.+?\/p\/[^\/]+\/)(.*)/', '$2', 'https://www.reading.am/p/4Nix/http://www.nejm.org/doi/full/10.1056/NEJMsa1202099#t=article');
# jeremycherfas I thought the markers were the ^ inside the parentheses
# jeremycherfas Well, that works, and once again I am indebted to you, zegnat
# jeremycherfas Zegnat++ for being amazingly willing to help
# jeremycherfas Man this stuff is hard.
# Zegnat Ie. /EXPRESSION/FLAGS . Regex will use the very first symbol (here a /) to split between the expression part and the flags part.
# Zegnat echo preg_replace('@^.+?/p/[^/]+/@', '', 'https://www.reading.am/p/4Nix/http://www.nejm.org/doi/full/10.1056/NEJMsa1202099#t=article');
# jeremycherfas I’m taking that over to the explainer
# Zegnat sknebel: https://stackoverflow.com/a/3415731
# jeremycherfas OK, so you have simplified the first match, and just left the replace blank.
tantek and [miklb] joined the channel
snarfed joined the channel
# jeremycherfas Acutally zegnat, I’ve just realised that the main link in those bhookmarks is to the clean link, only the little icon goes to reading.am The actual title goes to the clean link. So, maybe no need to even clean it up further.
snarfed joined the channel
# Zegnat Oh, interesting, jeremycherfas. I was more concerned with the parsed output: https://php.microformats.io/?url=http%3A%2F%2Fstream.jeremycherfas.net%2F2017%2F-danger-seeing-white-part-11
# jeremycherfas Oh, I see. So bookmark of is the reading link
# jeremycherfas Well, I’m happy enough at the moment. I’ll probably keep working at it.
# jeremycherfas I need to build a proper test suite, because at the moment I have to add a new bookmark to test things, because I don’t store the whole result I get from the RSS.
# jeremycherfas So need to build a tst suite that reads the xml from a file.
# jeremycherfas Interesting that the icon is different depending on where the bookmark came from (Quill vs known endpoint) and the star that quill puts in does not have a link.
# jeremycherfas Or maybe the star is Known and the fingers are from Reading. So much to figure out.
# jeremycherfas Zegnat: I can’t think where that name property is coming from.
[jeremycherfas] joined the channel
# [jeremycherfas] And micro.blog takes the reading.am link. I guess my work is not quite done yet.
[manton] joined the channel
[kevinmarks], gRegorLove and snarfed joined the channel
# loqi.me edited /User:Kaja.sknebel.net (+47) "sknebel added "PM-alerts if specific user becomes available" to "See Also"" (view diff)
davidmead, snarfed, EmreSokullu, KartikPrabhu, tbbrown and gRegorLove joined the channel
# gRegorLove Connections to graph.facebook.com are realllly slow from my site. I'm caching the profile photos for Bridgy backfeed and it keeps timing out.
# gRegorLove Even when I try using wget instead of php's copy()
# gRegorLove There's a 302 it follows, but it takes a long time just to respond to the initial request, then follow the redirect