Skip to content

Commit 272413f

Browse files
authored
Merge pull request #1894 from RoboSats/pre-release-fixes
v0.7.7 pre release fixes
2 parents 7fdf7e9 + 5042900 commit 272413f

File tree

13 files changed

+78
-52
lines changed

13 files changed

+78
-52
lines changed

frontend/src/components/Dialogs/Coordinator.tsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -525,29 +525,31 @@ const CoordinatorDialog = ({ open = false, onClose, shortAlias }: Props): JSX.El
525525
/>
526526
</ListItem>
527527

528-
<ListItemButton
529-
target='_blank'
530-
href={coordinator?.[settings.network][settings.selfhostedClient ? 'onion' : origin]}
531-
rel='noreferrer'
532-
>
533-
<ListItemIcon>
534-
<Web />
535-
</ListItemIcon>
536-
<ListItemText
537-
secondary={t('Coordinator hosted web app')}
538-
primaryTypographyProps={{
539-
style: {
540-
maxWidth: '20em',
541-
wordWrap: 'break-word',
542-
overflowWrap: 'break-word',
543-
},
544-
}}
528+
{coordinator?.[settings.network] && (
529+
<ListItemButton
530+
target='_blank'
531+
href={coordinator[settings.network][settings.selfhostedClient ? 'onion' : origin]}
532+
rel='noreferrer'
545533
>
546-
{`${String(
547-
coordinator?.[settings.network][settings.selfhostedClient ? 'onion' : origin],
548-
)}`}
549-
</ListItemText>
550-
</ListItemButton>
534+
<ListItemIcon>
535+
<Web />
536+
</ListItemIcon>
537+
<ListItemText
538+
secondary={t('Coordinator hosted web app')}
539+
primaryTypographyProps={{
540+
style: {
541+
maxWidth: '20em',
542+
wordWrap: 'break-word',
543+
overflowWrap: 'break-word',
544+
},
545+
}}
546+
>
547+
{`${String(
548+
coordinator?.[settings.network][settings.selfhostedClient ? 'onion' : origin],
549+
)}`}
550+
</ListItemText>
551+
</ListItemButton>
552+
)}
551553
</List>
552554

