aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers
diff options
context:
space:
mode:
authorLibravatar André Oliveira <37463445+SpecialAro@users.noreply.github.com>2024-01-26 02:06:35 +0000
committerLibravatar GitHub <noreply@github.com>2024-01-26 02:06:35 +0000
commit711181751f0a5ee183b74514a621e4aaa6da3dd7 (patch)
tree202718df2046fb92761abc3379ae48f35774a92c /src/helpers
parent6.7.1-nightly.10 [skip ci] (diff)
downloadferdium-app-711181751f0a5ee183b74514a621e4aaa6da3dd7.tar.gz
ferdium-app-711181751f0a5ee183b74514a621e4aaa6da3dd7.tar.zst
ferdium-app-711181751f0a5ee183b74514a621e4aaa6da3dd7.zip
feat: self signed certificates bypass (#1545)
* feat: self signed certificates bypass * fix lint and vscode setting * Fix some mistakes and comments * forgot this one [skip ci]
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/certs-helpers.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/helpers/certs-helpers.ts b/src/helpers/certs-helpers.ts
new file mode 100644
index 000000000..a81e7e365
--- /dev/null
+++ b/src/helpers/certs-helpers.ts
@@ -0,0 +1,25 @@
1import { readdirSync, readFileSync, ensureDirSync } from 'fs-extra';
2import { join } from 'node:path';
3import { userDataCertsPath } from '../environment-remote';
4
5export function removeNewLines(string: string) {
6 return string.replaceAll(/\r?\n|\r/g, '');
7}
8
9export function readCerts() {
10 const certsFolder = userDataCertsPath();
11
12 ensureDirSync(certsFolder);
13
14 const certs: string[] = [];
15
16 for (const file of readdirSync(certsFolder)) {
17 const cert = readFileSync(join(certsFolder, file), {
18 encoding: 'utf8',
19 flag: 'r',
20 });
21 certs.push(removeNewLines(cert));
22 }
23
24 return certs;
25}