Something went wrong. Try again.
Discover books, shows, and movies at your level. Track your progress by filling your Shelf with what you find, and share with other language shlf.space
Something went wrong. Try again.
1.7 kB · 55 lines
Markdown
at master
Hacking guide #
Required tools #
Running shlf #
To authenticate, you will need OAUTH JWKs to be setup:
export SHLF_OAUTH_CLIENT_KID="$(date +%s)"
export SHLF_OAUTH_CLIENT_SECRET="$(goat key generate -t P-256 | grep -A1 "Secret Key" | tail -n1 | awk '{print $1}')"
You will need to fetch a series of static assets shlf depends on:
mkdir -p ./static/files/js
# HTMX
curl -sLo ./static/files/js/htmx.min.js https://cdn.jsdelivr.net/npm/htmx.org@2.0.6/dist/htmx.min.js
# Lucide (icons)
curl -sLo ./static/files/js/lucide.min.js https://unpkg.com/lucide@0.525.0/dist/umd/lucide.min.js
# AlpineJS
curl -sLo ./static/files/js/alpinejs.min.js https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js
You will need to start a redis instance - using docker can simplify this process greatly:
docker run -d --name shlf-redis -p 6379:6379 redis:latest
To run:
SHLF_DEV=true go run cmd/server/main.go
If you modified the views, you will need to regenerate them:
go tool templ generate
go tool templ fmt ./internal/ui/
If you modified the tailwind styles, you will need to regenerate the css:
tailwindcss -i ./input.css -o ./static/files/style.css
If you modified the js files, you will need to regenerate the minified versions:
find internal static -path 'static/files' -prune -o -name '*.js' -print | while read f; do minify "$f" -o "static/files/js/$(basename "$f")"; done