mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
add content-type o http headers
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/anacrolix/missinggo/httptoo"
|
||||
"github.com/anacrolix/torrent"
|
||||
|
||||
mt "server/mimetype"
|
||||
sets "server/settings"
|
||||
"server/torr/state"
|
||||
)
|
||||
@@ -61,8 +62,12 @@ func (t *Torrent) Stream(fileID int, req *http.Request, resp http.ResponseWriter
|
||||
|
||||
resp.Header().Set("Connection", "close")
|
||||
resp.Header().Set("ETag", httptoo.EncodeQuotedString(fmt.Sprintf("%s/%s", t.Hash().HexString(), file.Path())))
|
||||
// DLNA headers
|
||||
resp.Header().Set("transferMode.dlna.org", "Streaming")
|
||||
|
||||
mime, err := mt.MimeTypeByPath(file.Path())
|
||||
if err == nil && mime.IsMedia() {
|
||||
resp.Header().Set("content-type", mime.String())
|
||||
}
|
||||
if req.Header.Get("getContentFeatures.dlna.org") != "" {
|
||||
resp.Header().Set("contentFeatures.dlna.org", dlna.ContentFeatures{
|
||||
SupportRange: true,
|
||||
|
||||
Reference in New Issue
Block a user