tvl-depot/tools/blog_cli
Vincent Ambo 01bad09eed refactor: Introduce new layout with nixpkgs in third_party
This is not the final layout yet, but makes it so that my top-level
attribute set is no longer overlaid into nixpkgs itself.

This is useful for other people who are importing my monorepo.
2019-12-09 02:40:48 +00:00
..
default.nix refactor: Introduce new layout with nixpkgs in third_party 2019-12-09 02:40:48 +00:00
deps.nix feat(tools): Add a horrifying tool to write blog posts into DNS 2019-08-19 16:59:55 +01:00
main.go fix(blog_cli): Quote JSON output for post dates 2019-08-23 11:24:03 +01:00
README.md feat(tools): Add a horrifying tool to write blog posts into DNS 2019-08-19 16:59:55 +01:00

tazblog CLI

My blog stores its content in DNS, spread out over three types of TXT entries:

  • TXT _posts.blog.tazj.in.: A sorted list of posts, serialised as a JSON list of strings (e.g. ["1486830338", "1476807384"])

  • TXT _chunks.$postID.blog.tazj.in: JSON chunks containing the blog post text

  • TXT _meta.$postID.blog.tazj.in: JSON blob with blog post metadata

All JSON blobs are base64-encoded.

This CLI tool helps to update those records.

Each blog post data is a series of JSON-encoded structures which follow one of these formats:

struct metadata {
    chunks: int
    title: string
    date: date
}

Where chunks describes the number of chunks following this format:

struct chunk {
    c: int
    t: string
}

Writing a blog post to DNS means taking its text and metadata, chunking it up and writing the chunks.

Reading a blog post means retrieving all data, reading the metadata and then assembling the chunks in order.