Improve default theme

This commit is contained in:
Andrew-71 2024-10-08 14:49:49 +03:00
parent 6d37c363bb
commit eb3c1fb32a
6 changed files with 34 additions and 17 deletions

View file

@ -4,7 +4,7 @@ This file keeps track of changes in a human-readable fashion
## Upcoming ## Upcoming
These changes were not yet released These changes were not yet released
* Brought default CSS up to date with my personal website * Adjusted default theme
* Error pages are now translated * Error pages are now translated
## v1.1.4 ## v1.1.4

8
Makefile Normal file
View file

@ -0,0 +1,8 @@
build:
go build
run:
go build & ./hibiscus-txt
dev:
go build & ./hibiscus-txt --config config/dev-config.txt

View file

@ -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. As a result, I can't guarantee that it's either secure or stable.
## Features: ## Features:
* Each day, you get a new text file. You have until the end of that very day to finalise it. * 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 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 * 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?* * Everything is plain(text) and simple.
* [Docker support](#docker-deployment) (in fact, that's probably the best way to run this) 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 * Optional Telegram notifications for failed login attempts
## Technical details ## 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. 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 format:
``` ```
data data
+-- day +-- day
@ -39,6 +44,7 @@ config
Deleting notes is done by clearing contents and clicking "Save" - the app deletes empty files when saving. Deleting notes is done by clearing contents and clicking "Save" - the app deletes empty files when saving.
### Config options: ### Config options:
Below are the available configuration options and their defaults. Below are the available configuration options and their defaults.
The settings are defined as newline separated `key=value` pairs in the config file. 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. If you do not provide an option, the default will be used.
@ -65,12 +71,14 @@ tg_topic=message_thread_id
``` ```
### Docker deployment: ### Docker deployment:
The Docker images are hosted via GitHub over at `ghcr.io/andrew-71/hibiscus:<tag>`, The Docker images are hosted via GitHub over at `ghcr.io/andrew-71/hibiscus:<tag>`,
built from the [Dockerfile](./Dockerfile). built from the [Dockerfile](./Dockerfile).
This repo contains the [compose.yml](./compose.yml) that I personally use. 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.* *Note: an extremely outdated self-hosted [package](https://git.a71.su/Andrew71/hibiscus/packages) will be provided for some time.*
### Executable flags ### Executable flags
If you decide to use plain executable instead of docker, it supports the following flags: If you decide to use plain executable instead of docker, it supports the following flags:
``` ```
-config string -config string
@ -86,6 +94,7 @@ If you decide to use plain executable instead of docker, it supports the followi
``` ```
### API methods ### API methods
You can access the API at `/api/<method>`. It is protected by same HTTP Basic Auth as "normal" routes. You can access the API at `/api/<method>`. It is protected by same HTTP Basic Auth as "normal" routes.
``` ```
GET /today - get file contents for today GET /today - get file contents for today

View file

@ -27,7 +27,7 @@ func NoteLoginFail(username string, password string, r *http.Request) {
attempt := failedLogin{username, password, time.Now()} attempt := failedLogin{username, password, time.Now()}
updatedLogins := []failedLogin{attempt} updatedLogins := []failedLogin{attempt}
for _, attempt := range failedLogins { for _, attempt := range failedLogins {
if 100 > time.Now().Sub(attempt.Timestamp).Abs().Seconds() { if 100 > time.Since(attempt.Timestamp).Seconds() {
updatedLogins = append(updatedLogins, attempt) updatedLogins = append(updatedLogins, attempt)
} }
} }

View file

@ -4,25 +4,25 @@
--text-light: #2b2a2a; --text-light: #2b2a2a;
--bg-light: #f4edd7; --bg-light: #f4edd7;
--clickable-light: #f85552; --clickable-light: #ed3e3b;
--clickable-hover-light: #e66868; --clickable-hover-light: #e55552;
--clickable-label-light: #f4edd7; --clickable-label-light: #f4edd7;
--text-hover-light: #656565; --text-hover-light: #656565;
--textarea-bg-light: #f5f2ee; --textarea-bg-light: #f9f5e4;
--textarea-border-light: #454545; --textarea-border-light: #c3c3c2;
/* Dark theme */ /* Dark theme */
--text-dark: #f5f0e1; --text-dark: #f5f0e1;
--bg-dark: #1b1916; --bg-dark: #1b1916;
--clickable-dark: #f85552; --clickable-dark: #ed3e3b;
--clickable-hover-dark: #e66868; --clickable-hover-dark: #ae3836;
--clickable-label-dark: #f5f2ee; --clickable-label-dark: #f5f2ee;
--text-hover-dark: #a9a8a4; --text-hover-dark: #a9a8a4;
--textarea-bg-dark: #383030; --textarea-bg-dark: #201d1b; /* 252020 f5f0e1 */
--textarea-border-dark: #454545; --textarea-border-dark: #2c2727;
} }
* { box-sizing: border-box; } * { box-sizing: border-box; }

View file

@ -176,7 +176,7 @@ func PostEntry(filename string, w http.ResponseWriter, r *http.Request) {
slog.Error("error saving file", "error", err, "file", filename) slog.Error("error saving file", "error", err, "file", filename)
} }
if r.Referer() != "" { if r.Referer() != "" {
http.Redirect(w, r, r.Header.Get("Referer"), 302) http.Redirect(w, r, r.Header.Get("Referer"), http.StatusFound)
return return
} }
} }
@ -190,7 +190,7 @@ func GetDay(w http.ResponseWriter, r *http.Request) {
return return
} }
if dayString == TodayDate() { // Today can still be edited if dayString == TodayDate() { // Today can still be edited
http.Redirect(w, r, "/", 302) http.Redirect(w, r, "/", http.StatusFound)
return return
} }