Wrote a sane Article handling. Added a mockup for mindflow.
This commit is contained in:
parent
148b1d889a
commit
4185992597
@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.arav.top/Arav/dwelling-home/pkg/mindflow"
|
||||
"git.arav.top/Arav/dwelling-home/web"
|
||||
)
|
||||
|
||||
@ -36,7 +37,10 @@ func (h *Handlers) Stuff(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *Handlers) Mindflow(w http.ResponseWriter, r *http.Request) {
|
||||
web.Mindflow("/ Mindflow", nil, r, w)
|
||||
posts := []mindflow.Post{
|
||||
{Category: "Kek", Date: time.Now(), Title: "LMAO", Body: "Testing!"},
|
||||
}
|
||||
web.Mindflow("/ Mindflow", posts, r, w)
|
||||
}
|
||||
|
||||
func (h *Handlers) About(w http.ResponseWriter, r *http.Request) {
|
||||
@ -44,19 +48,14 @@ func (h *Handlers) About(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *Handlers) Article(w http.ResponseWriter, r *http.Request) {
|
||||
if strings.HasSuffix(r.URL.Path, "hardening_mikrotik") {
|
||||
web.ArticleHardeningMikrotik("/ Article / Hardening Mikrotik", w)
|
||||
} else if strings.HasSuffix(r.URL.Path, "nginx_recipes_and_tips") {
|
||||
web.ArticleNginxRecipesAndTips("/ Article / NGiNX's recipes & tips", w)
|
||||
} else if strings.HasSuffix(r.URL.Path, "setting_up_a_mail_server") {
|
||||
web.ArticleSettingUpAMailServer("/ Article / Setting up a mail server", w)
|
||||
} else if strings.HasSuffix(r.URL.Path, "setting_up_a_tor_proxy_relay_hiddenserv") {
|
||||
web.ArticleSettingUpATorProxyRelayHiddenserv("/ Article / Setting up a Tor proxy, relay and hidden service", w)
|
||||
} else if strings.HasSuffix(r.URL.Path, "rpi_root_on_external_drive") {
|
||||
web.ArticleSettingUpATorProxyRelayHiddenserv("/ Article / How to move a root partition from SD card off to external drive on Raspberry Pi", w)
|
||||
} else {
|
||||
name := r.URL.Path[strings.LastIndex(r.URL.Path, "/")+1:]
|
||||
artcl, err := web.GetArticle(name)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
web.Article(artcl.Title, artcl.Description, string(artcl.Body), artcl.Date, r.Host, name, r, w)
|
||||
}
|
||||
|
||||
func (h *Handlers) RSS(w http.ResponseWriter, r *http.Request) {
|
||||
|
Loading…
Reference in New Issue
Block a user