From e783dea3059bd9af90c0d9561eb0f762276252f5 Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi <90936742+Reckless-Satoshi@users.noreply.github.com> Date: Sun, 9 Apr 2023 18:48:25 +0000 Subject: [PATCH] Fixes "no robot", add launchers on Android. (#411) * Update robohash repo url to RoboSats org * Add external launchers * Fix no-robot issue due to timing of initial fetchInfo * Collect new phrases --- .../src/components/Dialogs/EnableTelegram.tsx | 64 +++++++++++++------ frontend/src/components/Dialogs/Profile.tsx | 6 -- .../TradeBox/Prompts/LockInvoice.tsx | 13 +++- frontend/src/contexts/AppContext.tsx | 4 +- frontend/static/locales/ca.json | 1 + frontend/static/locales/cs.json | 1 + frontend/static/locales/de.json | 1 + frontend/static/locales/en.json | 1 + frontend/static/locales/es.json | 1 + frontend/static/locales/eu.json | 1 + frontend/static/locales/fr.json | 1 + frontend/static/locales/it.json | 1 + frontend/static/locales/pl.json | 1 + frontend/static/locales/pt.json | 1 + frontend/static/locales/ru.json | 1 + frontend/static/locales/sv.json | 1 + frontend/static/locales/th.json | 1 + frontend/static/locales/zh-SI.json | 1 + frontend/static/locales/zh-TR.json | 1 + requirements.txt | 2 +- 20 files changed, 73 insertions(+), 31 deletions(-) diff --git a/frontend/src/components/Dialogs/EnableTelegram.tsx b/frontend/src/components/Dialogs/EnableTelegram.tsx index d9525a23..ed7b6179 100644 --- a/frontend/src/components/Dialogs/EnableTelegram.tsx +++ b/frontend/src/components/Dialogs/EnableTelegram.tsx @@ -3,32 +3,37 @@ import { useTranslation } from 'react-i18next'; import { useTheme } from '@mui/material/styles'; import QRCode from 'react-qr-code'; import { + Box, Dialog, DialogTitle, DialogActions, DialogContent, DialogContentText, Button, + Grid, } from '@mui/material'; +import { NewTabIcon } from '../Icons'; interface Props { open: boolean; onClose: () => void; tgBotName: string; tgToken: string; - onClickEnable: () => void; } -const EnableTelegramDialog = ({ - open, - onClose, - tgBotName, - tgToken, - onClickEnable, -}: Props): JSX.Element => { +const EnableTelegramDialog = ({ open, onClose, tgBotName, tgToken }: Props): JSX.Element => { const { t } = useTranslation(); const theme = useTheme(); + const handleClickOpenBrowser = () => { + window.open(`https://t.me/${tgBotName}?start=${tgToken}`, '_blank').focus(); + setOpenEnableTelegram(false); + }; + + const handleOpenTG = () => { + window.open(`tg://resolve?domain=${tgBotName}&start=${tgToken}`); + }; + return ( {t('Enable TG Notifications')} -
- + + + {t( 'You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.', @@ -54,10 +79,11 @@ const EnableTelegramDialog = ({ - +
); diff --git a/frontend/src/components/Dialogs/Profile.tsx b/frontend/src/components/Dialogs/Profile.tsx index affb4a9a..614da4bd 100644 --- a/frontend/src/components/Dialogs/Profile.tsx +++ b/frontend/src/components/Dialogs/Profile.tsx @@ -117,11 +117,6 @@ const ProfileDialog = ({ e.preventDefault(); }; - const handleClickEnableTelegram = () => { - window.open('https://t.me/' + robot.tgBotName + '?start=' + robot.tgToken, '_blank').focus(); - setOpenEnableTelegram(false); - }; - const setStealthInvoice = (wantsStealth: boolean) => { apiClient .put(baseUrl, '/api/stealth/', { wantsStealth }) @@ -238,7 +233,6 @@ const ProfileDialog = ({ onClose={() => setOpenEnableTelegram(false)} tgBotName={robot.tgBotName} tgToken={robot.tgToken} - onClickEnable={handleClickEnableTelegram} /> diff --git a/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx b/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx index 374173ef..d0fbc468 100644 --- a/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx +++ b/frontend/src/components/TradeBox/Prompts/LockInvoice.tsx @@ -48,6 +48,10 @@ export const LockInvoicePrompt = ({ order, concept }: LockInvoicePromptProps): J ); }; + const handleClickQR = () => { + window.open(`lightning:${invoice}`); + }; + return ( { - systemClient.copyToClipboard(invoice); - }} + onClick={handleClickQR} /> diff --git a/frontend/src/contexts/AppContext.tsx b/frontend/src/contexts/AppContext.tsx index 85504a73..21c85353 100644 --- a/frontend/src/contexts/AppContext.tsx +++ b/frontend/src/contexts/AppContext.tsx @@ -335,11 +335,11 @@ export const AppContextProvider = ({ useEffect(() => { if (open.stats || open.coordinator || info.coordinatorVersion == 'v?.?.?') { - if (window.NativeRobosats === undefined || torStatus == '"Done"') { + if (window.NativeRobosats === undefined) { fetchInfo(); } } - }, [open.stats, open.coordinator, torStatus]); + }, [open.stats, open.coordinator]); useEffect(() => { // Sets Setting network from coordinator API param if accessing via web diff --git a/frontend/static/locales/ca.json b/frontend/static/locales/ca.json index 4c798868..82e51d0e 100644 --- a/frontend/static/locales/ca.json +++ b/frontend/static/locales/ca.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Activar Notificacions TG", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "Seràs dut a un xat amb el bot de Telegram de Robosats. Simplement prem Començar. Tingues en compte que si actives les notificaciones de Telegram reduiràs el teu anonimat.", + "Browser": "Browser", "Enable": "Activar", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Resum del coordinador", diff --git a/frontend/static/locales/cs.json b/frontend/static/locales/cs.json index e630e128..02b8c15b 100644 --- a/frontend/static/locales/cs.json +++ b/frontend/static/locales/cs.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Povolit TG notifikace", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "Budeš přesměrován do chatu s RoboSats telegram botem. Jednoduše otevři chat a zmáčkni Start. Měj na paměti, že povolením telegram notifikací máš nížší úroveň anonymity.", + "Browser": "Browser", "Enable": "Povolit", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/de.json b/frontend/static/locales/de.json index cda5c09b..93f60b7b 100644 --- a/frontend/static/locales/de.json +++ b/frontend/static/locales/de.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Aktiviere TG-Benachrichtigungen", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "Du wirst zu einem Chat mit dem RoboSats-Telegram-Bot weitergeleitet. Öffne einfach den Chat und drücke auf Start. Beachte, dass du deine Anonymität verringern könntest, wenn du Telegram-Benachrichtigungen aktivierst.", + "Browser": "Browser", "Enable": "Aktivieren", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/en.json b/frontend/static/locales/en.json index a6d0771f..d5e8c202 100644 --- a/frontend/static/locales/en.json +++ b/frontend/static/locales/en.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Enable TG Notifications", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.", + "Browser": "Browser", "Enable": "Enable", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/es.json b/frontend/static/locales/es.json index d9c81530..a997878d 100644 --- a/frontend/static/locales/es.json +++ b/frontend/static/locales/es.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Activar Notificaciones TG", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "Se abrirá un chat con el bot de Telegram de RoboSats. Simplemente pulsa en Empezar. Ten en cuenta que si activas las notificaciones de Telegram reducirás tu nivel de anonimato.", + "Browser": "Browser", "Enable": "Activar", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Resumen del coordinador", diff --git a/frontend/static/locales/eu.json b/frontend/static/locales/eu.json index 400fc798..234f7b77 100644 --- a/frontend/static/locales/eu.json +++ b/frontend/static/locales/eu.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Baimendu TG Jakinarazpenak", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "RoboSats telegrama botarekin hitz egingo duzu. Zabaldu berriketa eta sakatu Start. Telegrama bidez anonimotasun maila jaitsi zenezake.", + "Browser": "Browser", "Enable": "Baimendu", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/fr.json b/frontend/static/locales/fr.json index 317b2786..3043edbb 100644 --- a/frontend/static/locales/fr.json +++ b/frontend/static/locales/fr.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Activer notifications TG", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "Vous serez redirigé vers une conversation avec le robot telegram RoboSats. Il suffit d'ouvrir le chat et d'appuyer sur Start. Notez qu'en activant les notifications Telegram, vous risquez de réduire votre niveau d'anonymat.", + "Browser": "Browser", "Enable": "Activer", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/it.json b/frontend/static/locales/it.json index e6291a01..aca44249 100644 --- a/frontend/static/locales/it.json +++ b/frontend/static/locales/it.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Attiva notifiche TG", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "Sarai introdotto in conversazione con il bot RoboSats su telegram. Apri semplicemente la chat e premi Start. Considera che attivando le notifiche telegram potresti ridurre il tuo livello di anonimità.", + "Browser": "Browser", "Enable": "Attiva", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/pl.json b/frontend/static/locales/pl.json index bea3092d..d0cbf1da 100644 --- a/frontend/static/locales/pl.json +++ b/frontend/static/locales/pl.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Włącz powiadomienia TG", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "Zostaniesz przeniesiony do rozmowy z botem telegramowym RoboSats. Po prostu otwórz czat i naciśnij Start. Pamiętaj, że włączenie powiadomień telegramów może obniżyć poziom anonimowości.", + "Browser": "Browser", "Enable": "Włączyć", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/pt.json b/frontend/static/locales/pt.json index a115a390..1534362e 100644 --- a/frontend/static/locales/pt.json +++ b/frontend/static/locales/pt.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Habilitar notificações do TG", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "Você será levado a uma conversa com o bot do Telegram RoboSats. Basta abrir o bate-papo e pressionar Iniciar. Observe que, ao ativar as notificações de Telegram, você pode diminuir seu nível de anonimato.", + "Browser": "Browser", "Enable": "Ativar", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/ru.json b/frontend/static/locales/ru.json index 8949e0b0..bb951d01 100644 --- a/frontend/static/locales/ru.json +++ b/frontend/static/locales/ru.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Включить уведомления TG", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "Вы перейдёте к разговору с Telegram ботом RoboSats. Просто откройте чат и нажмите Старт. Обратите внимание, что включив уведомления Telegram, Вы можете снизить уровень анонимности.", + "Browser": "Browser", "Enable": "Включить", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/sv.json b/frontend/static/locales/sv.json index 19422935..cdb3f90c 100644 --- a/frontend/static/locales/sv.json +++ b/frontend/static/locales/sv.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "Aktivera TG-notifikationer", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "Du kommer att skickas till en konversation med RoboSats Telegram-bot. Öppna chatten och tryck Start. Notera att genom att aktivera Telegram-notiser så försämrar du möjligen din anonymitet.", + "Browser": "Browser", "Enable": "Aktivera", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/th.json b/frontend/static/locales/th.json index c8ba820e..949ddf08 100644 --- a/frontend/static/locales/th.json +++ b/frontend/static/locales/th.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "ใช้การแจ้งเตือน Telegram", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "คุณจะเข้าไปยังแชทกับ telegram bot ของ RoboSats ให้คุณกด Start อย่างไรก็ตาม การใช้การแจ้งเตือน telegram จะลดระดับการปกปิดตัวตนของคุณ", + "Browser": "Browser", "Enable": "เปิดใช้งาน", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/zh-SI.json b/frontend/static/locales/zh-SI.json index a53e0c5e..60d660e4 100644 --- a/frontend/static/locales/zh-SI.json +++ b/frontend/static/locales/zh-SI.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "开启 TG 通知", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "你将被带到 RoboSats Telegram Bot 的对话中。只需打开聊天并按开始。请注意,通过开启 Telegram 通知,你可能会降低匿名程度。", + "Browser": "Browser", "Enable": "开启", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/frontend/static/locales/zh-TR.json b/frontend/static/locales/zh-TR.json index a20b9703..11cb9393 100644 --- a/frontend/static/locales/zh-TR.json +++ b/frontend/static/locales/zh-TR.json @@ -144,6 +144,7 @@ "#23": "Phrases in components/Dialogs/EnableTelegram.tsx", "Enable TG Notifications": "開啟 TG 通知", "You will be taken to a conversation with RoboSats telegram bot. Simply open the chat and press Start. Note that by enabling telegram notifications you might lower your level of anonymity.": "你將被帶到與 RoboSats Telegram Bot 的對話中。只需打開聊天並按開始。請注意,通過啟用 Telegram 通知,你可能會降低匿名程度。", + "Browser": "Browser", "Enable": "開啟", "#24": "Phrases in components/Dialogs/CoordinatorSummary.tsx", "Coordinator Summary": "Coordinator Summary", diff --git a/requirements.txt b/requirements.txt index 97d7e3d3..e15dca38 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,7 +18,7 @@ Pillow==9.3.0 python-decouple==3.5 requests==2.22.0 ring==0.9.1 -git+https://github.com/Reckless-Satoshi/Robohash.git +git+https://github.com/RoboSats/Robohash.git scipy==1.8.0 gunicorn==20.1.0 psycopg2==2.9.5