Update 2024 #1

Open
mtrx wants to merge 11 commits from update-2024 into main
Showing only changes of commit 1afd70a516 - Show all commits

View file

@ -4,20 +4,16 @@ Pure rust. Built with actix, diesel, tera, serde and sqlite3.
## Run instructions using docker ## Run instructions using docker
**TODO REWRITE, OUTDATED**
1. Clone the repository 1. Clone this repository
```bash
git clone https://github.com/mtrx1337/crablog
cd crablog/site
```
2. Install diesel and create a database 2. Install diesel and create a database
```bash ```bash
cd ./site
cargo install diesel_cli --no-default-features --features "sqlite" cargo install diesel_cli --no-default-features --features "sqlite"
diesel setup --database-url ../content/db.sqlite3 diesel setup --database-url ../content/db.sqlite3
diesel migration run --database-url ../content/db.sqlite3 diesel migration run --database-url ../content/db.sqlite3
``` ```
3. Set up your configuration file (see below) 3. Set up your configuration .env (see below)
4. Pull the image (or build from source) and run the docker container 4. Pull the image (or build from source) and run the docker container
```bash ```bash
docker-compose up -d docker-compose up -d
@ -50,15 +46,20 @@ CL_ROOT_PATH=/path/to/template/directory/and/sqliteDB
| `/` | shows the last 5 posts | | `/` | shows the last 5 posts |
| `/id/<id>` | shows a single post by id | | `/id/<id>` | shows a single post by id |
| `/all` | shows all posts | | `/all` | shows all posts |
| `/submit` | set your submit token and create posts | | `/submit` | create posts using a web form |
| `/edit>` | post selection page for editing |
| `/edit/<id>` | edit, delete or hide posts | | `/edit/<id>` | edit, delete or hide posts |
| `/about` | information about this blog, social media accounts | | `/about` | information about this blog, social media accounts |
**API Routes** **API Routes**
| Route | Description | | Method | Route | Description |
| ---------------- | ------------------------- | |---- | ---------------- | ------------------------- |
| `api/blog/posts` | returns all posts as json | | 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: ## Regenerate Migrations from Schema: