improvements; fixes
This commit is contained in:
@@ -86,7 +86,10 @@ func (ch *CaddyHugo) handleConn(conn DeltaConn, doc *docref) (int, error) {
|
|||||||
timer := time.NewTimer(idlePing)
|
timer := time.NewTimer(idlePing)
|
||||||
resetTimer := func(d time.Duration) {
|
resetTimer := func(d time.Duration) {
|
||||||
if !timer.Stop() {
|
if !timer.Stop() {
|
||||||
<-timer.C
|
select {
|
||||||
|
case <-timer.C:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
timer.Reset(d)
|
timer.Reset(d)
|
||||||
}
|
}
|
||||||
@@ -145,7 +148,7 @@ func (ch *CaddyHugo) handleConn(conn DeltaConn, doc *docref) (int, error) {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case err := <-errCh:
|
case err := <-errCh:
|
||||||
fmt.Println(err)
|
fmt.Println("error handling websocket connection:", err)
|
||||||
return 500, err
|
return 500, err
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,18 @@ func (ch *CaddyHugo) ServeHTTPWithNext(next httpserver.Handler, c *caddy.Control
|
|||||||
w.Write(assets.MustAsset("simplemde/debug/simplemde.js"))
|
w.Write(assets.MustAsset("simplemde/debug/simplemde.js"))
|
||||||
return http.StatusOK, nil
|
return http.StatusOK, nil
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(r.URL.Path, "/hugo/vue.js") {
|
||||||
|
w.Write(assets.MustAsset("js/vue.js"))
|
||||||
|
return http.StatusOK, nil
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(r.URL.Path, "/hugo/moment.js") {
|
||||||
|
w.Write(assets.MustAsset("js/moment.js"))
|
||||||
|
return http.StatusOK, nil
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(r.URL.Path, "/hugo/font-awesome.css") {
|
||||||
|
w.Write(assets.MustAsset("css/font-awesome.min.css"))
|
||||||
|
return http.StatusOK, nil
|
||||||
|
}
|
||||||
if strings.HasPrefix(r.URL.Path, "/hugo/admin") {
|
if strings.HasPrefix(r.URL.Path, "/hugo/admin") {
|
||||||
return ch.Admin().ServeHTTP(w, r)
|
return ch.Admin().ServeHTTP(w, r)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user