Skip to content

Commit 0224d2f

Browse files
jsvisakielbarry
authored andcommitted
cmd: remove faucet/puppeth dead code (ethereum#16991)
* cmd/faucet: authGitHub is not used anymore * cmd/puppeth: remove not used code
1 parent 7adcf1f commit 0224d2f

File tree

2 files changed

+0
-66
lines changed

2 files changed

+0
-66
lines changed

cmd/faucet/faucet.go

-56
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ var (
7777
accJSONFlag = flag.String("account.json", "", "Key json file to fund user requests with")
7878
accPassFlag = flag.String("account.pass", "", "Decryption password to access faucet funds")
7979

80-
githubUser = flag.String("github.user", "", "GitHub user to authenticate with for Gist access")
81-
githubToken = flag.String("github.token", "", "GitHub personal token to access Gists with")
82-
8380
captchaToken = flag.String("captcha.token", "", "Recaptcha site key to authenticate client side")
8481
captchaSecret = flag.String("captcha.secret", "", "Recaptcha secret key to authenticate server side")
8582

@@ -638,59 +635,6 @@ func sendSuccess(conn *websocket.Conn, msg string) error {
638635
return send(conn, map[string]string{"success": msg}, time.Second)
639636
}
640637

641-
// authGitHub tries to authenticate a faucet request using GitHub gists, returning
642-
// the username, avatar URL and Ethereum address to fund on success.
643-
func authGitHub(url string) (string, string, common.Address, error) {
644-
// Retrieve the gist from the GitHub Gist APIs
645-
parts := strings.Split(url, "/")
646-
req, _ := http.NewRequest("GET", "https://api.github.com/gists/"+parts[len(parts)-1], nil)
647-
if *githubUser != "" {
648-
req.SetBasicAuth(*githubUser, *githubToken)
649-
}
650-
res, err := http.DefaultClient.Do(req)
651-
if err != nil {
652-
return "", "", common.Address{}, err
653-
}
654-
var gist struct {
655-
Owner struct {
656-
Login string `json:"login"`
657-
} `json:"owner"`
658-
Files map[string]struct {
659-
Content string `json:"content"`
660-
} `json:"files"`
661-
}
662-
err = json.NewDecoder(res.Body).Decode(&gist)
663-
res.Body.Close()
664-
if err != nil {
665-
return "", "", common.Address{}, err
666-
}
667-
if gist.Owner.Login == "" {
668-
return "", "", common.Address{}, errors.New("Anonymous Gists not allowed")
669-
}
670-
// Iterate over all the files and look for Ethereum addresses
671-
var address common.Address
672-
for _, file := range gist.Files {
673-
content := strings.TrimSpace(file.Content)
674-
if len(content) == 2+common.AddressLength*2 {
675-
address = common.HexToAddress(content)
676-
}
677-
}
678-
if address == (common.Address{}) {
679-
return "", "", common.Address{}, errors.New("No Ethereum address found to fund")
680-
}
681-
// Validate the user's existence since the API is unhelpful here
682-
if res, err = http.Head("https://github.com/" + gist.Owner.Login); err != nil {
683-
return "", "", common.Address{}, err
684-
}
685-
res.Body.Close()
686-
687-
if res.StatusCode != 200 {
688-
return "", "", common.Address{}, errors.New("Invalid user... boom!")
689-
}
690-
// Everything passed validation, return the gathered infos
691-
return gist.Owner.Login + "@github", fmt.Sprintf("https://github.com/%s.png?size=64", gist.Owner.Login), address, nil
692-
}
693-
694638
// authTwitter tries to authenticate a faucet request using Twitter posts, returning
695639
// the username, avatar URL and Ethereum address to fund on success.
696640
func authTwitter(url string) (string, string, common.Address, error) {

cmd/puppeth/wizard_netstats.go

-10
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,3 @@ func (stats serverStats) render() {
276276
}
277277
table.Render()
278278
}
279-
280-
// protips contains a collection of network infos to report pro-tips
281-
// based on.
282-
type protips struct {
283-
genesis string
284-
network int64
285-
bootFull []string
286-
bootLight []string
287-
ethstats string
288-
}

0 commit comments

Comments
 (0)