refactor(web): create /tfm directory for TFM pages

This commit is contained in:
2023-01-29 16:57:17 +03:00
parent 8c2fba25f0
commit 9bfb9f89fe
3 changed files with 45 additions and 3 deletions
+4 -1
View File
@@ -175,7 +175,10 @@ func main() {
}
public_fs := http.FileServer(http.Dir("/srv/www/tanabata"))
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" && path.Ext(r.URL.Path) == "" {
if r.URL.Path == "/tfm" {
r.URL.Path += "/"
}
if r.URL.Path[len(r.URL.Path)-1] != '/' && path.Ext(r.URL.Path) == "" {
r.URL.Path += ".html"
}
public_fs.ServeHTTP(w, r)