mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-20 21:21:36 +00:00
Fix conflicts
This commit is contained in:
parent
3446fc33d3
commit
df786376ac
@ -211,12 +211,14 @@ const Main = ({ settings, setSettings }: MainProps): JSX.Element => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open.profile || (robot.token && robot.nickname === null)) {
|
if (baseUrl != '') {
|
||||||
fetchRobot({ keys: false }); // fetch existing robot
|
if (open.profile || (robot.token && robot.nickname === null)) {
|
||||||
} else if (robot.token && robot.encPrivKey && robot.pubKey) {
|
fetchRobot({ keys: false }); // fetch existing robot
|
||||||
fetchRobot({ keys: true }); // create new robot with existing token and keys (on network and coordinator change)
|
} else if (robot.token && robot.encPrivKey && robot.pubKey) {
|
||||||
|
fetchRobot({ keys: true }); // create new robot with existing token and keys (on network and coordinator change)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [open.profile, settings.network, settings.coordinator]);
|
}, [open.profile, baseUrl]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Router basename={basename}>
|
<Router basename={basename}>
|
||||||
|
@ -184,6 +184,7 @@ const ProfileDialog = ({
|
|||||||
avatarClass='profileAvatar'
|
avatarClass='profileAvatar'
|
||||||
style={{ width: 65, height: 65 }}
|
style={{ width: 65, height: 65 }}
|
||||||
nickname={robot.nickname}
|
nickname={robot.nickname}
|
||||||
|
baseUrl={baseUrl}
|
||||||
/>
|
/>
|
||||||
</ListItemAvatar>
|
</ListItemAvatar>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
@ -22,6 +22,7 @@ interface Props {
|
|||||||
takerNick: string;
|
takerNick: string;
|
||||||
messages: EncryptedChatMessage[];
|
messages: EncryptedChatMessage[];
|
||||||
setMessages: (messages: EncryptedChatMessage[]) => void;
|
setMessages: (messages: EncryptedChatMessage[]) => void;
|
||||||
|
baseUrl: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EncryptedSocketChat: React.FC<Props> = ({
|
const EncryptedSocketChat: React.FC<Props> = ({
|
||||||
@ -30,6 +31,7 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
|||||||
takerNick,
|
takerNick,
|
||||||
messages,
|
messages,
|
||||||
setMessages,
|
setMessages,
|
||||||
|
baseUrl,
|
||||||
}: Props): JSX.Element => {
|
}: Props): JSX.Element => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@ -38,13 +40,13 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
|||||||
const [connected, setConnected] = useState<boolean>(false);
|
const [connected, setConnected] = useState<boolean>(false);
|
||||||
const [peerConnected, setPeerConnected] = useState<boolean>(false);
|
const [peerConnected, setPeerConnected] = useState<boolean>(false);
|
||||||
const [ownPubKey] = useState<string>(
|
const [ownPubKey] = useState<string>(
|
||||||
(systemClient.getCookie('pub_key') ?? '').split('\\').join('\n'),
|
(systemClient.getItem('pub_key') ?? '').split('\\').join('\n'),
|
||||||
);
|
);
|
||||||
const [ownEncPrivKey] = useState<string>(
|
const [ownEncPrivKey] = useState<string>(
|
||||||
(systemClient.getCookie('enc_priv_key') ?? '').split('\\').join('\n'),
|
(systemClient.getItem('enc_priv_key') ?? '').split('\\').join('\n'),
|
||||||
);
|
);
|
||||||
const [peerPubKey, setPeerPubKey] = useState<string>();
|
const [peerPubKey, setPeerPubKey] = useState<string>();
|
||||||
const [token] = useState<string>(systemClient.getCookie('robot_token') || '');
|
const [token] = useState<string>(systemClient.getItem('robot_token') || '');
|
||||||
const [serverMessages, setServerMessages] = useState<ServerMessage[]>([]);
|
const [serverMessages, setServerMessages] = useState<ServerMessage[]>([]);
|
||||||
const [value, setValue] = useState<string>('');
|
const [value, setValue] = useState<string>('');
|
||||||
const [connection, setConnection] = useState<WebsocketConnection>();
|
const [connection, setConnection] = useState<WebsocketConnection>();
|
||||||
@ -231,7 +233,12 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<li style={{ listStyleType: 'none' }} key={index}>
|
<li style={{ listStyleType: 'none' }} key={index}>
|
||||||
<MessageCard message={message} isTaker={isTaker} userConnected={userConnected} />
|
<MessageCard
|
||||||
|
message={message}
|
||||||
|
isTaker={isTaker}
|
||||||
|
userConnected={userConnected}
|
||||||
|
baseUrl={baseUrl}
|
||||||
|
/>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Button, Tooltip, TextField, Grid, Container, Paper, Typography } from '@mui/material';
|
import { Button, TextField, Grid, Container, Paper } from '@mui/material';
|
||||||
import { encryptMessage, decryptMessage } from '../../../../pgp';
|
import { encryptMessage, decryptMessage } from '../../../../pgp';
|
||||||
import { saveAsJson } from '../../../../utils';
|
|
||||||
import { AuditPGPDialog } from '../../../Dialogs';
|
import { AuditPGPDialog } from '../../../Dialogs';
|
||||||
import { systemClient } from '../../../../services/System';
|
import { systemClient } from '../../../../services/System';
|
||||||
import { websocketClient, WebsocketConnection } from '../../../../services/Websocket';
|
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
import CircularProgress from '@mui/material/CircularProgress';
|
import CircularProgress from '@mui/material/CircularProgress';
|
||||||
import KeyIcon from '@mui/icons-material/Key';
|
import KeyIcon from '@mui/icons-material/Key';
|
||||||
import { ExportIcon } from '../../../Icons';
|
|
||||||
import { useTheme } from '@mui/system';
|
import { useTheme } from '@mui/system';
|
||||||
import MessageCard from '../MessageCard';
|
import MessageCard from '../MessageCard';
|
||||||
import ChatHeader from '../ChatHeader';
|
import ChatHeader from '../ChatHeader';
|
||||||
@ -43,13 +40,13 @@ const EncryptedTurtleChat: React.FC<Props> = ({
|
|||||||
const audio = new Audio(`/static/assets/sounds/chat-open.mp3`);
|
const audio = new Audio(`/static/assets/sounds/chat-open.mp3`);
|
||||||
const [peerConnected, setPeerConnected] = useState<boolean>(false);
|
const [peerConnected, setPeerConnected] = useState<boolean>(false);
|
||||||
const [ownPubKey] = useState<string>(
|
const [ownPubKey] = useState<string>(
|
||||||
(systemClient.getCookie('pub_key') ?? '').split('\\').join('\n'),
|
(systemClient.getItem('pub_key') ?? '').split('\\').join('\n'),
|
||||||
);
|
);
|
||||||
const [ownEncPrivKey] = useState<string>(
|
const [ownEncPrivKey] = useState<string>(
|
||||||
(systemClient.getCookie('enc_priv_key') ?? '').split('\\').join('\n'),
|
(systemClient.getItem('enc_priv_key') ?? '').split('\\').join('\n'),
|
||||||
);
|
);
|
||||||
const [peerPubKey, setPeerPubKey] = useState<string>();
|
const [peerPubKey, setPeerPubKey] = useState<string>();
|
||||||
const [token] = useState<string>(systemClient.getCookie('robot_token') || '');
|
const [token] = useState<string>(systemClient.getItem('robot_token') || '');
|
||||||
const [value, setValue] = useState<string>('');
|
const [value, setValue] = useState<string>('');
|
||||||
const [audit, setAudit] = useState<boolean>(false);
|
const [audit, setAudit] = useState<boolean>(false);
|
||||||
const [waitingEcho, setWaitingEcho] = useState<boolean>(false);
|
const [waitingEcho, setWaitingEcho] = useState<boolean>(false);
|
||||||
@ -170,7 +167,7 @@ const EncryptedTurtleChat: React.FC<Props> = ({
|
|||||||
// If input string contains '#' send unencrypted and unlogged message
|
// If input string contains '#' send unencrypted and unlogged message
|
||||||
else if (value.substring(0, 1) == '#') {
|
else if (value.substring(0, 1) == '#') {
|
||||||
apiClient
|
apiClient
|
||||||
.post(`/api/chat`, {
|
.post(baseUrl, `/api/chat`, {
|
||||||
PGP_message: value,
|
PGP_message: value,
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@ -188,7 +185,7 @@ const EncryptedTurtleChat: React.FC<Props> = ({
|
|||||||
encryptMessage(value, ownPubKey, peerPubKey, ownEncPrivKey, token).then(
|
encryptMessage(value, ownPubKey, peerPubKey, ownEncPrivKey, token).then(
|
||||||
(encryptedMessage) => {
|
(encryptedMessage) => {
|
||||||
apiClient
|
apiClient
|
||||||
.post(`/api/chat/`, {
|
.post(baseUrl, `/api/chat/`, {
|
||||||
PGP_message: encryptedMessage.toString().split('\n').join('\\'),
|
PGP_message: encryptedMessage.toString().split('\n').join('\\'),
|
||||||
order_id: orderId,
|
order_id: orderId,
|
||||||
})
|
})
|
||||||
@ -225,7 +222,12 @@ const EncryptedTurtleChat: React.FC<Props> = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<li style={{ listStyleType: 'none' }} key={index}>
|
<li style={{ listStyleType: 'none' }} key={index}>
|
||||||
<MessageCard message={message} isTaker={isTaker} userConnected={userConnected} />
|
<MessageCard
|
||||||
|
message={message}
|
||||||
|
isTaker={isTaker}
|
||||||
|
userConnected={userConnected}
|
||||||
|
baseUrl={baseUrl}
|
||||||
|
/>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
@ -15,9 +15,10 @@ interface Props {
|
|||||||
message: EncryptedChatMessage;
|
message: EncryptedChatMessage;
|
||||||
isTaker: boolean;
|
isTaker: boolean;
|
||||||
userConnected: boolean;
|
userConnected: boolean;
|
||||||
|
baseUrl: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MessageCard: React.FC<Props> = ({ message, isTaker, userConnected }) => {
|
const MessageCard: React.FC<Props> = ({ message, isTaker, userConnected, baseUrl }) => {
|
||||||
const [showPGP, setShowPGP] = useState<boolean>();
|
const [showPGP, setShowPGP] = useState<boolean>();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@ -34,6 +35,7 @@ const MessageCard: React.FC<Props> = ({ message, isTaker, userConnected }) => {
|
|||||||
<RobotAvatar
|
<RobotAvatar
|
||||||
statusColor={userConnected ? 'success' : 'error'}
|
statusColor={userConnected ? 'success' : 'error'}
|
||||||
nickname={message.userNick}
|
nickname={message.userNick}
|
||||||
|
baseUrl={baseUrl}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
style={{ backgroundColor: cardColor }}
|
style={{ backgroundColor: cardColor }}
|
||||||
|
@ -55,6 +55,7 @@ const EncryptedChat: React.FC<Props> = ({
|
|||||||
orderId={orderId}
|
orderId={orderId}
|
||||||
takerNick={takerNick}
|
takerNick={takerNick}
|
||||||
userNick={userNick}
|
userNick={userNick}
|
||||||
|
baseUrl={baseUrl}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -38,7 +38,6 @@ import { apiClient } from '../../services/api';
|
|||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
import PercentIcon from '@mui/icons-material/Percent';
|
import PercentIcon from '@mui/icons-material/Percent';
|
||||||
import SelfImprovement from '@mui/icons-material/SelfImprovement';
|
|
||||||
import BookIcon from '@mui/icons-material/Book';
|
import BookIcon from '@mui/icons-material/Book';
|
||||||
import LockIcon from '@mui/icons-material/Lock';
|
import LockIcon from '@mui/icons-material/Lock';
|
||||||
import LockOpenIcon from '@mui/icons-material/LockOpen';
|
import LockOpenIcon from '@mui/icons-material/LockOpen';
|
||||||
@ -1435,14 +1434,7 @@ class TradeBox extends Component {
|
|||||||
{/* Make confirmation sound for Chat Open. */}
|
{/* Make confirmation sound for Chat Open. */}
|
||||||
{this.Sound('locked-invoice')}
|
{this.Sound('locked-invoice')}
|
||||||
<Grid item xs={12} align='center'>
|
<Grid item xs={12} align='center'>
|
||||||
<Typography variant='subtitle1'>
|
<div style={{ position: 'fixed', right: '-4em', top: '2.5em' }}>
|
||||||
<b>
|
|
||||||
{' '}
|
|
||||||
{this.props.data.is_seller ? t('Chat with the buyer') : t('Chat with the seller')}
|
|
||||||
</b>{' '}
|
|
||||||
{' ' + this.stepXofY()}
|
|
||||||
</Typography>
|
|
||||||
<Grid item>
|
|
||||||
<Tooltip
|
<Tooltip
|
||||||
enterTouchDelay={0}
|
enterTouchDelay={0}
|
||||||
placement='top'
|
placement='top'
|
||||||
@ -1464,7 +1456,14 @@ class TradeBox extends Component {
|
|||||||
<WifiTetheringErrorIcon sx={{ color: 'text.secondary' }} />
|
<WifiTetheringErrorIcon sx={{ color: 'text.secondary' }} />
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Grid>
|
</div>
|
||||||
|
<Typography variant='subtitle1'>
|
||||||
|
<b>
|
||||||
|
{' '}
|
||||||
|
{this.props.data.is_seller ? t('Chat with the buyer') : t('Chat with the seller')}
|
||||||
|
</b>{' '}
|
||||||
|
{' ' + this.stepXofY()}
|
||||||
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} align='center'>
|
<Grid item xs={12} align='center'>
|
||||||
{this.props.data.is_seller ? (
|
{this.props.data.is_seller ? (
|
||||||
|
Loading…
Reference in New Issue
Block a user