This commit is contained in:
NatureFreshMilk 2019-06-17 07:05:21 +02:00
parent cd406baec5
commit e1b255e5e5
2 changed files with 21 additions and 3 deletions

View File

@ -9,7 +9,7 @@
<link rel="stylesheet" href="css/bootstrap.min.css"/>
<link rel="stylesheet" href="css/fontawesome.min.css"/>
<link rel="stylesheet" href="css/leaflet.css"/>
<link rel="stylesheet" href="css/leaflet.aewsome-markers.css"/>
<link rel="stylesheet" href="css/leaflet.awesome-markers.css"/>
<link rel="stylesheet" href="css/custom.css"/>
<title>Minetest Mapserver</title>
@ -21,7 +21,7 @@
<!-- libraries -->
<script src="js/lib/mithril.min.js"></script>
<script src="js/lib/leaflet.js"></script>
<script src="js/lib/leaflet.aewsome-markers.js"></script>
<script src="js/lib/leaflet.awesome-markers.js"></script>
<script src="js/lib/moment.min.js"></script>
<!-- main module -->

View File

@ -47,7 +47,25 @@ func Serve(ctx *app.App) {
mux.Handle("/api/mapblock/", &MapblockHandler{ctx: ctx})
}
err := http.ListenAndServe(":"+strconv.Itoa(ctx.Config.Port), mux)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
uri := r.RequestURI
if len(uri) >= 3 {
suffix := uri[len(uri)-3:]
switch suffix {
case "css":
w.Header().Set("Content-Type", "text/css")
case ".js":
w.Header().Set("Content-Type", "application/javascript")
case "png":
w.Header().Set("Content-Type", "image/png")
}
}
mux.ServeHTTP(w, r)
})
err := http.ListenAndServe(":"+strconv.Itoa(ctx.Config.Port), nil)
if err != nil {
panic(err)
}