This commit is contained in:
parent
5d64594755
commit
889c88a801
3 changed files with 12 additions and 10 deletions
6
go.mod
6
go.mod
|
@ -1,8 +1,8 @@
|
||||||
module github.com/hugomd/ascii-live
|
module github.com/hugomd/ascii-live
|
||||||
|
|
||||||
go 1.17
|
go 1.24.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
|
github.com/golang/glog v1.2.4
|
||||||
github.com/gorilla/mux v1.7.3
|
github.com/gorilla/mux v1.8.1
|
||||||
)
|
)
|
||||||
|
|
10
go.sum
10
go.sum
|
@ -1,4 +1,6 @@
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
github.com/golang/glog v1.2.4 h1:CNNw5U8lSiiBk7druxtSHHTsRWcxKoac6kZKm2peBBc=
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
github.com/golang/glog v1.2.4/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
|
||||||
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
|
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||||
|
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||||
|
|
6
main.go
6
main.go
|
@ -15,7 +15,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var NotFoundMessage = map[string]string{
|
var NotFoundMessage = map[string]string{
|
||||||
"error": "Frames not found. Navigate to /list for list of frames. Navigate to https://github.com/hugomd/ascii-live to submit new frames.",
|
"error": "Frames not found. Navigate to /ascii/list for list of frames. Navigate to https://github.com/hugomd/ascii-live to submit new frames.",
|
||||||
}
|
}
|
||||||
|
|
||||||
var NotCurledMessage = map[string]string{
|
var NotCurledMessage = map[string]string{
|
||||||
|
@ -53,7 +53,7 @@ func notCurledHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func handler(w http.ResponseWriter, r *http.Request) {
|
func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
cn := w.(http.CloseNotifier)
|
ctx := r.Context()
|
||||||
flusher := w.(http.Flusher)
|
flusher := w.(http.Flusher)
|
||||||
|
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
|
@ -79,7 +79,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
// Handle client disconnects
|
// Handle client disconnects
|
||||||
case <-cn.CloseNotify():
|
case <-ctx.Done():
|
||||||
glog.Infof("Client stopped listening")
|
glog.Infof("Client stopped listening")
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue