forked from boyska/feedpanel
draft of a panel
This commit is contained in:
parent
cbdf48ec66
commit
ada3b4ad13
1 changed files with 12 additions and 1 deletions
|
@ -2,11 +2,21 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/urfave/negroni"
|
"github.com/urfave/negroni"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var helloTmpl *template.Template
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
helloTmpl = template.Must(template.New("hello").Parse(`
|
||||||
|
<html><body>Hello, {{.User}}
|
||||||
|
<p>Go to <a href="/tt-rss/">Feed Reader</a></p>
|
||||||
|
</body></html>`))
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -15,7 +25,8 @@ func main() {
|
||||||
panic("Authentication middleware failed!")
|
panic("Authentication middleware failed!")
|
||||||
}
|
}
|
||||||
w.WriteHeader(200)
|
w.WriteHeader(200)
|
||||||
fmt.Fprintf(w, "Hello, %s\n", user)
|
w.Header().Set("Content-type", "text/html")
|
||||||
|
helloTmpl.Execute(w, map[string]interface{}{"User": user})
|
||||||
})
|
})
|
||||||
|
|
||||||
ha := HeaderAuth{AllowedNames: []string{"feedati-fe"}, RequireUser: true}
|
ha := HeaderAuth{AllowedNames: []string{"feedati-fe"}, RequireUser: true}
|
||||||
|
|
Loading…
Reference in a new issue