Fix when you're in a channel
This commit is contained in:
parent
79c44a5b0b
commit
4829ce0192
|
@ -27,11 +27,13 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/gilliek/go-opml/opml"
|
||||
"p83.nl/go/ekster/pkg/client"
|
||||
"p83.nl/go/ekster/pkg/indieauth"
|
||||
"p83.nl/go/ekster/pkg/microsub"
|
||||
"p83.nl/go/ekster/pkg/server"
|
||||
|
||||
"github.com/GeertJohan/go.rice"
|
||||
"github.com/gilliek/go-opml/opml"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -389,7 +391,10 @@ func performCommands(sub microsub.Microsub, commands []string) {
|
|||
port := 8092
|
||||
log.Printf("Listening on port %d\n", port)
|
||||
http.Handle("/microsub", http.StripPrefix("/microsub", handler))
|
||||
http.Handle("/", http.FileServer(http.Dir("http-files")))
|
||||
box := rice.MustFindBox("http-files")
|
||||
http.Handle("/css/", http.FileServer(box.HTTPBox()))
|
||||
http.Handle("/js/", http.FileServer(box.HTTPBox()))
|
||||
http.Handle("/", AlwaysIndex(http.FileServer(box.HTTPBox())))
|
||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
|
||||
}
|
||||
|
||||
|
@ -398,6 +403,13 @@ func performCommands(sub microsub.Microsub, commands []string) {
|
|||
}
|
||||
}
|
||||
|
||||
func AlwaysIndex(handler http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
r.URL.Path = "/"
|
||||
handler.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
func exportOpmlFromMicrosub(sub microsub.Microsub) {
|
||||
output := opml.OPML{}
|
||||
output.Head.Title = "Microsub channels and feeds"
|
||||
|
|
Loading…
Reference in New Issue
Block a user