Add call to serve atom feed
This commit is contained in:
parent
878f57af08
commit
07e1983fcc
@ -39,9 +39,9 @@ func newConfig() *Config {
|
|||||||
return &Config{
|
return &Config{
|
||||||
AESKeyFile: "/var/www/cpolis/aes.key",
|
AESKeyFile: "/var/www/cpolis/aes.key",
|
||||||
ArticleDir: "/var/www/cpolis/articles",
|
ArticleDir: "/var/www/cpolis/articles",
|
||||||
|
AtomFeed: "/var/www/cpolis/cpolis.atom",
|
||||||
ConfigFile: "/etc/cpolis/config.toml",
|
ConfigFile: "/etc/cpolis/config.toml",
|
||||||
DBName: "cpolis",
|
DBName: "cpolis",
|
||||||
AtomFeed: "/var/www/cpolis/cpolis.atom",
|
|
||||||
FirebaseKey: "/var/www/cpolis/serviceAccountKey.json",
|
FirebaseKey: "/var/www/cpolis/serviceAccountKey.json",
|
||||||
GOBKeyFile: "/var/www/cpolis/gob.key",
|
GOBKeyFile: "/var/www/cpolis/gob.key",
|
||||||
LogFile: "/var/log/cpolis.log",
|
LogFile: "/var/log/cpolis.log",
|
||||||
|
26
cmd/calls/atom.go
Normal file
26
cmd/calls/atom.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package calls
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ServeAtomFeed(c *b.Config) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
if !tokenIsVerified(w, r, c) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
absFilepath, err := filepath.Abs(c.AtomFeed)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
http.ServeFile(w, r, absFilepath)
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,7 @@ import (
|
|||||||
b "streifling.com/jason/cpolis/cmd/backend"
|
b "streifling.com/jason/cpolis/cmd/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ServeImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
func ServeImage(c *b.Config) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
if !tokenIsVerified(w, r, c) {
|
if !tokenIsVerified(w, r, c) {
|
||||||
return
|
return
|
||||||
|
@ -66,8 +66,9 @@ func main() {
|
|||||||
mux.HandleFunc("GET /article/review-unpublished/{id}", f.ReviewArticle(config, db, store, "publish", "Artikel veröffentlichen", "Veröffentlichen"))
|
mux.HandleFunc("GET /article/review-unpublished/{id}", f.ReviewArticle(config, db, store, "publish", "Artikel veröffentlichen", "Veröffentlichen"))
|
||||||
mux.HandleFunc("GET /article/serve/{id}", c.ServeArticle(config, db))
|
mux.HandleFunc("GET /article/serve/{id}", c.ServeArticle(config, db))
|
||||||
mux.HandleFunc("GET /article/write", f.WriteArticle(config, db, store))
|
mux.HandleFunc("GET /article/write", f.WriteArticle(config, db, store))
|
||||||
|
mux.HandleFunc("GET /atom/serve", c.ServeAtomFeed(config))
|
||||||
mux.HandleFunc("GET /hub", f.ShowHub(config, db, store))
|
mux.HandleFunc("GET /hub", f.ShowHub(config, db, store))
|
||||||
mux.HandleFunc("GET /image/serve/{pic}", c.ServeImage(config, store))
|
mux.HandleFunc("GET /image/serve/{pic}", c.ServeImage(config))
|
||||||
mux.HandleFunc("GET /issue/this", f.ShowCurrentIssue(config, db, store))
|
mux.HandleFunc("GET /issue/this", f.ShowCurrentIssue(config, db, store))
|
||||||
mux.HandleFunc("GET /logout", f.Logout(config, store))
|
mux.HandleFunc("GET /logout", f.Logout(config, store))
|
||||||
mux.HandleFunc("GET /pdf/get-list", c.ServePDFList(config))
|
mux.HandleFunc("GET /pdf/get-list", c.ServePDFList(config))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user