Neocities automation

Working with geocities is nice enough, but after a while the drag-and-dropping gets old,so, time to automate it.

There are several command-line tools to work with the neocities api (there might be more…):

The python one is too much work, the official one wants me to install ruby which always makes a mess, so the easiest one is the go client, on Ubuntu / Debian, if needed, install go:

sudo apt install golang-go

Then the neocities client:

go get -u github.com/peterhellberg/neocities

Set go path

Next make sure the tool is in your path, add the following lines to ~/.bashrc or ~/.zshrc:

export GOROOT=/usr/lib/go 
export GOPATH=$HOME/go 
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

Check if it works:

NEOCITIES_USER=“dbob” NEOCITIES_PASS=“haha-no” neocities info

which should answer with something like:

{
  "result": "success",
  "info": {
    "sitename": "dbob",
    "views": 3,
    "hits": 9,
    "created_at": "Sun, 03 Nov 2019 08:32:28 -0000",
    "last_updated": null,
    "domain": null,
    "tags": [
      "fiction",
      "twine"
    ],
    "latest_ipfs_hash": null
  }
}

Use the api token instead of login/password

NEOCITIES_USER=“dbob” NEOCITIES_PASS=“haha-yeah-right” neocities key

Should return an API key that you then can use like this:

NEOCITIES_KEY=“1234567890supersecret” neocities info

Now you no longer need to use your password in scripts. +1 For security!