mirror of https://github.com/velour/catbase.git
Removing secondary URL
This commit is contained in:
parent
b5003e82b5
commit
42e17ae755
|
@ -449,20 +449,11 @@ func (p *FactoidPlugin) BotMessage(message bot.Message) bool {
|
||||||
// Register any web URLs desired
|
// Register any web URLs desired
|
||||||
func (p *FactoidPlugin) RegisterWeb() *string {
|
func (p *FactoidPlugin) RegisterWeb() *string {
|
||||||
http.HandleFunc("/factoid/req", p.serveQuery)
|
http.HandleFunc("/factoid/req", p.serveQuery)
|
||||||
http.HandleFunc("/factoid", p.serveIndex)
|
http.HandleFunc("/factoid", p.serveQuery)
|
||||||
tmp := "/factoid"
|
tmp := "/factoid"
|
||||||
return &tmp
|
return &tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
// Serve up the index template
|
|
||||||
func (p *FactoidPlugin) serveIndex(w http.ResponseWriter, r *http.Request) {
|
|
||||||
t, err := template.New("factoidIndex").Parse(factoidIndex)
|
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
}
|
|
||||||
t.Execute(w, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *FactoidPlugin) serveQuery(w http.ResponseWriter, r *http.Request) {
|
func (p *FactoidPlugin) serveQuery(w http.ResponseWriter, r *http.Request) {
|
||||||
context := make(map[string]interface{})
|
context := make(map[string]interface{})
|
||||||
if e := r.PostFormValue("entry"); e != "" {
|
if e := r.PostFormValue("entry"); e != "" {
|
||||||
|
@ -471,8 +462,6 @@ func (p *FactoidPlugin) serveQuery(w http.ResponseWriter, r *http.Request) {
|
||||||
context["Count"] = fmt.Sprintf("%d", len(entries))
|
context["Count"] = fmt.Sprintf("%d", len(entries))
|
||||||
context["Entries"] = entries
|
context["Entries"] = entries
|
||||||
context["Search"] = e
|
context["Search"] = e
|
||||||
} else {
|
|
||||||
context["Error"] = "Something's fucked."
|
|
||||||
}
|
}
|
||||||
t, err := template.New("factoidIndex").Parse(factoidIndex)
|
t, err := template.New("factoidIndex").Parse(factoidIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -11,7 +11,7 @@ var factoidIndex string = `
|
||||||
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.1.0/pure-min.css">
|
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.1.0/pure-min.css">
|
||||||
</head>
|
</head>
|
||||||
<div>
|
<div>
|
||||||
<form action="/factoid/req" method="POST" class="pure-form">
|
<form action="/factoid" method="POST" class="pure-form">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Search for a factoid</legend>
|
<legend>Search for a factoid</legend>
|
||||||
<input type="text" name="entry" placeholder="trigger" value="{{.Search}}" />
|
<input type="text" name="entry" placeholder="trigger" value="{{.Search}}" />
|
||||||
|
|
Loading…
Reference in New Issue