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
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

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.
## 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.
[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:<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.*
### 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/<method>`. It is protected by same HTTP Basic Auth as "normal" routes.
```
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()}
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)
}
}

View file

@ -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; }

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)
}
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
}