# tesoft website

This repository contains the source code of the tesoft.dev website.

The code is separated into a Go written backend and a Typescript frontend.
Both can be built together in a Docker/Podman image via the usual build
command:

```
podman build -t tesoft-website .
```

Once the image has been built, the website can be started as follows:

```
podman run -p 8080:80 \
  -e ROOT_PASSWORD=pwd \
  -v $(pwd):/db \
  -e DB_PATH=/db/tesoft-db.sqlite \
  tesoft-website
```

This command starts the website's web server on port 8080, sets the password to
`pwd` and stores the backend SQLite database in the current folder.

The password environment variable is only required in the case when no database
exists, yet and should be omitted on future calls to increase security.

Once the website is running the password can be used to upload and change blog
articles and to display a preview of unpublished articles.
To login on the webpage hit CTRL+ALT+P and type `login ` followed by the
password. Confirm with enter.

Blog articles can either be managed using direct api calls or via the
[./tesoft.bash](tesoft.bash) helper script.
It supports the following operations:

`tesoft.bash login`

Asks for the password and performs a login.

`tesoft.bash logout`

Logout from the server.

`tesoft.bash upload ./article-dir`

Create a new blog article in draft state. The folder must contain at least a
`README.md` file that contains the article content.
The command prints the id of the created article.

`tesoft.bash patch 123 ./aticle-dir`

Changes a blog article with the given id. This does not change the article state.

`tesoft.bash publish 123`

Sets the state for the blog article with the given id to published.

`tesoft.bash unpublish 123`

Sets the state for the blog article with the given id to unpublished.

`tesoft.bash drop 123`

Deletes the blog article with the given id.

