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)
resetTimer := func(d time.Duration) {
if !timer.Stop() {
<-timer.C
select {
case <-timer.C:
default:
}
}
timer.Reset(d)
}
@ -145,7 +148,7 @@ func (ch *CaddyHugo) handleConn(conn DeltaConn, doc *docref) (int, error) {
for {
select {
case err := <-errCh:
fmt.Println(err)
fmt.Println("error handling websocket connection:", err)
return 500, err
default:
}

@ -43,6 +43,18 @@ func (ch *CaddyHugo) ServeHTTPWithNext(next httpserver.Handler, c *caddy.Control
w.Write(assets.MustAsset("simplemde/debug/simplemde.js"))
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") {
return ch.Admin().ServeHTTP(w, r)
}

Loading…
Cancel
Save