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

Allow ENS available TLDs that are not ENS names #1017

Merged
merged 5 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
aliases:
- &restore-cache
keys:
- v1.0.3-{{ .Branch }}-{{ checksum "package.json" }}
- v1.0.3-{{ .Branch }}
- v1.0.4-{{ .Branch }}-{{ checksum "package.json" }}
- v1.0.4-{{ .Branch }}

- &save-cache
key: v1.0.3-{{ .Branch }}-{{ checksum "package.json" }}
key: v1.0.4-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- node_modules
- &restore-node-cache
keys:
- v1.0.3-node-{{ .Branch }}-{{ checksum "package.json" }}
- v1.0.3-node-{{ .Branch }}
- v1.0.4-node-{{ .Branch }}-{{ checksum "package.json" }}
- v1.0.4-node-{{ .Branch }}
- &save-node-cache
key: v1.0.3-node-{{ .Branch }}-{{ checksum "package.json" }}
key: v1.0.4-node-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- node_modules

Expand Down
15 changes: 13 additions & 2 deletions app/components/Views/BrowserTab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ export class BrowserTab extends PureComponent {

webview = React.createRef();
inputRef = React.createRef();
ensIgnoreList = [];
snapshotTimer = null;
lastUrlBeforeHome = null;
goingBack = false;
Expand Down Expand Up @@ -816,7 +817,10 @@ export class BrowserTab extends PureComponent {
const { hostname } = urlObj;
const tld = hostname.split('.').pop();
if (AppConstants.supportedTLDs.indexOf(tld.toLowerCase()) !== -1) {
return true;
// Make sure it's not in the ignore list
if (this.ensIgnoreList.indexOf(hostname) === -1) {
return true;
}
}
return false;
}
Expand Down Expand Up @@ -921,9 +925,16 @@ export class BrowserTab extends PureComponent {
type
};
} catch (err) {
// This is a TLD that might be a normal website
// For example .XYZ and might be more in the future
if (hostname.substr(-4) !== '.eth' && err.toString().indexOf('is not standard') !== -1) {
this.ensIgnoreList.push(hostname);
this.go(fullUrl);
return { url: null };
}
Logger.error('Failed to resolve ENS name', err);
Alert.alert(strings('browser.error'), strings('browser.failed_to_resolve_ens_name'));
return null;
return { url: null };
}
}

Expand Down