[MM-16677] New unsupported browser page (#11858)

* Added OSVersion to unsupported browser template (and some test code)

* [MM-17569] Working prototype (not functional) of unsupported browser page

* WIP

* WIP

* [MM-17571] Unsupported browser page template logic

* WIP

* [MM-17572][MM-17573] Added browsers and tested for unsupported under IE and Safari

* Clean-up

* Added missing license header

* Fixed a test

* Blank commit to force CI update

* PR feedback

* oops
Этот коммит содержится в:
Devin Binnie
2019-08-15 14:30:40 -04:00
коммит произвёл GitHub
родитель e71b99d9f6
Коммит 9562917734
7 изменённых файлов: 602 добавлений и 189 удалений

Просмотреть файл

@@ -45,6 +45,7 @@ func (w *Web) InitStatic() {
w.MainRouter.PathPrefix("/static/plugins/").Handler(pluginHandler)
w.MainRouter.PathPrefix("/static/").Handler(staticHandler)
w.MainRouter.Handle("/robots.txt", http.HandlerFunc(robotsHandler))
w.MainRouter.Handle("/unsupported_browser.js", http.HandlerFunc(unsupportedBrowserScriptHandler))
w.MainRouter.Handle("/{anything:.*}", w.NewStaticHandler(root)).Methods("GET")
// When a subpath is defined, it's necessary to handle redirects without a
@@ -60,11 +61,7 @@ func (w *Web) InitStatic() {
func root(c *Context, w http.ResponseWriter, r *http.Request) {
if !CheckClientCompatability(r.UserAgent()) {
w.Header().Set("Cache-Control", "no-store")
page := utils.NewHTMLTemplate(c.App.HTMLTemplates(), "unsupported_browser")
page.Props["Title"] = c.App.T("web.error.unsupported_browser.title")
page.Props["Message"] = c.App.T("web.error.unsupported_browser.message")
page.RenderToWriter(w)
renderUnsuppportedBrowser(c.App, w, r)
return
}
@@ -97,3 +94,13 @@ func robotsHandler(w http.ResponseWriter, r *http.Request) {
}
w.Write(robotsTxt)
}
func unsupportedBrowserScriptHandler(w http.ResponseWriter, r *http.Request) {
if strings.HasSuffix(r.URL.Path, "/") {
http.NotFound(w, r)
return
}
templatesDir, _ := fileutils.FindDir("templates")
http.ServeFile(w, r, filepath.Join(templatesDir, "unsupported_browser.js"))
}