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)
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user