diff options
Diffstat (limited to 'cmd/web/install.go')
| -rw-r--r-- | cmd/web/install.go | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/cmd/web/install.go b/cmd/web/install.go index ce8aa8d..dc85a89 100644 --- a/cmd/web/install.go +++ b/cmd/web/install.go @@ -1,32 +1,15 @@ package main import ( - "encoding/json" "fmt" "io" "net/http" - "net/url" "os" "strconv" "strings" "time" ) -func (a *App) HandleStats(w http.ResponseWriter, r *http.Request) { - a.Status.RLock() - defer a.Status.RUnlock() - - w.Header().Add("Content-type", "application/json") - - enc := json.NewEncoder(w) - - err := enc.Encode(a.Status) - if err != nil { - Logger.Println("While encoding Status: ", err) - } - return -} - func (a *App) installHttp(u string) error { Logger.Println("Installer: loading from url") resp, err := http.Get(u) @@ -129,38 +112,3 @@ func (a *App) installer() { } } -func (a *App) HandleInstall(w http.ResponseWriter, r *http.Request) { - if unauthorizedIfNotLocal(w, r) { - return - } - - err := r.ParseForm() - if err != nil { - Logger.Printf("Installer: While parsing form: %s", err) - http.Error(w, fmt.Sprintf("Invalid form: %s", err), 400) - return - } - - uri := r.Form.Get("uri") - - if strings.HasPrefix(uri, "http") { - _, err := url.Parse(uri) - if err != nil { - Logger.Printf("Installer: While parsing url: %s", err) - http.Error(w, fmt.Sprintf("Invalid url: %s", err), 400) - return - } - } else { - fi, err := os.Stat(uri) - if err != nil || !fi.Mode().IsRegular() { - Logger.Printf("Installer: While parsing url/path: %s", err) - http.Error(w, fmt.Sprintf("Invalid uri/path: %s", err), 400) - return - } - } - - Logger.Printf("Installer: Sending request for: %s to channel", uri) - a.download <- uri - - http.Redirect(w, r, "/", 302) -} |
