Compare commits

..

No commits in common. "b80ca7238d6599df041fd4977b53da7305692311" and "fdac28040db2d18d16ebaedf6ac93b1e90c708b9" have entirely different histories.

2 changed files with 4 additions and 42 deletions

44
main.js
View File

@ -113,25 +113,6 @@ function getLogFilePath() {
return _dailyLogPath; return _dailyLogPath;
} }
function buildFallbackLogName(dir) {
// Match the daily-log naming when enabled, so fallback files stay consistent.
const config = configStore.load();
const useDailyLog = config && config.globalSettings && config.globalSettings.sessionLog;
if (!useDailyLog) return path.join(dir, 'fileuploader.log');
const now = new Date();
const pad = (n) => String(n).padStart(2, '0');
const today = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
return path.join(dir, `fileuploader-${today}.log`);
}
function getSafeDesktopDir() {
try {
const desktop = app.getPath('desktop');
if (desktop && fs.existsSync(desktop)) return desktop;
} catch {}
return null;
}
let _uploadLogFallbackWarned = false; let _uploadLogFallbackWarned = false;
function appendUploadLog(hoster, link, fileName) { function appendUploadLog(hoster, link, fileName) {
const now = new Date(); const now = new Date();
@ -148,30 +129,11 @@ function appendUploadLog(hoster, link, fileName) {
tryWrite(getLogFilePath()); tryWrite(getLogFilePath());
return; return;
} catch (err) { } catch (err) {
debugLog(`appendUploadLog primary failed (${err.message}); trying desktop fallback`); debugLog(`appendUploadLog primary failed (${err.message}); using fallback`);
} }
// Fallback 1: current user's Desktop (visible, easy to find).
const desktop = getSafeDesktopDir();
if (desktop) {
try {
const fallbackPath = buildFallbackLogName(desktop);
tryWrite(fallbackPath);
if (!_uploadLogFallbackWarned) {
_uploadLogFallbackWarned = true;
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send('upload-log-fallback', { fallbackPath });
}
}
return;
} catch (err) {
debugLog(`appendUploadLog desktop fallback failed (${err.message}); trying userData`);
}
}
// Fallback 2: userData (always writable by the current user).
try { try {
const fallbackPath = buildFallbackLogName(app.getPath('userData')); const fallbackPath = path.join(app.getPath('userData'), 'fileuploader-fallback.log');
tryWrite(fallbackPath); tryWrite(fallbackPath);
if (!_uploadLogFallbackWarned) { if (!_uploadLogFallbackWarned) {
_uploadLogFallbackWarned = true; _uploadLogFallbackWarned = true;
@ -180,7 +142,7 @@ function appendUploadLog(hoster, link, fileName) {
} }
} }
} catch (err) { } catch (err) {
debugLog(`appendUploadLog all fallbacks failed: ${err.message}`); debugLog(`appendUploadLog fallback also failed: ${err.message}`);
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "multi-hoster-uploader", "name": "multi-hoster-uploader",
"version": "2.8.2", "version": "2.8.1",
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously", "description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {