Fixed files page
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
const fileElement = "<p><a href='https://darkstorm.tech/%v/'>%v</a></p>"
|
||||
const fileElement = "<p><a href='https://darkstorm.tech%v'>%v</a></p>"
|
||||
|
||||
func filesRequest(w http.ResponseWriter, r *http.Request) {
|
||||
partPath := filepath.Clean(r.URL.Path)
|
||||
@@ -38,7 +38,7 @@ func filesRequest(w http.ResponseWriter, r *http.Request) {
|
||||
if f.IsDir() {
|
||||
continue
|
||||
}
|
||||
pageContent += fmt.Sprintf(fileElement, partPath, f.Name())
|
||||
pageContent += fmt.Sprintf(fileElement, filepath.Join(partPath, f.Name()), f.Name())
|
||||
}
|
||||
} else {
|
||||
http.ServeFile(w, r, path)
|
||||
|
||||
@@ -88,7 +88,7 @@ func setupBackend(mux *http.ServeMux) {
|
||||
func setupWebsite(mux *http.ServeMux) {
|
||||
url, _ := url.Parse("https://localhost:30000")
|
||||
mux.Handle("rpg.darkstorm.tech/", httputil.NewSingleHostReverseProxy(url))
|
||||
mux.HandleFunc("GET /files", filesRequest)
|
||||
mux.HandleFunc("GET /files/{w...}", filesRequest)
|
||||
mux.HandleFunc("GET /portfolio", portfolioRequest)
|
||||
mux.HandleFunc("/", mainHandle)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user