Moving app from singular to being created for every request (#9889)
* Moving app from singular to being created for every request. * Automatic refactor * Adding license header * Feedback fixes
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1bcf08aa4b
Коммит
da265fbaf7
@@ -19,20 +19,20 @@ import (
|
||||
)
|
||||
|
||||
func (w *Web) InitStatic() {
|
||||
if *w.App.Config().ServiceSettings.WebserverMode != "disabled" {
|
||||
utils.UpdateAssetsSubpathFromConfig(w.App.Config())
|
||||
if *w.ConfigService.Config().ServiceSettings.WebserverMode != "disabled" {
|
||||
utils.UpdateAssetsSubpathFromConfig(w.ConfigService.Config())
|
||||
|
||||
staticDir, _ := utils.FindDir(model.CLIENT_DIR)
|
||||
mlog.Debug(fmt.Sprintf("Using client directory at %v", staticDir))
|
||||
|
||||
subpath, _ := utils.GetSubpathFromConfig(w.App.Config())
|
||||
subpath, _ := utils.GetSubpathFromConfig(w.ConfigService.Config())
|
||||
|
||||
mime.AddExtensionType(".wasm", "application/wasm")
|
||||
|
||||
staticHandler := staticFilesHandler(http.StripPrefix(path.Join(subpath, "static"), http.FileServer(http.Dir(staticDir))))
|
||||
pluginHandler := staticFilesHandler(http.StripPrefix(path.Join(subpath, "static", "plugins"), http.FileServer(http.Dir(*w.App.Config().PluginSettings.ClientDirectory))))
|
||||
pluginHandler := staticFilesHandler(http.StripPrefix(path.Join(subpath, "static", "plugins"), http.FileServer(http.Dir(*w.ConfigService.Config().PluginSettings.ClientDirectory))))
|
||||
|
||||
if *w.App.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
if *w.ConfigService.Config().ServiceSettings.WebserverMode == "gzip" {
|
||||
staticHandler = gziphandler.GzipHandler(staticHandler)
|
||||
pluginHandler = gziphandler.GzipHandler(pluginHandler)
|
||||
}
|
||||
@@ -56,8 +56,8 @@ 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.T("web.error.unsupported_browser.title")
|
||||
page.Props["Message"] = c.T("web.error.unsupported_browser.message")
|
||||
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)
|
||||
return
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user