diff --git a/api/management/commands/telegram_watcher.py b/api/management/commands/telegram_watcher.py index 44ce5c69..d626b756 100644 --- a/api/management/commands/telegram_watcher.py +++ b/api/management/commands/telegram_watcher.py @@ -50,16 +50,16 @@ class Command(BaseCommand): parts = message.split(" ") if len(parts) < 2: self.notifications.send_telegram_message( - chat_id=result["message"]["from"]["id"], - text='You must enable the notifications bot using the RoboSats client. Click on your "Robot robot" -> "Enable Telegram" and follow the link or scan the QR code.', + result["message"]["from"]["id"], + 'You must enable the notifications bot using the RoboSats client. Click on your "Robot robot" -> "Enable Telegram" and follow the link or scan the QR code.', ) continue token = parts[-1] robot = Robot.objects.filter(telegram_token=token).first() if not robot: self.notifications.send_telegram_message( - chat_id=result["message"]["from"]["id"], - text=f'Wops, invalid token! There is no Robot with telegram chat token "{token}"', + result["message"]["from"]["id"], + f'Wops, invalid token! There is no Robot with telegram chat token "{token}"', ) continue diff --git a/api/notifications.py b/api/notifications.py index 7adc9f60..57ec4a42 100644 --- a/api/notifications.py +++ b/api/notifications.py @@ -37,13 +37,13 @@ class Notifications: if robot.telegram_enabled: self.send_telegram_message(robot.telegram_chat_id, title, description) - def save_message(self, order, robot, title, description): + def save_message(self, order, robot, title, description=""): """Save a message for a user""" Notification.objects.create( title=title, description=description, robot=robot, order=order ) - def send_telegram_message(self, chat_id, title, description): + def send_telegram_message(self, chat_id, title, description=""): """sends a message to a user with telegram notifications enabled""" bot_token = config("TELEGRAM_TOKEN") diff --git a/api/utils.py b/api/utils.py index 66658db2..10f938c1 100644 --- a/api/utils.py +++ b/api/utils.py @@ -141,7 +141,7 @@ def get_devfund_pubkey(network: str) -> str: """ session = get_session() - url = "https://raw.githubusercontent.com/RoboSats/robosats/main/devfund_pubey.json" + url = "https://raw.githubusercontent.com/RoboSats/robosats/main/devfund_pubkey.json" try: response = session.get(url) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 652da827..1251e685 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -23,11 +23,11 @@ "@nivo/core": "^0.86.0", "@nivo/line": "^0.86.0", "base-ex": "^0.8.1", - "country-flag-icons": "^1.5.11", + "country-flag-icons": "^1.5.13", "date-fns": "^2.30.0", "file-replace-loader": "^1.4.0", "i18next": "^23.2.11", - "i18next-browser-languagedetector": "^7.2.1", + "i18next-browser-languagedetector": "^8.0.0", "i18next-http-backend": "^2.5.0", "install": "^0.13.0", "js-sha256": "^0.11.0", @@ -81,7 +81,7 @@ "jest": "^29.6.1", "prettier": "^3.3.2", "ts-node": "^10.9.2", - "typescript": "^5.4.2", + "typescript": "^5.5.4", "webpack": "^5.89.0", "webpack-cli": "^5.1.4" } @@ -6411,9 +6411,9 @@ } }, "node_modules/country-flag-icons": { - "version": "1.5.11", - "resolved": "https://registry.npmjs.org/country-flag-icons/-/country-flag-icons-1.5.11.tgz", - "integrity": "sha512-B+mvFywunkRJs270k7kCBjhogvIA0uNn6GAXv6m2cPn3rrwqZzZVr2gBWcz+Cz7OGVWlcbERlYRIX0S6OGr8Bw==" + "version": "1.5.13", + "resolved": "https://registry.npmjs.org/country-flag-icons/-/country-flag-icons-1.5.13.tgz", + "integrity": "sha512-4JwHNqaKZ19doQoNcBjsoYA+I7NqCH/mC/6f5cBWvdKzcK5TMmzLpq3Z/syVHMHJuDGFwJ+rPpGizvrqJybJow==" }, "node_modules/create-require": { "version": "1.1.1", @@ -8823,9 +8823,9 @@ } }, "node_modules/i18next-browser-languagedetector": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.2.1.tgz", - "integrity": "sha512-h/pM34bcH6tbz8WgGXcmWauNpQupCGr25XPp9cZwZInR9XHSjIFDYp1SIok7zSPsTOMxdvuLyu86V+g2Kycnfw==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-8.0.0.tgz", + "integrity": "sha512-zhXdJXTTCoG39QsrOCiOabnWj2jecouOqbchu3EfhtSHxIB5Uugnm9JaizenOy39h7ne3+fLikIjeW88+rgszw==", "dependencies": { "@babel/runtime": "^7.23.2" } @@ -16730,9 +16730,9 @@ } }, "node_modules/typescript": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", - "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true, "bin": { "tsc": "bin/tsc", diff --git a/frontend/package.json b/frontend/package.json index eafc7cac..f9241d02 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -43,7 +43,7 @@ "jest": "^29.6.1", "prettier": "^3.3.2", "ts-node": "^10.9.2", - "typescript": "^5.4.2", + "typescript": "^5.5.4", "webpack": "^5.89.0", "webpack-cli": "^5.1.4" }, @@ -62,11 +62,11 @@ "@nivo/core": "^0.86.0", "@nivo/line": "^0.86.0", "base-ex": "^0.8.1", - "country-flag-icons": "^1.5.11", + "country-flag-icons": "^1.5.13", "date-fns": "^2.30.0", "file-replace-loader": "^1.4.0", "i18next": "^23.2.11", - "i18next-browser-languagedetector": "^7.2.1", + "i18next-browser-languagedetector": "^8.0.0", "i18next-http-backend": "^2.5.0", "install": "^0.13.0", "js-sha256": "^0.11.0", diff --git a/frontend/src/basic/OrderPage/index.tsx b/frontend/src/basic/OrderPage/index.tsx index 20f8adf4..aa2f3e74 100644 --- a/frontend/src/basic/OrderPage/index.tsx +++ b/frontend/src/basic/OrderPage/index.tsx @@ -40,14 +40,14 @@ const OrderPage = (): JSX.Element => { const shortAlias = params.shortAlias; const coordinator = federation.getCoordinator(shortAlias ?? ''); if (coordinator) { - const { url, basePath } = coordinator?.getEndpoint( + const endpoint = coordinator?.getEndpoint( settings.network, origin, settings.selfhostedClient, hostUrl, ); - setBaseUrl(`${url}${basePath}`); + if (endpoint) setBaseUrl(`${endpoint?.url}${endpoint?.basePath}`); const orderId = Number(params.orderId); if ( diff --git a/frontend/src/basic/RobotPage/RobotProfile.tsx b/frontend/src/basic/RobotPage/RobotProfile.tsx index 55bd5fe7..4095d41a 100644 --- a/frontend/src/basic/RobotPage/RobotProfile.tsx +++ b/frontend/src/basic/RobotPage/RobotProfile.tsx @@ -156,7 +156,7 @@ const RobotProfile = ({ )} - {loadingCoordinators > 0 && !Boolean(robot?.activeOrderId) ? ( + {loadingCoordinators > 0 && !robot?.activeOrderId ? ( {t('Looking for orders!')} @@ -210,9 +210,9 @@ const RobotProfile = ({ ) : null} - {!Boolean(robot?.activeOrderId) && + {!robot?.activeOrderId && slot?.hashId && - !Boolean(robot?.lastOrderId) && + !robot?.lastOrderId && loadingCoordinators === 0 ? ( {t('No existing orders found')} ) : null} diff --git a/frontend/src/basic/SettingsPage/index.tsx b/frontend/src/basic/SettingsPage/index.tsx index e54d1c07..a47360e5 100644 --- a/frontend/src/basic/SettingsPage/index.tsx +++ b/frontend/src/basic/SettingsPage/index.tsx @@ -4,7 +4,7 @@ import SettingsForm from '../../components/SettingsForm'; import { AppContext, type UseAppStoreType } from '../../contexts/AppContext'; import FederationTable from '../../components/FederationTable'; import { t } from 'i18next'; -import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext'; +import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext'; const SettingsPage = (): JSX.Element => { const { windowSize, navbarHeight } = useContext(AppContext); @@ -16,7 +16,7 @@ const SettingsPage = (): JSX.Element => { // Regular expression to match a valid .onion URL const onionUrlPattern = /^((http|https):\/\/)?[a-zA-Z2-7]{16,56}\.onion$/; - const addCoordinator = () => { + const addCoordinator: () => void = () => { if (federation.coordinators[newAlias]) { setError(t('Alias already exists')); } else { @@ -65,7 +65,9 @@ const SettingsPage = (): JSX.Element => { variant='outlined' size='small' value={newAlias} - onChange={(e) => setNewAlias(e.target.value)} + onChange={(e) => { + setNewAlias(e.target.value); + }} /> { variant='outlined' size='small' value={newUrl} - onChange={(e) => setNewUrl(e.target.value)} + onChange={(e) => { + setNewUrl(e.target.value); + }} />