updated for increased security theater

This commit is contained in:
gutmet 2020-08-08 11:52:42 +02:00
parent 2578f7acca
commit 56db7d59dd
2 changed files with 8 additions and 4 deletions

View File

@ -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}

View File

@ -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
}