hibiscus/README.md

115 lines
4.4 KiB
Markdown
Raw Normal View History

2024-03-15 18:34:24 +03:00
# 🌺 Hibiscus.txt
2024-03-15 19:22:22 +03:00
Simple plaintext diary.
2024-03-15 18:34:24 +03:00
2024-03-17 18:11:20 +03:00
This project is *very* opinionated and minimal, and is designed primarily for my usage.
2024-10-23 11:26:35 +03:00
As a result, neither security nor stability are guaranteed.
2024-03-15 20:20:33 +03:00
2024-03-15 18:34:24 +03:00
## Features:
2024-10-08 14:49:49 +03:00
2024-05-05 13:06:20 +03:00
* Each day, you get a new text file. You have until the end of that very day to finalise it.
2024-04-23 23:18:06 +03:00
* You can save named notes to document milestones, big events, or just a nice game you played this month
2024-05-05 23:15:44 +03:00
* You can easily export the files in a `.zip` archive for backups
2024-03-15 20:20:33 +03:00
2024-10-08 14:49:49 +03:00
* Everything is plain(text) and simple.
No databases, encryption, OAuth, or anything fancy. Even the password is plainte- *wait is this a feature?*
* [Docker support](#docker-deployment)
2024-03-26 14:44:58 +03:00
* Optional Telegram notifications for failed login attempts
2024-03-17 18:26:13 +03:00
2024-04-23 21:24:11 +03:00
## Technical details
2024-05-05 23:15:44 +03:00
2024-10-08 14:49:49 +03:00
[CHANGELOG.md](./CHANGELOG.md) provides a good overview of updates, and [TODO.md](./TODO.md) file shows my plans for the future.
You can read a relevant entry in my blog [here](https://a71.su/notes/hibiscus/).
2024-04-23 21:24:11 +03:00
It provides some useful information and context for why this app exists in the first place.
2024-10-08 14:49:49 +03:00
This repository is [self-hosted by me](https://git.a71.su/Andrew71/hibiscus),
but [mirrored to GitHub](https://github.com/Andrew-71/hibiscus).
2024-04-23 21:24:11 +03:00
### Data format:
2024-10-08 14:49:49 +03:00
2024-03-17 18:26:13 +03:00
```
data
+-- day
| +-- yyyy-mm-dd.txt (ISO 8601)
| ...
+-- notes
| +-- note1.txt
| +-- note2.txt
| ...
+-- readme.txt
2024-03-18 19:33:57 +03:00
config
+-- config.txt
2024-04-23 21:24:11 +03:00
```
2024-05-05 13:06:20 +03:00
Deleting notes is done by clearing contents and clicking "Save" - the app deletes empty files when saving.
2024-04-23 21:24:11 +03:00
### Config options:
2024-10-08 14:49:49 +03:00
2024-08-06 00:51:05 +03:00
Below are the available configuration options and their defaults.
The settings are defined as newline separated `key=value` pairs in the config file.
If you do not provide an option, the default will be used.
2024-05-04 15:39:15 +03:00
Please don't include the bash-style "comments" in your actual config,
2024-08-06 00:51:05 +03:00
they are provided purely for demonstration and **will break the config if present**.
2024-04-23 21:24:11 +03:00
```
username=admin # Your username
password=admin # Your password
port=7101 # What port to run on (probably leave on 7101 if using docker)
2024-05-03 15:40:40 +03:00
timezone=Local # IANA Time zone database identifier ("UTC", Local", "Europe/Moscow" etc.), Defaults to Local if can't parse.
grace_period=0s # Time after a new day begins, but before the switch to next day's file. e.g. 3h26m - files will change at 3:26am
2024-05-18 16:15:20 +03:00
language=en # ISO-639 language code (available - en, ru)
2024-08-28 14:53:54 +03:00
theme="" # Picked theme (available - default (if left empty), high-contrast, lavender, gruvbox, sans)
2024-05-09 23:44:37 +03:00
title=🌺 Hibiscus.txt # The text in the header
2024-05-04 15:39:15 +03:00
log_to_file=false # Whether to write logs to a file
log_file=config/log.txt # Where to store the log file if it is enabled
2024-04-23 21:24:11 +03:00
enable_scram=false # Whether the app should shut down if there are 3 or more failed login attempts within 100 seconds
# Not present by default, set only if you want to be notified of any failed login attempts over Telegram
# Values correspond to API flags, see https://core.telegram.org/bots/api#sendmessage
tg_token=your_telegram_token
tg_chat=chat_id
tg_topic=message_thread_id
2024-04-23 21:24:11 +03:00
```
### Docker deployment:
2024-10-08 14:49:49 +03:00
2024-06-02 01:35:01 +03:00
The Docker images are hosted via GitHub over at `ghcr.io/andrew-71/hibiscus:<tag>`,
built from the [Dockerfile](./Dockerfile).
This repo contains the [compose.yml](./compose.yml) that I personally use.
*Note: an extremely outdated self-hosted [package](https://git.a71.su/Andrew71/hibiscus/packages) will be provided for some time.*
2024-05-07 13:27:11 +03:00
2024-04-23 21:24:11 +03:00
### Executable flags
2024-10-08 14:49:49 +03:00
If you decide to use plain executable instead of docker, it supports the following flags:
2024-04-23 21:24:11 +03:00
```
-config string
override config file location
-user string
override username
-pass string
override password
-port int
override port
2024-05-04 14:29:49 +03:00
-debug
show debug log
2024-05-05 13:06:20 +03:00
```
### API methods
2024-10-08 14:49:49 +03:00
You can access the API at `/api/<method>`. It is protected by same HTTP Basic Auth as "normal" routes.
2024-05-05 13:06:20 +03:00
```
GET /today - get file contents for today
POST /today - save request body into today's file
GET /day - get JSON list of all daily entries
GET /day/<name> - get file contents for a specific day
GET /notes - get JSON list of all named notes
GET /notes/<name> - get file contents for a specific note
POST /notes/<name> - save request body into a named note
GET /readme - get file contents for readme.txt in data dir's root
POST /readme - save request body into readme.txt
2024-05-06 14:53:18 +03:00
2024-05-07 13:27:11 +03:00
GET /export - get .zip archive of entire data directory
2024-05-06 14:53:18 +03:00
GET /grace - "true" if grace period is active, otherwise "false"
2024-05-07 13:27:11 +03:00
GET /version - get app's version
2024-05-07 14:55:11 +03:00
GET /reload - reload app config
2024-03-17 18:26:13 +03:00
```