fix (#234): missing mime type

This commit is contained in:
Mickael Kerjean
2020-03-05 21:30:30 +11:00
parent c117c99401
commit 2c891c35c8
2 changed files with 3 additions and 3 deletions

View File

@ -161,13 +161,13 @@ func initPluginsRoutes(r *mux.Router, a *App) {
// frontoffice overrides: it is the mean by which plugin can interact with the frontoffice
for _, obj := range Hooks.Get.FrontendOverrides() {
r.HandleFunc(obj, func(res http.ResponseWriter, req *http.Request) {
res.WriteHeader(http.StatusOK)
res.Header().Set("Content-Type", GetMimeType(req.URL.String()))
res.Write([]byte(fmt.Sprintf("/* Default '%s' */", obj)))
})
}
// map which file can be open with what application
r.HandleFunc("/overrides/xdg-open.js", func(res http.ResponseWriter, req *http.Request) {
res.Header().Set("Content-Type", GetMimeType("xdg-open.js"))
res.Header().Set("Content-Type", GetMimeType(req.URL.String()))
res.Write([]byte(`window.overrides["xdg-open"] = function(mime){`))
openers := Hooks.Get.XDGOpen()
for i:=0; i<len(openers); i++ {

View File

@ -94,7 +94,7 @@ func init(){
Hooks.Register.HttpEndpoint(func(r *mux.Router, app *App) error {
r.HandleFunc(OverrideVideoSourceMapper, func(res http.ResponseWriter, req *http.Request) {
res.Header().Set("Content-Type", "application/javascript")
res.Header().Set("Content-Type", GetMimeType(req.URL.String()))
res.Write([]byte(`window.overrides["video-map-sources"] = function(sources){`))
res.Write([]byte(` return sources.map(function(source){`))