2022-03-17 15:56:08 +00:00
import React , { Component } from 'react'
2022-04-05 14:25:53 +00:00
import { withTranslation , Trans } from "react-i18next" ;
import { Paper , Alert , AlertTitle , Button , Link } from "@mui/material"
2022-03-17 15:56:08 +00:00
import MediaQuery from 'react-responsive'
2022-04-05 14:25:53 +00:00
class UnsafeAlert extends Component {
2022-03-17 15:56:08 +00:00
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 ( ) {
2022-04-05 14:25:53 +00:00
const { t , i18n } = this . props ;
2022-03-17 15:56:08 +00:00
return (
( ! this . safe _urls . includes ( this . getHost ( ) ) & this . state . show ) ?
2022-03-18 21:21:13 +00:00
< div >
2022-03-17 15:56:08 +00:00
< MediaQuery minWidth = { 800 } >
2022-03-19 16:33:01 +00:00
< Paper elevation = { 6 } className = "alertUnsafe" >
2022-03-24 13:41:32 +00:00
< Alert severity = "warning" sx = { { maxHeight : "100px" } }
2022-04-05 14:25:53 +00:00
action = { < Button onClick = { ( ) => this . setState ( { show : false } ) } > { t ( "Hide" ) } < / B u t t o n > }
2022-03-17 15:56:08 +00:00
>
2022-04-05 14:25:53 +00:00
< AlertTitle > { t ( "You are not using RoboSats privately" ) } < / A l e r t T i t l e >
< Trans i18nKey = "desktop_unsafe_alert" >
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 < Link href = 'https://www.torproject.org/download/' target = "_blank" > Tor Browser < /Link> and visit the <Link href='http:/ / robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid . onion ' target = "_blank" > Onion < / L i n k > s i t e .
< / T r a n s >
< / A l e r t >
2022-03-19 16:33:01 +00:00
< / P a p e r >
2022-03-17 15:56:08 +00:00
< / M e d i a Q u e r y >
< MediaQuery maxWidth = { 799 } >
2022-03-19 16:33:01 +00:00
< Paper elevation = { 6 } className = "alertUnsafe" >
2022-03-24 13:41:32 +00:00
< Alert severity = "warning" sx = { { maxHeight : "120px" } } >
2022-04-05 14:25:53 +00:00
< AlertTitle > { t ( "You are not using RoboSats privately" ) } < / A l e r t T i t l e >
< Trans i18nKey = "phone_unsafe_alert" >
You will not be able to complete a
trade . Use < Link href = 'https://www.torproject.org/download/' target = "_blank" > Tor Browser < /Link> and visit the <Link href='http:/ / robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid . onion ' target = "_blank" > Onion < / L i n k > s i t e .
< / T r a n s >
2022-03-17 15:56:08 +00:00
< div style = { { width : '100%' } } >
< / d i v >
< div align = "center" >
2022-04-05 14:25:53 +00:00
< Button className = "hideAlertButton" onClick = { ( ) => this . setState ( { show : false } ) } > { t ( "Hide" ) } < / B u t t o n >
2022-03-17 15:56:08 +00:00
< / d i v >
< / A l e r t >
2022-03-19 16:33:01 +00:00
< / P a p e r >
2022-03-17 15:56:08 +00:00
< / M e d i a Q u e r y >
2022-03-18 21:21:13 +00:00
< / d i v >
2022-03-17 15:56:08 +00:00
:
null
)
}
2022-04-05 14:25:53 +00:00
}
export default withTranslation ( ) ( UnsafeAlert ) ;