···55 "github.com/rachel-mp4/lrcd"
66 "net/http"
77 "os"
88+ "time"
89)
9101011func main() {
···1718 panic(err)
1819 }
1920 fmt.Println("serving lrcd on localhost:8080")
2020- http.ListenAndServe(":8080", guessIfUpgradeFail(server))
2121+ now := time.Now()
2222+ http.ListenAndServe(":8080", guessIfUpgradeFail(server, now))
2123}
22242323-func guessIfUpgradeFail(server *lrcd.Server) http.HandlerFunc {
2525+func guessIfUpgradeFail(server *lrcd.Server, now time.Time) http.HandlerFunc {
2426 return func(w http.ResponseWriter, r *http.Request) {
2527 if r.Header.Get("Upgrade") != "websocket" {
2626- fmt.Fprintf(w, `hi! i am an lrc server
2727-i think you should try connecting to me with an lrc client (e.g. tty!xcvr)
2828+ fmt.Fprintf(w, `
2929+~live~~
3030+~relay~
3131+~~chat~
3232+hi! i am an lrc server!
3333+you can look at my code at tangled.org/moth11.net/lrcd & tangled.org/lrcdaemon
3434+3535+i think you should try connecting to me with an lrc client (e.g. tty!xcvr (@tangled.org/moth11.net/ttyxcvr))
2836it'll be more fun for us both!
29373030-currently connected: %d`, server.Connected())
3838+currently connected: %d
3939+ live since: %s`, server.Connected(), now.Format(time.RubyDate))
3140 } else {
3241 server.WSHandler()(w, r)
3342 }