This commit is contained in:
gmemstr 2017-09-25 09:04:29 -07:00
parent 33a2755948
commit 577535c897
5 changed files with 17 additions and 21 deletions

View file

@ -11,6 +11,7 @@ body {
label { label {
display: block; display: block;
} }
input,textarea { input,textarea {
margin-bottom: 10px; margin-bottom: 10px;
padding: 10px; padding: 10px;

View file

@ -1,17 +1,19 @@
package main package main
import ( import (
"io/ioutil"
"encoding/json" "encoding/json"
"io/ioutil"
) )
type Config struct { type Config struct {
Name string Name string
Host string Host string
Email string Email string
Description string Description string
Image string Image string
PodcastUrl string PodcastUrl string
AdminUsername string
AdminPassword string
} }
func ReadConfig() Config { func ReadConfig() Config {
@ -27,4 +29,4 @@ func ReadConfig() Config {
} }
return c return c
} }

View file

@ -17,7 +17,7 @@ type Author struct {
type Image struct { type Image struct {
Url, Title, Link string Url, Title, Link string
Width, Height int Width, Height int
} }
type Enclosure struct { type Enclosure struct {
@ -33,7 +33,7 @@ type Item struct {
Id string // used as guid in rss, id in atom Id string // used as guid in rss, id in atom
Updated time.Time Updated time.Time
Created time.Time Created time.Time
Enclosure *Enclosure Enclosure *Enclosure
} }
type Feed struct { type Feed struct {
@ -47,7 +47,7 @@ type Feed struct {
Subtitle string Subtitle string
Items []*Item Items []*Item
Copyright string Copyright string
Image *Image Image *Image
} }
// add a new Item to a Feed // add a new Item to a Feed

View file

@ -7,8 +7,8 @@ package feeds
import ( import (
"encoding/xml" "encoding/xml"
"fmt" "fmt"
"time"
"strconv" "strconv"
"time"
) )
// private wrapper around the RssFeed which gives us the <rss>..</rss> xml // private wrapper around the RssFeed which gives us the <rss>..</rss> xml
@ -122,7 +122,7 @@ func (r *Rss) RssFeed() *RssFeed {
} }
} }
image := &RssImage{Url: r.Image.Url, Title: r.Image.Title, Link: r.Image.Link, Width:r.Image.Width, Height: r.Image.Height} image := &RssImage{Url: r.Image.Url, Title: r.Image.Title, Link: r.Image.Link, Width: r.Image.Width, Height: r.Image.Height}
channel := &RssFeed{ channel := &RssFeed{
Title: r.Title, Title: r.Title,
@ -132,7 +132,7 @@ func (r *Rss) RssFeed() *RssFeed {
PubDate: pub, PubDate: pub,
LastBuildDate: build, LastBuildDate: build,
Copyright: r.Copyright, Copyright: r.Copyright,
Image: image, Image: image,
} }
for _, i := range r.Items { for _, i := range r.Items {
channel.Items = append(channel.Items, newRssItem(i)) channel.Items = append(channel.Items, newRssItem(i))

View file

@ -92,13 +92,6 @@ func AdminHandler(w http.ResponseWriter, r *http.Request) {
// Main function that defines routes // Main function that defines routes
func main() { func main() {
viper.SetConfigName("config")
viper.AddConfigPath(".")
err := viper.ReadInConfig() // Find and read the config file
if err != nil { // Handle errors reading the config file
panic(fmt.Errorf("Fatal error config file: %s \n", err))
}
// Start the watch() function in generate_rss.go, which // Start the watch() function in generate_rss.go, which
// watches for file changes and regenerates the feed // watches for file changes and regenerates the feed
go watch() go watch()