feat: add import preflight summaries
Inspect every manual file, folder, and drag-and-drop import before queue admission. Report exact duplicate, filename-filter, filesystem, destination, configured size-limit, and resulting job counts in the host selection dialog with live bilingual updates.
This commit is contained in:
@@ -55,6 +55,7 @@ const { buildFailedUploadSummary, buildTerminalJobSnapshots } = require('./lib/u
|
||||
const { selectPublicUploadUrl } = require('./lib/upload-confirmation');
|
||||
const { createBatchMutationGate } = require('./lib/batch-mutation-gate');
|
||||
const { createUploadStartReservation } = require('./lib/upload-start-reservation');
|
||||
const { inspectImportEntries } = require('./lib/import-preflight');
|
||||
|
||||
const _eventLoopDelay = monitorEventLoopDelay({ resolution: 10 });
|
||||
_eventLoopDelay.enable();
|
||||
@@ -2247,6 +2248,32 @@ ipcMain.handle('get-file-sizes', async (_event, paths) => {
|
||||
return out;
|
||||
});
|
||||
|
||||
ipcMain.handle('inspect-import-files', async (_event, payload) => {
|
||||
const input = payload && typeof payload === 'object' ? payload : {};
|
||||
const currentConfig = configStore.load();
|
||||
return inspectImportEntries(input.entries, {
|
||||
existingPaths: input.existingPaths,
|
||||
filenameFilter: currentConfig.globalSettings?.filenameFilter,
|
||||
concurrency: 8,
|
||||
inspectPath: async filePath => {
|
||||
let fileStat;
|
||||
try {
|
||||
fileStat = await fs.promises.stat(filePath);
|
||||
} catch (error) {
|
||||
if (error && error.code === 'ENOENT') return { exists: false };
|
||||
return { exists: true, readable: false };
|
||||
}
|
||||
if (!fileStat.isFile()) return { exists: true, readable: false, size: fileStat.size };
|
||||
try {
|
||||
await fs.promises.access(filePath, fs.constants.R_OK);
|
||||
} catch {
|
||||
return { exists: true, readable: false, size: fileStat.size };
|
||||
}
|
||||
return { exists: true, readable: true, size: fileStat.size };
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ipcMain.handle('start-upload', async (_event, payload) => {
|
||||
if (closeFlushRequested) return { error: 'Die Anwendung wird gerade beendet' };
|
||||
if (!settingsImportGate.canStartUpload()) return { error: 'Einstellungen werden gerade importiert' };
|
||||
|
||||
Reference in New Issue
Block a user