mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Alert when using clearnet
This commit is contained in:
parent
26e0664f44
commit
967c441bb4
@ -2,6 +2,7 @@ import React, { Component } from "react";
|
||||
import { render } from "react-dom";
|
||||
import HomePage from "./HomePage";
|
||||
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
||||
import UnsafeAlert from "./UnsafeAlert";
|
||||
|
||||
export default class App extends Component {
|
||||
constructor(props) {
|
||||
@ -32,6 +33,7 @@ export default class App extends Component {
|
||||
render() {
|
||||
return (
|
||||
<ThemeProvider theme={this.state.dark ? this.darkTheme : this.lightTheme}>
|
||||
<UnsafeAlert/>
|
||||
<HomePage setAppState={this.setAppState}/>
|
||||
</ThemeProvider>
|
||||
);
|
||||
|
56
frontend/src/components/UnsafeAlert.js
Normal file
56
frontend/src/components/UnsafeAlert.js
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
import {Alert, AlertTitle, Button, Grid, Typography} from "@mui/material"
|
||||
import React, { Component } from 'react'
|
||||
import MediaQuery from 'react-responsive'
|
||||
|
||||
export default class UnsafeAlert extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
state = {
|
||||
show: true,
|
||||
};
|
||||
|
||||
getHost(){
|
||||
var url = (window.location != window.parent.location) ? this.getHost(document.referrer) : document.location.href;
|
||||
return url.split('/')[2]
|
||||
}
|
||||
|
||||
safe_urls = [
|
||||
'robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion',
|
||||
'robotestagw3dcxmd66r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion',
|
||||
'robodevs7ixniseezbv7uryxhamtz3hvcelzfwpx3rvoipttjomrmpqd.onion',
|
||||
]
|
||||
|
||||
render() {
|
||||
return (
|
||||
(!this.safe_urls.includes(this.getHost()) & this.state.show) ?
|
||||
<>
|
||||
<MediaQuery minWidth={800}>
|
||||
<Alert severity="warning"
|
||||
action={<Button onClick={() => this.setState({show:false})}>Hide</Button>}
|
||||
>
|
||||
<AlertTitle>You are not using RoboSats privately</AlertTitle>
|
||||
Some features are disabled for your protection (e.g. chat) and you will not be able to complete a
|
||||
trade without them. To protect your privacy and fully enable RoboSats, use <a href='https://www.torproject.org/download/' target="_blank">Tor Browser</a> and visit the <a href='http://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion' target="_blank">Onion</a> site.
|
||||
</Alert>
|
||||
</MediaQuery>
|
||||
|
||||
<MediaQuery maxWidth={799}>
|
||||
<Alert severity="warning" >
|
||||
<AlertTitle>You are not using RoboSats privately</AlertTitle>
|
||||
You will not be able to complete a
|
||||
trade. Use <a href='https://www.torproject.org/download/' target="_blank">Tor Browser</a> and visit the <a href='http://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion' target="_blank">Onion</a> site.
|
||||
<div style={{width: '100%'}}>
|
||||
</div>
|
||||
<div align="center">
|
||||
<Button onClick={() => this.setState({show:false})}>Hide</Button>
|
||||
</div>
|
||||
</Alert>
|
||||
</MediaQuery>
|
||||
</>
|
||||
:
|
||||
null
|
||||
)
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -54,6 +54,10 @@
|
||||
!*** ./node_modules/isarray/index.js ***!
|
||||
\***************************************/
|
||||
|
||||
/*!***************************************!*\
|
||||
!*** ./src/components/UnsafeAlert.js ***!
|
||||
\***************************************/
|
||||
|
||||
/*!***************************************!*\
|
||||
!*** ./src/components/UserGenPage.js ***!
|
||||
\***************************************/
|
||||
@ -1382,6 +1386,10 @@
|
||||
!*** ./node_modules/@material-ui/system/esm/breakpoints.js ***!
|
||||
\*************************************************************/
|
||||
|
||||
/*!*************************************************************!*\
|
||||
!*** ./node_modules/@mui/material/AlertTitle/AlertTitle.js ***!
|
||||
\*************************************************************/
|
||||
|
||||
/*!*************************************************************!*\
|
||||
!*** ./node_modules/@mui/material/ButtonBase/ButtonBase.js ***!
|
||||
\*************************************************************/
|
||||
@ -2090,6 +2098,10 @@
|
||||
!*** ./node_modules/@mui/lab/node_modules/@mui/utils/esm/useId.js ***!
|
||||
\********************************************************************/
|
||||
|
||||
/*!********************************************************************!*\
|
||||
!*** ./node_modules/@mui/material/AlertTitle/alertTitleClasses.js ***!
|
||||
\********************************************************************/
|
||||
|
||||
/*!********************************************************************!*\
|
||||
!*** ./node_modules/@mui/material/ButtonBase/buttonBaseClasses.js ***!
|
||||
\********************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user