Compare commits
No commits in common. "6f939103b9730cc587c3a5d869004c0ef7a6e741" and "fb4dd94827df972724b08e68bd8dd1da123e51a7" have entirely different histories.
6f939103b9
...
fb4dd94827
@ -27,8 +27,6 @@ function encrypt(config, password) {
|
|||||||
const encrypted = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
const encrypted = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
||||||
const tag = cipher.getAuthTag();
|
const tag = cipher.getAuthTag();
|
||||||
|
|
||||||
plaintext.fill(0);
|
|
||||||
key.fill(0);
|
|
||||||
return Buffer.concat([MAGIC, salt, iv, tag, encrypted]);
|
return Buffer.concat([MAGIC, salt, iv, tag, encrypted]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,9 +65,6 @@ function decrypt(buffer, password) {
|
|||||||
return JSON.parse(decrypted.toString('utf-8'));
|
return JSON.parse(decrypted.toString('utf-8'));
|
||||||
} catch {
|
} catch {
|
||||||
throw new Error('Entschlüsselte Daten sind kein gültiges JSON');
|
throw new Error('Entschlüsselte Daten sind kein gültiges JSON');
|
||||||
} finally {
|
|
||||||
decrypted.fill(0);
|
|
||||||
key.fill(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
22
main.js
22
main.js
@ -649,19 +649,17 @@ ipcMain.handle('import-backup', async (_event, password) => {
|
|||||||
});
|
});
|
||||||
if (canceled || !filePaths.length) return { ok: false, canceled: true };
|
if (canceled || !filePaths.length) return { ok: false, canceled: true };
|
||||||
const buffer = fs.readFileSync(filePaths[0]);
|
const buffer = fs.readFileSync(filePaths[0]);
|
||||||
const imported = backupCrypto.decrypt(buffer, password);
|
const config = backupCrypto.decrypt(buffer, password);
|
||||||
// Safety net: timestamped backup so multiple imports don't overwrite each other
|
// Safety net: save current config before overwriting
|
||||||
const ts = new Date().toISOString().replace(/[:.]/g, '-');
|
const preImportPath = configStore.filePath + '.pre-import.json';
|
||||||
const preImportPath = configStore.filePath.replace('.json', `.pre-import-${ts}.json`);
|
|
||||||
try { fs.copyFileSync(configStore.filePath, preImportPath); } catch {}
|
try { fs.copyFileSync(configStore.filePath, preImportPath); } catch {}
|
||||||
// Single atomic write — no split state, no TOCTOU race
|
await configStore.save(config);
|
||||||
const merged = {
|
if (config.history) {
|
||||||
hosters: imported.hosters,
|
// Overwrite history too (save() doesn't touch history)
|
||||||
hosterSettings: imported.hosterSettings,
|
const full = configStore.load();
|
||||||
globalSettings: imported.globalSettings,
|
full.history = config.history;
|
||||||
history: imported.history || []
|
await configStore._atomicWrite(JSON.stringify(full, null, 2));
|
||||||
};
|
}
|
||||||
await configStore._atomicWrite(JSON.stringify(merged, null, 2));
|
|
||||||
return { ok: true, config: configStore.load() };
|
return { ok: true, config: configStore.load() };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "1.7.1",
|
"version": "1.7.0",
|
||||||
"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": {
|
||||||
|
|||||||
@ -857,14 +857,9 @@ async function confirmBackupAction() {
|
|||||||
if (result.ok) {
|
if (result.ok) {
|
||||||
config = result.config;
|
config = result.config;
|
||||||
hosterSettings = config.hosterSettings || {};
|
hosterSettings = config.hosterSettings || {};
|
||||||
// Refresh global settings state (always-on-top, etc.)
|
|
||||||
alwaysOnTopState = !!(config.globalSettings && config.globalSettings.alwaysOnTop);
|
|
||||||
window.api.setAlwaysOnTop(alwaysOnTopState);
|
|
||||||
closeBackupModal();
|
closeBackupModal();
|
||||||
renderSettings();
|
renderSettingsPanel();
|
||||||
renderAccounts();
|
renderAccountsList();
|
||||||
renderHosterSummary();
|
|
||||||
renderHosterModal();
|
|
||||||
loadHistory();
|
loadHistory();
|
||||||
showCopyToast('Backup importiert');
|
showCopyToast('Backup importiert');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user