Skip to content

Commit

Permalink
fixup! feat(suite-desktop-core): support external Tor
Browse files Browse the repository at this point in the history
  • Loading branch information
karliatto committed Dec 2, 2024
1 parent 41b74a6 commit 6c177a3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/suite-desktop-core/src/modules/tor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ const load = async ({ mainWindowProxy, store, mainThreadEmitter }: Dependencies)

const settings = store.getTorSettings();

const implementations = [
const processes = [
{
type: 'tor',
impl: new TorProcess({
process: new TorProcess({
host: settings.host,
port: settings.port,
controlPort: settings.controlPort,
Expand All @@ -43,14 +43,14 @@ const load = async ({ mainWindowProxy, store, mainThreadEmitter }: Dependencies)
},
{
type: 'tor-external',
impl: new TorExternalProcess(),
process: new TorExternalProcess(),
},
];

const getTarget = () => {
const { useExternalTor } = store.getTorSettings();
const currentTarget = useExternalTor ? 'tor-external' : 'tor';
return implementations.find(impl => impl.type === currentTarget)!.impl;
return processes.find(process => process.type === currentTarget)!.process;

Check failure on line 53 in packages/suite-desktop-core/src/modules/tor.ts

View workflow job for this annotation

GitHub Actions / Linting and formatting

Expected blank line before this statement
};

const updateTorPort = (port: number) => {
Expand Down Expand Up @@ -120,8 +120,9 @@ const load = async ({ mainWindowProxy, store, mainThreadEmitter }: Dependencies)

const createFakeBootstrapProcess = () => {
let progress = 0;
const duration = 3 * 1000; // 3 seconds.
const interval = 300; // update progress every 300ms
const duration = 3_000;
// update progress every 300ms.
const interval = 300;

const increment = (100 / duration) * interval;
const intervalId = setInterval(() => {
Expand Down

0 comments on commit 6c177a3

Please sign in to comment.