Compare commits
No commits in common. "9d5fbca92921e6049d2c354b46a48469f009fd70" and "e42f307bd19aded187c671af5b43d076edf67255" have entirely different histories.
9d5fbca929
...
e42f307bd1
@ -9,6 +9,4 @@ services:
|
||||
- ./dev/templates:/templates:ro
|
||||
env_file:
|
||||
- .env
|
||||
tmpfs:
|
||||
- /tmp
|
||||
restart: unless-stopped
|
||||
|
10
handlers.go
10
handlers.go
@ -6,12 +6,12 @@ import (
|
||||
"crypto/subtle"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
type Application struct {
|
||||
@ -119,18 +119,10 @@ func (app *Application) indexHandler(w http.ResponseWriter, r *http.Request) {
|
||||
".rst": true,
|
||||
}
|
||||
|
||||
videoExtensions := map[string]bool{
|
||||
".mkv": true,
|
||||
}
|
||||
|
||||
if textExtensions[ext] {
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
}
|
||||
|
||||
if videoExtensions[ext] {
|
||||
w.Header().Set("Content-Type", "video/mp4")
|
||||
}
|
||||
|
||||
http.ServeFile(w, r, path)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user