import React, { Component } from 'react'; import { withTranslation, Trans } from 'react-i18next'; import { Paper, Alert, AlertTitle, Button, Link } from '@mui/material'; import MediaQuery from 'react-responsive'; class UnsafeAlert extends Component { constructor(props) { super(props); this.state = { show: true, isSelfhosted: this.isSelfhosted(), }; } getHost() { var url = window.location != window.parent.location ? this.getHost(document.referrer) : document.location.href; return url.split('/')[2]; } isSelfhosted() { var http = new XMLHttpRequest(); http.open('HEAD', `${location.protocol}//${this.getHost()}/selfhosted`, false); http.send(); return http.status != 404; } safe_urls = [ 'robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion', 'robotestagw3dcxmd66r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion', 'robodevs7ixniseezbv7uryxhamtz3hvcelzfwpx3rvoipttjomrmpqd.onion', 'robosats.i2p', 'r7r4sckft6ptmk4r2jajiuqbowqyxiwsle4iyg4fijtoordc6z7a.b32.i2p', ]; render() { const { t, i18n } = this.props; // If alert is hidden return null if (!this.state.show) { return null; } // Show selfhosted notice if (this.state.isSelfhosted) { return (