diff --git a/common/site.go b/common/site.go index c705b936..87724994 100644 --- a/common/site.go +++ b/common/site.go @@ -91,6 +91,10 @@ type config struct { ItemsPerPage int // ? - Move this into the settings table? MaxTopicTitleLength int MaxUsernameLength int + + ReadTimeout int + WriteTimeout int + IdleTimeout int } type devConfig struct { @@ -99,7 +103,9 @@ type devConfig struct { TemplateDebug bool Profiling bool TestDB bool - NoFsnotify bool // Super Experimental! + + NoFsnotify bool // Super Experimental! + FullReqLog bool } // configHolder is purely for having a big struct to unmarshal data into diff --git a/gen_router.go b/gen_router.go index 7315c5fe..231448fd 100644 --- a/gen_router.go +++ b/gen_router.go @@ -709,6 +709,9 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { counters.AgentViewCounter.Bump(27) return } + if common.Dev.FullReqLog { + r.DumpRequest(req,"") + } // TODO: Cover more suspicious strings and at a lower layer than this for _, char := range req.URL.Path { diff --git a/main.go b/main.go index f91b2fd4..f98cbb19 100644 --- a/main.go +++ b/main.go @@ -470,13 +470,25 @@ func main() { func startServer() { // We might not need the timeouts, if we're behind a reverse-proxy like Nginx var newServer = func(addr string, handler http.Handler) *http.Server { + rtime := common.Config.ReadTimeout + if rtime == 0 { + rtime = 5 + } + wtime := common.Config.WriteTimeout + if wtime == 0 { + wtime = 10 + } + itime := common.Config.IdleTimeout + if itime == 0 { + itime = 120 + } return &http.Server{ Addr: addr, Handler: handler, - ReadTimeout: 5 * time.Second, - WriteTimeout: 10 * time.Second, - IdleTimeout: 120 * time.Second, + ReadTimeout: time.Duration(rtime) * time.Second, + WriteTimeout: time.Duration(wtime) * time.Second, + IdleTimeout: time.Duration(itime) * time.Second, TLSConfig: &tls.Config{ PreferServerCipherSuites: true, diff --git a/public/analytics.js b/public/analytics.js index 4e2c603c..cf738f72 100644 --- a/public/analytics.js +++ b/public/analytics.js @@ -5,6 +5,7 @@ // TODO: Fully localise this // TODO: Load rawLabels and seriesData dynamically rather than potentially fiddling with nonces for the CSP? function buildStatsChart(rawLabels, seriesData, timeRange, legendNames) { + console.log("buildStatsChart"); let labels = []; let aphrases = phraseBox["analytics"]; if(timeRange=="one-year") { diff --git a/public/init.js b/public/init.js index 5c50a79d..2e983d2c 100644 --- a/public/init.js +++ b/public/init.js @@ -214,14 +214,14 @@ function fetchPhrases(plist) { let toLoad = 2; // TODO: Shunt this into loggedIn if there aren't any search and filter widgets? notifyOnScriptW("template_topics_topic", () => { - if(!Template_topics_topic) throw("template function not found"); toLoad--; if(toLoad===0) initPhrases(); + if(!Template_topics_topic) throw("template function not found"); }); notifyOnScriptW("template_paginator", () => { - if(!Template_paginator) throw("template function not found"); toLoad--; if(toLoad===0) initPhrases(); + if(!Template_paginator) throw("template function not found"); }); let loggedIn = document.head.querySelector("[property='x-loggedin']").content; diff --git a/router_gen/main.go b/router_gen/main.go index 689cad86..af528789 100644 --- a/router_gen/main.go +++ b/router_gen/main.go @@ -490,6 +490,9 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { counters.AgentViewCounter.Bump({{.AllAgentMap.malformed}}) return } + if common.Dev.FullReqLog { + r.DumpRequest(req,"") + } // TODO: Cover more suspicious strings and at a lower layer than this for _, char := range req.URL.Path { diff --git a/themes/nox/overrides/panel_group_menu.html b/themes/nox/overrides/panel_group_menu.html index 98be77e0..3fae9bb4 100644 --- a/themes/nox/overrides/panel_group_menu.html +++ b/themes/nox/overrides/panel_group_menu.html @@ -1,6 +1,6 @@