mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-12 20:14:12 +00:00
Add polling warning for console snoopers
This commit is contained in:
parent
895b959822
commit
3497bffffe
@ -71,7 +71,7 @@ class CustomNodeModal extends React.Component<Props, State> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.checkForDefaultNodes();
|
||||
this.pollForDefaultNodes();
|
||||
}
|
||||
|
||||
public componentDidUpdate(prevProps: Props) {
|
||||
@ -251,7 +251,13 @@ class CustomNodeModal extends React.Component<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
private async checkForDefaultNodes() {
|
||||
private pollForDefaultNodes() {
|
||||
const pollingInterval = 3000;
|
||||
// console.warning in production to explain to users why we are making a call to localhost
|
||||
console.warn(
|
||||
"Don't panic! MyCrypto is going to start a poll for default nodes on port 8545. If you don't like this feature, send us a ping at support@mycrypto.com and we'll walk you through disabling it."
|
||||
);
|
||||
this.timer = window.setInterval(async () => {
|
||||
const results = await exists(
|
||||
[
|
||||
// tslint:disable-next-line:no-http-string
|
||||
@ -259,7 +265,9 @@ class CustomNodeModal extends React.Component<Props, State> {
|
||||
],
|
||||
{ includeDefaults: false }
|
||||
);
|
||||
|
||||
if (!this.timer) {
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
defaultNodes: results.filter(r => r.success).map((r, index) => ({
|
||||
...r,
|
||||
@ -267,6 +275,7 @@ class CustomNodeModal extends React.Component<Props, State> {
|
||||
index
|
||||
}))
|
||||
});
|
||||
}, pollingInterval);
|
||||
}
|
||||
|
||||
private renderDefaultNodeDropdown() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user