Unverified Commit 0aaf1537 authored by Wujiao233's avatar Wujiao233 Committed by GitHub

fix: video and audio can't play on safari (#980)

* fix: video can't play on safari

* fix: audio can't play on safari
parent 942e1f88
......@@ -274,6 +274,10 @@ func (s *Server) registerResourcePublicRoutes(g *echo.Group) {
}
c.Response().Writer.Header().Set(echo.HeaderCacheControl, "max-age=31536000, immutable")
c.Response().Writer.Header().Set(echo.HeaderContentSecurityPolicy, "default-src 'self'")
if strings.HasPrefix(resourceType, "video") || strings.HasPrefix(resourceType, "audio") {
http.ServeContent(c.Response(), c.Request(), resource.Filename, time.Unix(resource.UpdatedTs, 0), bytes.NewReader(resource.Blob))
return nil
}
return c.Stream(http.StatusOK, resourceType, bytes.NewReader(resource.Blob))
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment