-
Notifications
You must be signed in to change notification settings - Fork 5k
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
ENS Address preservation when calling URLs #7740
Conversation
Hello, @whymarrh, @tmashuang . Do you think this code change can be the best solution to obtain this result? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea!
Has anybody else taken a similar approach? I'm wary of creating a de-facto standard for dapps served via ENS when one might already exist, or when we can avoid creating one altogether.
@@ -43,10 +43,11 @@ function setupEnsIpfsResolver ({ provider, getIpfsGateway }) { | |||
const ipfsGateway = getIpfsGateway() | |||
extension.tabs.update(tabId, { url: `loading.html` }) | |||
let url = `https://app.ens.domains/name/${name}` | |||
const completeSearch = (search || '') + (!search || search.indexOf('?') === -1 ? '?' : '&') + 'ensd=' + name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to checking for existing query params, it might be a good idea to ensure ensd
itself isn't already set. If we include it twice, it might not be parsed the way we expect.
Not sure whether we'd want to leave alone a pre-existing ensd
parameter or overwrite it though 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In query parameters, it is allowed to have multiple vars with the same name: it is one of the allowed methods to implicitly declare that the var is an array, as you can see here in the first example. https://medium.com/raml-api/arrays-in-query-params-33189628fa68
As this PR would just be a help to users who could potentially need it, we cannot imagine the scenario they are running: one of those could be that they need ensd
as an array var.
So I would not bother to check that ensd
is a unique parameter, that is the user's business, we are only concerned with passing it on.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting idea!
Has anybody else taken a similar approach? I'm wary of creating a de-facto standard for dapps served via ENS when one might already exist, or when we can avoid creating one altogether.
Really glad you mentioned it! ✌
Unfortunately, I have not found anything that can help preserve the ENS address when querying an instrument such as a Chrome Extension like Metamask or similar.
The idea around this PR was, in fact, to lay the foundations for a de-facto standard, starting with Metamask (which is the main tool) and expanding it as much as possible.
If someone of you would like to make this happen I am willing to actively collaborate.
I really want to discuss it seriously because it's extremely useful for the growth of the Ethereum eco-system.
The ideal option would be to not redirect at all, preserving the host header. Since that's not presently possible, is it possible to include an http header with requests instead? |
That would make sense for communicating to the server which ENS domain was used, but I suspect the goal in this case is to inform the dapp of the ENS address used. The dapp wouldn't have any information about what headers were sent to the server. There may still be other options for informing the dapp. We could store it in |
Good point, I'd forgotten JS can't access HTTP headers for the request. Storing it somewhere that's accessible to the dapp via JS seems better than adding it to a query string, to me. |
Yeah I don't think that Cookie or local/session storage is a clean solution, it could be really a pain to keep the cache consisntent. I followed this approach just for 3 reasons:
I think that the best implementation would be the one also used by GoDaddy's default homepages:
If you like it I can think to do another PR which works like this. |
Hey @Gudahtt, any news about this PR? Is there anything I could do? Many thanks |
@marcovasapollo If you're able to preserve the ENS URL in the URL bar for an iframe page, can't you do it for the actual content? RE using an iframe, this doesn't seem ideal because if a user navigates to a new page in the iframe, the URL will not update to reflect that. |
Hey @marcovasapollo , sorry for the delay! I still have some reservations about this solution, and I'd like to try prototyping an alternative solution first - one that would preserve the ENS address in the address bar. I think it should be possible using the I should have time to try this in a week or so - I'm pretty busy until then. Feel free to give it a shot yourself in the meantime though, if you want to. If this is feasible with just the runtime |
Hello @Arachnid. I made some experiments and you were right: managing stuff using iframes is really tricky and not applicable. |
Hey @Gudahtt, if I'm understanding you correctly, you are thinking on a solution like this:
An example of the business logic I have in mind is similar to this:
Need to investigate if the Otherwise, I think that the I will investigate for sure. |
Whoops, that throws a wrench in my plan. Good find though - thanks for looking into this! I'll bring this up with the rest of the team. We're pretty hesitant to add new permissions in general, so this might be a non-starter.
If we were going to support address preservation at all, we'd likely make that the only option. We might want to allow disabling ENS resolution altogether, but the current resolver seems strictly worse than one that would preserve the address.
Not necessarily - we could proxy anything with a |
Which other systems do you think would benefit from the query-parameter style solution you proposed? I know of a few others that preserve the address - I don't know of any offhand that work like ours. |
This sounds cool even because the execution scope of the
I'm talking about all the other applications with ENS-browsing capabilities (mobile applications, other browsers). BTW can you tell me which are applications that already do ENS preservation? I don't know any. (Feel free to contact me on telegram @vasapower if you cannot write them here for any reason). |
When I looked around for "ENS browsers", the first couple of examples I found both preserved ENS addresses: ENS Gateway, Opera. It seems to be the approach that is preferred by the ENS team itself as well, and it's clearly better for users. At this point I'm inclined to not accept this PR, but instead pursue ENS address preservation. We have a few releases lined up that we'd like to get out first, but after that we might be able to ship an improved ENS resolver that preserves the ENS name in the address bar. It would require adding the I'll see what the rest of the team thinks first though; we might accept this anyway in the meantime. Either way, thanks for implementing this and pushing the discussion forward! |
Glad to be of inspiration! I already tried the Opera Beta Browser (regular does not have ENS support) and it still not work, but maybe that is the correct way. ENS GW is actually in beta too (and their website does not work, maybe abandoned project?) so I think that your idea to use queryParam in the meantime can be a good placeholder. |
I've had a different take on this where we redirect to |
CLA Signature Action: Thank you for your submission, we really appreciate it. We ask that you read and sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just by adding a comment to this pull request with this exact sentence:
By commenting with the above message you are agreeing to the terms of the CLA. Your account will be recorded as agreeing to our CLA so you don't need to sign it again for future contributions to this repository. 0 out of 1 committers have signed the CLA. |
One drawback of this approach is that all ENS related names share a common localStorage and cookie namespace. I think that security issue makes me considerably prefer approaches like are discussed in #9353, and I'm not sure this change is worth the benefit before a more complete change like that. I'm going to close this for now, because we do plan to implement one of those approaches, and so I don't think it makes sense to continue leaving this one open. |
It could be extremely useful to have more ENS domains to point to the same IPFS/Swarm/every-other-distributed-file-system destination.
But how to find the original source call?
Inserting the original ens domain name as query param is the best method I found,
I hope you will appreciate the idea because me and my team really need it.
Thank you very much