Compare commits
No commits in common. "f33206c99d202e2401271843442edbe290792583" and "00298df1ccdf8f2f9aa24fa843c9909676195cb1" have entirely different histories.
f33206c99d
...
00298df1cc
6 changed files with 6 additions and 18 deletions
|
@ -1,11 +1,6 @@
|
|||
# Changelog
|
||||
This file keeps track of changes in more human-readable fashion
|
||||
|
||||
## v1.1.2
|
||||
This version contains changes from pull request #2 by Rithas K.
|
||||
* Real IPs are now logged
|
||||
* Textarea has been fixed Safari
|
||||
* Done some minor behind-the-scenes housekeeping
|
||||
## v1.1.1
|
||||
This release is mostly a technicality, with a move over to GitHub (`ghcr.io/andrew-71/hibiscus`) for packages due to DockerHub's anti-Russian actions making old "CI/CD" impossible.
|
||||
## v1.1.0
|
||||
|
|
|
@ -48,7 +48,6 @@ var DefaultConfig = Config{
|
|||
|
||||
TelegramToken: "",
|
||||
TelegramChat: "",
|
||||
TelegramTopic: "",
|
||||
}
|
||||
|
||||
// String returns text version of modified and mandatory config options
|
||||
|
|
2
info.go
2
info.go
|
@ -15,7 +15,7 @@ type AppInfo struct {
|
|||
|
||||
// Info contains app information
|
||||
var Info = AppInfo{
|
||||
Version: "1.1.2",
|
||||
Version: "1.1.1",
|
||||
SourceLink: "https://git.a71.su/Andrew71/hibiscus",
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
--textarea-border-dark: #454545;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
color: var(--text-light);
|
||||
background-color: var(--bg-light);
|
||||
|
|
14
routes.go
14
routes.go
|
@ -27,21 +27,17 @@ type Entry struct {
|
|||
|
||||
type formatEntries func([]string) []Entry
|
||||
|
||||
// Public contains the static files e.g. CSS, JS
|
||||
//
|
||||
//go:embed public
|
||||
var Public embed.FS
|
||||
|
||||
// Pages contains the HTML templates used by the app
|
||||
//
|
||||
//go:embed pages
|
||||
var Pages embed.FS
|
||||
|
||||
// EmbeddedPage returns contents of a file in Pages while "handling" potential errors
|
||||
func EmbeddedPage(name string) []byte {
|
||||
// EmbeddedFile returns a file in Pages while "handling" potential errors
|
||||
func EmbeddedFile(name string) []byte {
|
||||
data, err := Pages.ReadFile(name)
|
||||
if err != nil {
|
||||
slog.Error("error reading embedded file", "err", err)
|
||||
slog.Error("Error embedded file", "err", err)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
@ -58,13 +54,13 @@ var listTemplate = template.Must(template.New("").Funcs(templateFuncs).ParseFS(P
|
|||
// NotFound returns a user-friendly 404 error page
|
||||
func NotFound(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(404)
|
||||
HandleWrite(w.Write(EmbeddedPage("pages/error/404.html")))
|
||||
HandleWrite(w.Write(EmbeddedFile("pages/error/404.html")))
|
||||
}
|
||||
|
||||
// InternalError returns a user-friendly 500 error page
|
||||
func InternalError(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(500)
|
||||
HandleWrite(w.Write(EmbeddedPage("pages/error/500.html")))
|
||||
HandleWrite(w.Write(EmbeddedFile("pages/error/500.html")))
|
||||
}
|
||||
|
||||
// GetToday renders HTML page for today's entry
|
||||
|
|
1
serve.go
1
serve.go
|
@ -12,7 +12,6 @@ import (
|
|||
// Serve starts the app's web server
|
||||
func Serve() {
|
||||
r := chi.NewRouter()
|
||||
r.Use(middleware.RealIP)
|
||||
r.Use(middleware.Logger, middleware.CleanPath, middleware.StripSlashes)
|
||||
r.NotFound(NotFound)
|
||||
|
||||
|
|
Loading…
Reference in a new issue