Random Devlogs - I'm migrating

I've been wanting to migrate from Blogger to a self-hosted CMS for ages now, primarily due to issues with Google, and fear of all my content getting nuked one day, the main things that stopped me from starting the process were the insane requirements I had, which include running on my Raspberry Pi Zero 2W, supporting some sort of localization and being easily customizable for each post. The solution to all these issues was building my own CMS with a language low enough to be highly optimized by nature, doing a lot of MacGyvering and reducing most features to their simplest forms, which are all complicated ways of saying "lots of pain". 

 

The beginning of this masochistic journey started some weeks ago with a barebones static HTTP server written in Rust. The premise was simple actually, baking every asset into the binary and serving them directly, but it did have its shortcomings, the main one being that making a post required recompiling the whole server. To fix that I added static file serving with fallbacks for extensionless HTML pages and indexes, it worked fine so I now had a rough base.

Image of the server successfully serving a picture of Niko from OneShot It works! 
 
Another problem was that all pages in NightCirrus follow a template and rewriting it on all pages would be tedious, so I used custom tags and a primitive templating system that is very VERY fit for specific tasks, so it won't work on anything fancy, still have to think how to handle that.
 
 
 Now for the CMS part, it's a made in hell duo of SSG with CSR, using LMDB for backuping posts and storing comments. Most stuff is stored as a binary data, and categories for posts are hardcoded so it's a bit clunky, still I'm happy with the result! The generator runs on a parallel thread to the server, when the server receives a post it raises a flag which makes the generator rebuild the static post files, also not the cleanest thing by the way. 
 
Comments and posts are identified by personal hashes (pashes) that are made from 128 bit secrets, they are used to authenticate most stuff except for the admin privileges. Speaking of which the way I handled them was by opening 2 TCP ports, one for Cloudflared to access and the other for admin stuff, the two streams are consumed by the same server thread.
 
The next step is implementing localization and PoW to stop bots from messing with my stuff, also cleaning up the codebase as it's very messy. Anyway, see you soon with more news on this and other projects!
 
-A 

Nenhum comentário

Postar um comentário