Skip to content

Commit b4a6199

Browse files
committed
Move file operation to backend
1 parent bd6a1a0 commit b4a6199

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

app/src/actions/ConnectionManager.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ import {
99
import { default as persistentStorage, StorageIdentifier } from '../utils/PersistentStorage'
1010
import { Dispatch } from 'redux'
1111
import { showError } from './Global'
12-
import { promises as fsPromise } from 'fs'
1312
import * as path from 'path'
1413
import { ActionTypes, Action } from '../reducers/ConnectionManager'
1514
import { Subscription } from '../../../backend/src/DataSource/MqttSource'
1615
import { connectionsMigrator } from './migrations/Connection'
17-
import { rendererRpc } from '../../../events'
16+
import { rendererRpc, readFromFile } from '../../../events'
1817
import { makeOpenDialogRpc } from '../../../events/OpenDialogRequest'
1918

2019
export interface ConnectionDictionary {
@@ -81,7 +80,7 @@ async function openCertificate(): Promise<CertificateParameters> {
8180
throw rejectReasons.noCertificateSelected
8281
}
8382

84-
const data = await fsPromise.readFile(selectedFile)
83+
const data = await rendererRpc.call(readFromFile, { filePath: selectedFile })
8584
if (data.length > 16_384 || data.length < 64) {
8685
throw rejectReasons.certificateSizeDoesNotMatch
8786
}

0 commit comments

Comments
 (0)