diff --git a/assets/admin.html b/assets/admin.html index 28eca10..a9d03e5 100644 --- a/assets/admin.html +++ b/assets/admin.html @@ -7,6 +7,7 @@ +

White Rabbit Publish

@@ -21,9 +22,16 @@
+
+ + + +
+
+ \ No newline at end of file diff --git a/assets/index.html b/assets/index.html index 95561c4..b367bed 100644 --- a/assets/index.html +++ b/assets/index.html @@ -4,11 +4,15 @@ CMS Loading + + +

Loading

+

Admin

diff --git a/assets/static/custom.css b/assets/static/custom.css new file mode 100644 index 0000000..c35638f --- /dev/null +++ b/assets/static/custom.css @@ -0,0 +1,3 @@ +body { +background-color:red; +} \ No newline at end of file diff --git a/assets/static/styles.css b/assets/static/styles.css index 30d65fb..a481180 100644 --- a/assets/static/styles.css +++ b/assets/static/styles.css @@ -15,4 +15,10 @@ h1,h2,h3,h4,h5 { .podcast { width:70%; -} \ No newline at end of file +} +label { + display: block; +} +.admin { + text-align: center; +} diff --git a/src/admin.go b/src/admin.go index fc17163..6d96dbe 100644 --- a/src/admin.go +++ b/src/admin.go @@ -15,6 +15,29 @@ import ( "os" ) +func CustomCss(w http.ResponseWriter, r *http.Request) { + if r.Method == "POST" { + r.ParseMultipartForm(32 << 20) + css := strings.Join(r.Form["css"], "") + + filename := "custom.css" + + err := ioutil.WriteFile("./assets/static/" + filename, []byte(css), 0644) + if err != nil { + panic(err) + } else { + w.Write([]byte("success")) + } + } else { + css,err := ioutil.ReadFile("./assets/static/custom.css") + if err != nil { + panic (err) + } else { + w.Write(css) + } + } +} + func CreateEpisode(w http.ResponseWriter, r *http.Request) { if r.Method == "POST" { r.ParseMultipartForm(32 << 20) diff --git a/src/webserver.go b/src/webserver.go index fbdbb03..ddef81c 100644 --- a/src/webserver.go +++ b/src/webserver.go @@ -114,6 +114,7 @@ func main() { r.HandleFunc("/json", JsonHandler) r.HandleFunc("/admin", BasicAuth(AdminHandler, viper.GetString("AdminUsername"), viper.GetString("AdminPassword"), "Login to White Rabbit admin interface")) r.HandleFunc("/admin/publish", CreateEpisode) + r.HandleFunc("/admin/css", CustomCss) // We're live! log.Fatal(http.ListenAndServe(":8000", r))