A blog software. It's meant to be as minimal as possible (thin client), while still maintaining basic readability and styling.
Find a file
2024-08-18 01:17:27 +02:00
.vscode add extension recommendations 2024-08-17 01:05:57 +02:00
site Better error handling when .env not set 2024-08-17 20:47:07 +02:00
.gitignore serving social icons from static instead of using the ones from their sites (faster, does not set cookies from <website of icon>) 2020-12-05 22:23:37 +01:00
docker-compose.yml Better error handling when .env not set 2024-08-17 20:47:07 +02:00
Dockerfile Add change to compile with all threads again 2021-02-13 14:04:43 +01:00
Makefile clear makefile 2024-08-10 09:01:14 +02:00
README.md updated readme 2024-08-18 01:17:27 +02:00

Crablog

Pure rust. Built with actix, diesel, tera, serde and sqlite3.

Run instructions using docker

  1. Clone this repository
  2. Install diesel and create a database
cd ./site
cargo install diesel_cli --no-default-features --features "sqlite"
diesel setup --database-url ../content/db.sqlite3
diesel migration run --database-url ../content/db.sqlite3
  1. Set up your configuration .env (see below)
  2. Pull the image (or build from source) and run the docker container
docker-compose up -d

Configuration environment file

All configuration options are defined in .env which should be placed in the path where crablog is run. An example configuration is provided:

.env

CL_USERNAME=yourusername
CL_EMAIL=me@mydomain.tld # optional
CL_BIND_PORT=8000 # optional
CL_SUBMIT_TOKEN=Submit!123 # required, token needed for submitting
CL_GITHUB_ACCOUNT=yourusername # optional
CL_TWITTER_ACCOUNT=yourusername # optional
CL_MASTODON_ACCOUNT=yourusername@mastodon.social # optional
CL_REDDIT_ACCOUNT=yourusername # optional
CL_DISCORD_ACCOUNT=yourusername # optional

# only needed when not using a docker container
CL_ROOT_PATH=/path/to/template/directory/and/sqliteDB

Routes

Route Description
/ shows the last 5 posts
/id/<id> shows a single post by id
/all shows all posts
/submit create posts using a web form
/edit> post selection page for editing
/edit/<id> edit, delete or hide posts
/about information about this blog, social media accounts

API Routes

Method Route Description
GET /api/blog/posts returns all posts as json
POST /api/blog/create creates a post
POST /api/blog/posts/edit/{post_id} edits a post
POST /api/blog/posts/hide/{post_id} hides a post
POST /api/blog/posts/delete/{post_id} deletes a post

Regenerate Migrations from Schema:

diesel migration generate --diff-schema=./src/db/schema.rs create_posts