mirror of
https://code.rocketnine.space/tslocum/twins.git
synced 2024-11-27 11:18:13 +01:00
parent
12aa024671
commit
0c4c7e8ecb
2 changed files with 8 additions and 3 deletions
|
@ -234,6 +234,7 @@ listen: :1965
|
||||||
# Custom content types
|
# Custom content types
|
||||||
types:
|
types:
|
||||||
.json: application/json; charset=UTF-8
|
.json: application/json; charset=UTF-8
|
||||||
|
.js: application/javascript; charset=UTF-8
|
||||||
|
|
||||||
# Hosts and paths to serve
|
# Hosts and paths to serve
|
||||||
hosts:
|
hosts:
|
||||||
|
|
|
@ -183,12 +183,16 @@ func serveHTTPS(w http.ResponseWriter, r *http.Request) (int, int64, string) {
|
||||||
fileExt := strings.ToLower(filepath.Ext(filePath))
|
fileExt := strings.ToLower(filepath.Ext(filePath))
|
||||||
if fileExt == ".gmi" || fileExt == ".gemini" {
|
if fileExt == ".gmi" || fileExt == ".gemini" {
|
||||||
result = gmitohtml.Convert([]byte(data), r.URL.String())
|
result = gmitohtml.Convert([]byte(data), r.URL.String())
|
||||||
} else if fileExt == ".htm" || fileExt == ".html" {
|
|
||||||
result = data
|
|
||||||
} else {
|
} else {
|
||||||
result = data
|
result = data
|
||||||
|
if fileExt == ".htm" || fileExt == ".html" {
|
||||||
|
// HTML content type already set
|
||||||
|
} else if customType := config.Types[filepath.Ext(filePath)]; customType != "" {
|
||||||
|
contentType = customType
|
||||||
|
} else {
|
||||||
contentType = plainType
|
contentType = plainType
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
status := http.StatusOK
|
status := http.StatusOK
|
||||||
w.Header().Set("Content-Type", contentType)
|
w.Header().Set("Content-Type", contentType)
|
||||||
|
|
Loading…
Reference in a new issue