Compare commits
No commits in common. "a92147939d0c09c943a0b7099721c6032466227f" and "54daaf0410db8e36a42d6fd7c3ccb45588be4d55" have entirely different histories.
a92147939d
...
54daaf0410
@ -18,7 +18,6 @@ function deriveKey(password, salt) {
|
|||||||
* Returns a Buffer: MHU1 | salt(16) | iv(12) | tag(16) | ciphertext
|
* Returns a Buffer: MHU1 | salt(16) | iv(12) | tag(16) | ciphertext
|
||||||
*/
|
*/
|
||||||
function encrypt(config, password) {
|
function encrypt(config, password) {
|
||||||
if (!password || typeof password !== 'string') throw new Error('Passwort darf nicht leer sein');
|
|
||||||
const plaintext = Buffer.from(JSON.stringify(config), 'utf-8');
|
const plaintext = Buffer.from(JSON.stringify(config), 'utf-8');
|
||||||
const salt = crypto.randomBytes(SALT_LEN);
|
const salt = crypto.randomBytes(SALT_LEN);
|
||||||
const iv = crypto.randomBytes(IV_LEN);
|
const iv = crypto.randomBytes(IV_LEN);
|
||||||
@ -38,7 +37,6 @@ function encrypt(config, password) {
|
|||||||
* Returns the config object or throws on invalid password/data.
|
* Returns the config object or throws on invalid password/data.
|
||||||
*/
|
*/
|
||||||
function decrypt(buffer, password) {
|
function decrypt(buffer, password) {
|
||||||
if (!password || typeof password !== 'string') throw new Error('Passwort darf nicht leer sein');
|
|
||||||
if (buffer.length < MAGIC.length + SALT_LEN + IV_LEN + TAG_LEN + 1) {
|
if (buffer.length < MAGIC.length + SALT_LEN + IV_LEN + TAG_LEN + 1) {
|
||||||
throw new Error('Ungültiges Backup-Format');
|
throw new Error('Ungültiges Backup-Format');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,9 +152,6 @@ async function installUpdate(onProgress) {
|
|||||||
if (!check || !check.available) {
|
if (!check || !check.available) {
|
||||||
throw new Error('Kein Update verfuegbar');
|
throw new Error('Kein Update verfuegbar');
|
||||||
}
|
}
|
||||||
if (!check.assetUrl || !check.assetName) {
|
|
||||||
throw new Error('Update-Asset unvollstaendig (URL oder Name fehlt)');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stage: downloading
|
// Stage: downloading
|
||||||
const tmpDir = app.getPath('temp');
|
const tmpDir = app.getPath('temp');
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "2.3.4",
|
"version": "2.3.3",
|
||||||
"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": {
|
||||||
|
|||||||
@ -51,24 +51,22 @@ describe('ConfigStore', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('save then load round-trips', async () => {
|
it('save then load round-trips', async () => {
|
||||||
await store.save({ hosters: { 'doodstream.com': [{ id: 'test-1', enabled: true, authType: 'api', apiKey: 'test-key-123' }] } });
|
await store.save({ hosters: { 'doodstream.com': { enabled: true, apiKey: 'test-key-123' } } });
|
||||||
const config = store.load();
|
const config = store.load();
|
||||||
assert.equal(config.hosters['doodstream.com'][0].apiKey, 'test-key-123');
|
assert.equal(config.hosters['doodstream.com'].apiKey, 'test-key-123');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('load merges with defaults for missing hosters', () => {
|
it('load merges with defaults for missing hosters', () => {
|
||||||
// Write partial config in old single-object format (triggers migration)
|
// Write partial config
|
||||||
fs.writeFileSync(store.filePath, JSON.stringify({
|
fs.writeFileSync(store.filePath, JSON.stringify({
|
||||||
hosters: { 'doodstream.com': { apiKey: 'abc' } }
|
hosters: { 'doodstream.com': { apiKey: 'abc' } }
|
||||||
}), 'utf-8');
|
}), 'utf-8');
|
||||||
|
|
||||||
const config = store.load();
|
const config = store.load();
|
||||||
// Old format is migrated to array
|
assert.equal(config.hosters['doodstream.com'].apiKey, 'abc');
|
||||||
assert.ok(Array.isArray(config.hosters['doodstream.com']));
|
// Other hosters should still have defaults
|
||||||
assert.equal(config.hosters['doodstream.com'][0].apiKey, 'abc');
|
assert.equal(config.hosters['voe.sx'].enabled, true);
|
||||||
// Other hosters should still have defaults (empty arrays)
|
assert.equal(config.hosters['voe.sx'].apiKey, '');
|
||||||
assert.ok(Array.isArray(config.hosters['voe.sx']));
|
|
||||||
assert.equal(config.hosters['voe.sx'].length, 0);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('hosterSettings merge fills gaps with defaults', () => {
|
it('hosterSettings merge fills gaps with defaults', () => {
|
||||||
@ -85,11 +83,11 @@ describe('ConfigStore', () => {
|
|||||||
it('save only updates provided sections', async () => {
|
it('save only updates provided sections', async () => {
|
||||||
// Save hoster settings first
|
// Save hoster settings first
|
||||||
await store.save({ hosterSettings: { 'doodstream.com': { retries: 10, maxSpeedKbs: 0, parallelCount: 2, restartBelowKbs: 0, timeIntervalSec: 0, maxSizeMb: 0 } } });
|
await store.save({ hosterSettings: { 'doodstream.com': { retries: 10, maxSpeedKbs: 0, parallelCount: 2, restartBelowKbs: 0, timeIntervalSec: 0, maxSizeMb: 0 } } });
|
||||||
// Save hosters credentials separately (array format)
|
// Save hosters credentials separately
|
||||||
await store.save({ hosters: { 'doodstream.com': [{ id: 'test-1', enabled: true, authType: 'api', apiKey: 'key123' }] } });
|
await store.save({ hosters: { 'doodstream.com': { enabled: true, apiKey: 'key123' } } });
|
||||||
|
|
||||||
const config = store.load();
|
const config = store.load();
|
||||||
assert.equal(config.hosters['doodstream.com'][0].apiKey, 'key123');
|
assert.equal(config.hosters['doodstream.com'].apiKey, 'key123');
|
||||||
assert.equal(config.hosterSettings['doodstream.com'].retries, 10); // preserved
|
assert.equal(config.hosterSettings['doodstream.com'].retries, 10); // preserved
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user