aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-03-09 14:19:37 -0300
committerSebastian <sebasjm@gmail.com>2023-03-09 14:19:37 -0300
commit034f2c6dcb12817bf18785a2fdc78e5a1b6669f5 (patch)
treea21061a4552468aa8d1bdc1fc5a9988676c56be2 /packages/taler-wallet-webextension
parent863e6db058ccfd7f02d50313055537ed0b9f018d (diff)
downloadwallet-core-034f2c6dcb12817bf18785a2fdc78e5a1b6669f5.tar.gz
wallet-core-034f2c6dcb12817bf18785a2fdc78e5a1b6669f5.tar.bz2
wallet-core-034f2c6dcb12817bf18785a2fdc78e5a1b6669f5.zip
dev mode: check exchange cache
Diffstat (limited to 'packages/taler-wallet-webextension')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx37
1 files changed, 37 insertions, 0 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
index ee0986076..2db2041d4 100644
--- a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx
@@ -171,6 +171,7 @@ export function View({
[exchange_name: string]: CalculatedCoinfInfo[];
},
);
+ const exchanges = Object.keys(money_by_exchange);
const [tagName, setTagName] = useState("");
const [logLevel, setLogLevel] = useState("info");
@@ -317,6 +318,42 @@ export function View({
>
<i18n.Translate>Remove ext+taler:// handler</i18n.Translate>
</Button>
+ </Grid>
+ <Grid item>
+ <Button
+ variant="contained"
+ onClick={async () => {
+ const result = await Promise.all(
+ exchanges.map(async (ex) => {
+ const oldKeys = JSON.stringify(
+ await (await fetch(`${ex}keys`)).json(),
+ );
+ const oldWire = JSON.stringify(
+ await (await fetch(`${ex}wire`)).json(),
+ );
+ const newKeys = JSON.stringify(
+ await (
+ await fetch(`${ex}keys`, { cache: "no-cache" })
+ ).json(),
+ );
+ const newWire = JSON.stringify(
+ await (
+ await fetch(`${ex}wire`, { cache: "no-cache" })
+ ).json(),
+ );
+ return oldKeys !== newKeys || newWire !== oldWire;
+ }),
+ );
+ const ex = exchanges.filter((e, i) => result[i]);
+ if (!ex.length) {
+ alert("no exchange was outdated");
+ } else {
+ alert(`found some exchange out of date: ${result.join(", ")}`);
+ }
+ }}
+ >
+ <i18n.Translate>Clear exchange key cache</i18n.Translate>
+ </Button>
</Grid>{" "}
</Grid>
<Paper style={{ padding: 10, margin: 10 }}>