Fix reverse boltdb list and tests
parent
c4d3b24e5c
commit
c32ef6c099
|
|
@ -107,7 +107,7 @@ func (feed *Feed) fromGofeed(gofeed *gofeed.Feed) ([]*Item, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
feed.Updated = time.Now().UTC() //*updated
|
feed.Updated = *updated //time.Now().UTC() //*updated
|
||||||
feed.Title = gofeed.Title
|
feed.Title = gofeed.Title
|
||||||
return newitems, nil
|
return newitems, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ func Test_RSSItem(t *testing.T) {
|
||||||
output: Item{
|
output: Item{
|
||||||
Name: "a",
|
Name: "a",
|
||||||
Link: "b",
|
Link: "b",
|
||||||
Content: `<img src="A"/><br><img src="asdf"/>`,
|
Content: `<a href="b">a</a><br><img src="A"/><br><img src="asdf"/>`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -35,7 +35,7 @@ func Test_RSSItem(t *testing.T) {
|
||||||
output: Item{
|
output: Item{
|
||||||
Name: "a",
|
Name: "a",
|
||||||
Link: "b",
|
Link: "b",
|
||||||
Content: `<img src="asdf"/>`,
|
Content: `<a href="b">a</a><br><img src="asdf"/>`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -48,7 +48,7 @@ func Test_RSSItem(t *testing.T) {
|
||||||
output: Item{
|
output: Item{
|
||||||
Name: "a",
|
Name: "a",
|
||||||
Link: "b",
|
Link: "b",
|
||||||
Content: "",
|
Content: `<a href="b">a</a><br>`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -61,7 +61,7 @@ func Test_RSSItem(t *testing.T) {
|
||||||
output: Item{
|
output: Item{
|
||||||
Name: "a",
|
Name: "a",
|
||||||
Link: "b",
|
Link: "b",
|
||||||
Content: `<img src="asdf"/>`,
|
Content: `<a href="b">a</a><br><img src="asdf"/>`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -74,7 +74,7 @@ func Test_RSSItem(t *testing.T) {
|
||||||
output: Item{
|
output: Item{
|
||||||
Name: "a",
|
Name: "a",
|
||||||
Link: "b",
|
Link: "b",
|
||||||
Content: "x<br>y",
|
Content: `<a href="b">a</a><br>x<br>y`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,9 +96,13 @@ func (s *Server) feed(w http.ResponseWriter, r *http.Request) {
|
||||||
case "tag":
|
case "tag":
|
||||||
s.getFeedTag(w, r)
|
s.getFeedTag(w, r)
|
||||||
default:
|
default:
|
||||||
|
if v == "" {
|
||||||
|
s.bad(w, r)
|
||||||
|
} else {
|
||||||
r.URL.Path = v + "/" + r.URL.Path
|
r.URL.Path = v + "/" + r.URL.Path
|
||||||
s.getFeed(w, r)
|
s.getFeed(w, r)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case "POST":
|
case "POST":
|
||||||
s.newFeed(w, r)
|
s.newFeed(w, r)
|
||||||
case "PUT":
|
case "PUT":
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,8 @@ func (bc *BoltClient) List(namespace, key string, asc bool, limit int) ([]string
|
||||||
found = append(found, string(k))
|
found = append(found, string(k))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for k, _ := c.Seek([]byte(key)); k != nil && len(found) < limit; k, _ = c.Next() {
|
key += "}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"
|
||||||
|
for k, _ := c.Seek([]byte(key)); k != nil && len(found) < limit; k, _ = c.Prev() {
|
||||||
found = append(found, string(k))
|
found = append(found, string(k))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue