mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Fix order click on matches. Fix existing PGP on deleted robot rebuild.
This commit is contained in:
parent
7f6b2bb79e
commit
09027deffc
@ -97,38 +97,42 @@ class Logics:
|
|||||||
# Try to import the public key
|
# Try to import the public key
|
||||||
import_pub_result = gpg.import_keys(pub_key)
|
import_pub_result = gpg.import_keys(pub_key)
|
||||||
if not import_pub_result.imported == 1:
|
if not import_pub_result.imported == 1:
|
||||||
return (
|
# If a robot is deleted and it is rebuilt with the same pubKey, the key will not be imported again
|
||||||
False,
|
# so we assert that the import error is "Not actually changed"
|
||||||
{
|
if "Not actually changed" not in import_pub_result.results[0]["text"]:
|
||||||
"bad_request": "Your PGP public key does not seem valid.\n"
|
return (
|
||||||
+ f"Stderr: {str(import_pub_result.stderr)}\n"
|
False,
|
||||||
+ f"ReturnCode: {str(import_pub_result.returncode)}\n"
|
{
|
||||||
+ f"Summary: {str(import_pub_result.summary)}\n"
|
"bad_request": "Your PGP public key does not seem valid.\n"
|
||||||
+ f"Results: {str(import_pub_result.results)}\n"
|
+ f"Stderr: {str(import_pub_result.stderr)}\n"
|
||||||
+ f"Imported: {str(import_pub_result.imported)}\n"
|
+ f"ReturnCode: {str(import_pub_result.returncode)}\n"
|
||||||
},
|
+ f"Summary: {str(import_pub_result.summary)}\n"
|
||||||
None,
|
+ f"Results: {str(import_pub_result.results)}\n"
|
||||||
None,
|
+ f"Imported: {str(import_pub_result.imported)}\n"
|
||||||
)
|
},
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
)
|
||||||
# Exports the public key again for uniform formatting.
|
# Exports the public key again for uniform formatting.
|
||||||
pub_key = gpg.export_keys(import_pub_result.fingerprints[0])
|
pub_key = gpg.export_keys(import_pub_result.fingerprints[0])
|
||||||
|
|
||||||
# Try to import the encrypted private key (without passphrase)
|
# Try to import the encrypted private key (without passphrase)
|
||||||
import_priv_result = gpg.import_keys(enc_priv_key)
|
import_priv_result = gpg.import_keys(enc_priv_key)
|
||||||
if not import_priv_result.sec_imported == 1:
|
if not import_priv_result.sec_imported == 1:
|
||||||
return (
|
if "Not actually changed" not in import_priv_result.results[0]["text"]:
|
||||||
False,
|
return (
|
||||||
{
|
False,
|
||||||
"bad_request": "Your PGP encrypted private key does not seem valid.\n"
|
{
|
||||||
+ f"Stderr: {str(import_priv_result.stderr)}\n"
|
"bad_request": "Your PGP encrypted private key does not seem valid.\n"
|
||||||
+ f"ReturnCode: {str(import_priv_result.returncode)}\n"
|
+ f"Stderr: {str(import_priv_result.stderr)}\n"
|
||||||
+ f"Summary: {str(import_priv_result.summary)}\n"
|
+ f"ReturnCode: {str(import_priv_result.returncode)}\n"
|
||||||
+ f"Results: {str(import_priv_result.results)}\n"
|
+ f"Summary: {str(import_priv_result.summary)}\n"
|
||||||
+ f"Sec Imported: {str(import_priv_result.sec_imported)}\n"
|
+ f"Results: {str(import_priv_result.results)}\n"
|
||||||
},
|
+ f"Sec Imported: {str(import_priv_result.sec_imported)}\n"
|
||||||
None,
|
},
|
||||||
None,
|
None,
|
||||||
)
|
None,
|
||||||
|
)
|
||||||
|
|
||||||
return True, None, pub_key, enc_priv_key
|
return True, None, pub_key, enc_priv_key
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import MakerForm from '../../components/MakerForm';
|
|||||||
import BookTable from '../../components/BookTable';
|
import BookTable from '../../components/BookTable';
|
||||||
|
|
||||||
import { AppContext, AppContextProps } from '../../contexts/AppContext';
|
import { AppContext, AppContextProps } from '../../contexts/AppContext';
|
||||||
|
import { NoRobotDialog } from '../../components/Dialogs';
|
||||||
|
|
||||||
const MakerPage = (): JSX.Element => {
|
const MakerPage = (): JSX.Element => {
|
||||||
const {
|
const {
|
||||||
@ -21,16 +22,19 @@ const MakerPage = (): JSX.Element => {
|
|||||||
setCurrentOrder,
|
setCurrentOrder,
|
||||||
navbarHeight,
|
navbarHeight,
|
||||||
setPage,
|
setPage,
|
||||||
|
setOrder,
|
||||||
|
setDelay,
|
||||||
} = useContext<AppContextProps>(AppContext);
|
} = useContext<AppContextProps>(AppContext);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
const maxHeight = (windowSize.height - navbarHeight) * 0.85 - 3;
|
const maxHeight = (windowSize.height - navbarHeight) * 0.85 - 3;
|
||||||
const [showMatches, setShowMatches] = useState<boolean>(false);
|
const [showMatches, setShowMatches] = useState<boolean>(false);
|
||||||
|
const [openNoRobot, setOpenNoRobot] = useState<boolean>(false);
|
||||||
|
|
||||||
const matches = filterOrders({
|
const matches = filterOrders({
|
||||||
orders: book.orders,
|
orders: book.orders,
|
||||||
baseFilter: { currency: fav.currency === 0 ? 1 : fav.currency, type: fav.type },
|
baseFilter: { currency: fav.currency === 0 ? 1 : fav.currency, type: fav.type, mode: fav.mode },
|
||||||
paymentMethods: maker.paymentMethods,
|
paymentMethods: maker.paymentMethods,
|
||||||
amountFilter: {
|
amountFilter: {
|
||||||
amount: maker.amount,
|
amount: maker.amount,
|
||||||
@ -40,8 +44,25 @@ const MakerPage = (): JSX.Element => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const onViewOrder = function () {
|
||||||
|
setOrder(undefined);
|
||||||
|
setDelay(10000);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onOrderClicked = function (id: number) {
|
||||||
|
if (robot.avatarLoaded) {
|
||||||
|
history.push('/order/' + id);
|
||||||
|
setPage('order');
|
||||||
|
setCurrentOrder(id);
|
||||||
|
onViewOrder();
|
||||||
|
} else {
|
||||||
|
setOpenNoRobot(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container direction='column' alignItems='center' spacing={1}>
|
<Grid container direction='column' alignItems='center' spacing={1}>
|
||||||
|
<NoRobotDialog open={openNoRobot} onClose={() => setOpenNoRobot(false)} setPage={setPage} />
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Collapse in={matches.length > 0 && showMatches}>
|
<Collapse in={matches.length > 0 && showMatches}>
|
||||||
<Grid container direction='column' alignItems='center' spacing={1}>
|
<Grid container direction='column' alignItems='center' spacing={1}>
|
||||||
@ -57,6 +78,7 @@ const MakerPage = (): JSX.Element => {
|
|||||||
showControls={false}
|
showControls={false}
|
||||||
showFooter={false}
|
showFooter={false}
|
||||||
showNoResults={false}
|
showNoResults={false}
|
||||||
|
onOrderClicked={onOrderClicked}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -43,7 +43,7 @@ const RobotPage = (): JSX.Element => {
|
|||||||
setInputToken(robot.token);
|
setInputToken(robot.token);
|
||||||
}
|
}
|
||||||
if (robot.nickname == null && robot.token) {
|
if (robot.nickname == null && robot.token) {
|
||||||
fetchRobot({ action: 'generate' });
|
fetchRobot({ action: 'generate', setBadRequest });
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user