Skip to content

Commit 6f20303

Browse files
Gathin23jgresham
andauthored
feat: add podman version when reporting an issue (#427)
also format data from json --------- Co-authored-by: jgresham <[email protected]>
1 parent 2dcad94 commit 6f20303

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/main/debug.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { app } from 'electron';
33

44
import { getArch } from './arch';
55
import { getPlatform } from './platform';
6+
import { getInstalledPodmanVersion } from './podman/install/install';
67
import { getOperatingSystemInfo } from './systemInfo.js';
78

89
export default async function getDebugInfo() {
910
let niceNodeVersion = app.getVersion();
11+
const podmanVersion = await getInstalledPodmanVersion();
1012

1113
if (process.env.NODE_ENV === 'development') {
1214
niceNodeVersion = `Dev-${niceNodeVersion}`;
@@ -23,12 +25,14 @@ export default async function getDebugInfo() {
2325
arch: getArch(),
2426
freeMemory: os.freemem(),
2527
totalMemory: os.totalmem(),
28+
podmanVersion,
2629
niceNodeVersion,
2730
};
2831
}
2932

3033
const getDebugInfoShort = async () => {
3134
let niceNodeVersion = app.getVersion();
35+
const podmanVersion = await getInstalledPodmanVersion();
3236

3337
if (process.env.NODE_ENV === 'development') {
3438
niceNodeVersion = `Dev-${niceNodeVersion}`;
@@ -43,8 +47,8 @@ const getDebugInfoShort = async () => {
4347
release: release,
4448
arch: getArch(),
4549
totalMemory: os.totalmem(),
50+
podmanVersion,
4651
niceNodeVersion,
47-
// ethereumNodeVersion: gethBuildNameForPlatformAndArch(),
4852
};
4953
};
5054

@@ -58,18 +62,24 @@ export const getDebugInfoString = async () => {
5862

5963
export const getDebugInfoShortString = async () => {
6064
try {
61-
return JSON.stringify(await getDebugInfoShort(), null, 2);
65+
const formattedString = JSON.stringify(await getDebugInfoShort(), null, 2)
66+
.replace(/[{}"]/g, '')
67+
.replace(/:/g, ': ')
68+
.replace(/,\n/g, '\n')
69+
.replace(/(^|\n)\s*\w/g, (s) => s.toUpperCase());
70+
71+
return formattedString;
6272
} catch (err) {
6373
return 'No system details.';
6474
}
6575
};
6676

6777
export const getGithubIssueProblemURL = async () => {
6878
const url = new URL('https://github.com/NiceNode/nice-node/issues/new');
79+
const debugInfo = await getDebugInfoShortString();
6980
url.searchParams.set(
7081
'body',
71-
`Problem description\n-\n<!-- Describe your problem on the next line! Thank you -->\n\n\nFor NiceNode developers\n-\n${await getDebugInfoShortString()}`,
82+
`Problem description\n-\n<!-- Describe your problem on the next line! Thank you -->\n\n\nFor NiceNode developers\n-\n${debugInfo}`,
7283
);
73-
7484
return url.toString();
7585
};

0 commit comments

Comments
 (0)