diff --git a/src/viddown.go b/src/viddown.go index 1744abe..0402589 100644 --- a/src/viddown.go +++ b/src/viddown.go @@ -20,6 +20,7 @@ package main import ( + "encoding/json" "io" "io/ioutil" "log" @@ -32,6 +33,7 @@ import ( ) const template = ` + Download @@ -41,7 +43,26 @@ const template = ` -

currentWork

+ +

` @@ -66,8 +87,17 @@ var opsc = make(chan ops) // handleRequest handles http requests func handleRequest(w http.ResponseWriter, r *http.Request) { - if r.Method == http.MethodGet { - log.Print("New Get request") + if r.Method == http.MethodGet && r.URL.Path == "/currentwork" { + list, err := json.Marshal(currentWork) + if err != nil { + log.Panic(err) + } + + w.Write(list) + return + + } else if r.Method == http.MethodGet { + log.Print("New Get request: " + r.URL.Path) } else if r.Method == http.MethodPost { r.ParseForm() go func() {