|
|
|
@ -4,6 +4,7 @@ import (
@@ -4,6 +4,7 @@ import (
|
|
|
|
|
"fmt" |
|
|
|
|
"net/http" |
|
|
|
|
"net/url" |
|
|
|
|
"os" |
|
|
|
|
"path" |
|
|
|
|
"path/filepath" |
|
|
|
|
"strings" |
|
|
|
@ -43,6 +44,13 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) {
@@ -43,6 +44,13 @@ func IndexHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// If this is a directory listing request then return a 404
|
|
|
|
|
info, err := os.Stat(path.Join(config.WebRoot, r.URL.Path)) |
|
|
|
|
if err != nil || (info.IsDir() && !isIndexRequest) { |
|
|
|
|
w.WriteHeader(http.StatusNotFound) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if path.Ext(r.URL.Path) == ".m3u8" { |
|
|
|
|
middleware.DisableCache(w) |
|
|
|
|
} |
|
|
|
|