Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions frontend/src/components/Dialogs/Coordinator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ import { systemClient } from '../../services/System';
import type Coordinator from '../../models/Coordinator.model';
import { type Badges } from '../../models/Coordinator.model';
import { type UseFederationStoreType, FederationContext } from '../../contexts/FederationContext';
import { verifyCoordinatorToken } from '../../utils/nostr';

interface Props {
open: boolean;
Expand Down Expand Up @@ -367,9 +366,8 @@ const CoordinatorDialog = ({ open = false, onClose, shortAlias }: Props): React.
federation.roboPool.subscribeRatings(
{
onevent: (event) => {
const verfied = verifyCoordinatorToken(event);
const coordinatorPubKey = event.tags.find((t) => t[0] === 'p')?.[1];
if (verfied && coordinatorPubKey === coordinator.nostrHexPubkey) {
if (coordinatorPubKey === coordinator.nostrHexPubkey) {
const eventRating = event.tags.find((t) => t[0] === 'rating')?.[1];
if (eventRating) {
setRating((prev) => {
Expand Down
61 changes: 57 additions & 4 deletions frontend/src/components/FederationTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import React, { useCallback, useContext, useEffect, useState } from 'react';
import { Link, LinkOff } from '@mui/icons-material';
import { Box, Checkbox, CircularProgress, Grid, Rating, Typography, useTheme } from '@mui/material';
import {
Box,
Button,
Checkbox,
CircularProgress,
Grid,
Rating,
Typography,
useTheme,
} from '@mui/material';
import { DataGrid, type GridColDef, type GridValidRowModel } from '@mui/x-data-grid';
import { useTranslation } from 'react-i18next';
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
Expand Down Expand Up @@ -33,6 +42,8 @@ const FederationTable = ({
}, {}),
);
const [useDefaultPageSize, setUseDefaultPageSize] = useState(true);
const [verifyRatings, setVerifyRatings] = useState(false);
const [verifcationText, setVerificationText] = useState<string>();

// all sizes in 'em'
const fontSize = theme.typography.fontSize;
Expand All @@ -49,18 +60,31 @@ const FederationTable = ({
loadRatings();
}, []);

useEffect(() => {
if (verifyRatings) {
loadRatings();
setVerificationText(t('Reloading. Invalid ratings will be filtered.'));
}
}, [verifyRatings]);

useEffect(() => {
if (useDefaultPageSize) {
setPageSize(defaultPageSize);
}
}, [federationUpdatedAt]);

const loadRatings: () => void = () => {
setRatings(
federation.getCoordinators().reduce((acc, coord) => {
if (coord.nostrHexPubkey) acc[coord.nostrHexPubkey] = {};
return acc;
}, {}),
);
federation.roboPool.subscribeRatings({
onevent: (event) => {
const verfied = verifyCoordinatorToken(event);
const coordinatorPubKey = event.tags.find((t) => t[0] === 'p')?.[1];
if (verfied && coordinatorPubKey) {
const verified = verifyRatings ? verifyCoordinatorToken(event) : true;
if (verified && coordinatorPubKey) {
const rating = event.tags.find((t) => t[0] === 'rating')?.[1];
if (rating) {
setRatings((prev) => {
Expand All @@ -70,7 +94,9 @@ const FederationTable = ({
}
}
},
oneose: () => {},
oneose: () => {
if (verifyRatings) setVerificationText(t('Invalid ratings have been filtered.'));
},
});
};

Expand Down Expand Up @@ -333,6 +359,33 @@ const FederationTable = ({
}}
hideFooter={true}
/>

<Grid item>
{!verifcationText && (
<Button
sx={{ maxHeight: 38, mt: '1em' }}
disabled={false}
onClick={() => setVerifyRatings(true)}
variant='contained'
color='secondary'
size='small'
type='submit'
>
{t('Verify ratings')}
</Button>
)}
<Typography
variant='body2'
color={verifcationText ? 'success.main' : 'warning.main'}
sx={{ mt: 2, fontWeight: 'bold' }}
>
{verifcationText
? verifcationText
: t(
'Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.',
)}
</Typography>
</Grid>
</Box>
);
};
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Avís",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Habilitat",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No s'han trobat coordinadors.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Pujar",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "El client RoboSats és servit pel teu propi node, gaudeixes de la major seguretat i privacitat.",
"You are self-hosting RoboSats": "Estàs hostejant RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "RoboSats client is served from your own node granting you the strongest security and privacy.",
"You are self-hosting RoboSats": "You are self-hosting RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "RoboSats client is served from your own node granting you the strongest security and privacy.",
"You are self-hosting RoboSats": "You are self-hosting RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "RoboSats client is served from your own node granting you the strongest security and privacy.",
"You are self-hosting RoboSats": "You are self-hosting RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "El cliente RoboSats es servido por tu propio nodo, gozas de la mayor seguridad y privacidad.",
"You are self-hosting RoboSats": "Estás alojando RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/eu.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "RoboSats webgunea zure nodotik zerbitzatzen da beraz segurtasun eta pribatutasun sendoena eskaintzen dizu.",
"You are self-hosting RoboSats": "You are self-hosting RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "Le client RoboSats est servi à partir de votre propre nœud, ce qui vous garantit une sécurité et une confidentialité optimales.",
"You are self-hosting RoboSats": "Vous auto-hébergez RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "Il client RoboSats è servito dal proprio nodo, garantendo la massima sicurezza e privacy.",
"You are self-hosting RoboSats": "Stai ospitando RoboSats in autonomia",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "RoboSatsクライアントは、あなた自身のノードから提供され、最高のセキュリティとプライバシーが保証されます。",
"You are self-hosting RoboSats": "RoboSatsを自己ホスティングしています",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "RoboSats client is served from your own node granting you the strongest security and privacy.",
"You are self-hosting RoboSats": "You are self-hosting RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "RoboSats client is served from your own node granting you the strongest security and privacy.",
"You are self-hosting RoboSats": "You are self-hosting RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "Клиент RoboSats обслуживается с вашего собственного нода, что обеспечивает максимальную безопасность и конфиденциальность.",
"You are self-hosting RoboSats": "Вы самостоятельно размещаете RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "RoboSats client is served from your own node granting you the strongest security and privacy.",
"You are self-hosting RoboSats": "You are self-hosting RoboSats",
Expand Down
4 changes: 4 additions & 0 deletions frontend/static/locales/sw.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@
"Warning": "Warning",
"#39": "Phrases in components/FederationTable/index.tsx",
"Enabled": "Enabled",
"Invalid ratings have been filtered.": "Invalid ratings have been filtered.",
"No coordinators found.": "No coordinators found.",
"Rating": "Rating",
"Reloading. Invalid ratings will be filtered.": "Reloading. Invalid ratings will be filtered.",
"Up": "Up",
"Verify ratings": "Verify ratings",
"Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.": "Verifying all ratings might take some time; this window may freeze for a few seconds while the cryptographic certification is in progress.",
"#40": "Phrases in components/HostAlert/SelfhostedAlert.tsx",
"RoboSats client is served from your own node granting you the strongest security and privacy.": "Mteja wa RoboSats unatolewa kutoka kwenye node yako mwenyewe ikikupa usalama na faragha imara kabisa.",
"You are self-hosting RoboSats": "Unaendesha RoboSats yako mwenyewe",
Expand Down
Loading