#dev 2019-10-24

2019-10-24 UTC
#
GWG
Is there a good way to redirect a URL using PHP only?
[snarfed] joined the channel
#
[snarfed]
<meta http-equiv="refresh"> ?
#
[snarfed]
specifically <meta http-equiv="refresh" content="0;url=...">
#
GWG
[snarfed]: An image url
#
GWG
I am displaying images and I want to hide the actual url. The terms of service forbid me from permanent caching
#
GWG
And I thought building a caching system would be difficult
#
GWG
I use static map systems that require an API key. I want to hide it from being copied
#
[snarfed]
oh internal redirect? you'd need to fetch and serve it then
#
[snarfed]
apache makes this easy with mod_proxy, nginx probably has something similar, but if you can only write PHP, then fetch and serve 😐
#
GWG
[snarfed]: I have to serve the greater WordPress community, alas
RenDiscord[m], EdEdorEddyDiscor, captain-nemoDisc, [jgmac1106], [schmarty], dougbeal|mb1, chimo, treora and [Lewis_Cowles] joined the channel
#
[Lewis_Cowles]
It looks like exit may have a typo as well as the refresh time-out, but it combines several methods of redirection
#
[Lewis_Cowles]
so that browser does what you told it to do
#
[Lewis_Cowles]
Right I've changed it up a little now so it's less rigid, at the cost of a little more code and readability. Have to say getting phpdebug working has been a boon
[xavierroy], ffgvv, [Rose], cweiske, tsrt^ and [tantek] joined the channel
#
[tantek]
Head still full of too many things I want to build from this weekend!
alloramanaagia joined the channel
#
alloramanaagia
hello guys
#
alloramanaagia
I have an enqury for you
#
alloramanaagia
would be possibile to link a google spreadsheet to a domain name?
#
alloramanaagia
if so, I need only to redirect the dns records to google?
#
sebsel
[tantek]: me too!
tsrt^ and [Lewis_Cowles] joined the channel
#
[Lewis_Cowles]
@alloramanaagia you’d need something to resolve the path too
#
[Lewis_Cowles]
nginx, apache, a php file which redirects to the place. In any case Google will want it to show their domain
gxt joined the channel
#
@janboddez
↩️ Receiving webmentions doesn't work either, for my setup. (`webmention_url_to_postid` does not return the proper post ID.) Might revert to my own plugin, then.
(twitter.com/_/status/1187318521321218048)
[frank] and krychu joined the channel
#
[Lewis_Cowles]
maybe an unpopular opinion, but async and await in JS is an admission that the async by default was a mistake. Language syntax compatibility demand that more keywords fix the problem, thereby growing the problem space
[KevinMarks], [jgmac1106] and [tantek] joined the channel
#
[jgmac1106]
alloramanaagia I use my url shortner to point to a spreadsheet.... You could also export the sheet as html and throw that up
#
[jgmac1106]
Isn't dynamic you would have to re export if you change
#
@janboddez
↩️ One thing I'd like to do, still, is replace Bridgy's URL with the actual source. Which would require filtering `webmention_comment_data` and parse the source's microformats ... (Although I've also installed Semantic Linkbacks, it doesn't seem to cover that part.)
(twitter.com/_/status/1187337812263260160)
#
[jgmac1106]
how can I help dogtrax syndicate his poem to indeweb.xyz what did he do wrong: https://dailyconnector.com/2018/10/10/testing-out-indieweb-with-poetry/
#
[jgmac1106]
...ahh no h-entry on the post the syndication link won't matter
#
[jgmac1106]
...people want to play....WordPress just so hard....
#
GWG
You know what happens when you say that
#
[jgmac1106]
an angel gets her wings?
#
GWG
[jgmac1106]: That's an interesting pivot
#
[jgmac1106]
I am a big Henry Travers fan
#
[jgmac1106]
looks like he is trying to use bridgy...https://dailyconnector.com/2018/10/10/testing-out-indieweb-with-poetry/#respond dogtrax one of the most IndieWeb people I know....but just can never get this stuff working correctly
[jeremycherfas] joined the channel
#
[jgmac1106]
but there are zero mf2 on his theme...there is that....but I also don't see any old microformats. May try to tell him to use the micformats2 plugin
#
GWG
It does work in many cases
#
[jgmac1106]
yes he has no legacy mf so I think it will work
#
[jgmac1106]
I think the mf2 plugin could have a resurrgence now that legacy mf not showing up as much in core and that is translating into theme updates
#
[KevinMarks]
I like promises better than async/await but it is still confusing (I forget to return the promise)
#
[KevinMarks]
expressing call graphs in text is awkward.
#
GWG
[jgmac1106]: The problem is the hooks. But it may be due for a refresh
[qubyte] joined the channel
#
[qubyte]
All the same under the hood 😉
#
sebsel
[KevinMarks]: async/await is just another syntax to handle promises.
#
[KevinMarks]
yes, but it doesn't help much with the Promise.all() thing to run stuff in parallel
#
[qubyte]
I frequently mix the two. For example: `const responses = await Promise.all(urls.map(fetch));` etc.
#
[KevinMarks]
so that ends up doing return Promise.all(urls.map(fetch)).then(responses => { /* following code goes here */})
#
[KevinMarks]
so you put the catch on the Promise.all() rather than after it?
#
[qubyte]
In the snippet above, if any of the fetch promises rejects then the line will throw. You can put a catch on each, or a catch on the `Promise.all`, or wrap the line in a try-catch.
#
[qubyte]
The catch will receive the unwrapped content of the rejection.
#
[qubyte]
Sometimes the try-catch is a little ugly and I opt to handle individual rejections. Case by case.
#
[qubyte]
If you don’t want to use the promise.all, then you can await each fetch in the collection and the effect is essentially the same. For example:
#
[qubyte]
const promises = urls.map(fetch);
#
[qubyte]
for (const promise of promises) {
#
[qubyte]
responses.push(await promise):
#
[qubyte]
const responses = [];
#
[qubyte]
eck. You get the picture.
#
[qubyte]
Since the fetches are all in flights, the loop effectively only takes as long as the longest promise to resolve, as is the case with the Promise.all.
#
[KevinMarks]
that won't preserve order though, which promise.All() does
#
[qubyte]
It wil.
#
[qubyte]
Since the array of promises is ordered the same as the URLs, and you await each in order, order is preserved.
#
[qubyte]
(stick with Promise.all though I reckon, it’s more obvious)
#
petermolnar
I gave up trying Zapier to be my micropub client: it has way too many limitations. Example: I want to forward "like" and "bookmark" entries to wallabag, but wallabag is synchronous: it fetches the remote article before coming back to the client. Zapier has 1s max execution time limit. On the other hand, with a dead simple PHP I can now use any indie reader's like functionality to save entries to wallabag :)
#
[jgmac1106]
What is wallabag?
#
Loqi
Wallabag is a free-software tool for saving/bookmarking web pages, in the style of Instapaper and Pocket https://indieweb.org/wallabag
[Lewis_Cowles] joined the channel
#
[Lewis_Cowles]
Very nice. I’ve not had much luck with Zapier myself. I expect that the 1s is a limit which respects their low price-point and ensures they can always run as actions live on their severs, probably become their IP
#
[KevinMarks]
I've been building things with AWS lambdas that set a 3s timeout by default, but if you don't call them often they can take ~1s to spin up, which adding to the network stuff I had to do made them time out. I hadn't noticed, because the AWS queue I was using will retry 3 times, and the 2nd time there is an instance there to process it without timing out o_O
#
[qubyte]
[Rose] I’ve built a shortcut which posts a note with photo. It uses the media endpoint to first upload the photo because I want to use a JSON payload to post to the endpoint so I can include alt-text. The first request returns the URL of the uploaded photo in a `Location` header, but I can’t figure out how to get headers from a `Get contents of` step. At the moment I have the media endpoint responding with JSON including the URL since thatâ
#
[qubyte]
allowed, but it bothers me that it’s not using the Location header. Have I missed something, or does this sound reasonable to you?
#
[qubyte]
(you’ve sent me down a shortcuts rabbit hole btw, and I’m thoroughly enjoying it)
#
[qubyte]
The curious thing about all this is that the micropub spec is very careful how it handles files (which I like), but my micropub server creates files in my git repo on GitHub using the Contents API, which makes you base64 encode file contents and send that in JSON. 🤷‍♂️
#
[qubyte]
I suppose they’d assert that git isn’t for big files.
[Rose] joined the channel
#
[Rose]
You can’t get the header of a get contents of unfortunately
#
[qubyte]
Ah ok. At least I know I’m not missing anything 🙂
#
[qubyte]
Same for status code too?
#
[Rose]
Indeed
#
[qubyte]
I guess we’ll get these in the future. For now this works 🌟
#
[qubyte]
Thanks!
#
[Rose]
I have requested in the micropub spec that we return the URL in the body of the post
#
[Rose]
I also made a pull request on the WP plugin to do that
#
[qubyte]
I saw a note in the spec about that I think. Did that come from you?
#
[qubyte]
Or maybe it was on the indieweb page for it. I don’t see it in the spec now.
#
[qubyte]
Either way it seems like a good idea.
#
Loqi
[grantcodes] #108 Consider requiring a response body for returned locations
#
[qubyte]
[Rose]++
#
Loqi
[Rose] has 20 karma in this channel over the last year (66 in all channels)
#
[qubyte]
Oh, a fresh comment.
#
[Rose]
Comments are always helpful for seeing how widely wanted a feature is
#
aaronpk
[Rose]: do you know if there's a feature request to Apple to enable retrieving the headers and status code?
#
[Rose]
I have one in, but there are a _lot_ of open requests
#
aaronpk
Seems like a reasonable request, and like it'd be useful in plenty of other situations too
#
[qubyte]
Both are really important, yeah.
#
[Rose]
I’ve been told by several iOS developers at Apple that they won’t even see a request unless it’s put in multiple times
#
[qubyte]
I know I’ve been bitten by status codes in the past.
#
[Rose]
Which means that everyone who needs it should request it, the more the merrier
#
[qubyte]
I’m happy to put another request in if you link me to the right place.
#
[Rose]
It’s under Siri
KartikPrabhu joined the channel
#
[qubyte]
heh. Thanks to 2fa pretty much every device I have buzzed or made a noise when I tried to log in.
[snarfed] joined the channel
#
[snarfed]
ugh, pixelfed. it pretends it's Mastodon, so bridgy signup thinks it is, but it's not actually, so bridgy breaks
#
[jgmac1106]
snarfed did we ever come to agreement around granary mf2->rss for size and duration to enable podcast feeds?
#
Loqi
[snarfed] #169 convert mf2 length and size properties to RSS duration and length
#
[jgmac1106]
I was also wondering if a post has a u-featured img could that be picked up as img tag for an rss feed. Does that work already?
[xavierroy] joined the channel
#
[xavierroy]
I think I was the one who was trying bridgy with pixelfed earlier today 🙂
#
[snarfed]
probably just needs someone to drive/declare consensus. i'm happy to follow but haven't yet started driving this one
#
[jgmac1106]
cool, well let me finish updating my podcast feed, currently I copy and paste the xml file from granary and then manually add in the length and size
#
[snarfed]
ugh, sorry, no fun
#
[jgmac1106]
...which I why my feed is like 10 shows out of date,,,,
#
[snarfed]
[jgmac1106] and no, rss doesn't include u-photo or u-featured if they're outside e-content
#
[snarfed]
feel free to file a feature request!
#
[jgmac1106]
yeah if we can get granary to spit out a "proper" podcast feed ...life will be better
#
[snarfed]
it should be close now, right? just missing length/size and...? image?
#
[jgmac1106]
yeah that is it
#
[jgmac1106]
will double check that random photo size that Apple requires but I think that validates fine. I will test today with a podcast feed validator
KartikPrabhu joined the channel
#
[qubyte]
[Rose] I did a feedback. With a little luck we just crossed a threshold and we now have the full might of their engineering teams engaged on this one issue.
#
[Rose]
If you let me know the feedback number I’ll ping some people I know and see if we can get it secretly escalated
#
[qubyte]
It’s poorly written, but here it is: FB7405567
#
[qubyte]
Ooooooo back-channels.
#
[qubyte]
Good to know strategically placed people 👍
#
[Rose]
No guarantees of course, I can only ask politely.
#
[qubyte]
I still like the idea.
KartikPrabhu joined the channel
#
[jgmac1106]
interesting open up this url to a pdf in a browser and the % space doesn't show, couldn't bookmark, luckily adding it here and the % appeared. I don't have to manually do it http://ide.mit.edu/sites/default/files/publications/2017%20IDE%20Research%20Brief%20False%20News.pdf
KartikPrabhu, [frank], [tantek], [Lewis_Cowles], [KevinMarks] and gRegorLove joined the channel
#
aaronpk
[Rose]: I just remembered the last step in getting okta to show the right city in the push notification!
#
aaronpk
you have to send an X-Forwarded-For HTTP header to Okta with the value of the remote IP address
#
aaronpk
that will only be allowed if your server's IP address is listed as a gateway, which is the step you did
[xavierroy], [schmarty], KartikPrabhu and [SE_NOVEM] joined the channel
#
[SE_NOVEM]
Hello, could someone point me to the right direction why my grid system is overlapping in this modal dialog:
[schmarty], gxt and KartikPrabhu joined the channel
#
Loqi
Ok, I'll tell them that when I see them next
#
[schmarty]
!tell aaronpk: i saw a weird thing w/ ownyourgram. i have a post permalink that is https://www.instagram.com/ghostpartyimprov/p/B4AoRqXpl6l/ and ownyourgram.com wouldn't import it until i removed the "username/" section.
#
[tantek]
didn't even know that username/ version of a permalink worked!
#
[tantek]
presumably it's non-canonical
[snarfed] joined the channel
#
[snarfed]
huh [schmarty] that's the first time i've seen that format of instagram URL
#
[snarfed]
heh jinx yup
#
[schmarty]
it came from instagram-atom
#
[schmarty]
(previous links from instagram-atom have not included that URL segment to my recollection)
#
[snarfed]
hah funny
#
[tantek]
so snarfed your code saw it 🙂
#
[snarfed]
they must have changed their JSON
#
[snarfed]
glad it's compatible
[mapkyca], jjuran, [Rose], [chrisbergr] and gRegorLove joined the channel
#
[chrisbergr]
I wish I could use ownyourgram, too. Then I wouldn't always have to do this crap manually. But I still have to get my old posts back to my site anyway. I've been putting this off for so long, the thought of it always scares me off...
#
sebsel
what is the state of OwnYourGram Lite?
#
Loqi
It looks like we don't have a page for "state of OwnYourGram Lite" yet. Would you like to create it? (Or just say "state of OwnYourGram Lite is ____", a sentence describing the term)
#
sebsel
At one point in Brighton there was a conversation about it: the hardest part of OwnYourGram is polling, and as a user, you know when you posted.
#
sebsel
so if you as a user can click a button and let OYS check the last photo you posted, the app becomes much simpler.
#
sebsel
simpler to self-host.
#
sebsel
and then I heard aaronpk saying to [Rose] in one of our channels that "the hook" worked? Is that this?
jjuran joined the channel
#
sebsel
(the whole thing is about tradeoffs: yes, polling is better UX, but with the current state of polling, a button might work just fine or even better)
#
[chrisbergr]
In the past (3-4 years ago) I used IFTTT for instagram. But it seems like that all those scripts doesn't work anymore. Always seeing empty images everywhere.
#
sebsel
yea they are really locking down everything.
#
sebsel
I manually post to Instagram *after* posting to my own site, using an iOS Shortcuts workflow.
#
sebsel
that works for me
[grantcodes] joined the channel
#
[grantcodes]
What is microgram?
#
Loqi
Microgram is an extension to micro.blog to show photos in an instagram like photos page https://github.com/cleverdevil/microgram https://indieweb.org/Microgram
#
[chrisbergr]
For a side project I'm using later.com, they are pushing the contents to their iphone app and this app uses the instagram app to natively post the images.
#
[grantcodes]
Not that one. I'm sure someone made a script very recently
[qubyte] joined the channel
#
[qubyte]
I have a nav bar. At the moment, the current location is _not_ an anchor, and the other items are. This was because in the past I saw no sense in a nav item linking back to itself (and also it makes it clearer where you are when you’re using lynx, which I’m sure is a common use case). Is there a better practice for this? A special attribute or microformat I might not have considered?
#
[qubyte]
Not sure if this is exactly a dev question. Apologies if not!
#
aaronpk
[schmarty] whoa i've never seen an instagram URL like that!
#
Loqi
aaronpk: [schmarty] left you a message 2 hours, 20 minutes ago: i saw a weird thing w/ ownyourgram. i have a post permalink that is https://www.instagram.com/ghostpartyimprov/p/B4AoRqXpl6l/ and ownyourgram.com wouldn't import it until i removed the "username/" section.
#
aaronpk
I have a regex that looks for an instagram URL before fetching it to avoid people throwing random stuff in and maybe hitting the rate limits again, but apparently it needs some tuning
#
[chrisbergr]
[qubyte] I guess you have a very unique audience if lynx users are common there. The 28 client websites I'm monitoring for my employer right now (mid-sized companies from germany) have together not a single visitor with lynx. Anyways: I'm interested in some empirical conclusions on the subject of whether it is better not to drop anchor or rather to do so. I couldn't find any discussions out there and I always tend to give everything an
#
[chrisbergr]
anchor...
#
[qubyte]
Don’t worry, I’m joking about lynx. I do use it to check accessibility in a primitive way though.
#
[chrisbergr]
That's the only reason I know the browser at all, by the way 🙂
#
[qubyte]
I’m slightly surprised that there doesn’t seem to be a standard way (again, unless I’ve missed it) of an anchor being labelled as “self” or something. Would be useful for CSS.
#
[chrisbergr]
There is aria-current=page
#
KartikPrabhu
::target is a CSS selector too
#
[chrisbergr]
Oh really? I should have known that about a few years ago when I was building a one page..
#
[qubyte]
That’s for fragments though, right? I suppose that (fragments) reveals why there’s no anchor state for this.
[dougbeal] joined the channel
#
KartikPrabhu
[qubyte]: yes, :target is from fragments, I don't know any page level URL detection in CSS. Depending on your backend, you could add a class attribute in your system ans then target that
#
[qubyte]
Yup, that’s what I’d default to. I wondered if there was a standard way though. 🤷‍♂️
#
KartikPrabhu
not in CSS afaik, but the "aria-current" attribute might work
#
[qubyte]
Oh well. I reckon I’ll just keep current nav items as non-anchors.
#
[qubyte]
Perhaps aria-current in the future. Thanks for the tips 🙂
#
KartikPrabhu
:thumbsup: