Missing handlers but there we goddamn GO
Former-commit-id: 2505146a54acaf18eadfdebf1dd2720889aef795
This commit is contained in:
@@ -2,7 +2,6 @@ package server
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"local/router"
|
||||
"local/rssmon3/monitor"
|
||||
@@ -77,16 +76,21 @@ func (s *Server) feed(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
var putFeed struct {
|
||||
URL string `json:"url"`
|
||||
Interval time.Duration `json:"refresh"`
|
||||
TitleFilter string `json:"items"`
|
||||
ContentFilter string `json:"content"`
|
||||
Tags []string `json:"tags"`
|
||||
URL string `json:"url"`
|
||||
Interval string `json:"refresh"`
|
||||
TitleFilter string `json:"items"`
|
||||
ContentFilter string `json:"content"`
|
||||
Tags []string `json:"tags"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&putFeed); err != nil {
|
||||
s.userError(w, r, err)
|
||||
return
|
||||
}
|
||||
interval, err := time.ParseDuration(putFeed.Interval)
|
||||
if err != nil {
|
||||
s.userError(w, r, err)
|
||||
return
|
||||
}
|
||||
f := &rss.Feed{
|
||||
Key: putFeed.URL,
|
||||
URL: putFeed.URL,
|
||||
@@ -98,12 +102,10 @@ func (s *Server) feed(w http.ResponseWriter, r *http.Request) {
|
||||
s.error(w, r, err)
|
||||
return
|
||||
}
|
||||
i, err := monitor.NewItem(f.Key, putFeed.Interval)
|
||||
i, err := monitor.NewItem(f.Key, interval)
|
||||
if err != nil {
|
||||
s.error(w, r, err)
|
||||
return
|
||||
}
|
||||
log.Println(i)
|
||||
s.error(w, r, errors.New("not impl"))
|
||||
// TODO
|
||||
s.Jobs <- i
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user