PLT-4026 Use client dir constant for OAuth Authorization page (#3895)
Этот коммит содержится в:
@@ -429,7 +429,7 @@ func authorizeOAuth(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Header().Set("Content-Type", "text/html")
|
w.Header().Set("Content-Type", "text/html")
|
||||||
|
|
||||||
w.Header().Set("Cache-Control", "no-cache, max-age=31556926, public")
|
w.Header().Set("Cache-Control", "no-cache, max-age=31556926, public")
|
||||||
http.ServeFile(w, r, utils.FindDir("webapp/dist")+"root.html")
|
http.ServeFile(w, r, utils.FindDir(model.CLIENT_DIR)+"root.html")
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAccessToken(c *Context, w http.ResponseWriter, r *http.Request) {
|
func getAccessToken(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ const (
|
|||||||
STATUS_OK = "OK"
|
STATUS_OK = "OK"
|
||||||
STATUS_FAIL = "FAIL"
|
STATUS_FAIL = "FAIL"
|
||||||
|
|
||||||
|
CLIENT_DIR = "webapp/dist"
|
||||||
|
|
||||||
API_URL_SUFFIX_V1 = "/api/v1"
|
API_URL_SUFFIX_V1 = "/api/v1"
|
||||||
API_URL_SUFFIX_V3 = "/api/v3"
|
API_URL_SUFFIX_V3 = "/api/v3"
|
||||||
API_URL_SUFFIX = API_URL_SUFFIX_V3
|
API_URL_SUFFIX = API_URL_SUFFIX_V3
|
||||||
|
|||||||
@@ -16,17 +16,13 @@ import (
|
|||||||
"github.com/mssola/user_agent"
|
"github.com/mssola/user_agent"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
CLIENT_DIR = "webapp/dist"
|
|
||||||
)
|
|
||||||
|
|
||||||
func InitWeb() {
|
func InitWeb() {
|
||||||
l4g.Debug(utils.T("web.init.debug"))
|
l4g.Debug(utils.T("web.init.debug"))
|
||||||
|
|
||||||
mainrouter := api.Srv.Router
|
mainrouter := api.Srv.Router
|
||||||
|
|
||||||
if *utils.Cfg.ServiceSettings.WebserverMode != "disabled" {
|
if *utils.Cfg.ServiceSettings.WebserverMode != "disabled" {
|
||||||
staticDir := utils.FindDir(CLIENT_DIR)
|
staticDir := utils.FindDir(model.CLIENT_DIR)
|
||||||
l4g.Debug("Using client directory at %v", staticDir)
|
l4g.Debug("Using client directory at %v", staticDir)
|
||||||
if *utils.Cfg.ServiceSettings.WebserverMode == "gzip" {
|
if *utils.Cfg.ServiceSettings.WebserverMode == "gzip" {
|
||||||
mainrouter.PathPrefix("/static/").Handler(gziphandler.GzipHandler(staticHandler(http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir))))))
|
mainrouter.PathPrefix("/static/").Handler(gziphandler.GzipHandler(staticHandler(http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir))))))
|
||||||
@@ -76,5 +72,5 @@ func root(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
w.Header().Set("Cache-Control", "no-cache, max-age=31556926, public")
|
w.Header().Set("Cache-Control", "no-cache, max-age=31556926, public")
|
||||||
http.ServeFile(w, r, utils.FindDir(CLIENT_DIR)+"root.html")
|
http.ServeFile(w, r, utils.FindDir(model.CLIENT_DIR)+"root.html")
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user