#dev 2023-02-01

2023-02-01 UTC
#
aaronpk
IIRC it was a little more than just reducing the file size
#
aaronpk
i think something like with a certain php setting it would actually output some of the JS code?
#
aaronpk
from the source "...so that no comment hacks or output buffering is required..."
#
aaronpk
wish i had documented the specifics
#
[tantek]
ah, interesting.I can see how removing the output buffering requirement would make it more useful to some usecases
#
aaronpk
ooh i think it was because i wanted to publish it to packagist, which means there's no way to insert the ob_start() https://packagist.org/packages/tantek/cassis
#
aaronpk
i wonder if you'd be able to figure out a way to have cassisjs itself include the ob_start() call then we could get rid of the post-process step?
btrem joined the channel
#
[tantek]
I think I tried originally and wasn't able to at the time
geoffo and IWSlackGateway joined the channel; btrem left the channel
#
@IndieAuthorGirl
We’re ready to train new writers to take on the task of writing short Facebook ads. We’re seeking people new to the… https://twitter.com/i/web/status/1618636691769540614
(twitter.com/_/status/1618636691769540614)
#
@fetchkorey
↩️ Webmention Test - 1, 2, 3...
(twitter.com/_/status/1620674882613952513)
gRegor, [KevinMarks] and peter[m]123 joined the channel; peter[m]123 left the channel
#
IWDiscordRelay
<G​remblo#6137> So I've got a personal site I'm building with nextjs, I'm in the process of adding webmentions. Here's hoping I can get it to work...
#
IWDiscordRelay
<G​remblo#6137> I sat down and tried to figure out how I could create a little notes page on my site while also posting and linking it to twitter, my implementation leaves much to be desired but it gets to job done
#
IWDiscordRelay
<G​remblo#6137> The plan (for the time being) is to create and push a markdown file to my site that's located in a notes folder, I've set up a github action that will take the contents of that file and make a tweet on my behalf, while also linking said tweet back to the website
#
IWDiscordRelay
<G​remblo#6137> I have the parsing and tweeting created, now all I have to do is setup the actual notes section on my site as well as webmentions
#
rubenwardy
are you using github pages to publish?
#
rubenwardy
github pages runs after actions finishes, so the note won't be live when you send the tweet. This might cause issues if you want an embed
#
IWDiscordRelay
<G​remblo#6137> I'm using vercel, as it lets me do some fancy stuff like OG image generation
#
IWDiscordRelay
<G​remblo#6137> the idea is very barebones and I opted to do it this way because I'd know what the link would be at the end of the process (I get to make up the slug), however, there probably is a better way to do this
peter[m]123, Guest6, khurtwilliams1, nertzy and [jacky] joined the channel
#
[jacky]
do we have pointers for people implementing IndieAuth servers?
#
[jacky]
more specifically, I'm at the point with Sele where I can confirm that someone is at least able to attest a challenge when I ask them for it, which is a flexible anchor (can be via WebAuthn, e-mail, rel-me-auth, etc)
#
[jacky]
however, I'm not completely sure what to do next (in order to get to a point where I think it's okay to authorize them). It's made a bit more interesting because this act of authentication can be done outside of the browser (for example, if one is using something similar to a push notification to approve or deny a request).
#
[jacky]
I'm thinking about issuing a very short lived token that can be traded by the server (a bit similar to TicketAuth, I guess)
#
[jacky]
goes to write this out more on the wiki
[tantek], [snarfed], geoffo and [dave] joined the channel
#
[jacky]
don't all answer at once now 😛
[schmarty] joined the channel
#
[schmarty]
jacky: i'm not sure i fully understand the situation. seems like you're talking about the indieauth step where the authentication server (sele) needs to authenticate the user. if that's something that happens outside the browser with a ping to another device, it's kind of like a reverse device flow, i think?
#
[jacky]
It is! (I'm slightly stealing the flow that things like https://www.microsoft.com/en-us/security/mobile-authenticator-app could be powered by)
#
[jacky]
Or, it's _like_ a reverse device flow yeah
#
[schmarty]
yeah like the browser gets a request ID of some kind and is just gonna sit and the page will refresh while the request goes out to the device for approval.
#
[jacky]
Yup! Or enabling "magic link" support (though in a slightly convoluted way)
gRegor and bterry joined the channel
#
gRegor
[jacky], I've done a handful of passwordless login links for work, though not part of an IndieAuth flow. aaronpk has written about passwordless with Okta, https://aaronparecki.com/2017/10/04/23/passwordless-logins
#
Loqi
[preview] [Aaron Parecki] Passwordless Logins for Your Website
[tw2113_Slack_] and [aciccarello] joined the channel
#
[schmarty]
jacky: your posting about forgejo got me curious and their faq certainly gave me some bummer news as a gitea self-hoster. "In October 2022 the domains and trademark of Gitea were transferred to a for-profit company without knowledge or approval of the community." 😩
#
gRegor
what is gitea
#
Loqi
Gitea is a site, service, and open source project for code repositories (using git) and issue tracking https://indieweb.org/Gitea
#
[aciccarello]
TIL it's pronounced
#
[aciccarello]
> /ɡɪ’ti:/ as in "gi-tea" with a hard g
#
[aciccarello]
I always thought it was "git-e-a"
heyyyy and geoffo joined the channel
#
[jacky]
yeah I'm glad that there's people picking up the mantle
#
[jacky]
it's like the third fork thus far lol
#
[jacky]
migrating was just switching a Docker image for me (I think just swapping the binary used _should_ work as well)
#
[aciccarello]
gogs -> gitea; What's the other fork?
#
[schmarty]
the blog post about gitea's pivot to a company clarified things for me and i don't currently find it scary, tbh.
#
[jacky]
heh off by one error then 😛
#
[jacky]
yeah it looks like they're going the gitlab route which is cool
#
[jacky]
but AFAIK, forgejo is hoping to lean into the distributed code forge (which is nigh time - consolidation is cool but 🤷)
#
[schmarty]
i just hope the software doesn't bloat like gitlab 😅
#
[jacky]
exactly
#
[schmarty]
i am very curious what the forgejo federation stuff will look like!
#
[aciccarello]
Creating a company is honestly understandable. Having the copyright under a single person isn't ideal either.
btrem joined the channel
#
[snarfed]
ok fine, I guess it's time I should give you all the heads up, I sold Bridgy to Meta
#
[snarfed]
they promised to fix all the API stuff and make it all work again Real Soon Now
#
[snarfed]
plus, the money
#
[snarfed]
I'm sure it'll all end up fine
#
[snarfed]
:trollface:
#
[tantek]
[snarfed] STOP. not funny. not April 1. yet.
#
btrem
question for 11ty folks here: I swear at some point I saw an example of moving functions out of the main `.eleventy.js` into separate files. But I can't figure out what to search for. Anyone got any pointers?
#
[aciccarello]
Oh, I just did that
#
[aciccarello]
You could import individual functions or you could create a function that operates as a plugin.
#
btrem
Ouf! I'm having a hard time wading through that commit. Is there a website that explains how it works? Or a web search I can try?
#
[jacky]
they have groups for handling copyrights
#
[jacky]
like https://sfconservancy.org/ and I _think_ OSI can help too
#
[aciccarello]
btrem, sorry. It's a lot of moving code around. Unfortunately the 11ty website doesn't explain how to create plugins well
#
btrem
Well, that might be a start. If I want to move a function out of .eleventy.js, I create a plugin? I have a .plugin directory, so I create e.g., responsive-images.js there? And require it in .eleventy.js?
#
btrem
[aciccarello] You said I "could import individual functions." Import them in .eleventy.js?
#
[jacky]
I could have sworn 11ty had an example plugin
#
[jacky]
I was working on one once but stoppoed
#
btrem
I once read a post by someone or other that imported a function into .eleventy.js (or maybe made a plugin). But it was a long time ago. And I foolishly didn't bookmark it. :/
#
[aciccarello]
btrem, within your .eleventy.js you can import with `eleventyConfig.addPlugin(require("./path/plugin-name.js"));`
#
btrem
Ok, I'll feel around in the dark, and maybe with a bit of luck I'll find what I need. Without knowing what it is I need!
#
[aciccarello]
Then the plugin would have something like `module.exports = function (eleventyConfig) { eleventyConfig.addFilter('filterName', (input) => "do something " + input) };`
#
[aciccarello]
Basically a plugin can be set up exactly like the main .eleventy.js file. There's also an option to take in options but that's not neccessary.
[benji] joined the channel
#
[benji]
btrem not sure if this is what you're looking for but this is how I split up my shortlink function to its own plugin: https://github.com/benjifs/eleventy-plugin-shortlinks/blob/main/.eleventy.js
#
[tantek]
What is whistle
#
Loqi
Whistle is an algorithmic link shortener https://indieweb.org/Whistle
#
[tantek]
Benji, can you add that plugin to that page?
#
[benji]
will do
#
btrem
I think I have it working now. I'll see if what I did is what [benji] did. At the end of the day, I think the problem is I do a lot of copy [modify] and past without fully understanding the code on a theoretical level.
#
btrem
No, what [benji] did is not what I did. But it's working. so I'll leave it as is. The benchmarks have not changed much, so I'm probably not doing anything too wrong. :-)
#
benatkin
<[schmarty]> "i am very curious what the..." <- It's exciting. It will be interesting to see if GitHub goes Elon Musk on it. I hope so because it will be very good for the fediverse.
#
capjamesg
I need help with cache invalidation.
#
capjamesg
My screenshot service creates a screenshot for a page on first load (i.e. https://screenshots.jamesg.blog/?url=https://jamesg.blog/) and saves that screenshot.
#
capjamesg
This is saved locally.
#
[snarfed]
it's a hard problem
#
capjamesg
Indeed. I'm struggling and a cursory review of literature resulted in finding things that dive deep into the weeds, particularly with regard to synchronization (which isn't a problem here).
#
capjamesg
I want it so that if I upate
#
capjamesg
*update my site, the new image would generate.
#
capjamesg
I could even purge the cache on a weekly basis if that's easiest, but I wondered if there were more elegant solutions.
geoffo and nertzy joined the channel
#
[tantek]
I'm considering a fixed time length 2s cache of static generated files for my permalinks to handle the "thundering herd" problem of Mastodon link preview fetching
#
[tantek]
is there a cache file for the request and is it modified <2s ago? return it, else generate it (current code path) and save it to serve in the future
#
[tantek]
2s expiration seems good enough for personal content posting / editing use-cases, and will handle 1000s requests per second
#
[tantek]
or am I missing something? why doesn't every personal site that generates files do this?
#
[tantek]
I mean that generates pages dynamically to be served?
#
[tantek]
storage costs?
#
[tantek]
my permalink HTML is pretty small so I can't imagine file size being a big deal
#
capjamesg
2 sceonds?
#
capjamesg
I keep making typos this evening.
#
capjamesg
2 seconds?
#
[snarfed]
microcaching in memory and static files is a pretty common technique in bigger CMSes
#
capjamesg
These files aren't exactly static.
#
capjamesg
They would change with the page. If I decide to change my post structure, or change a title, it would be ideal for the image to change.
#
capjamesg
One alternative is for me to have a /cache-invalidate route that, when executed with some password, clears the cache.
#
capjamesg
I can trigger that on the build of my site.
#
capjamesg
I don't change things that often, though. So maybe even a manual operation would work.
#
[0x3b0b]
<[schmarty]> "i am very curious what the..." <- https://github.com/cjb/GitTorrent ?
#
Loqi
[preview] [cjb] GitTorrent: A decentralization of GitHub using BitTorrent and Bitcoin
#
[0x3b0b]
(that was a joke)
#
[KevinMarks]
Store a hash of the generated page (or a version number, but hash is safer). Return the cached thing, then generate. If the hash is different, update the cache.
#
[KevinMarks]
For bonus points, use the hash as the etag.
#
capjamesg
So I'd need to run a separate service for serving and generating?
#
[tantek]
is the hash computation complexity really worth saving the file write every 2s?
#
[tantek]
that feels like yet another moving piece that can break
#
[tantek]
bad from a robustness of design perspective
#
[tantek]
slightly more inefficient code is MUCH better than more complex code (which is fragile to bugs / greater surface for vulns)
#
capjamesg
[tantek] A request might take a while though.
#
capjamesg
Since the image is for sharing, I want it to be available quickly (i.e. if someone links to a blog post, the image shouldn't take long to load).
#
capjamesg
But, some pages are bigger than others. I have one page that's ~ 1 MB because it has a video on it and puppeteer -- the framework I use to render pages -- will I think load it by default.
#
capjamesg
That's an edge case, but something worth noting.
#
[KevinMarks]
Express already kinda does this - it will render the page, calculate the hash and decimate it for an etag. If it matches the previous one it does the 304 thing. Which is OK as a first pass, but if you have a better way of knowing if nothing has changed you can override it.