diff --git a/main.go b/main.go index 5d1544b..992bfa5 100644 --- a/main.go +++ b/main.go @@ -10,20 +10,20 @@ import ( "net/http" ) -//go:embed source static +//go:embed source var sourceFS embed.FS func main() { port := flag.Int("port", 8081, "port to listen on") flag.Parse() - staticRoot, err := fs.Sub(sourceFS, "source") + sourceRoot, err := fs.Sub(sourceFS, "source") if err != nil { log.Fatal(err) } // print exactly what got embedded - fs.WalkDir(staticRoot, ".", func(path string, d fs.DirEntry, err error) error { + fs.WalkDir(sourceRoot, ".", func(path string, d fs.DirEntry, err error) error { if err != nil { log.Println("walk error:", err) return nil @@ -34,7 +34,7 @@ func main() { mux := http.NewServeMux() mux.HandleFunc("GET /{$}", func(w http.ResponseWriter, r *http.Request) { - tmpl, err := template.ParseFS(staticRoot, "templates/main.html", "pages/index.html") + tmpl, err := template.ParseFS(sourceRoot, "templates/main.html", "pages/index.html") if err != nil { log.Println("parse error:", err) http.Error(w, err.Error(), http.StatusInternalServerError) @@ -58,7 +58,7 @@ func main() { }) mux.HandleFunc("GET /research", func(w http.ResponseWriter, r *http.Request) { - tmpl, err := template.ParseFS(staticRoot, "templates/main.html", "pages/research.html") + tmpl, err := template.ParseFS(sourceRoot, "templates/main.html", "pages/research.html") if err != nil { log.Println("parse error:", err) http.Error(w, err.Error(), http.StatusInternalServerError) @@ -82,7 +82,7 @@ func main() { }) mux.HandleFunc("GET /bookkeeping", func(w http.ResponseWriter, r *http.Request) { - tmpl, err := template.ParseFS(staticRoot, "templates/main.html", "pages/bookkeeping.html") + tmpl, err := template.ParseFS(sourceRoot, "templates/main.html", "pages/bookkeeping.html") if err != nil { log.Println("parse error:", err) http.Error(w, err.Error(), http.StatusInternalServerError) @@ -106,7 +106,7 @@ func main() { }) mux.HandleFunc("GET /personal", func(w http.ResponseWriter, r *http.Request) { - tmpl, err := template.ParseFS(staticRoot, "templates/main.html", "pages/interests.html") + tmpl, err := template.ParseFS(sourceRoot, "templates/main.html", "pages/interests.html") if err != nil { log.Println("parse error:", err) http.Error(w, err.Error(), http.StatusInternalServerError) @@ -129,9 +129,16 @@ func main() { } }) - assetsRoot, err := fs.Sub(sourceFS, "static") + staticRoot, err := fs.Sub(sourceFS, "source/static") + if err != nil { + log.Fatal(err) + } - mux.Handle("/static/", http.StripPrefix("/static/", http.FileServerFS(assetsRoot))) + mux.Handle("/static/", http.StripPrefix("/static/", http.FileServerFS(staticRoot))) + + mux.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) { + http.ServeFileFS(w, r, staticRoot, "favicon.ico") + }) addr := fmt.Sprintf(":%d", *port) log.Printf("running on http://localhost%s/\n", addr) diff --git a/source/favicon.ico b/source/favicon.ico new file mode 100644 index 0000000..c0e17d5 Binary files /dev/null and b/source/favicon.ico differ diff --git a/static/.DS_Store b/source/static/.DS_Store similarity index 100% rename from static/.DS_Store rename to source/static/.DS_Store diff --git a/static/components/background.html b/source/static/components/background.html similarity index 100% rename from static/components/background.html rename to source/static/components/background.html diff --git a/static/components/eq.html b/source/static/components/eq.html similarity index 100% rename from static/components/eq.html rename to source/static/components/eq.html diff --git a/static/components/games.html b/source/static/components/games.html similarity index 100% rename from static/components/games.html rename to source/static/components/games.html diff --git a/static/components/themetoggle.html b/source/static/components/themetoggle.html similarity index 100% rename from static/components/themetoggle.html rename to source/static/components/themetoggle.html diff --git a/static/cv.pdf b/source/static/cv.pdf similarity index 100% rename from static/cv.pdf rename to source/static/cv.pdf diff --git a/static/gamesbanners/Tombraider.png b/source/static/gamesbanners/Tombraider.png similarity index 100% rename from static/gamesbanners/Tombraider.png rename to source/static/gamesbanners/Tombraider.png diff --git a/static/gamesbanners/baldursgate3.jpg b/source/static/gamesbanners/baldursgate3.jpg similarity index 100% rename from static/gamesbanners/baldursgate3.jpg rename to source/static/gamesbanners/baldursgate3.jpg diff --git a/static/gamesbanners/detroitbecomehuman.jpg b/source/static/gamesbanners/detroitbecomehuman.jpg similarity index 100% rename from static/gamesbanners/detroitbecomehuman.jpg rename to source/static/gamesbanners/detroitbecomehuman.jpg diff --git a/static/gamesbanners/factorio.jpg b/source/static/gamesbanners/factorio.jpg similarity index 100% rename from static/gamesbanners/factorio.jpg rename to source/static/gamesbanners/factorio.jpg diff --git a/static/gamesbanners/gtav.webp b/source/static/gamesbanners/gtav.webp similarity index 100% rename from static/gamesbanners/gtav.webp rename to source/static/gamesbanners/gtav.webp diff --git a/static/gamesbanners/minecraft.webp b/source/static/gamesbanners/minecraft.webp similarity index 100% rename from static/gamesbanners/minecraft.webp rename to source/static/gamesbanners/minecraft.webp diff --git a/static/gamesbanners/planetzoo.webp b/source/static/gamesbanners/planetzoo.webp similarity index 100% rename from static/gamesbanners/planetzoo.webp rename to source/static/gamesbanners/planetzoo.webp diff --git a/static/gamesbanners/riskofrain2.jpg b/source/static/gamesbanners/riskofrain2.jpg similarity index 100% rename from static/gamesbanners/riskofrain2.jpg rename to source/static/gamesbanners/riskofrain2.jpg diff --git a/static/gamesbanners/slaythespire2.png b/source/static/gamesbanners/slaythespire2.png similarity index 100% rename from static/gamesbanners/slaythespire2.png rename to source/static/gamesbanners/slaythespire2.png diff --git a/static/icons/Invoice-OKZP3LVL-0011.pdf b/source/static/icons/Invoice-OKZP3LVL-0011.pdf similarity index 100% rename from static/icons/Invoice-OKZP3LVL-0011.pdf rename to source/static/icons/Invoice-OKZP3LVL-0011.pdf diff --git a/static/icons/arcade.svg b/source/static/icons/arcade.svg similarity index 100% rename from static/icons/arcade.svg rename to source/static/icons/arcade.svg diff --git a/static/icons/at-sign.svg b/source/static/icons/at-sign.svg similarity index 100% rename from static/icons/at-sign.svg rename to source/static/icons/at-sign.svg diff --git a/static/icons/half-moon.svg b/source/static/icons/half-moon.svg similarity index 100% rename from static/icons/half-moon.svg rename to source/static/icons/half-moon.svg diff --git a/static/icons/leafeon-the-eevees-and-umbreon-l3kahsutrpv30hko.jpg b/source/static/icons/leafeon-the-eevees-and-umbreon-l3kahsutrpv30hko.jpg similarity index 100% rename from static/icons/leafeon-the-eevees-and-umbreon-l3kahsutrpv30hko.jpg rename to source/static/icons/leafeon-the-eevees-and-umbreon-l3kahsutrpv30hko.jpg diff --git a/static/icons/lovesun.png b/source/static/icons/lovesun.png similarity index 100% rename from static/icons/lovesun.png rename to source/static/icons/lovesun.png diff --git a/static/icons/magic-moon.png b/source/static/icons/magic-moon.png similarity index 100% rename from static/icons/magic-moon.png rename to source/static/icons/magic-moon.png diff --git a/static/icons/moon.png b/source/static/icons/moon.png similarity index 100% rename from static/icons/moon.png rename to source/static/icons/moon.png diff --git a/static/icons/mooncloud.png b/source/static/icons/mooncloud.png similarity index 100% rename from static/icons/mooncloud.png rename to source/static/icons/mooncloud.png diff --git a/static/icons/sleepmoon.png b/source/static/icons/sleepmoon.png similarity index 100% rename from static/icons/sleepmoon.png rename to source/static/icons/sleepmoon.png diff --git a/static/icons/sun-light.svg b/source/static/icons/sun-light.svg similarity index 100% rename from static/icons/sun-light.svg rename to source/static/icons/sun-light.svg diff --git a/static/icons/sun.png b/source/static/icons/sun.png similarity index 100% rename from static/icons/sun.png rename to source/static/icons/sun.png diff --git a/static/images/97143-200.png b/source/static/images/97143-200.png similarity index 100% rename from static/images/97143-200.png rename to source/static/images/97143-200.png diff --git a/static/images/Screenshot 2024-10-07 at 12.24.11.png b/source/static/images/Screenshot 2024-10-07 at 12.24.11.png similarity index 100% rename from static/images/Screenshot 2024-10-07 at 12.24.11.png rename to source/static/images/Screenshot 2024-10-07 at 12.24.11.png diff --git a/static/images/book.png b/source/static/images/book.png similarity index 100% rename from static/images/book.png rename to source/static/images/book.png diff --git a/static/images/books.png b/source/static/images/books.png similarity index 100% rename from static/images/books.png rename to source/static/images/books.png diff --git a/static/images/calc.png b/source/static/images/calc.png similarity index 100% rename from static/images/calc.png rename to source/static/images/calc.png diff --git a/static/images/coffe.png b/source/static/images/coffe.png similarity index 100% rename from static/images/coffe.png rename to source/static/images/coffe.png diff --git a/static/images/directory.png b/source/static/images/directory.png similarity index 100% rename from static/images/directory.png rename to source/static/images/directory.png diff --git a/static/images/dragon.png b/source/static/images/dragon.png similarity index 100% rename from static/images/dragon.png rename to source/static/images/dragon.png diff --git a/static/images/files.png b/source/static/images/files.png similarity index 100% rename from static/images/files.png rename to source/static/images/files.png diff --git a/static/images/games.png b/source/static/images/games.png similarity index 100% rename from static/images/games.png rename to source/static/images/games.png diff --git a/static/images/image.png b/source/static/images/image.png similarity index 100% rename from static/images/image.png rename to source/static/images/image.png diff --git a/static/images/keyboard.png b/source/static/images/keyboard.png similarity index 100% rename from static/images/keyboard.png rename to source/static/images/keyboard.png diff --git a/static/images/mac.png b/source/static/images/mac.png similarity index 100% rename from static/images/mac.png rename to source/static/images/mac.png diff --git a/static/images/map.png b/source/static/images/map.png similarity index 100% rename from static/images/map.png rename to source/static/images/map.png diff --git a/static/images/program.png b/source/static/images/program.png similarity index 100% rename from static/images/program.png rename to source/static/images/program.png diff --git a/static/images/rabbit.svg b/source/static/images/rabbit.svg similarity index 100% rename from static/images/rabbit.svg rename to source/static/images/rabbit.svg diff --git a/static/images/rice.png b/source/static/images/rice.png similarity index 100% rename from static/images/rice.png rename to source/static/images/rice.png diff --git a/static/images/sql.png b/source/static/images/sql.png similarity index 100% rename from static/images/sql.png rename to source/static/images/sql.png diff --git a/static/input.css b/source/static/input.css similarity index 100% rename from static/input.css rename to source/static/input.css diff --git a/static/movies.md b/source/static/movies.md similarity index 100% rename from static/movies.md rename to source/static/movies.md diff --git a/static/output.css b/source/static/output.css similarity index 100% rename from static/output.css rename to source/static/output.css diff --git a/static/pdf/.DS_Store b/source/static/pdf/.DS_Store similarity index 100% rename from static/pdf/.DS_Store rename to source/static/pdf/.DS_Store diff --git a/static/pdf/mstr.pdf b/source/static/pdf/mstr.pdf similarity index 100% rename from static/pdf/mstr.pdf rename to source/static/pdf/mstr.pdf diff --git a/static/pdf/novo.pdf b/source/static/pdf/novo.pdf similarity index 100% rename from static/pdf/novo.pdf rename to source/static/pdf/novo.pdf diff --git a/static/posters/AcureForWellness.jpg b/source/static/posters/AcureForWellness.jpg similarity index 100% rename from static/posters/AcureForWellness.jpg rename to source/static/posters/AcureForWellness.jpg diff --git a/static/posters/Adolescence.webp b/source/static/posters/Adolescence.webp similarity index 100% rename from static/posters/Adolescence.webp rename to source/static/posters/Adolescence.webp diff --git a/static/posters/Avatar.webp b/source/static/posters/Avatar.webp similarity index 100% rename from static/posters/Avatar.webp rename to source/static/posters/Avatar.webp diff --git a/static/posters/Breaking Bad.webp b/source/static/posters/Breaking Bad.webp similarity index 100% rename from static/posters/Breaking Bad.webp rename to source/static/posters/Breaking Bad.webp diff --git a/static/posters/Chernobyl.webp b/source/static/posters/Chernobyl.webp similarity index 100% rename from static/posters/Chernobyl.webp rename to source/static/posters/Chernobyl.webp diff --git a/static/posters/Dracula.webp b/source/static/posters/Dracula.webp similarity index 100% rename from static/posters/Dracula.webp rename to source/static/posters/Dracula.webp diff --git a/static/posters/Fightclub.jpg b/source/static/posters/Fightclub.jpg similarity index 100% rename from static/posters/Fightclub.jpg rename to source/static/posters/Fightclub.jpg diff --git a/static/posters/Succession.webp b/source/static/posters/Succession.webp similarity index 100% rename from static/posters/Succession.webp rename to source/static/posters/Succession.webp diff --git a/static/posters/TheGirlwiththeDragonTattoo.webp b/source/static/posters/TheGirlwiththeDragonTattoo.webp similarity index 100% rename from static/posters/TheGirlwiththeDragonTattoo.webp rename to source/static/posters/TheGirlwiththeDragonTattoo.webp diff --git a/static/posters/bladerunner2049.jpg b/source/static/posters/bladerunner2049.jpg similarity index 100% rename from static/posters/bladerunner2049.jpg rename to source/static/posters/bladerunner2049.jpg diff --git a/static/posters/foundation.jpg b/source/static/posters/foundation.jpg similarity index 100% rename from static/posters/foundation.jpg rename to source/static/posters/foundation.jpg diff --git a/static/posters/matrix.jpg b/source/static/posters/matrix.jpg similarity index 100% rename from static/posters/matrix.jpg rename to source/static/posters/matrix.jpg diff --git a/static/posters/risetr-banner.png b/source/static/posters/risetr-banner.png similarity index 100% rename from static/posters/risetr-banner.png rename to source/static/posters/risetr-banner.png diff --git a/static/scripts/posteranimation.js b/source/static/scripts/posteranimation.js similarity index 100% rename from static/scripts/posteranimation.js rename to source/static/scripts/posteranimation.js