nsupdate
This commit is contained in:
@@ -16,29 +16,31 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
TYPE_APPLICATION_PEM string = "application/x-pem-file"
|
||||
TYPE_APPLICATION_JSON string = "application/json"
|
||||
TYPE_AUDIO_MPEG string = "audio/mpeg"
|
||||
TYPE_FONT_WOFF string = "font/woff"
|
||||
TYPE_FONT_WOFF2 string = "font/woff2"
|
||||
TYPE_IMAGE_JPG string = "image/jpg"
|
||||
TYPE_IMAGE_PNG string = "image/png"
|
||||
TYPE_TEXT_CSS string = "text/css"
|
||||
TYPE_TEXT_HTML string = "text/html"
|
||||
TYPE_TEXT_JS string = "text/javascript"
|
||||
TYPE_TEXT_PLAIN string = "text/plain"
|
||||
TYPE_TEXT_RAW string = "text/raw"
|
||||
TYPE_APPLICATION_JSON string = "application/json"
|
||||
TYPE_APPLICATION_MANIFEST_JSON string = "application/manifest+json"
|
||||
TYPE_APPLICATION_PEM string = "application/x-pem-file"
|
||||
TYPE_AUDIO_MPEG string = "audio/mpeg"
|
||||
TYPE_FONT_WOFF string = "font/woff"
|
||||
TYPE_FONT_WOFF2 string = "font/woff2"
|
||||
TYPE_IMAGE_JPG string = "image/jpg"
|
||||
TYPE_IMAGE_PNG string = "image/png"
|
||||
TYPE_TEXT_CSS string = "text/css"
|
||||
TYPE_TEXT_HTML string = "text/html"
|
||||
TYPE_TEXT_JS string = "text/javascript"
|
||||
TYPE_TEXT_PLAIN string = "text/plain"
|
||||
TYPE_TEXT_RAW string = "text/raw"
|
||||
)
|
||||
|
||||
var validFiles map[string]string = map[string]string{
|
||||
"/robots.txt": TYPE_TEXT_PLAIN,
|
||||
"/apple-touch-icon.png": TYPE_IMAGE_PNG,
|
||||
"/favicon.ico": TYPE_IMAGE_PNG,
|
||||
"/favicon-16x16.png": TYPE_IMAGE_PNG,
|
||||
"/favicon-32x32.png": TYPE_IMAGE_PNG,
|
||||
"/js/bootstrap.bundle.min.js": TYPE_TEXT_JS,
|
||||
"/favicon.ico": TYPE_IMAGE_PNG,
|
||||
"/js/bootstrap.bundle.min.js.map": TYPE_APPLICATION_JSON,
|
||||
"/js/bootstrap.bundle.min.js": TYPE_TEXT_JS,
|
||||
"/js/jquery.min.js": TYPE_TEXT_JS,
|
||||
"/robots.txt": TYPE_TEXT_PLAIN,
|
||||
"/site.webmanifest": TYPE_APPLICATION_MANIFEST_JSON, // https://developer.mozilla.org/en-US/docs/Web/Manifest
|
||||
}
|
||||
|
||||
func isValidReq(file string) (string, error) {
|
||||
@@ -110,9 +112,9 @@ func webRoot(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("Content-Encoding", "gzip")
|
||||
gw := gzip.NewWriter(w)
|
||||
defer gw.Close()
|
||||
gw.Write(o)
|
||||
gw.Write(o) //nolint:errcheck
|
||||
} else {
|
||||
w.Write(o)
|
||||
w.Write(o) //nolint:errcheck
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -75,7 +75,7 @@ func tmpltWebRoot(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
w.Write(msgBuffer.Bytes())
|
||||
w.Write(msgBuffer.Bytes()) //nolint:errcheck
|
||||
}
|
||||
|
||||
func tmpltStatusNotFound(w http.ResponseWriter, path string) {
|
||||
@@ -98,5 +98,5 @@ func tmpltStatusNotFound(w http.ResponseWriter, path string) {
|
||||
tmpltError(w, http.StatusInternalServerError, "Template Parse Error.")
|
||||
return
|
||||
}
|
||||
w.Write(msgBuffer.Bytes())
|
||||
w.Write(msgBuffer.Bytes()) //nolint:errcheck
|
||||
}
|
||||
|
Reference in New Issue
Block a user