Fix Makefile

This commit is contained in:
Andrew-71 2024-10-11 11:13:55 +03:00
parent eb3c1fb32a
commit b56ce43c80
3 changed files with 11 additions and 5 deletions

View file

@ -2,7 +2,7 @@ build:
go build go build
run: run:
go build & ./hibiscus-txt go build && ./hibiscus-txt
dev: dev:
go build & ./hibiscus-txt --config config/dev-config.txt go build && ./hibiscus-txt --config config/dev-config.txt

View file

@ -3,13 +3,16 @@ List of things to add to this project
## Urgent (1.1.5-2.0.0) ## Urgent (1.1.5-2.0.0)
* `style.css` in config instead of theme (provide themes as examples in repo) * `style.css` in config instead of theme (provide themes as examples in repo)
* man page, maybe try packaging for fun
* Auth improvement so it DOESN'T ASK ME FOR PASSWORD EVERY DAY UGH XD * Auth improvement so it DOESN'T ASK ME FOR PASSWORD EVERY DAY UGH XD
## Nice to have ## Nice to have
* Forward/backward buttons for days * Forward/backward buttons for days
* Changelog included * Changelog included
* Refactor code * Refactor code
* API field for version
* Notifications late in the day
* man page, maybe try packaging for fun
* store passwords as hash
## Brainstorming ## Brainstorming
Don't expect any of this, these are ideas floating inside my head Don't expect any of this, these are ideas floating inside my head

View file

@ -3,7 +3,6 @@ package main
import ( import (
"embed" "embed"
"errors" "errors"
"github.com/go-chi/chi/v5"
"html/template" "html/template"
"log/slog" "log/slog"
"net/http" "net/http"
@ -11,6 +10,8 @@ import (
"os" "os"
"strings" "strings"
"time" "time"
"github.com/go-chi/chi/v5"
) )
type EntryList struct { type EntryList struct {
@ -56,6 +57,7 @@ var viewTemplate = template.Must(template.New("").Funcs(templateFuncs).ParseFS(P
var listTemplate = template.Must(template.New("").Funcs(templateFuncs).ParseFS(Pages, "pages/base.html", "pages/list.html")) var listTemplate = template.Must(template.New("").Funcs(templateFuncs).ParseFS(Pages, "pages/base.html", "pages/list.html"))
var template404 = template.Must(template.New("404").Funcs(templateFuncs).ParseFS(Pages, "pages/error/404.html")) var template404 = template.Must(template.New("404").Funcs(templateFuncs).ParseFS(Pages, "pages/error/404.html"))
// NotFound returns a user-friendly 404 error page. // NotFound returns a user-friendly 404 error page.
func NotFound(w http.ResponseWriter, r *http.Request) { func NotFound(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(404) w.WriteHeader(404)
@ -69,12 +71,13 @@ func NotFound(w http.ResponseWriter, r *http.Request) {
} }
var template500 = template.Must(template.New("500").Funcs(templateFuncs).ParseFS(Pages, "pages/error/500.html")) var template500 = template.Must(template.New("500").Funcs(templateFuncs).ParseFS(Pages, "pages/error/500.html"))
// InternalError returns a user-friendly 500 error page. // InternalError returns a user-friendly 500 error page.
func InternalError(w http.ResponseWriter, r *http.Request) { func InternalError(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(500) w.WriteHeader(500)
err := template500.Execute(w, nil) err := template500.Execute(w, nil)
if err != nil { // Well this is awkward if err != nil { // Well this is awkward
slog.Error("error rendering error 500 page", "error", err) slog.Error("error rendering error 500 page", "error", err)
HandleWrite(w.Write([]byte("500. Something went *very* wrong."))) HandleWrite(w.Write([]byte("500. Something went *very* wrong.")))
return return