My brain is kinda exhausted from first wrestling with Linux and Ansible automation, and then wrestling with JavaScript type hell in trying to get some p2p libraries to work.
Gonna decompress before bed by live-coding a lil #p2p #gemini #microblog in #agregore with some basic #JavaScript and #HTML
So if you haven't yet, try installing the latest pre-release of Agregore and follow along.
https://github.com/AgregoreWeb/agregore-browser/releases/tag/v2.0.0-12
Next I'm going to use the `fetch()` API to create a new `hyper://` website based on a "pet name" for the key. Every time I use this human readable name it will resolve to the same human-unreadable public key URL.
I got back hyper://sqtc3rcay8hcg3y8ehcrc66zpiceufstcwupukrggf5eukwp7xdo/ which is the public URL for my new site (currently empty)
```
res = await fetch('hyper://localhost/?key=gemblog', {method: 'POST'})
await res.text()
```
Navigating to the URL will give me an empty index. So first thing I'll do is add my "homepage" under `/README.gemini`. Sadly I don't have a thing to resolve `index.gemini` yet, but I wanna add that next time I get a chance. Gonna read these docs to brush up on my gemtext: gemini://gemini.circumlunar.space/docs/gemtext.gmi
```
res = await fetch('/README.gemini', {
method: 'PUT',
body: `# Mauve's Gemblog!`
})
await res.text()
```
Now I can reload and click to open the page
Honestly, this is all you need to get a basic blog up and running. From here you an change the URL in the `fetch()` API call to whatever page you want and add the gemtext into the `body`. Each time you'll be overwriting what was there before.
Whoops! I got the file extension wrong. Seems it's just loading it as Markdown. :P Most of the formatting works anyway. Hopefully folks looking at this in the future will see the fixed version. Also I think I got the file extension wrong?
K, lets delete the old file and make a new one:
```
await fetch('README.gemini', {method: 'delete'})
await fetch('/index.gmi', {
method: 'PUT',
body: `
# Mauve's Gemblog!
Wow this sure is something.
Way more advanced than my HTML based blog!
=> https://blog.mauve.moe
`
})
```
hyper://sqtc3rcay8hcg3y8ehcrc66zpiceufstcwupukrggf5eukwp7xdo/index.gmi
Now that I have some basics in there, lemme add a DNS address: hyper://gem.mauve.moe/index.gmi
I use namecheap for DNS but you should be able to use whatever you want as long as it supports DNS TXT records.
```
TXT _dnslink.gem dnslink=/hyper/sqtc3rcay8hcg3y8ehcrc66zpiceufstcwupukrggf5eukwp7xdo
```
And bam! I now have a nice looking URL for my blog and it just took a few commands in my devtools and a single DNS record. No servers required!
@mauve
they changed names again!??
@jonny Yeah, along with a total overhaul of the protocol again. :P
@mauve
ok, well. I can't not read it lol
@jonny This is in the 2.0.0 prerelease of Agregore? That has the new breaking changes from Hyper. :P
@mauve
no no sry I mean I need to see what is new!
@jonny Oh! Yeah. There's a bunch of stuff. The main thing is that the connections are a lot more reliable since the DHT and wire protocol got overhauled with new "hole punching" capabilities. The way `Hyperdrive` works changed again so any data needs to be migrated again with new keys.
First, I'm going to create a new #hypercore based website. This used to be called #dat and I think is now called holepunch.to (all very hard to search for :P ).
You can find the docs for the protocol handlers here: https://github.com/RangerMauve/hypercore-fetch/