|
77 | 77 | accJSONFlag = flag.String("account.json", "", "Key json file to fund user requests with")
|
78 | 78 | accPassFlag = flag.String("account.pass", "", "Decryption password to access faucet funds")
|
79 | 79 |
|
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 |
| - |
83 | 80 | captchaToken = flag.String("captcha.token", "", "Recaptcha site key to authenticate client side")
|
84 | 81 | captchaSecret = flag.String("captcha.secret", "", "Recaptcha secret key to authenticate server side")
|
85 | 82 |
|
@@ -638,59 +635,6 @@ func sendSuccess(conn *websocket.Conn, msg string) error {
|
638 | 635 | return send(conn, map[string]string{"success": msg}, time.Second)
|
639 | 636 | }
|
640 | 637 |
|
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 |
| - |
694 | 638 | // authTwitter tries to authenticate a faucet request using Twitter posts, returning
|
695 | 639 | // the username, avatar URL and Ethereum address to fund on success.
|
696 | 640 | func authTwitter(url string) (string, string, common.Address, error) {
|
|
0 commit comments