aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2024-01-26 08:24:20 +0530
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2024-01-28 03:31:35 +0000
commit6c67387b2978f1a02244a1350725238da35b341b (patch)
treec357ab6826cce8272642c01b0d80120bd5baaa86 /src/helpers
parent6.7.1-nightly.11 [skip ci] (diff)
downloadferdium-app-6c67387b2978f1a02244a1350725238da35b341b.tar.gz
ferdium-app-6c67387b2978f1a02244a1350725238da35b341b.tar.zst
ferdium-app-6c67387b2978f1a02244a1350725238da35b341b.zip
chore: minor refactoring to reduce lines and add tests
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/certs-helpers.ts9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/helpers/certs-helpers.ts b/src/helpers/certs-helpers.ts
index a81e7e365..a6c83f5c4 100644
--- a/src/helpers/certs-helpers.ts
+++ b/src/helpers/certs-helpers.ts
@@ -1,12 +1,9 @@
1import { readdirSync, readFileSync, ensureDirSync } from 'fs-extra'; 1import { readdirSync, readFileSync, ensureDirSync } from 'fs-extra';
2import { join } from 'node:path'; 2import { join } from 'node:path';
3import { userDataCertsPath } from '../environment-remote'; 3import { userDataCertsPath } from '../environment-remote';
4import { removeNewLines } from '../jsUtils';
4 5
5export function removeNewLines(string: string) { 6export function checkIfCertIsPresent(certData: string): boolean {
6 return string.replaceAll(/\r?\n|\r/g, '');
7}
8
9export function readCerts() {
10 const certsFolder = userDataCertsPath(); 7 const certsFolder = userDataCertsPath();
11 8
12 ensureDirSync(certsFolder); 9 ensureDirSync(certsFolder);
@@ -21,5 +18,5 @@ export function readCerts() {
21 certs.push(removeNewLines(cert)); 18 certs.push(removeNewLines(cert));
22 } 19 }
23 20
24 return certs; 21 return certs.length > 0 && certs.includes(removeNewLines(certData));
25} 22}