Skip to content

Commit d6a5b14

Browse files
committed
Merge branch 'main' into release
2 parents 3c65cc6 + 477d13a commit d6a5b14

File tree

9 files changed

+49
-19
lines changed

9 files changed

+49
-19
lines changed

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
url = https://github.com/wmitsuda/topic0
44
[submodule "mfer-node"]
55
path = mfer-node
6-
url = git@github.com:sec-bit/mfer-node.git
6+
url = https://github.com/sec-bit/mfer-node

mfer-safe-desktop-app/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mfer-safe-desktop-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mfer-safe",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"private": true,
55
"dependencies": {
66
"@emotion/react": "^11.9.3",

mfer-safe-desktop-app/src-tauri/tauri.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"package": {
1010
"productName": "MferSafe",
11-
"version": "0.1.3"
11+
"version": "0.1.4"
1212
},
1313
"tauri": {
1414
"allowlist": {

mfer-safe-desktop-app/src/App.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import "./App.css";
22
import * as React from "react";
3+
import {useState, useEffect} from "react"
34

45
import NavTabs from "./NavTabs";
56
import SimulateView from "./SimulateView";
@@ -8,8 +9,22 @@ import SettingsView from "./SettingsView";
89
import TxDataOverview from "./TxDataOverview";
910
import TraceView from "./TraceView";
1011
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
12+
import { listen } from "@tauri-apps/api/event";
1113

1214
function App() {
15+
const [log, setLog] = useState("")
16+
useEffect(() => {
17+
console.log("init tauri event listener")
18+
listen("mfernode-event", (event) => {
19+
if (event.payload !== undefined) {
20+
setLog((log) => {
21+
var logLines = log.split("\n").slice(0, 500);
22+
log = logLines.join("\n");
23+
return event.payload + "\n" + log
24+
});
25+
}
26+
});
27+
}, []);
1328
return (
1429
<Router>
1530
<div>
@@ -19,7 +34,7 @@ function App() {
1934
<Route path="/txs" element={<TxDataOverview />} />
2035
<Route path="/trace/:txHash" element={<TraceView />} />
2136
<Route path="/safemultisend" element={<SimulateView />} />
22-
<Route path="/logs" element={<LogsView/>} />
37+
<Route path="/logs" element={<LogsView log={log} />} />
2338
</Routes>
2439
</div>
2540
</Router>

mfer-safe-desktop-app/src/LogsView.js

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
import * as React from "react";
2-
import { useState, useEffect } from "react";
32
import TextareaAutosize from "@mui/material/TextareaAutosize";
4-
import { listen } from "@tauri-apps/api/event";
53

6-
export default function LogView() {
7-
const [log, setLog] = useState("");
8-
useEffect(() => {
9-
listen("mfernode-event", (event) => {
10-
if (event.payload !== undefined) {
11-
setLog((log) => event.payload + "\n" + log);
12-
}
13-
});
14-
}, []);
4+
export default function LogView(props) {
5+
const { log } = props;
156
return (
167
<TextareaAutosize
178
aria-label="empty textarea"

mfer-safe-desktop-app/src/NavTabs.js

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import SpeedDialIcon from "@mui/material/SpeedDialIcon";
1313
import SpeedDialAction from "@mui/material/SpeedDialAction";
1414
import ReplayIcon from "@mui/icons-material/Replay";
1515
import DeleteForeverIcon from "@mui/icons-material/DeleteForever";
16+
import ClearIcon from '@mui/icons-material/Clear';
1617
import TerminalIcon from "@mui/icons-material/Terminal";
1718

1819
const actions = [
@@ -30,6 +31,13 @@ const actions = [
3031
docall("mfer_clearTxPool", []);
3132
},
3233
},
34+
{
35+
icon: <ClearIcon />,
36+
name: "Clear Key Cache",
37+
onClick: () => {
38+
docall("mfer_clearKeyCache", []);
39+
},
40+
},
3341
];
3442
export default function NavTabs() {
3543
const [value, setValue] = React.useState(0);

mfer-safe-desktop-app/src/SettingsView.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default function SettingsView() {
5656
const [blockTimeDelta, setBlockTimeDelta] = useState(0);
5757
const [keyCacheFilePath, setKeyCacheFilePath] = useState("");
5858
const [addrRandomize, setAddrRandomize] = useState(false);
59+
const [passthrough, setPassthrough] = useState(true);
5960

6061
useEffect(() => {
6162
getMferNodeArgs().then((args) => {
@@ -93,6 +94,11 @@ export default function SettingsView() {
9394
setAddrRandomize(result.result);
9495
});
9596

97+
docall("mfer_passthroughEnabled", [])
98+
.then((res) => res.json())
99+
.then((result) => {
100+
setPassthrough(result.result);
101+
});
96102
}, []);
97103

98104
const saveRPCSettings = useCallback(() => {
@@ -151,6 +157,11 @@ export default function SettingsView() {
151157
setAddrRandomize(e.target.checked);
152158
};
153159

160+
const setPassthroughFunc = (e) => {
161+
docall("mfer_togglePassthrough", [e.target.checked]);
162+
setPassthrough(e.target.checked);
163+
};
164+
154165
return (
155166
<Box
156167
component="div"
@@ -171,7 +182,12 @@ export default function SettingsView() {
171182
padding={2}
172183
width="520px"
173184
>
174-
<FormGroup>
185+
<FormGroup row>
186+
<FormControlLabel control={
187+
<Checkbox
188+
checked={passthrough}
189+
onChange={setPassthroughFunc}
190+
/>} label="Passthrough" />
175191
<FormControlLabel control={
176192
<Checkbox
177193
checked={addrRandomize}

0 commit comments

Comments
 (0)