diff --git a/CHANGELOG.md b/CHANGELOG.md index 39e733a..40264af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ This file keeps track of changes in a human-readable fashion ## Upcoming These changes were not yet released -* Brought default CSS up to date with my personal website +* Adjusted default theme * Error pages are now translated ## v1.1.4 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..51564d3 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +build: + go build + +run: + go build & ./hibiscus-txt + +dev: + go build & ./hibiscus-txt --config config/dev-config.txt \ No newline at end of file diff --git a/README.md b/README.md index 46674fa..de0c9b6 100644 --- a/README.md +++ b/README.md @@ -6,22 +6,27 @@ This project is *very* opinionated and minimal, and is designed primarily for my As a result, I can't guarantee that it's either secure or stable. ## Features: + * Each day, you get a new text file. You have until the end of that very day to finalise it. * You can save named notes to document milestones, big events, or just a nice game you played this month * You can easily export the files in a `.zip` archive for backups -* 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) (in fact, that's probably the best way to run this) +* 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) * Optional Telegram notifications for failed login attempts ## Technical details -[CHANGELOG.md](./CHANGELOG.md) provides a good overview of updates, and [TODO.md](./TODO.md) file shows what I will (or *may*) work on in the future. -You can read a relevant entry in my blog [here](https://a71.su/notes/hibiscus/). +[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/). It provides some useful information and context for why this app exists in the first place. -This repository is [self-hosted by me](https://git.a71.su/Andrew71/hibiscus), but [mirrored to GitHub](https://github.com/Andrew-71/hibiscus) in case my server goes down. +This repository is [self-hosted by me](https://git.a71.su/Andrew71/hibiscus), +but [mirrored to GitHub](https://github.com/Andrew-71/hibiscus). ### Data format: + ``` data +-- day @@ -39,6 +44,7 @@ config Deleting notes is done by clearing contents and clicking "Save" - the app deletes empty files when saving. ### Config options: + 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. @@ -65,12 +71,14 @@ tg_topic=message_thread_id ``` ### Docker deployment: + The Docker images are hosted via GitHub over at `ghcr.io/andrew-71/hibiscus:`, 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.* ### Executable flags + If you decide to use plain executable instead of docker, it supports the following flags: ``` -config string @@ -86,6 +94,7 @@ If you decide to use plain executable instead of docker, it supports the followi ``` ### API methods + You can access the API at `/api/`. It is protected by same HTTP Basic Auth as "normal" routes. ``` GET /today - get file contents for today diff --git a/auth.go b/auth.go index cc255e2..0f2aee7 100644 --- a/auth.go +++ b/auth.go @@ -27,7 +27,7 @@ func NoteLoginFail(username string, password string, r *http.Request) { attempt := failedLogin{username, password, time.Now()} updatedLogins := []failedLogin{attempt} for _, attempt := range failedLogins { - if 100 > time.Now().Sub(attempt.Timestamp).Abs().Seconds() { + if 100 > time.Since(attempt.Timestamp).Seconds() { updatedLogins = append(updatedLogins, attempt) } } diff --git a/public/main.css b/public/main.css index e92af6a..993eb06 100644 --- a/public/main.css +++ b/public/main.css @@ -4,25 +4,25 @@ --text-light: #2b2a2a; --bg-light: #f4edd7; - --clickable-light: #f85552; - --clickable-hover-light: #e66868; + --clickable-light: #ed3e3b; + --clickable-hover-light: #e55552; --clickable-label-light: #f4edd7; --text-hover-light: #656565; - --textarea-bg-light: #f5f2ee; - --textarea-border-light: #454545; + --textarea-bg-light: #f9f5e4; + --textarea-border-light: #c3c3c2; /* Dark theme */ --text-dark: #f5f0e1; --bg-dark: #1b1916; - --clickable-dark: #f85552; - --clickable-hover-dark: #e66868; + --clickable-dark: #ed3e3b; + --clickable-hover-dark: #ae3836; --clickable-label-dark: #f5f2ee; --text-hover-dark: #a9a8a4; - --textarea-bg-dark: #383030; - --textarea-border-dark: #454545; + --textarea-bg-dark: #201d1b; /* 252020 f5f0e1 */ + --textarea-border-dark: #2c2727; } * { box-sizing: border-box; } diff --git a/routes.go b/routes.go index ba347ca..4386e57 100644 --- a/routes.go +++ b/routes.go @@ -176,7 +176,7 @@ func PostEntry(filename string, w http.ResponseWriter, r *http.Request) { slog.Error("error saving file", "error", err, "file", filename) } if r.Referer() != "" { - http.Redirect(w, r, r.Header.Get("Referer"), 302) + http.Redirect(w, r, r.Header.Get("Referer"), http.StatusFound) return } } @@ -190,7 +190,7 @@ func GetDay(w http.ResponseWriter, r *http.Request) { return } if dayString == TodayDate() { // Today can still be edited - http.Redirect(w, r, "/", 302) + http.Redirect(w, r, "/", http.StatusFound) return }