Compare commits

..

5 commits

Author SHA1 Message Date
Lilian Jónsdóttir 51f1f6bc35 update projects 2024-08-10 16:35:38 -07:00
Lilian Jónsdóttir e0c0f222f6 format readme 2024-06-03 19:33:01 -07:00
Lilian Jónsdóttir 753e15b59e handle certbot challenge 2024-06-03 19:32:38 -07:00
Lilian Jónsdóttir 3d2c13b588 format justfile 2024-06-03 19:32:07 -07:00
Lilian Jónsdóttir a2f9b69504 add statsviz 2024-06-03 19:32:03 -07:00
6 changed files with 35 additions and 11 deletions

View file

@ -3,6 +3,7 @@
Code for the [burning.moe](https://burning.moe) homepage Code for the [burning.moe](https://burning.moe) homepage
## technologies used ## technologies used
- written in [go](https://go.dev) using: - written in [go](https://go.dev) using:
- [chi](https://github.com/go-chi/chi) - [chi](https://github.com/go-chi/chi)
- [cleanenv](https://github.com/ilyakaznacheev/cleanenv) - [cleanenv](https://github.com/ilyakaznacheev/cleanenv)
@ -16,6 +17,4 @@ Code for the [burning.moe](https://burning.moe) homepage
why not? why not?
Improving my go skills, and learning to write web apps in go, was a Improving my go skills, and learning to write web apps in go, was a good opportunity to rewrite my ancient and basic website while having it functionally not change at all.
good opportunity to rewrite my ancient and basic website while having
it functionally not change at all.

View file

@ -3,6 +3,7 @@ package main
import ( import (
"net/http" "net/http"
"github.com/arl/statsviz"
"github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5"
"git.burning.moe/celediel/burning.moe/internal/config" "git.burning.moe/celediel/burning.moe/internal/config"
@ -19,10 +20,21 @@ func routes(app *config.AppConfig) http.Handler {
mux.Use(mw) mux.Use(mw)
} }
// Setup stats viewer
stats, _ := statsviz.NewServer()
mux.Get("/debug/statsviz/ws", stats.Ws())
mux.Get("/debug/statsviz", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/debug/statsviz/", 301)
})
mux.Handle("/debug/statsviz/*", stats.Index())
// Setup static file server // Setup static file server
app.Logger.Debug("Setting up /static file server") app.Logger.Debug("Setting up /static file server")
mux.Handle("/static/*", http.StripPrefix("/static", http.FileServer(http.Dir("./static")))) mux.Handle("/static/*", http.StripPrefix("/static", http.FileServer(http.Dir("./static"))))
// handle certbot challenge
mux.Handle("/.well-known/acme-challenge/*", http.StripPrefix("/.well-known/acme-challenge", http.FileServer(http.Dir("./.well-known/acme-challenge"))))
// Setup routes for handlers // Setup routes for handlers
for _, handler := range handlers.Handlers { for _, handler := range handlers.Handlers {
app.Logger.Info("Setting up handler for " + handler.Handles) app.Logger.Info("Setting up handler for " + handler.Handles)

2
go.mod
View file

@ -11,9 +11,11 @@ require (
require ( require (
github.com/BurntSushi/toml v1.3.2 // indirect github.com/BurntSushi/toml v1.3.2 // indirect
github.com/arl/statsviz v0.6.0 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/charmbracelet/lipgloss v0.10.0 // indirect github.com/charmbracelet/lipgloss v0.10.0 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/joho/godotenv v1.5.1 // indirect github.com/joho/godotenv v1.5.1 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect

4
go.sum
View file

@ -1,6 +1,8 @@
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/arl/statsviz v0.6.0 h1:jbW1QJkEYQkufd//4NDYRSNBpwJNrdzPahF7ZmoGdyE=
github.com/arl/statsviz v0.6.0/go.mod h1:0toboo+YGSUXDaS4g1D5TVS4dXs7S7YYT5J/qnW2h8s=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s= github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s=
@ -13,6 +15,8 @@ github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s=
github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/ilyakaznacheev/cleanenv v1.5.0 h1:0VNZXggJE2OYdXE87bfSSwGxeiGt9moSR2lOrsHHvr4= github.com/ilyakaznacheev/cleanenv v1.5.0 h1:0VNZXggJE2OYdXE87bfSSwGxeiGt9moSR2lOrsHHvr4=
github.com/ilyakaznacheev/cleanenv v1.5.0/go.mod h1:a5aDzaJrLCQZsazHol1w8InnDcOX0OColm64SlIi6gk= github.com/ilyakaznacheev/cleanenv v1.5.0/go.mod h1:a5aDzaJrLCQZsazHol1w8InnDcOX0OColm64SlIi6gk=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=

View file

@ -8,27 +8,27 @@ default: run
# build binary # build binary
build: build:
go build -o {{output}} {{cmd}} go build -o {{ output }} {{ cmd }}
# run from source # run from source
run: run:
go run {{cmd}} go run {{ cmd }}
# build 'n run # build 'n run
run-binary: build run-binary: build
exec {{output}} exec {{ output }}
# run with args # run with args
run-args args: run-args args:
go run {{cmd}} {{args}} go run {{ cmd }} {{ args }}
# install binary into $GOPATH # install binary into $GOPATH
install: install:
go install {{cmd}} go install {{ cmd }}
# clean up after yourself # clean up after yourself
clean: clean:
rm {{output}} rm {{ output }}
# run go tests # run go tests
test: test:

View file

@ -18,10 +18,17 @@ LinkMap:
- href: https://git.burning.moe/celediel/qud-mods - href: https://git.burning.moe/celediel/qud-mods
text: assorted mods for Caves of Qud text: assorted mods for Caves of Qud
icon: teenyicons:c-sharp-solid icon: teenyicons:c-sharp-solid
misc: go:
- href: https://git.burning.moe/celediel/burning.moe - href: https://git.burning.moe/celediel/burning.moe
text: burning.moe - this website text: burning.moe - this website
icon: file-icons:go-old icon: file-icons:go-old
- href: https://git.burning.moe/celediel/gt
text: gt - small cli for XDG trash specification
icon: file-icons:go-old
- href: https://git.burning.moe/celediel/agedit
text: agedit - edit age encrypted text with $EDITOR
icon: file-icons:go-old
misc:
- href: https://git.burning.moe/celediel/poiekolon.nvim - href: https://git.burning.moe/celediel/poiekolon.nvim
text: poiekolon.nvim - neovim plugin to add or toggle a char at the end of a line text: poiekolon.nvim - neovim plugin to add or toggle a char at the end of a line
icon: simple-icons:lua icon: simple-icons:lua