diff --git a/chat/consumers.py b/chat/consumers.py index 67720f46..83570c28 100644 --- a/chat/consumers.py +++ b/chat/consumers.py @@ -244,8 +244,6 @@ class ChatRoomConsumer(AsyncWebsocketConsumer): nick = event["nick"] peer_connected = event["peer_connected"] - print(message) - await self.send(text_data=json.dumps({ "message": message, "user_nick": nick, diff --git a/frontend/src/components/EncryptedChat.js b/frontend/src/components/EncryptedChat.js index 057ea480..7c3c19b7 100644 --- a/frontend/src/components/EncryptedChat.js +++ b/frontend/src/components/EncryptedChat.js @@ -208,9 +208,9 @@ class Chat extends Component { } style={{backgroundColor: props.cardColor}} title={ - +
-
+
{props.message.userNick} {props.message.validSignature ? diff --git a/frontend/src/components/MakerPage.js b/frontend/src/components/MakerPage.js index 497adaf9..3615a4f1 100644 --- a/frontend/src/components/MakerPage.js +++ b/frontend/src/components/MakerPage.js @@ -86,6 +86,13 @@ class MakerPage extends Component { })); } + recalcBounds = () =>{ + this.setState({ + minAmount: this.state.amount ? parseFloat((this.state.amount/2).toPrecision(2)) : parseFloat(Number(this.state.limits[this.state.currency]['max_amount']*0.25).toPrecision(2)), + maxAmount: this.state.amount ? this.state.amount : parseFloat(Number(this.state.limits[this.state.currency]['max_amount']*0.75).toPrecision(2)), + }); + } + a11yProps(index) { return { id: `simple-tab-${index}`, @@ -321,9 +328,9 @@ class MakerPage extends Component { = this.getMaxAmount()) & this.state.amount != "" ? true : false} - helperText={this.state.amount <= this.getMinAmount() & this.state.amount != "" ? t("Too low") - : (this.state.amount >= this.getMaxAmount() & this.state.amount != "" ? t("Too high") : null)} + error={(this.state.amount < this.getMinAmount() || this.state.amount > this.getMaxAmount()) & this.state.amount != "" ? true : false} + helperText={this.state.amount < this.getMinAmount() & this.state.amount != "" ? t("Must be more than {{minAmount}}",{minAmount:this.getMinAmount()}) + : (this.state.amount > this.getMaxAmount() & this.state.amount != "" ? t("Must be less than {{maxAmount}}",{maxAmount:this.getMaxAmount()}) : null)} label={t("Amount")} type="number" required={true} @@ -546,7 +553,7 @@ class MakerPage extends Component { - this.setState({enableAmountRange:e.target.checked, is_explicit: false})}/> + this.setState({enableAmountRange:e.target.checked, is_explicit: false}) & this.recalcBounds()}/> {this.state.enableAmountRange & this.state.minAmount != null? this.rangeText() : t("Enable Amount Range")} diff --git a/frontend/src/components/TradeBox.js b/frontend/src/components/TradeBox.js index 4757b9ed..d162e9ff 100644 --- a/frontend/src/components/TradeBox.js +++ b/frontend/src/components/TradeBox.js @@ -132,8 +132,9 @@ class TradeBox extends Component { {t("The RoboSats staff will examine the statements and evidence provided. You need to build a complete case, as the staff cannot read the chat. It is best to provide a burner contact method with your statement. The satoshis in the trade escrow will be sent to the dispute winner, while the dispute loser will lose the bond.")} +
- {t("Make sure to EXPORT the chat log using the button. Staff might request your chat log in order to solve discrepancies. It is your responsibility to store it.")} + {t("Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.")} diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 9108a61b..73f1ba85 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -179,7 +179,7 @@ "Your last order #{{orderID}}":"Your last order #{{orderID}}", "Inactive order":"Inactive order", "You do not have previous orders":"You do not have previous orders", - "Join RoboSat's Subreddit":"Join RoboSat's Subreddit", + "Join RoboSats' Subreddit":"Join RoboSats' Subreddit", "RoboSats in Reddit":"RoboSats in Reddit", "ORDER PAGE - OrderPage.js": "Order details page", @@ -280,6 +280,8 @@ "Keys":"Keys", "Save messages as a JSON file":"Save messages as a JSON file", "Messages":"Messages", + "Verified signature by {{nickname}}":"Verified signature by {{nickname}}", + "Cannot verify signature of {{nickname}}":"Cannot verify signature of {{nickname}}", "CONTRACT BOX - TradeBox.js": "The Contract Box that guides users trough the whole trade pipeline", @@ -387,6 +389,7 @@ "The invoice provided has no explicit amount":"The invoice provided has no explicit amount", "Does not look like a valid lightning invoice":"Does not look like a valid lightning invoice", "The invoice provided has already expired":"The invoice provided has already expired", + "Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.":"Make sure to EXPORT the chat log. The staff might request your exported chat log JSON in order to solve discrepancies. It is your responsibility to store it.", "INFO DIALOG - InfoDiagog.js":"App information and clarifications and terms of use", diff --git a/frontend/src/locales/es.json b/frontend/src/locales/es.json index 89a6bbcd..e68d222f 100644 --- a/frontend/src/locales/es.json +++ b/frontend/src/locales/es.json @@ -280,6 +280,8 @@ "Keys":"Llaves", "Save messages as a JSON file":"Guardar mensajes como archivo JSON", "Messages":"Mensajes", + "Verified signature by {{nickname}}":"Firma de {{nickname}} verificada", + "Cannot verify signature of {{nickname}}":"No se pudo verificar la firma de {{nickname}}", "CONTRACT BOX - TradeBox.js": "The Contract Box that guides users trough the whole trade pipeline", "Contract Box": "Contrato", diff --git a/frontend/src/utils/pgp.js b/frontend/src/utils/pgp.js index 486548ac..21903da1 100644 --- a/frontend/src/utils/pgp.js +++ b/frontend/src/utils/pgp.js @@ -12,7 +12,7 @@ import { sha256 } from 'js-sha256'; // Generate KeyPair. Private Key is encrypted with the highEntropyToken export async function genKey(highEntropyToken) { - var d = new Date(); + const d = new Date(); const keyPair = await generateKey({ type: 'ecc', // Type of the key, defaults to ECC curve: 'curve25519', // ECC curve name, defaults to curve25519 @@ -35,10 +35,12 @@ export async function encryptMessage(plaintextMessage, ownPublicKeyArmored, peer passphrase }); + const d = new Date(); const encryptedMessage = await encrypt({ message: await createMessage({ text: plaintextMessage }), // input as Message object, message must be string encryptionKeys: [ ownPublicKey, peerPublicKey ], - signingKeys: privateKey // optional + signingKeys: privateKey, // optional + date: d.setDate(d.getDate()-1) // One day of offset, avoids verification issue due to clock mismatch }); return encryptedMessage; // '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----' @@ -61,7 +63,7 @@ export async function decryptMessage(encryptedMessage, publicKeyArmored, private verificationKeys: publicKey, // optional decryptionKeys: privateKey }); - + // check signature validity (signed messages only) try { await signatures[0].verified; // throws on invalid signature