553555
{!coordinator || coordinator?.loadingInfo ? (

frontend/src/components/TradeBox/CancelButton.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const CancelButton = ({
2727
Boolean(order?.is_maker && [0, 1, 2].includes(order?.status)) ||
2828
Boolean([3, 6, 7].includes(order?.status ?? -1));
2929
const showCollabCancelButton = order?.status === 9 && !order?.asked_for_cancel;
30+
const unTaken = Boolean(order?.is_maker && [1, 2].includes(order?.status));
3031
const noConfirmation =
3132
Boolean(order?.is_maker && [0, 1, 2].includes(order?.status)) ||
3233
Boolean(order?.is_taker && order?.status === 3);
@@ -55,7 +56,9 @@ const CancelButton = ({
5556
? () => {
5657
setOpenCancelWarning(true);
5758
}
58-
: openCancelDialog
59+
: unTaken
60+
? onClickCancel
61+
: openCancelDialog
5962
}
6063
>
6164
{t('Cancel')}

frontend/src/models/Coordinator.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class Coordinator {
180180
this.url = hostUrl;
181181
this.basePath = `/${settings.network}/${this.shortAlias}`;
182182
} else {
183-
this.url = String(this[settings.network][origin]);
183+
this.url = String(this[settings.network]?.[origin]);
184184
this.basePath = '';
185185
}
186186
};

frontend/src/models/Order.model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ class Order {
202202
if (slot) {
203203
const coordinator = federation.getCoordinator(this.shortAlias);
204204
const { basePath, url } = coordinator;
205+
const authHeaders = slot.getRobot()?.getAuthHeaders();
206+
if (!authHeaders) return this;
205207
const data = await apiClient
206-
.post(url + basePath, '/api/make/', body, {
207-
tokenSHA256: slot?.getRobot()?.tokenSHA256 ?? '',
208-
})
208+
.post(url + basePath, '/api/make/', body, authHeaders)
209209
.catch((e) => {
210210
console.log(e);
211211
});

frontend/src/models/Robot.model.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ class Robot {
5757
await apiClient
5858
.get(coordinator.url, `${coordinator.basePath}/api/robot/`, authHeaders)
5959
.then((data: any) => {
60+
if (data?.bad_request) {
61+
console.error(data?.bad_request);
62+
return;
63+
}
64+
6065
this.update({
6166
nickname: data.nickname,
6267
activeOrderId: data.active_order_id ?? null,

frontend/src/services/RoboPool/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class RoboPool {
1616
this.relays = [];
1717
const federationRelays = Object.values(defaultFederation)
1818
.map((coord) => {
19-
const url: string = coord[this.network][settings.selfhostedClient ? 'onion' : origin];
19+
const url: string = coord[this.network]?.[settings.selfhostedClient ? 'onion' : origin];
2020

2121
if (!url) return undefined;
2222

frontend/src/utils/nostr.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ export const verifyCoordinatorToken: (event: Event) => boolean = (event) => {
114114
const hash = `${event.pubkey}${orderId ?? ''}`;
115115
const coordinatorPubKey = event.tags.find((t) => t[0] === 'p')?.[1];
116116
if (signature && coordinatorPubKey) {
117-
return schnorr.verify(signature, hash, coordinatorPubKey);
117+
try {
118+
return schnorr.verify(signature, hash, coordinatorPubKey);
119+
} catch (e) {
120+
return false;
121+
}
118122
}
119123
return false;
120124
};

frontend/static/locales/fr.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@
479479
"The order has expired": "L'ordre a expiré",
480480
"The pinned location is approximate. The exact location for the meeting place must be exchanged in the encrypted chat.": "The pinned location is approximate. The exact location for the meeting place must be exchanged in the encrypted chat.",
481481
"You cannot take an order yet! Wait {{timeMin}}m {{timeSec}}s": "Vous ne pouvez pas encore prendre un ordre! Attendez {{timeMin}}m {{timeSec}}s",
482-
"You receive via {{method}} {{amount}}": "Vous recevez via {{méthode}} {{montant}}",
482+
"You receive via {{method}} {{amount}}": "Vous recevez via {{method}} {{amount}}",
483483
"You receive {{amount}} Sats (Approx)": "Vous recevez via Lightning {{amount}} Sats (environ)",
484484
"You send via Lightning {{amount}} Sats (Approx)": "Vous envoyez via Lightning {{amount}} Sats (environ)",
485485
"You send via {{method}} {{amount}}": "Vous envoyez via {{method}} {{amount}}",
@@ -570,10 +570,10 @@
570570
"#56": "Phrases in components/TradeBox/Dialogs/ConfirmFiatReceived.tsx",
571571
"Confirm": "Confirmer",
572572
"Confirm you received {{amount}} {{currencyCode}}?": "Confirmez que vous avez reçu les {{amount}} {{currencyCode}}?",
573-
"Confirming that you received {{amount}} {{currencyCode}} will finalize the trade. The satoshis in the escrow will be released to the buyer. Only confirm after {{amount}} {{currencyCode}} have arrived to your account. Note that if you have received the payment and do not click confirm, you risk losing your bond.": "Confirmer que vous avez reçu {{montant}} {{currencyCode}} finalisera la transaction. Les satoshis en caution seront remis à l'acheteur. Ne confirmez qu'une fois que {{montant}} {{currencyCode}} sont arrivés sur votre compte. Notez que si vous avez reçu le paiement et que vous ne cliquez pas sur confirmer, vous risquez de perdre votre caution.",
573+
"Confirming that you received {{amount}} {{currencyCode}} will finalize the trade. The satoshis in the escrow will be released to the buyer. Only confirm after {{amount}} {{currencyCode}} have arrived to your account. Note that if you have received the payment and do not click confirm, you risk losing your bond.": "Confirmer que vous avez reçu {{amount}} {{currencyCode}} finalisera la transaction. Les satoshis en caution seront remis à l'acheteur. Ne confirmez qu'une fois que {{amount}} {{currencyCode}} sont arrivés sur votre compte. Notez que si vous avez reçu le paiement et que vous ne cliquez pas sur confirmer, vous risquez de perdre votre caution.",
574574
"#57": "Phrases in components/TradeBox/Dialogs/ConfirmFiatSent.tsx",
575575
"Confirm you sent {{amount}} {{currencyCode}}?": "Confirmez votre envoi {{amount}} {{currencyCode}}?",
576-
"Confirming that you sent {{amount}} {{currencyCode}} will allow your peer to finalize the trade. If you have not yet sent it and you still proceed to falsely confirm, you risk losing your bond.": "Confirmer que vous avez envoyé {{montant}} {{currencyCode}} permettra à votre correspondant de finaliser la transaction. Si vous ne l'avez pas encore envoyé et que vous procédez à une fausse confirmation, vous risquez de perdre votre caution.",
576+
"Confirming that you sent {{amount}} {{currencyCode}} will allow your peer to finalize the trade. If you have not yet sent it and you still proceed to falsely confirm, you risk losing your bond.": "Confirmer que vous avez envoyé {{amount}} {{currencyCode}} permettra à votre correspondant de finaliser la transaction. Si vous ne l'avez pas encore envoyé et que vous procédez à une fausse confirmation, vous risquez de perdre votre caution.",
577577
"#58": "Phrases in components/TradeBox/Dialogs/ConfirmUndoFiatSent.tsx",
578578
"READ. In case your payment to the seller has been blocked and it is absolutely impossible to finish the trade, you can revert your confirmation of \"Fiat sent\". Do so only if you and the seller have ALREADY AGREED in the chat to proceed to a collaborative cancellation. After confirming, the \"Collaborative cancel\" button will be visible again. Only click this button if you know what you are doing. First time users of RoboSats are highly discouraged from performing this action! Make 100% sure your payment has failed and the amount is in your account.": "LIRE. Si votre paiement au vendeur a été bloqué et qu'il est absolument impossible de terminer la transaction, vous pouvez annuler votre confirmation de vente de \"Fiat envoyé\". Ne le faites que si vous et le vendeur avez DÉJÀ ACCORDÉ dans le chat de procéder à une annulation collaborative. Après avoir confirmé, le bouton \"Annulation collaborative\" sera à nouveau visible. Ne cliquez sur ce bouton que si vous savez ce que vous faites. Il est fortement déconseillé aux nouveaux utilisateurs de RoboSats d'effectuer cette action ! Assurez-vous à 100 % que votre paiement a échoué et que le montant est sur votre compte.",
579579
"Revert the confirmation of fiat sent?": "Revenir sur la confirmation de l'envoi fiat ?",

frontend/static/locales/it.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,10 @@
570570
"#56": "Phrases in components/TradeBox/Dialogs/ConfirmFiatReceived.tsx",
571571
"Confirm": "Conferma",
572572
"Confirm you received {{amount}} {{currencyCode}}?": "Confermi la ricezione di {{amount}} {{currencyCode}}?",
573-
"Confirming that you received {{amount}} {{currencyCode}} will finalize the trade. The satoshis in the escrow will be released to the buyer. Only confirm after {{amount}} {{currencyCode}} have arrived to your account. Note that if you have received the payment and do not click confirm, you risk losing your bond.": "Confermando di aver ricevuto {{importo}} {{currencyCode}} concluderai lo scambio. I satoshi in deposito saranno rilasciati all'acquirente. Conferma solo dopo che {{amount}} {{valutaCodice}} sono arrivati sul tuo conto. Si noti che se si riceve il pagamento e non si clicca su conferma, si rischia di perdere la propria cauzione.",
573+
"Confirming that you received {{amount}} {{currencyCode}} will finalize the trade. The satoshis in the escrow will be released to the buyer. Only confirm after {{amount}} {{currencyCode}} have arrived to your account. Note that if you have received the payment and do not click confirm, you risk losing your bond.": "Confermando di aver ricevuto {{amount}} {{currencyCode}} concluderai lo scambio. I satoshi in deposito saranno rilasciati all'acquirente. Conferma solo dopo che {{amount}} {{valutaCodice}} sono arrivati sul tuo conto. Si noti che se si riceve il pagamento e non si clicca su conferma, si rischia di perdere la propria cauzione.",
574574
"#57": "Phrases in components/TradeBox/Dialogs/ConfirmFiatSent.tsx",
575575
"Confirm you sent {{amount}} {{currencyCode}}?": "Confermi di aver inviato {{amount}} {{currencyCode}}?",
576-
"Confirming that you sent {{amount}} {{currencyCode}} will allow your peer to finalize the trade. If you have not yet sent it and you still proceed to falsely confirm, you risk losing your bond.": "Confermando di aver inviato {{importo}} {{currencyCode}} consentirai al tuo pari di finalizzare la transazione. Se non lo si è ancora inviato e si procede comunque a una falsa conferma, si rischia di perdere la propria cauzione.",
576+
"Confirming that you sent {{amount}} {{currencyCode}} will allow your peer to finalize the trade. If you have not yet sent it and you still proceed to falsely confirm, you risk losing your bond.": "Confermando di aver inviato {{amount}} {{currencyCode}} consentirai al tuo pari di finalizzare la transazione. Se non lo si è ancora inviato e si procede comunque a una falsa conferma, si rischia di perdere la propria cauzione.",
577577
"#58": "Phrases in components/TradeBox/Dialogs/ConfirmUndoFiatSent.tsx",
578578
"READ. In case your payment to the seller has been blocked and it is absolutely impossible to finish the trade, you can revert your confirmation of \"Fiat sent\". Do so only if you and the seller have ALREADY AGREED in the chat to proceed to a collaborative cancellation. After confirming, the \"Collaborative cancel\" button will be visible again. Only click this button if you know what you are doing. First time users of RoboSats are highly discouraged from performing this action! Make 100% sure your payment has failed and the amount is in your account.": "LEGGERE. Nel caso in cui il pagamento al venditore sia stato bloccato e sia assolutamente impossibile concludere la compravendita, puoi annullare la tua conferma di \"Fiat inviate\". Questo solo se tu e il venditore avete già concordato in chat di procedere a un annullamento collaborativo. Dopo la conferma, il pulsante \"Annullamento collaborativo\" sarà nuovamente visibile. Fare clic su questo pulsante solo se si sa cosa si sta facendo. Agli utenti che utilizzano RoboSats per la prima volta è caldamente sconsigliato eseguire questa azione! Assicurarsi al 100% che il pagamento non sia andato a buon fine e che l'importo sia presente nel conto.",
579579
"Revert the confirmation of fiat sent?": "Annullare la conferma dell'invio di fiat?",

mobile/android/app/src/main/java/com/robosats/NotificationsService.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public void checkNotifications() {
141141

142142
while (it.hasNext()) {
143143
String robotToken = it.next();
144+
Log.d("NotificationsService", "Checking Slot");
144145
JSONObject slot = (JSONObject) slots.get(robotToken);
145146
JSONObject robots = slot.getJSONObject("robots");
146147
JSONObject coordinatorRobot;
@@ -187,9 +188,25 @@ private void fetchNotifications(JSONObject robot, String coordinator) throws JSO
187188

188189
OkHttpClient client = builder.build();
189190
Request.Builder requestBuilder = new Request.Builder().url(url);
190-
191+
String header = String.format("Token %s", token);
192+
try {
193+
String pubKey = robot.getString("pubKey");
194+
String parsedPubKey = String.join("\\", pubKey.split("\n"));
195+
String encPrivKey = robot.getString("encPrivKey");
196+
String parsedEncPrivKey = String.join("\\", encPrivKey.split("\n"));
197+
header += String.format(" | Public %s | Private %s", parsedPubKey, parsedEncPrivKey);
198+
} catch (JSONException e) {
199+
Log.e("NotificationsService", "Error obtaining PGP keys");
200+
return;
201+
}
202+
try {
203+
String nostrPubKey = robot.getString("nostrPubKey");
204+
header += String.format(" | Nostr %s", nostrPubKey);
205+
} catch (JSONException e) {
206+
Log.d("NotificationsService", "Nostr key not found");
207+
}
191208
requestBuilder
192-
.addHeader("Authorization", "Token " + token);
209+
.addHeader("Authorization", header);
193210

194211
requestBuilder.get();
195212
Request request = requestBuilder.build();

0 commit comments

Comments
 (0)