From 35334e365f078ba6461354e573ca7f65eddaaf09 Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 11 Mar 2026 21:45:08 +0100 Subject: [PATCH] feat: per-session log files New "Neues Log pro Session" checkbox in settings. When enabled, each app session creates a separate log file with timestamp (e.g. fileuploader-2026-03-11_20-30-15.log). File is only created when an upload actually completes. When disabled, behaves as before (single appending log file). Co-Authored-By: Claude Opus 4.6 --- lib/config-store.js | 1 + main.js | 24 +++++++++++++++++++++++- renderer/app.js | 5 +++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/config-store.js b/lib/config-store.js index da5474b..0d02fe6 100644 --- a/lib/config-store.js +++ b/lib/config-store.js @@ -27,6 +27,7 @@ const DEFAULTS = { alwaysOnTop: false, shutdownAfterFinish: 'nothing', // nothing | sleep | shutdown | restart logFilePath: '', + sessionLog: false, resumeQueueOnLaunch: true, parallelUploadCount: 0, // 0 = use per-hoster limits only scaleParallelUploads: false, diff --git a/main.js b/main.js index 84410c3..c1f5349 100644 --- a/main.js +++ b/main.js @@ -68,7 +68,7 @@ function getDefaultLogFilePath() { return path.join(baseDir, 'fileuploader.log'); } -function getLogFilePath() { +function getBaseLogFilePath() { const config = configStore.load(); const customPath = config && config.globalSettings ? String(config.globalSettings.logFilePath || '').trim() @@ -76,6 +76,28 @@ function getLogFilePath() { return customPath || getDefaultLogFilePath(); } +// Session log: one file per app session, created lazily on first upload +let sessionLogPath = null; + +function getLogFilePath() { + const config = configStore.load(); + const useSessionLog = config && config.globalSettings && config.globalSettings.sessionLog; + if (!useSessionLog) return getBaseLogFilePath(); + + // Lazy: generate session log path on first call + if (!sessionLogPath) { + const base = getBaseLogFilePath(); + const dir = path.dirname(base); + const ext = path.extname(base); + const name = path.basename(base, ext); + const now = new Date(); + const pad = (n) => String(n).padStart(2, '0'); + const ts = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}_${pad(now.getHours())}-${pad(now.getMinutes())}-${pad(now.getSeconds())}`; + sessionLogPath = path.join(dir, `${name}-${ts}${ext}`); + } + return sessionLogPath; +} + function appendUploadLog(hoster, link, fileName) { try { const logPath = getLogFilePath(); diff --git a/renderer/app.js b/renderer/app.js index fd2ba8d..02a2bb0 100644 --- a/renderer/app.js +++ b/renderer/app.js @@ -1591,6 +1591,10 @@ function renderSettings() { +
+ + +
`; container.appendChild(generalPanel); @@ -1693,6 +1697,7 @@ async function saveSettings(options = {}) { const globalSettings = { ...(config.globalSettings || {}), logFilePath: (document.getElementById('logFilePathInput')?.value || '').trim(), + sessionLog: !!document.getElementById('sessionLogInput')?.checked, resumeQueueOnLaunch: !!document.getElementById('resumeQueueOnLaunchInput')?.checked, parallelUploadCount: Math.max(0, Math.min(100, parseInt(document.getElementById('parallelUploadCountInput')?.value || '0', 10) || 0)), scaleParallelUploads: !!document.getElementById('scaleParallelUploadsInput')?.checked,