Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(faucet): compliency gno/faucet and gnoweb #8

Closed
wants to merge 2 commits into from

Conversation

albttx
Copy link
Member

@albttx albttx commented Dec 16, 2023

No description provided.

@albttx albttx requested a review from a team as a code owner December 16, 2023 16:11
Copy link
Member

@zivkovicmilos zivkovicmilos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comment about request standardization 🙏

I think we don't need to make this change on the side of this lib, but on gnoweb

Comment on lines +24 to +29
err := r.ParseForm()
if err != nil {
http.Error(w, "invalid request body", http.StatusBadRequest)

return
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: you can inline this

if err := r.ParseForm(); err != nil {
    http.Error(w, "invalid request body", http.StatusBadRequest)

    return
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't put it like that to avoid redefine err lower, but i'm fine for adding a var err error :)

Comment on lines +41 to +44
if to := r.FormValue("toaddr"); to != "" {
requests = Requests{
{To: to},
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not like the fact we are modelling the behavior of a generic TM2 faucet based on gnoweb (and exact field names in gnoweb. The faucet is envisioned to work through POST requests of a specific format (or we can define our own handlers, endpoints, the faucet lib allows for that).

We are deprecating the old gno faucet anyways, so might as well make the change now.

I propose we take one of these routes:

  • modify gnoweb to send a POST with a standard body that is expected in this faucet implementation, this way only 1 thing is changed, and it's on the Gnoweb side (easy route, and longterm the final version, since we are deprecating the old faucet)
  • use this faucet as a lib in gno, and extend the faucet to have specific handlers / routes you would use for gnoweb (define custom handlers, like we did for gnochess). This option is less favorable, because it just introduces complexity we'd drop later on when deleting the old faucet

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100% ok with this, i just choose a quicker solution for having a fix to work with

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the "form" system is an easier system for the way we're using gno/templating html

@zivkovicmilos
Copy link
Member

Closing this in favor of gnolang/gno#1614

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants