feat(gui): Tor toggle (#300)

* re-add tor info box, show switch for toggling tor

* add use_tor to TauriSettings, only initialize tor client when it's true

* add warning log message when not using tor client

* change the label text of the switch, fail to align switch with SettingsBox icons

* move Tor settings to SettingsBox
This commit is contained in:
Raphael 2025-04-22 16:36:09 +02:00 committed by GitHub
parent ffe103cb49
commit 3fa31ba139
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 44 additions and 77 deletions

View file

@ -44,6 +44,8 @@ import { Theme } from "renderer/components/theme";
import { Add, ArrowUpward, Delete, Edit, HourglassEmpty } from "@material-ui/icons";
import { getNetwork } from "store/config";
import { currencySymbol } from "utils/formatUtils";
import { setTorEnabled } from "store/features/settingsSlice";
const PLACEHOLDER_ELECTRUM_RPC_URL = "ssl://blockstream.info:700";
const PLACEHOLDER_MONERO_NODE_URL = "http://xmr-node.cakewallet.com:18081";
@ -82,6 +84,7 @@ export default function SettingsBox() {
<TableContainer>
<Table>
<TableBody>
<TorSettings />
<ElectrumRpcUrlSetting />
<MoneroNodeUrlSetting />
<FetchFiatPricesSetting />
@ -489,4 +492,23 @@ function NodeTable({
</Table>
</TableContainer>
)
}
}
export function TorSettings() {
const dispatch = useAppDispatch();
const torEnabled = useSettings((settings) => settings.enableTor)
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => dispatch(setTorEnabled(event.target.checked));
const status = (state: boolean) => state === true ? "enabled" : "disabled";
return (
<TableRow>
<TableCell>
<SettingLabel label="Use Tor" tooltip="Tor (The Onion Router) is a decentralized network allowing for anonymous browsing. If enabled, the app will use its internal Tor client to hide your IP address from the maker. Requires a restart to take effect." />
</TableCell>
<TableCell>
<Switch checked={torEnabled} onChange={handleChange} color="primary" />
</TableCell>
</TableRow>
)
}