💾 Archived View for midnight.pub › posts › 263 captured on 2023-04-20 at 00:05:58. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

Midnight Pub

Post from your terminal

~m15o

The sky is blue in the city today, a change from the usually cloudy atmosphere. Brewed and I are having a coffee since it's still the afternoon. This evening will get busy on my end, and so will most of this week's evenings actually. It's all work-related though. I should be excited, but am I?

Before the Midnight opened, I didn't know much besides the Web. Since then, I discovered other protocols like Gemini or Gopher. Just the other day, while reading inquiry, I learned about usenet as well. It's humbling to see how forward thinking some software was more than 20 years ago. These are also incredibly exciting venues to learn and explore. And that's what I've been doing!

One thing that's been bugging me for a while now is that to write posts or replies on Midnight, we need to access it through the web. And while I do like the web, I'm slowly burning out from it. Maybe it's because it reminds me of what I don't like about technology, or maybe it's because I associate it too much with work. Whatever the deep reason, too much of anything isn't good. So when I'm enjoying my evening's Old Fashioned (thank you bartender!) I'd rather stay away from it. Heck, I'd like to do it from the comfort of my terminal (or emacs, in this case.)

I've been wondering about what a good way to write on the midnight without the web could look like. While exploring the small net, I've fallen in love with pubnixes and it just *feels* right. People access a remote terminal and are free to use any mean they'd like to interact and write content. Do you want to write a post in vim? Go for it. Do it locally and use rsync to make your content available. Prefer to build an emacs command? Say no more!

I'm fairly new to linux, so it might not be the right time to open an ssh access midnight.pub just yet. I have a lot of learning to go through first. But as I learn, how about a simple shell script for those of us who'd rather not open firefox? (By the way, I love you firefox!)

midnight.sh

This script is merely a convenient way to access Midnight's https endpoints without opening a browser. It's very basic, but hopefully it will be useful for some of us.

man midnight.sh

Here's how to use it:

1. Download the script, make it executable (`chmod +x midnight`). Optionally, move it to `/usr/local/bin`

2. Create `~/.config/.midnight` and put your session token in there. To get it, copy the value of the "midn" session cookie on the web, when you are logged, into that file.

3. It's now ready to use!

Writing an post

To write a post, first create a file. The name of the file isn't important:

myfile.gmi:

This is the title

This is the content

Then pipe that file to midnight:

cat myfile.gmi | midnight

The script will take the first like and add it as a title. The second line needs to be an empty line. Anything after is the content.

If you are actually seing this message, it means that I successfuly ran the following command:

cat post-from-your-terminal.gmi | midnight

Wish me luck!

Write a reply

Replies

~maya wrote:

Oh, how lovely! Thank you so much for making this possible.

~tidux wrote (thread):

On Terminals

You can also use w3m to browse the web directly in your terminal. It will spawn whatever editor you want, or you can use the Emacs frontend to w3m and it will open a new buffer for large text input forms like midnight.pub. I posted my first post to the pub that way.

~5th-position wrote:

I would like to try to post from a terminal, but I am anything but a hacker. So perhaps someone can assist me: where do I find the session token (or the "midn" session cookie on the web)? In case this is needed for your assistance: I use Firefox on Linux.

Thanks in advance!

~abacushex wrote:

Oooooh! This is glorious!

While I am stuck in Windows land for now (don't hate me), I have managed to streamline and CLI the hell out of it and script as much as I can. Challenge to self; implement in powershell or perhaps python...

~gerwitz wrote (thread):

I’ve been thinking about this, because I want to visit the Pub without leaving Gemini. I’m also a big fan of the Indieweb movement.

So, naturally I think it’d be nice if Gemini browsers supported Micropub for posting and replying.

There are some issues I haven’t worked through: how do “sync” authentication between these two protocols? How might a Gemini page signal the correct endpoint for posting?

Maybe Micropub should be extended to support SSH keys for auth, and then you’ve basically already done the server part!

~uirapuru wrote (thread):

Hooray!! I've been waiting for this. Keep up the good work. And I have just replied using your script :)