Compare commits
3 Commits
d4b51a6ad7
...
3addbb50de
Author | SHA1 | Date | |
---|---|---|---|
3addbb50de | |||
507aff683e | |||
c678fc67da |
|
@ -25,7 +25,7 @@ import (
|
|||
"regexp"
|
||||
"time"
|
||||
|
||||
"github.com/garyburd/redigo/redis"
|
||||
"github.com/gomodule/redigo/redis"
|
||||
)
|
||||
|
||||
// TokenResponse is the information that we get back from the token endpoint of the user...
|
||||
|
|
|
@ -33,7 +33,7 @@ import (
|
|||
"p83.nl/go/ekster/pkg/util"
|
||||
|
||||
"github.com/alecthomas/template"
|
||||
"github.com/garyburd/redigo/redis"
|
||||
"github.com/gomodule/redigo/redis"
|
||||
"willnorris.com/go/microformats"
|
||||
)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
"p83.nl/go/ekster/pkg/util"
|
||||
"p83.nl/go/ekster/pkg/websub"
|
||||
|
||||
"github.com/garyburd/redigo/redis"
|
||||
"github.com/gomodule/redigo/redis"
|
||||
)
|
||||
|
||||
// LeaseSeconds is the default number of seconds we want the subscription to last
|
||||
|
|
|
@ -27,7 +27,8 @@ import (
|
|||
"time"
|
||||
|
||||
"cloud.google.com/go/profiler"
|
||||
"github.com/garyburd/redigo/redis"
|
||||
"github.com/gomodule/redigo/redis"
|
||||
|
||||
"p83.nl/go/ekster/pkg/microsub"
|
||||
)
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import (
|
|||
"p83.nl/go/ekster/pkg/fetch"
|
||||
"p83.nl/go/ekster/pkg/microsub"
|
||||
|
||||
"github.com/garyburd/redigo/redis"
|
||||
"github.com/gomodule/redigo/redis"
|
||||
"willnorris.com/go/microformats"
|
||||
)
|
||||
|
||||
|
@ -511,6 +511,8 @@ func (b *memoryBackend) Search(query string) ([]microsub.Feed, error) {
|
|||
log.Printf("Error while fetching %s: %v\n", u, err)
|
||||
continue
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
fetchUrl, err := url.Parse(u)
|
||||
md := microformats.Parse(resp.Body, fetchUrl)
|
||||
if err != nil {
|
||||
|
@ -567,6 +569,7 @@ func (b *memoryBackend) PreviewURL(previewURL string) (microsub.Timeline, error)
|
|||
if err != nil {
|
||||
return microsub.Timeline{}, fmt.Errorf("error while fetching %s: %v", previewURL, err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
items, err := fetch.FeedItems(&fetch2{}, previewURL, resp.Header.Get("content-type"), resp.Body)
|
||||
if err != nil {
|
||||
return microsub.Timeline{}, fmt.Errorf("error while fetching %s: %v", previewURL, err)
|
||||
|
|
|
@ -29,7 +29,7 @@ import (
|
|||
"p83.nl/go/ekster/pkg/jf2"
|
||||
"p83.nl/go/ekster/pkg/microsub"
|
||||
|
||||
"github.com/garyburd/redigo/redis"
|
||||
"github.com/gomodule/redigo/redis"
|
||||
"willnorris.com/go/microformats"
|
||||
)
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
|
||||
"p83.nl/go/ekster/pkg/microsub"
|
||||
|
||||
"github.com/garyburd/redigo/redis"
|
||||
"github.com/gomodule/redigo/redis"
|
||||
)
|
||||
|
||||
type microsubHandler struct {
|
||||
|
@ -225,18 +225,11 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
if method == "mark_read" || r.PostForm.Get("method") == "mark_read" {
|
||||
values = r.Form
|
||||
channel := values.Get("channel")
|
||||
var markAsRead []string
|
||||
if uids, e := values["entry"]; e {
|
||||
err := h.Backend.MarkRead(channel, uids)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), 500)
|
||||
return
|
||||
}
|
||||
markAsRead = uids
|
||||
} else if uids, e := values["entry[]"]; e {
|
||||
err := h.Backend.MarkRead(channel, uids)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), 500)
|
||||
return
|
||||
}
|
||||
markAsRead = uids
|
||||
} else {
|
||||
uids := []string{}
|
||||
for k, v := range values {
|
||||
|
@ -244,7 +237,11 @@ func (h *microsubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
uids = append(uids, v...)
|
||||
}
|
||||
}
|
||||
err := h.Backend.MarkRead(channel, uids)
|
||||
markAsRead = uids
|
||||
}
|
||||
|
||||
if len(markAsRead) > 0 {
|
||||
err := h.Backend.MarkRead(channel, markAsRead)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), 500)
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue
Block a user