diff --git a/cmd/server/main.go b/cmd/server/main.go index 462cc41..9079dd8 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -303,10 +303,10 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { jw.Encode(map[string][]microsub.Feed{ "results": feeds, }) - } else if action == "timeline" { + } else if action == "timeline" || r.PostForm.Get("action") == "timeline" { method := values.Get("method") - if method == "mark_read" { + if method == "mark_read" || r.PostForm.Get("method") == "mark_read" { values = r.PostForm channel := values.Get("channel") if uids, e := values["entry"]; e { @@ -315,7 +315,11 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { h.Backend.MarkRead(channel, uids) } else if uids, e := values["entry[0]"]; e { h.Backend.MarkRead(channel, uids) + } else { + log.Println("timeline mark_read value not found") } + } else { + log.Println("unknown method in timeline %s") } w.Header().Add("Content-Type", "application/json") fmt.Fprintln(w, "[]") diff --git a/cmd/server/memory.go b/cmd/server/memory.go index a9a85b7..f7e07d8 100644 --- a/cmd/server/memory.go +++ b/cmd/server/memory.go @@ -273,8 +273,10 @@ func (b *memoryBackend) PreviewURL(previewURL string) microsub.Timeline { } func (b *memoryBackend) MarkRead(channel string, itemUids []string) { + log.Printf("Marking read for %s %v\n", channel, itemUids) args := redis.Args{}.Add(fmt.Sprintf("timeline:%s:read", channel)).AddFlat(itemUids) if _, err := b.Redis.Do("SADD", args...); err != nil { log.Printf("Marking read for channel %s has failed\n", channel) } + log.Printf("Marking read success for %s %v\n", channel, itemUids) }