Compare commits
3 Commits
e42f307bd1
...
9d5fbca929
Author | SHA1 | Date | |
---|---|---|---|
9d5fbca929 | |||
e341d2f166 | |||
444c725fc6 |
@ -9,4 +9,6 @@ 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,10 +119,18 @@ 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