From 56db7d59ddacb9006125a2191e885949498b077c Mon Sep 17 00:00:00 2001 From: gutmet Date: Sat, 8 Aug 2020 11:52:42 +0200 Subject: [PATCH] updated for increased security theater --- credentials.go | 7 +++---- drivel.go | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/credentials.go b/credentials.go index 55e5b43..0d0cf66 100644 --- a/credentials.go +++ b/credentials.go @@ -57,12 +57,11 @@ func createAppDir(appDir string) { return a } fmt.Println("Did not find " + appDir + ", creating.") - fmt.Println("Go to " + registerAppURL + " to register a new app") - fmt.Println("and create an access token\n") + fmt.Println("Go to " + registerAppURL + " to register a developer account, register a new app and generate access tokens with read & write permissions\n") err := os.MkdirAll(appDir, 0755) optLogFatal("createAppDir", err) - ck := ask("Consumer Key") - cs := ask("Consumer Secret") + ck := ask("Consumer Key/API Key") + cs := ask("Consumer Secret/API Secret") at := ask("Access Token") ats := ask("Access Token Secret") c := credentials{ck, cs, at, ats} diff --git a/drivel.go b/drivel.go index 91c8d16..d07bf73 100644 --- a/drivel.go +++ b/drivel.go @@ -131,6 +131,11 @@ func send(client *http.Client, url string, vals url.Values) []byte { log(err) defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) + if resp.StatusCode != http.StatusOK { + fmt.Fprintln(os.Stderr, "response:", resp, "\n") + fmt.Fprintln(os.Stderr, "body:", string(body), "\n") + log(errors.New("HTTP status " + fmt.Sprint(resp.StatusCode))) + } log(err) return body }