improvements; fixes

pull/8/head
Stephen Searles 7 years ago
parent f753f94390
commit c63022b636
  1. 7
      deltas.go
  2. 12
      http.go

@ -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)
} }

Loading…
Cancel
Save