mirror of https://github.com/nealey/spongy
Finally enable push notification
This commit is contained in:
parent
b7f0d926fc
commit
b450b67d67
|
@ -43,6 +43,9 @@ input[name~=target] {
|
||||||
}
|
}
|
||||||
input[name~=text] {
|
input[name~=text] {
|
||||||
width: 75%;
|
width: 75%;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
13
irc.cgi.go
13
irc.cgi.go
|
@ -35,6 +35,8 @@ func tail(w http.ResponseWriter, pos int) {
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
|
for {
|
||||||
|
printid := false
|
||||||
|
|
||||||
_, err = f.Seek(int64(pos), 0)
|
_, err = f.Seek(int64(pos), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -45,8 +47,17 @@ func tail(w http.ResponseWriter, pos int) {
|
||||||
t := bf.Text()
|
t := bf.Text()
|
||||||
pos += len(t) + 1 // XXX: this breaks if we ever see \r\n
|
pos += len(t) + 1 // XXX: this breaks if we ever see \r\n
|
||||||
fmt.Fprintf(w, "data: %s\n", t)
|
fmt.Fprintf(w, "data: %s\n", t)
|
||||||
|
printid = true
|
||||||
|
}
|
||||||
|
if printid {
|
||||||
|
_, err = fmt.Fprintf(w, "id: %d\n\n", pos)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
w.(http.Flusher).Flush()
|
||||||
|
time.Sleep(350 * time.Millisecond)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(w, "id: %d\n\n", pos)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleCommand(w http.ResponseWriter, text string, target string) {
|
func handleCommand(w http.ResponseWriter, text string, target string) {
|
||||||
|
|
Loading…
Reference in New Issue