diff --git a/app.go b/app.go index bf05e28..f4d7e3a 100644 --- a/app.go +++ b/app.go @@ -25,6 +25,7 @@ type Parser interface { Title() string Description() string RootUrl() string + ImageUrl() string ServerUrl() string CacheName() string CacheTimeout() int @@ -65,6 +66,11 @@ func (this *ParserFeed) ParseAndUpdateCache() { Link: &feeds.Link{Href: this.parser.RootUrl()}, Description: this.parser.Description(), Created: time.Now(), + Image: &feeds.Image{ + Url: this.parser.ImageUrl(), + Title: this.parser.Title(), + Link: this.parser.RootUrl(), + }, } entities := this.parser.Parse() @@ -74,7 +80,7 @@ func (this *ParserFeed) ParseAndUpdateCache() { Id: re.url, Title: re.title, Link: &feeds.Link{Href: re.url}, - Description: re.title, + Description: re.descripiton, Created: time.Now(), }) } @@ -102,13 +108,11 @@ func (this *ParserFeed) RunWorker() { for { nextmark := this.time.Add(time.Second * time.Duration(this.parser.CacheTimeout())) sleepfor := nextmark.Unix() - time.Now().Unix() - fmt.Println(sleepfor) if sleepfor > 0 { time.Sleep(time.Second * time.Duration(sleepfor)) } this.ParseAndUpdateCache() - fmt.Println("update") } } @@ -152,6 +156,11 @@ func main() { rootPage += "" http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/" { + w.WriteHeader(404) + return + } + fmt.Fprintf(w, rootPage) }) diff --git a/nvidia.go b/nvidia.go index 3cd3cf9..fcb68b6 100644 --- a/nvidia.go +++ b/nvidia.go @@ -64,6 +64,10 @@ func (this NvidiaParser) RootUrl() string { return "https://research.nvidia.com" } +func (this NvidiaParser) ImageUrl() string { + return this.RootUrl() + "/themes/custom/nvidia/favicon.ico" +} + func (this NvidiaParser) ServerUrl() string { return "/nvidia" }