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