From f7436e8aada9447991e022ff107743bf1df3b3f8 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sat, 21 Jun 2025 16:15:19 -0400 Subject: [PATCH] Add log path to OnionShare error --- gui/electron/main.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/gui/electron/main.js b/gui/electron/main.js index c3a9a55..d676e94 100644 --- a/gui/electron/main.js +++ b/gui/electron/main.js @@ -72,7 +72,27 @@ function runServe(retry = false) { }); onionProc.on('close', code => { if ((code !== 0 && code !== null) || retry) { - dialog.showErrorBox('OnionShare error', `onionshare exited with code ${code}.`); + let extra = ''; + try { + const confRaw = fs.readFileSync(configPath, 'utf8'); + const conf = JSON.parse(confRaw); + const logPath = path.join( + __dirname, + '..', + '..', + 'host', + conf.subdomain, + 'onionshare.log' + ); + fs.readFileSync(logPath, 'utf8'); + extra = `\nSee ${logPath} for details.`; + } catch (err) { + // ignore errors reading log + } + dialog.showErrorBox( + 'OnionShare error', + `onionshare exited with code ${code}.${extra}` + ); } if (!restarting && (code !== 0 || code === null)) { restarting = true;