Merge uploader 2.1.87 fixes into statistics development branch
This commit is contained in:
commit
ff62172778
26 files changed
+406
-102
No files matched your search
@@ -178,7 +178,7 @@ English is the default language for new profiles. Open **Settings > General** to
|
|||||||
|
|
||||||
### Local data and credentials
|
### Local data and credentials
|
||||||
|
|
||||||
Settings, pending queue state, and upload history are stored in Electron's user-data directory. Passwords and API keys must be encrypted with Electron `safeStorage` before they are written. On Windows, `safeStorage` uses DPAPI and ties encrypted values to the current Windows user profile. If operating-system encryption is unavailable or encryption fails, the write is rejected and credentials are never written as plaintext. Legacy plaintext credentials remain readable for migration and are encrypted during the next successful save.
|
Settings, pending queue state, and upload history are stored in Electron's user-data directory. Passwords and API keys must be encrypted with Electron `safeStorage` before they are written. On Windows, `safeStorage` uses DPAPI and ties encrypted values to the current Windows user profile. If operating-system encryption is unavailable or encryption fails, the write is rejected and credentials are never written as plaintext. Legacy plaintext credentials remain readable for migration and are encrypted during the next successful save. The app uses the asynchronous `safeStorage` API (`encryptStringAsync`, `decryptStringAsync`, `isAsyncEncryptionAvailable`). Values encrypted by earlier versions with the synchronous API keep the same `enc:v1:` format and remain readable; when `decryptStringAsync` reports `shouldReEncrypt`, the settings file is re-encrypted once after loading.
|
||||||
|
|
||||||
Credentials are decrypted when required for account validation or upload to the selected host. Do not share application data files, backup files, screenshots containing credentials, or generated backup keys.
|
Credentials are decrypted when required for account validation or upload to the selected host. Do not share application data files, backup files, screenshots containing credentials, or generated backup keys.
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const { EventEmitter } = require('node:events');
|
|||||||
const { ClouddropLogApi, CloudLogError } = require('./clouddrop-log-api');
|
const { ClouddropLogApi, CloudLogError } = require('./clouddrop-log-api');
|
||||||
const { iterateUploadLogEntries } = require('./upload-log');
|
const { iterateUploadLogEntries } = require('./upload-log');
|
||||||
|
|
||||||
const MAX_DOCUMENT_BYTES = 700000;
|
const MAX_DOCUMENT_BYTES = 4000000;
|
||||||
const hash = value => createHash('sha256').update(value).digest('hex');
|
const hash = value => createHash('sha256').update(value).digest('hex');
|
||||||
const validId = value => typeof value === 'string' && /^[a-zA-Z0-9_-]{1,100}$/.test(value);
|
const validId = value => typeof value === 'string' && /^[a-zA-Z0-9_-]{1,100}$/.test(value);
|
||||||
const blocksRetry = code => ['INVALID_KEY', 'ACCESS_DENIED', 'UNRESTRICTED_KEY_REQUIRED',
|
const blocksRetry = code => ['INVALID_KEY', 'ACCESS_DENIED', 'UNRESTRICTED_KEY_REQUIRED',
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class ClouddropLogApi {
|
|||||||
let size = 0;
|
let size = 0;
|
||||||
for await (const chunk of response.body) {
|
for await (const chunk of response.body) {
|
||||||
size += chunk.length;
|
size += chunk.length;
|
||||||
if (size > 2 * 1024 * 1024) {
|
if (size > 10 * 1024 * 1024) {
|
||||||
response.body.destroy();
|
response.body.destroy();
|
||||||
throw new CloudLogError('RESPONSE_TOO_LARGE');
|
throw new CloudLogError('RESPONSE_TOO_LARGE');
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-16
@@ -196,6 +196,7 @@ class ConfigStore {
|
|||||||
this._cacheKey = '';
|
this._cacheKey = '';
|
||||||
this._lastConfigCheck = 0;
|
this._lastConfigCheck = 0;
|
||||||
this._refreshTask = null;
|
this._refreshTask = null;
|
||||||
|
this._reEncryptScheduled = false;
|
||||||
this._perfLog = null;
|
this._perfLog = null;
|
||||||
this._wqDepth = 0;
|
this._wqDepth = 0;
|
||||||
|
|
||||||
@@ -458,11 +459,24 @@ class ConfigStore {
|
|||||||
const rotationCursors = (data.rotationCursors && typeof data.rotationCursors === 'object' && !Array.isArray(data.rotationCursors))
|
const rotationCursors = (data.rotationCursors && typeof data.rotationCursors === 'object' && !Array.isArray(data.rotationCursors))
|
||||||
? data.rotationCursors
|
? data.rotationCursors
|
||||||
: {};
|
: {};
|
||||||
const result = { hosters, hosterSettings, globalSettings, history: this._historyMigrated ? [] : (data.history || []), rotationCursors };
|
return { hosters, hosterSettings, globalSettings, history: this._historyMigrated ? [] : (data.history || []), rotationCursors };
|
||||||
// Decrypt credentials stored with safeStorage so the rest of the app
|
}
|
||||||
// keeps working with plaintext in memory.
|
|
||||||
secretStore.decryptCredentials(result);
|
async _normalizeAndDecrypt(data) {
|
||||||
return result;
|
const config = this._normalizeConfig(data);
|
||||||
|
const { shouldReEncrypt } = await secretStore.decryptCredentials(config);
|
||||||
|
return { config, shouldReEncrypt };
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
if (this._cache) return Promise.resolve();
|
||||||
|
return this.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
_scheduleReEncrypt() {
|
||||||
|
if (this._reEncryptScheduled || this._writesQuiesced) return;
|
||||||
|
this._reEncryptScheduled = true;
|
||||||
|
void this._enqueueWrite(async () => this._commit(this.load())).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
_loadImpl() {
|
_loadImpl() {
|
||||||
@@ -475,11 +489,14 @@ class ConfigStore {
|
|||||||
try { data = this._readAndParse(file); } catch {}
|
try { data = this._readAndParse(file); } catch {}
|
||||||
if (data) break;
|
if (data) break;
|
||||||
}
|
}
|
||||||
try { this._cache = this._normalizeConfig(data || {}); }
|
let normalized;
|
||||||
catch (error) {
|
try { normalized = this._normalizeConfig(data || {}); }
|
||||||
if (error instanceof secretStore.SecretStoreError) throw error;
|
catch { normalized = this._normalizeConfig({}); }
|
||||||
this._cache = this._normalizeConfig({});
|
if (secretStore.hasEncryptedCredentials(normalized)) {
|
||||||
|
this._scheduleConfigRefresh();
|
||||||
|
throw new secretStore.SecretStoreError('SECRET_STORE_NOT_READY', 'Gespeicherte Zugangsdaten wurden noch nicht geladen');
|
||||||
}
|
}
|
||||||
|
this._cache = normalized;
|
||||||
this._lastConfigCheck = Date.now();
|
this._lastConfigCheck = Date.now();
|
||||||
return this._clone(this._cache);
|
return this._clone(this._cache);
|
||||||
}
|
}
|
||||||
@@ -508,8 +525,10 @@ class ConfigStore {
|
|||||||
try {
|
try {
|
||||||
const data = JSON.parse(await fs.promises.readFile(file, 'utf8'));
|
const data = JSON.parse(await fs.promises.readFile(file, 'utf8'));
|
||||||
if (!data || typeof data !== 'object' || Array.isArray(data)) continue;
|
if (!data || typeof data !== 'object' || Array.isArray(data)) continue;
|
||||||
this._cache = this._normalizeConfig(data);
|
const { config, shouldReEncrypt } = await this._normalizeAndDecrypt(data);
|
||||||
|
this._cache = config;
|
||||||
this._cacheKey = file === this.filePath ? key : '';
|
this._cacheKey = file === this.filePath ? key : '';
|
||||||
|
if (shouldReEncrypt) this._scheduleReEncrypt();
|
||||||
return;
|
return;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof secretStore.SecretStoreError) throw error;
|
if (error instanceof secretStore.SecretStoreError) throw error;
|
||||||
@@ -523,20 +542,20 @@ class ConfigStore {
|
|||||||
// (history, globalSettings, …) is referenced read-only into the stringified
|
// (history, globalSettings, …) is referenced read-only into the stringified
|
||||||
// object. Deep-cloning the whole config here (incl. an ever-growing history)
|
// object. Deep-cloning the whole config here (incl. an ever-growing history)
|
||||||
// on every write was a primary long-running main-thread stall.
|
// on every write was a primary long-running main-thread stall.
|
||||||
_serializeForDisk(config) {
|
async _serializeForDisk(config) {
|
||||||
const hosters = this._clone(config.hosters || {});
|
const hosters = this._clone(config.hosters || {});
|
||||||
const globalSettings = this._clone(config.globalSettings || {});
|
const globalSettings = this._clone(config.globalSettings || {});
|
||||||
delete globalSettings.remote;
|
delete globalSettings.remote;
|
||||||
delete globalSettings.diagnostics;
|
delete globalSettings.diagnostics;
|
||||||
delete globalSettings.allowPlaintextCredentialStorage;
|
delete globalSettings.allowPlaintextCredentialStorage;
|
||||||
secretStore.encryptCredentials({ hosters, globalSettings });
|
await secretStore.encryptCredentials({ hosters, globalSettings });
|
||||||
return JSON.stringify({ ...config, globalSettings, hosters }, null, 2);
|
return JSON.stringify({ ...config, globalSettings, hosters }, null, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
_commit(config) {
|
async _commit(config) {
|
||||||
if (!this._perfLog) return this._atomicWrite(this._serializeForDisk(config));
|
if (!this._perfLog) return this._atomicWrite(await this._serializeForDisk(config));
|
||||||
const t0 = performance.now();
|
const t0 = performance.now();
|
||||||
const data = this._serializeForDisk(config);
|
const data = await this._serializeForDisk(config);
|
||||||
const dt = performance.now() - t0;
|
const dt = performance.now() - t0;
|
||||||
if (dt >= 20) {
|
if (dt >= 20) {
|
||||||
const q = this._pqLen(config.globalSettings);
|
const q = this._pqLen(config.globalSettings);
|
||||||
@@ -819,6 +838,7 @@ class ConfigStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _atomicWrite(data) {
|
async _atomicWrite(data) {
|
||||||
|
const { config: nextCache } = await this._normalizeAndDecrypt(JSON.parse(data));
|
||||||
const tmpPath = this.filePath + '.tmp';
|
const tmpPath = this.filePath + '.tmp';
|
||||||
const backupPath = this.filePath + '.bak';
|
const backupPath = this.filePath + '.bak';
|
||||||
const fileHandle = await fs.promises.open(tmpPath, 'w');
|
const fileHandle = await fs.promises.open(tmpPath, 'w');
|
||||||
@@ -836,7 +856,7 @@ class ConfigStore {
|
|||||||
if (current && current.trim().length > 2) await fs.promises.writeFile(backupPath, current, 'utf-8');
|
if (current && current.trim().length > 2) await fs.promises.writeFile(backupPath, current, 'utf-8');
|
||||||
} catch {}
|
} catch {}
|
||||||
await fs.promises.rename(tmpPath, this.filePath);
|
await fs.promises.rename(tmpPath, this.filePath);
|
||||||
this._cache = this._normalizeConfig(JSON.parse(data));
|
this._cache = nextCache;
|
||||||
this._cacheKey = '';
|
this._cacheKey = '';
|
||||||
this._lastConfigCheck = Date.now();
|
this._lastConfigCheck = Date.now();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,6 +232,12 @@ class DoodstreamUploader {
|
|||||||
this.sessId = '';
|
this.sessId = '';
|
||||||
const guest = /utype\s*:\s*['"]anon['"]/.test(html);
|
const guest = /utype\s*:\s*['"]anon['"]/.test(html);
|
||||||
_debugLog(`session-missing HTTP=${res.status} guest=${guest} cookies=${this.cookies.size}`, true);
|
_debugLog(`session-missing HTTP=${res.status} guest=${guest} cookies=${this.cookies.size}`, true);
|
||||||
|
if (res.status !== 200) {
|
||||||
|
const error = new Error(`DoodStream: Upload-Seite antwortete mit HTTP ${res.status}`);
|
||||||
|
if (res.status >= 500 || res.status === 408) error.transientNetwork = true;
|
||||||
|
else error.accountError = true;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
throw new Error('Doodstream: sess_id nicht gefunden nach Login');
|
throw new Error('Doodstream: sess_id nicht gefunden nach Login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const { isStagedSourceFile } = require('./source-cleanup-policy');
|
||||||
|
|
||||||
async function walkFolderAsync(rootDir, options = {}) {
|
async function walkFolderAsync(rootDir, options = {}) {
|
||||||
const fsPromises = options.fsPromises || fs.promises;
|
const fsPromises = options.fsPromises || fs.promises;
|
||||||
@@ -22,7 +23,7 @@ async function walkFolderAsync(rootDir, options = {}) {
|
|||||||
const fullPath = pathImpl.join(dir, entry.name);
|
const fullPath = pathImpl.join(dir, entry.name);
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
if (recursive) stack.push(fullPath);
|
if (recursive) stack.push(fullPath);
|
||||||
} else if (entry.isFile()) {
|
} else if (entry.isFile() && !isStagedSourceFile(entry.name)) {
|
||||||
let size = 0;
|
let size = 0;
|
||||||
try {
|
try {
|
||||||
size = (await fsPromises.stat(fullPath)).size;
|
size = (await fsPromises.stat(fullPath)).size;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ const path = require('path');
|
|||||||
const chokidar = require('chokidar');
|
const chokidar = require('chokidar');
|
||||||
const { walkFolderAsync } = require('./file-discovery');
|
const { walkFolderAsync } = require('./file-discovery');
|
||||||
const { normalizeAutomationSettings } = require('./automation-control');
|
const { normalizeAutomationSettings } = require('./automation-control');
|
||||||
|
const { isStagedSourceFile } = require('./source-cleanup-policy');
|
||||||
|
|
||||||
class FolderMonitor extends EventEmitter {
|
class FolderMonitor extends EventEmitter {
|
||||||
constructor({
|
constructor({
|
||||||
@@ -267,6 +268,7 @@ class FolderMonitor extends EventEmitter {
|
|||||||
|
|
||||||
_onNewFile(filePath, generation) {
|
_onNewFile(filePath, generation) {
|
||||||
if (!this._acceptCallback(generation)) return;
|
if (!this._acceptCallback(generation)) return;
|
||||||
|
if (isStagedSourceFile(filePath)) return;
|
||||||
if (!this._classifyPath(filePath, this._settings).allowed) return;
|
if (!this._classifyPath(filePath, this._settings).allowed) return;
|
||||||
const normalized = this._normalizePath(filePath);
|
const normalized = this._normalizePath(filePath);
|
||||||
const ownsSeenReservation = !!this._settings?.skipDuplicates && !this._seenFiles.has(normalized);
|
const ownsSeenReservation = !!this._settings?.skipDuplicates && !this._seenFiles.has(normalized);
|
||||||
@@ -381,6 +383,7 @@ class FolderMonitor extends EventEmitter {
|
|||||||
for (const descriptor of discovered) {
|
for (const descriptor of discovered) {
|
||||||
if (!this._isCurrent(generation)) return [];
|
if (!this._isCurrent(generation)) return [];
|
||||||
if (!settings.recursive && this._isNestedPath(descriptor.path, settings.folderPath)) continue;
|
if (!settings.recursive && this._isNestedPath(descriptor.path, settings.folderPath)) continue;
|
||||||
|
if (isStagedSourceFile(descriptor.path)) continue;
|
||||||
const classification = this._classifyPath(descriptor.path, settings);
|
const classification = this._classifyPath(descriptor.path, settings);
|
||||||
let mtimeMs = 0;
|
let mtimeMs = 0;
|
||||||
try {
|
try {
|
||||||
|
|||||||
+8
-3
@@ -1,4 +1,5 @@
|
|||||||
const { statUploadFile, readUploadFile } = require('./upload-file-io');
|
const { statUploadFile, readUploadFile } = require('./upload-file-io');
|
||||||
|
const { findAttachmentVoidPatches, applyPatches } = require('./matroska-attachments');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const { request } = require('undici');
|
const { request } = require('undici');
|
||||||
@@ -284,7 +285,7 @@ async function buildMultipart(filePath, formFields) {
|
|||||||
return { boundary, preambleBuf, epilogueBuf, totalSize, fileSize };
|
return { boundary, preambleBuf, epilogueBuf, totalSize, fileSize };
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createUploadBody(filePath, formFields, onProgress, throttle, signal) {
|
async function createUploadBody(filePath, formFields, onProgress, throttle, signal, patches = []) {
|
||||||
const { boundary, preambleBuf, epilogueBuf, totalSize, fileSize } = await buildMultipart(filePath, formFields);
|
const { boundary, preambleBuf, epilogueBuf, totalSize, fileSize } = await buildMultipart(filePath, formFields);
|
||||||
|
|
||||||
let bytesRead = 0;
|
let bytesRead = 0;
|
||||||
@@ -294,8 +295,9 @@ async function createUploadBody(filePath, formFields, onProgress, throttle, sign
|
|||||||
for await (const chunk of readUploadFile(filePath, signal)) {
|
for await (const chunk of readUploadFile(filePath, signal)) {
|
||||||
if (signal && signal.aborted) throw new Error('Aborted');
|
if (signal && signal.aborted) throw new Error('Aborted');
|
||||||
if (throttle) await throttle.consume(chunk.length, signal);
|
if (throttle) await throttle.consume(chunk.length, signal);
|
||||||
|
const chunkOffset = bytesRead;
|
||||||
bytesRead += chunk.length;
|
bytesRead += chunk.length;
|
||||||
yield chunk;
|
yield patches.length ? applyPatches(chunk, chunkOffset, patches) : chunk;
|
||||||
if (onProgress) onProgress(bytesRead, fileSize);
|
if (onProgress) onProgress(bytesRead, fileSize);
|
||||||
}
|
}
|
||||||
yield epilogueBuf;
|
yield epilogueBuf;
|
||||||
@@ -556,7 +558,9 @@ async function uploadFile(hosterName, filePath, apiKey, onProgress, signal, thro
|
|||||||
const targetUrl = config.buildUploadUrl(uploadUrl, apiKey);
|
const targetUrl = config.buildUploadUrl(uploadUrl, apiKey);
|
||||||
const formFields = config.formFields(apiKey);
|
const formFields = config.formFields(apiKey);
|
||||||
|
|
||||||
const { iterable, boundary, totalSize } = await createUploadBody(filePath, formFields, onProgress, throttle, signal);
|
const patches = hosterName === 'byse.sx' ? await findAttachmentVoidPatches(filePath).catch(() => []) : [];
|
||||||
|
if (patches.length && opts && typeof opts.onAttachmentsHidden === 'function') opts.onAttachmentsHidden(patches.length);
|
||||||
|
const { iterable, boundary, totalSize } = await createUploadBody(filePath, formFields, onProgress, throttle, signal, patches);
|
||||||
|
|
||||||
const { body, statusCode, headers } = await request(targetUrl, {
|
const { body, statusCode, headers } = await request(targetUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -717,6 +721,7 @@ module.exports = {
|
|||||||
prefetchBaseline,
|
prefetchBaseline,
|
||||||
HOSTER_CONFIGS,
|
HOSTER_CONFIGS,
|
||||||
__test: {
|
__test: {
|
||||||
|
createUploadBody,
|
||||||
extractUploadServerUrl,
|
extractUploadServerUrl,
|
||||||
parseVoeResult,
|
parseVoeResult,
|
||||||
parseDoodstreamResult,
|
parseDoodstreamResult,
|
||||||
|
|||||||
@@ -0,0 +1,154 @@
|
|||||||
|
const fs = require('node:fs');
|
||||||
|
|
||||||
|
const EBML_ID = 0x1A45DFA3;
|
||||||
|
const SEGMENT_ID = 0x18538067;
|
||||||
|
const SEEK_HEAD_ID = 0x114D9B74;
|
||||||
|
const SEEK_ID = 0x4DBB;
|
||||||
|
const SEEK_ID_ID = 0x53AB;
|
||||||
|
const SEEK_POSITION_ID = 0x53AC;
|
||||||
|
const ATTACHMENTS_ID = 0x1941A469;
|
||||||
|
const CLUSTER_ID = 0x1F43B675;
|
||||||
|
const VOID_ID = 0xEC;
|
||||||
|
const MAX_TOP_LEVEL_ELEMENTS = 256;
|
||||||
|
const MAX_SEEK_HEAD_BYTES = 64 * 1024;
|
||||||
|
|
||||||
|
function readVint(buffer, offset, keepMarker) {
|
||||||
|
const first = buffer[offset];
|
||||||
|
if (first === undefined || first === 0) return null;
|
||||||
|
let length = 1;
|
||||||
|
while (length <= 8 && !(first & (0x80 >> (length - 1)))) length++;
|
||||||
|
if (length > 8 || offset + length > buffer.length) return null;
|
||||||
|
let value = keepMarker ? first : first & (0xFF >> length);
|
||||||
|
let unknown = value === (0xFF >> length);
|
||||||
|
for (let index = 1; index < length; index++) {
|
||||||
|
const byte = buffer[offset + index];
|
||||||
|
value = value * 256 + byte;
|
||||||
|
if (byte !== 0xFF) unknown = false;
|
||||||
|
}
|
||||||
|
return { value, length, unknown: !keepMarker && unknown };
|
||||||
|
}
|
||||||
|
|
||||||
|
function encodeVint(value, length) {
|
||||||
|
if (!Number.isSafeInteger(value) || value < 0 || length < 1 || length > 8) return null;
|
||||||
|
if (value >= 2 ** (7 * length) - 1) return null;
|
||||||
|
const bytes = Buffer.alloc(length);
|
||||||
|
let rest = value;
|
||||||
|
for (let index = length - 1; index >= 0; index--) {
|
||||||
|
bytes[index] = rest % 256;
|
||||||
|
rest = Math.floor(rest / 256);
|
||||||
|
}
|
||||||
|
bytes[0] |= 0x80 >> (length - 1);
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
function voidHeader(headerLength, payloadLength) {
|
||||||
|
const single = encodeVint(payloadLength, headerLength - 1);
|
||||||
|
if (single) return Buffer.concat([Buffer.from([VOID_ID]), single]);
|
||||||
|
for (let sizeLength = 8; sizeLength >= 1; sizeLength--) {
|
||||||
|
const filler = headerLength - 2 - 1 - sizeLength;
|
||||||
|
if (filler < 0 || filler > 126) continue;
|
||||||
|
const size = encodeVint(payloadLength, sizeLength);
|
||||||
|
if (!size) continue;
|
||||||
|
return Buffer.concat([Buffer.from([VOID_ID, 0x80 | filler]), Buffer.alloc(filler), Buffer.from([VOID_ID]), size]);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function readAt(handle, position, length) {
|
||||||
|
const buffer = Buffer.alloc(length);
|
||||||
|
const { bytesRead } = await handle.read(buffer, 0, length, position);
|
||||||
|
return buffer.subarray(0, bytesRead);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function readElementHeader(handle, position) {
|
||||||
|
const buffer = await readAt(handle, position, 12);
|
||||||
|
const id = readVint(buffer, 0, true);
|
||||||
|
if (!id || id.length > 4) return null;
|
||||||
|
const size = readVint(buffer, id.length, false);
|
||||||
|
if (!size) return null;
|
||||||
|
return { id: id.value, position, headerLength: id.length + size.length, size: size.unknown ? null : size.value };
|
||||||
|
}
|
||||||
|
|
||||||
|
function seekTargets(buffer, segmentDataStart) {
|
||||||
|
const targets = [];
|
||||||
|
let offset = 0;
|
||||||
|
while (offset < buffer.length) {
|
||||||
|
const id = readVint(buffer, offset, true);
|
||||||
|
const size = id && readVint(buffer, offset + id.length, false);
|
||||||
|
if (!id || !size || size.unknown) break;
|
||||||
|
const start = offset + id.length + size.length;
|
||||||
|
const end = start + size.value;
|
||||||
|
if (end > buffer.length) break;
|
||||||
|
if (id.value === SEEK_ID) {
|
||||||
|
let inner = start;
|
||||||
|
let seekId = null;
|
||||||
|
let seekPosition = null;
|
||||||
|
while (inner < end) {
|
||||||
|
const childId = readVint(buffer, inner, true);
|
||||||
|
const childSize = childId && readVint(buffer, inner + childId.length, false);
|
||||||
|
if (!childId || !childSize || childSize.unknown) break;
|
||||||
|
const valueStart = inner + childId.length + childSize.length;
|
||||||
|
const valueEnd = valueStart + childSize.value;
|
||||||
|
if (valueEnd > end) break;
|
||||||
|
let value = 0;
|
||||||
|
for (let index = valueStart; index < valueEnd; index++) value = value * 256 + buffer[index];
|
||||||
|
if (childId.value === SEEK_ID_ID) seekId = value;
|
||||||
|
if (childId.value === SEEK_POSITION_ID) seekPosition = value;
|
||||||
|
inner = valueEnd;
|
||||||
|
}
|
||||||
|
if (seekId === ATTACHMENTS_ID && Number.isSafeInteger(seekPosition)) targets.push(segmentDataStart + seekPosition);
|
||||||
|
}
|
||||||
|
offset = end;
|
||||||
|
}
|
||||||
|
return targets;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findAttachmentVoidPatches(filePath, { open = file => fs.promises.open(file, 'r') } = {}) {
|
||||||
|
const handle = await open(filePath);
|
||||||
|
try {
|
||||||
|
const { size: fileSize } = await handle.stat();
|
||||||
|
const ebml = await readElementHeader(handle, 0);
|
||||||
|
if (!ebml || ebml.id !== EBML_ID || ebml.size === null) return [];
|
||||||
|
const segment = await readElementHeader(handle, ebml.headerLength + ebml.size);
|
||||||
|
if (!segment || segment.id !== SEGMENT_ID) return [];
|
||||||
|
const segmentDataStart = segment.position + segment.headerLength;
|
||||||
|
const segmentEnd = segment.size === null ? fileSize : Math.min(fileSize, segmentDataStart + segment.size);
|
||||||
|
const candidates = new Set();
|
||||||
|
let position = segmentDataStart;
|
||||||
|
for (let count = 0; count < MAX_TOP_LEVEL_ELEMENTS && position < segmentEnd; count++) {
|
||||||
|
const element = await readElementHeader(handle, position);
|
||||||
|
if (!element || element.size === null || element.id === CLUSTER_ID) break;
|
||||||
|
if (element.id === ATTACHMENTS_ID) candidates.add(position);
|
||||||
|
if (element.id === SEEK_HEAD_ID && element.size <= MAX_SEEK_HEAD_BYTES) {
|
||||||
|
const content = await readAt(handle, position + element.headerLength, element.size);
|
||||||
|
for (const target of seekTargets(content, segmentDataStart)) candidates.add(target);
|
||||||
|
}
|
||||||
|
position += element.headerLength + element.size;
|
||||||
|
}
|
||||||
|
const patches = [];
|
||||||
|
for (const candidate of [...candidates].sort((a, b) => a - b)) {
|
||||||
|
const element = await readElementHeader(handle, candidate);
|
||||||
|
if (!element || element.id !== ATTACHMENTS_ID || element.size === null) continue;
|
||||||
|
if (candidate + element.headerLength + element.size > segmentEnd) continue;
|
||||||
|
const bytes = voidHeader(element.headerLength, element.size);
|
||||||
|
if (bytes && bytes.length === element.headerLength) patches.push({ offset: candidate, bytes });
|
||||||
|
}
|
||||||
|
return patches;
|
||||||
|
} finally {
|
||||||
|
await handle.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyPatches(chunk, chunkOffset, patches) {
|
||||||
|
let patched = chunk;
|
||||||
|
for (const patch of patches) {
|
||||||
|
const start = Math.max(patch.offset, chunkOffset);
|
||||||
|
const end = Math.min(patch.offset + patch.bytes.length, chunkOffset + chunk.length);
|
||||||
|
if (start >= end) continue;
|
||||||
|
if (patched === chunk) patched = Buffer.from(chunk);
|
||||||
|
patch.bytes.copy(patched, start - chunkOffset, start - patch.offset, end - patch.offset);
|
||||||
|
}
|
||||||
|
return patched;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { findAttachmentVoidPatches, applyPatches, __test: { readVint, encodeVint, voidHeader } };
|
||||||
+10
-4
@@ -16,7 +16,7 @@ function page(items, args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createMcpApp({ loadConfig, invoke, invokeGuarded = (_context, channel, ...args) => invoke(channel, ...args), renderer, collectors, getGrants, trashFile, canWrite,
|
function createMcpApp({ loadConfig, invoke, invokeGuarded = (_context, channel, ...args) => invoke(channel, ...args), renderer, collectors, getGrants, trashFile, canWrite,
|
||||||
getCapabilities, getProtectedPaths, getInstallationId, getDiagnosticSources, getRuntimeDiagnostics = () => null, getPerformance = () => null, getSystemMetrics = () => null, profile, updates }) {
|
getCapabilities, getProtectedPaths, getInstallationId, getDiagnosticSources, getRuntimeDiagnostics = () => null, getPerformance = () => null, getSystemMetrics = () => null, profile, updates, grantDirectory }) {
|
||||||
const transfers = createMcpTransfers({ getGrants, getCapabilities, getProtectedPaths, getInstallationId });
|
const transfers = createMcpTransfers({ getGrants, getCapabilities, getProtectedPaths, getInstallationId });
|
||||||
const sanitize = createMcpSanitizer(loadConfig);
|
const sanitize = createMcpSanitizer(loadConfig);
|
||||||
const guard = context => {
|
const guard = context => {
|
||||||
@@ -67,15 +67,21 @@ function createMcpApp({ loadConfig, invoke, invokeGuarded = (_context, channel,
|
|||||||
...createMcpFiles({ getGrants, trashFile }),
|
...createMcpFiles({ getGrants, trashFile }),
|
||||||
...transfers.handlers,
|
...transfers.handlers,
|
||||||
...createMcpDiagnostics({ getSources: getDiagnosticSources, redact: text => sanitize(redactLogText(text, collectSecretValues(loadConfig()))) }),
|
...createMcpDiagnostics({ getSources: getDiagnosticSources, redact: text => sanitize(redactLogText(text, collectSecretValues(loadConfig()))) }),
|
||||||
|
mhu_files_grant: async ({ path: directory, readOnly, allowTransfer }, context) => {
|
||||||
|
canWrite(); guard(context);
|
||||||
|
if (typeof grantDirectory !== 'function') throw new McpAccessError('ACTION_UNAVAILABLE');
|
||||||
|
return grantDirectory(directory, { readOnly: readOnly !== false, allowTransfer: allowTransfer === true });
|
||||||
|
},
|
||||||
mhu_app_info: () => invoke('get-app-info'),
|
mhu_app_info: () => invoke('get-app-info'),
|
||||||
mhu_capabilities: () => {
|
mhu_capabilities: () => {
|
||||||
const permissions = getCapabilities?.() || [];
|
const permissions = getCapabilities?.() || [];
|
||||||
const settings = loadConfig().globalSettings;
|
const settings = loadConfig().globalSettings;
|
||||||
return { permissions, tools: MCP_TOOLS.filter(tool => tool.requiredScopes.every(scope => permissions.includes(scope))).map(tool => ({
|
const fullAccess = permissions.includes('full_access');
|
||||||
|
return { permissions, tools: MCP_TOOLS.filter(tool => fullAccess || tool.requiredScopes.every(scope => permissions.includes(scope))).map(tool => ({
|
||||||
name: tool.name, readOnly: tool.annotations.readOnlyHint, requiredScopes: tool.requiredScopes,
|
name: tool.name, readOnly: tool.annotations.readOnlyHint, requiredScopes: tool.requiredScopes,
|
||||||
localConfirmation: tool.destructive || requiresMcpConfirmation(tool.name, {}, settings),
|
localConfirmation: !fullAccess && (tool.destructive || requiresMcpConfirmation(tool.name, {}, settings)),
|
||||||
conditionalConfirmation: tool.name === 'mhu_settings_update'
|
conditionalConfirmation: tool.name === 'mhu_settings_update'
|
||||||
})), boundaries: ['Permissions and directory grants can only be changed locally.', 'Destructive actions require an exact local confirmation; MCP cannot approve it.', 'No arbitrary shell, SQL, mouse/keyboard or screen control.', 'Paused automation is resumed with mhu_automation_resume. A disabled monitor requires mhu_automation_start.'] };
|
})), boundaries: [fullAccess ? 'Full access: actions run without local confirmation. Permissions, and narrowing or removing directory grants, can only be changed locally.' : 'Permissions and directory grants can only be changed locally.', fullAccess ? 'mhu_files_grant can add or widen directory grants.' : 'Destructive actions require an exact local confirmation; MCP cannot approve it.', 'No arbitrary shell, SQL, mouse/keyboard or screen control.', 'Paused automation is resumed with mhu_automation_resume. A disabled monitor requires mhu_automation_start.'] };
|
||||||
},
|
},
|
||||||
mhu_performance_get: () => getPerformance(),
|
mhu_performance_get: () => getPerformance(),
|
||||||
mhu_profile_start: args => profile.start(args.seconds),
|
mhu_profile_start: args => profile.start(args.seconds),
|
||||||
|
|||||||
+21
-2
@@ -25,7 +25,10 @@ class McpService {
|
|||||||
this.protocol = null;
|
this.protocol = null;
|
||||||
this.generation = 0;
|
this.generation = 0;
|
||||||
}
|
}
|
||||||
capabilities() { return this.active ? this.store.value.capabilities : []; }
|
capabilities() {
|
||||||
|
if (!this.active) return [];
|
||||||
|
return this.store.value.capabilities.includes('full_access') ? [...CAPABILITIES] : this.store.value.capabilities;
|
||||||
|
}
|
||||||
state() {
|
state() {
|
||||||
const { name, capabilities, grants, enabled, identity, revocations } = this.store.value;
|
const { name, capabilities, grants, enabled, identity, revocations } = this.store.value;
|
||||||
return { name, capabilities, grants, enabled: this.active && enabled, connection: this.connection, installationId: identity?.installationId || null,
|
return { name, capabilities, grants, enabled: this.active && enabled, connection: this.connection, installationId: identity?.installationId || null,
|
||||||
@@ -86,7 +89,7 @@ class McpService {
|
|||||||
}
|
}
|
||||||
configure(args) {
|
configure(args) {
|
||||||
validateInput(args, { type: 'object', additionalProperties: false, required: ['enabled', 'name', 'capabilities'], properties: {
|
validateInput(args, { type: 'object', additionalProperties: false, required: ['enabled', 'name', 'capabilities'], properties: {
|
||||||
enabled: { type: 'boolean' }, name: { type: 'string', minLength: 1, maxLength: 100 }, capabilities: { type: 'array', maxItems: 5, items: { type: 'string', enum: CAPABILITIES } }
|
enabled: { type: 'boolean' }, name: { type: 'string', minLength: 1, maxLength: 100 }, capabilities: { type: 'array', maxItems: CAPABILITIES.length, items: { type: 'string', enum: CAPABILITIES } }
|
||||||
} });
|
} });
|
||||||
if (!args.name.trim()) throw new McpAccessError('INVALID_ARGUMENTS');
|
if (!args.name.trim()) throw new McpAccessError('INVALID_ARGUMENTS');
|
||||||
this.active = false;
|
this.active = false;
|
||||||
@@ -143,6 +146,22 @@ class McpService {
|
|||||||
this.publish(); return this.state();
|
this.publish(); return this.state();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
grantDirectory(directory, { readOnly = true, allowTransfer = false } = {}) {
|
||||||
|
return this.serialize(async () => {
|
||||||
|
if (!this.ready) throw new McpAccessError('ACCESS_STORE_UNAVAILABLE');
|
||||||
|
if (typeof directory !== 'string' || !path.isAbsolute(directory)) throw new McpAccessError('PATH_NOT_GRANTED');
|
||||||
|
const resolved = await fs.realpath(directory).catch(() => { throw new McpAccessError('PATH_NOT_GRANTED'); });
|
||||||
|
const stat = await fs.stat(resolved);
|
||||||
|
if (!stat.isDirectory() || path.parse(resolved).root === resolved) throw new McpAccessError('PATH_NOT_GRANTED');
|
||||||
|
const existing = this.store.value.grants.find(grant => grant.path === resolved);
|
||||||
|
if (existing && ((existing.readOnly === false && readOnly) || (existing.allowTransfer === true && !allowTransfer))) throw new McpAccessError('GRANT_NARROWING_LOCAL_ONLY');
|
||||||
|
if (!existing && this.store.value.grants.length >= 30) throw new McpAccessError('GRANT_LIMIT');
|
||||||
|
const grant = existing ? { ...existing, readOnly, allowTransfer } : { id: randomUUID(), label: path.basename(resolved), path: resolved, readOnly, allowTransfer };
|
||||||
|
await this.store.save({ ...this.store.value, grants: existing ? this.store.value.grants.map(item => item.id === existing.id ? grant : item) : [...this.store.value.grants, grant] });
|
||||||
|
this.publish();
|
||||||
|
return { id: grant.id, label: grant.label, readOnly: grant.readOnly, allowTransfer: grant.allowTransfer };
|
||||||
|
});
|
||||||
|
}
|
||||||
updateGrant(id, remove, readOnly = true, allowTransfer) {
|
updateGrant(id, remove, readOnly = true, allowTransfer) {
|
||||||
const generation = this.generation;
|
const generation = this.generation;
|
||||||
return this.serialize(async () => {
|
return this.serialize(async () => {
|
||||||
|
|||||||
+18
-7
@@ -4,7 +4,7 @@ const { randomUUID, randomBytes } = require('node:crypto');
|
|||||||
const { McpAccessError } = require('./mcp-access');
|
const { McpAccessError } = require('./mcp-access');
|
||||||
|
|
||||||
const RELAY_URL = 'https://downloader.24-music.de/mcp-relay';
|
const RELAY_URL = 'https://downloader.24-music.de/mcp-relay';
|
||||||
const CAPABILITIES = ['read', 'control', 'files', 'secrets', 'updates'];
|
const CAPABILITIES = ['read', 'control', 'files', 'secrets', 'updates', 'full_access'];
|
||||||
|
|
||||||
class McpStore {
|
class McpStore {
|
||||||
constructor({ directory, encrypt, decrypt }) {
|
constructor({ directory, encrypt, decrypt }) {
|
||||||
@@ -27,15 +27,18 @@ class McpStore {
|
|||||||
|| value.grants.some(grant => !grant || typeof grant.id !== 'string' || typeof grant.path !== 'string' || !path.isAbsolute(grant.path)
|
|| value.grants.some(grant => !grant || typeof grant.id !== 'string' || typeof grant.path !== 'string' || !path.isAbsolute(grant.path)
|
||||||
|| typeof grant.label !== 'string' || typeof grant.readOnly !== 'boolean'
|
|| typeof grant.label !== 'string' || typeof grant.readOnly !== 'boolean'
|
||||||
|| (grant.allowTransfer !== undefined && typeof grant.allowTransfer !== 'boolean'))) throw new Error('format');
|
|| (grant.allowTransfer !== undefined && typeof grant.allowTransfer !== 'boolean'))) throw new Error('format');
|
||||||
const decode = identity => {
|
const decode = async identity => {
|
||||||
if (!identity) return null;
|
if (!identity) return null;
|
||||||
if (identity.relayUrl !== RELAY_URL || !/^[a-f0-9-]{36}$/.test(identity.installationId)) throw new Error('identity');
|
if (identity.relayUrl !== RELAY_URL || !/^[a-f0-9-]{36}$/.test(identity.installationId)) throw new Error('identity');
|
||||||
if (!identity.agentToken?.startsWith('enc:v1:') || !identity.clientToken?.startsWith('enc:v1:')) throw new Error('encryption');
|
if (!identity.agentToken?.startsWith('enc:v1:') || !identity.clientToken?.startsWith('enc:v1:')) throw new Error('encryption');
|
||||||
const decoded = { ...identity, agentToken: this.decrypt(identity.agentToken), clientToken: this.decrypt(identity.clientToken) };
|
const decoded = { ...identity, agentToken: await this.decrypt(identity.agentToken), clientToken: await this.decrypt(identity.clientToken) };
|
||||||
if (![decoded.agentToken, decoded.clientToken].every(token => /^[A-Za-z0-9_-]{43}$/.test(token)) || decoded.agentToken === decoded.clientToken) throw new Error('credentials');
|
if (![decoded.agentToken, decoded.clientToken].every(token => /^[A-Za-z0-9_-]{43}$/.test(token)) || decoded.agentToken === decoded.clientToken) throw new Error('credentials');
|
||||||
return decoded;
|
return decoded;
|
||||||
};
|
};
|
||||||
this.value = { ...value, capabilities: value.capabilities.filter(item => CAPABILITIES.includes(item)), identity: decode(value.identity), revocations: value.revocations.map(decode) };
|
const identity = await decode(value.identity);
|
||||||
|
const revocations = [];
|
||||||
|
for (const revoked of value.revocations) revocations.push(await decode(revoked));
|
||||||
|
this.value = { ...value, capabilities: value.capabilities.filter(item => CAPABILITIES.includes(item)), identity, revocations };
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
this.value.enabled = false;
|
this.value.enabled = false;
|
||||||
if (this.value.identity) {
|
if (this.value.identity) {
|
||||||
@@ -55,13 +58,21 @@ class McpStore {
|
|||||||
finally { await handle.close(); }
|
finally { await handle.close(); }
|
||||||
}
|
}
|
||||||
async clearDisabled() { await fs.unlink(this.disabledMarker).catch(error => { if (error.code !== 'ENOENT') throw error; }); }
|
async clearDisabled() { await fs.unlink(this.disabledMarker).catch(error => { if (error.code !== 'ENOENT') throw error; }); }
|
||||||
async save(next) {
|
async _encode(next) {
|
||||||
const encode = identity => identity ? { ...identity, agentToken: this.encrypt(identity.agentToken), clientToken: this.encrypt(identity.clientToken) } : null;
|
const encode = async identity => identity ? { ...identity, agentToken: await this.encrypt(identity.agentToken), clientToken: await this.encrypt(identity.clientToken) } : null;
|
||||||
const disk = { ...next, identity: encode(next.identity), revocations: next.revocations.map(encode) };
|
const revocations = [];
|
||||||
|
for (const revoked of next.revocations) revocations.push(await encode(revoked));
|
||||||
|
const disk = { ...next, identity: await encode(next.identity), revocations };
|
||||||
for (const identity of [disk.identity, ...disk.revocations].filter(Boolean)) {
|
for (const identity of [disk.identity, ...disk.revocations].filter(Boolean)) {
|
||||||
if (!identity.agentToken.startsWith('enc:v1:') || !identity.clientToken.startsWith('enc:v1:')) throw new McpAccessError('ENCRYPTION_UNAVAILABLE');
|
if (!identity.agentToken.startsWith('enc:v1:') || !identity.clientToken.startsWith('enc:v1:')) throw new McpAccessError('ENCRYPTION_UNAVAILABLE');
|
||||||
}
|
}
|
||||||
|
return disk;
|
||||||
|
}
|
||||||
|
save(next) {
|
||||||
|
const encoded = this._encode(next);
|
||||||
|
encoded.catch(() => {});
|
||||||
const task = this.tail.then(async () => {
|
const task = this.tail.then(async () => {
|
||||||
|
const disk = await encoded;
|
||||||
await fs.mkdir(path.dirname(this.file), { recursive: true });
|
await fs.mkdir(path.dirname(this.file), { recursive: true });
|
||||||
const temporary = this.file + '.' + randomUUID() + '.tmp';
|
const temporary = this.file + '.' + randomUUID() + '.tmp';
|
||||||
try { await fs.writeFile(temporary, JSON.stringify(disk), { mode: 0o600, flag: 'wx' }); await fs.rename(temporary, this.file); }
|
try { await fs.writeFile(temporary, JSON.stringify(disk), { mode: 0o600, flag: 'wx' }); await fs.rename(temporary, this.file); }
|
||||||
|
|||||||
+4
-2
@@ -98,6 +98,7 @@ const definitions = [
|
|||||||
{ transferId: id, offset: integer(0, 32 * 1024 ** 3), length: integer(1, 1024 * 1024) }, ['transferId', 'offset']],
|
{ transferId: id, offset: integer(0, 32 * 1024 ** 3), length: integer(1, 1024 * 1024) }, ['transferId', 'offset']],
|
||||||
['files_transfer_close', 'Close an owned temporary transfer handle without modifying its source file.', 'files', { transferId: id }, ['transferId']],
|
['files_transfer_close', 'Close an owned temporary transfer handle without modifying its source file.', 'files', { transferId: id }, ['transferId']],
|
||||||
['files_delete', 'Delete a specifically selected file inside a writable grant.', 'files.write', file, ['rootId', 'relativePath'], true],
|
['files_delete', 'Delete a specifically selected file inside a writable grant.', 'files.write', file, ['rootId', 'relativePath'], true],
|
||||||
|
['files_grant', 'Grant or widen access to an absolute local directory. Requires full access; narrowing or removing a grant stays local.', 'full_access', { path: text(), readOnly: boolean, allowTransfer: boolean }, ['path']],
|
||||||
['cloud_status', 'Read CloudDrop log synchronization state.', 'read', {}, []],
|
['cloud_status', 'Read CloudDrop log synchronization state.', 'read', {}, []],
|
||||||
['cloud_configure', 'Enable or disable CloudDrop log sync with the saved or supplied key.', 'settings', { enabled: boolean, apiKey: text(200) }, ['enabled']],
|
['cloud_configure', 'Enable or disable CloudDrop log sync with the saved or supplied key.', 'settings', { enabled: boolean, apiKey: text(200) }, ['enabled']],
|
||||||
['cloud_backfill', 'Queue missing entries from the current local upload log.', 'control', {}, []],
|
['cloud_backfill', 'Queue missing entries from the current local upload log.', 'control', {}, []],
|
||||||
@@ -131,7 +132,8 @@ function createMcpToolAdapter({ handlers, authorizeConfirmation, sanitize, audit
|
|||||||
const tool = byName.get(name);
|
const tool = byName.get(name);
|
||||||
if (!tool || typeof handlers[name] !== 'function') throw new McpAccessError('TOOL_UNAVAILABLE');
|
if (!tool || typeof handlers[name] !== 'function') throw new McpAccessError('TOOL_UNAVAILABLE');
|
||||||
const allowed = () => getCapabilities ? getCapabilities() : context?.scopes;
|
const allowed = () => getCapabilities ? getCapabilities() : context?.scopes;
|
||||||
const permitted = () => Array.isArray(allowed()) && tool.requiredScopes.every(scope => allowed().includes(scope));
|
const fullAccess = () => Array.isArray(allowed()) && allowed().includes('full_access');
|
||||||
|
const permitted = () => Array.isArray(allowed()) && (fullAccess() || tool.requiredScopes.every(scope => allowed().includes(scope)));
|
||||||
if (!permitted()) throw new McpAccessError('SCOPE_DENIED');
|
if (!permitted()) throw new McpAccessError('SCOPE_DENIED');
|
||||||
validateInput(args, tool.inputSchema);
|
validateInput(args, tool.inputSchema);
|
||||||
if (context.signal?.aborted || !Number.isFinite(context.deadline) || context.deadline <= Date.now()) throw new McpAccessError('REQUEST_EXPIRED');
|
if (context.signal?.aborted || !Number.isFinite(context.deadline) || context.deadline <= Date.now()) throw new McpAccessError('REQUEST_EXPIRED');
|
||||||
@@ -150,7 +152,7 @@ function createMcpToolAdapter({ handlers, authorizeConfirmation, sanitize, audit
|
|||||||
const startedAt = Date.now();
|
const startedAt = Date.now();
|
||||||
if (context.signal?.aborted || Date.now() >= context.deadline) throw new McpAccessError('REQUEST_EXPIRED');
|
if (context.signal?.aborted || Date.now() >= context.deadline) throw new McpAccessError('REQUEST_EXPIRED');
|
||||||
if (!permitted()) throw new McpAccessError('SCOPE_DENIED');
|
if (!permitted()) throw new McpAccessError('SCOPE_DENIED');
|
||||||
if ((tool.destructive || requiresConfirmation(name, args)) && (!authorizeConfirmation || !await authorizeConfirmation({ tool: name, digest, args, context }))) throw new McpAccessError('CONFIRMATION_REQUIRED');
|
if (!fullAccess() && (tool.destructive || requiresConfirmation(name, args)) && (!authorizeConfirmation || !await authorizeConfirmation({ tool: name, digest, args, context }))) throw new McpAccessError('CONFIRMATION_REQUIRED');
|
||||||
if (context.signal?.aborted || Date.now() >= context.deadline) throw new McpAccessError('REQUEST_EXPIRED');
|
if (context.signal?.aborted || Date.now() >= context.deadline) throw new McpAccessError('REQUEST_EXPIRED');
|
||||||
if (!permitted()) throw new McpAccessError('SCOPE_DENIED');
|
if (!permitted()) throw new McpAccessError('SCOPE_DENIED');
|
||||||
audit({ tool: name, event: 'started', requestId: context.requestId, durationMs: 0 });
|
audit({ tool: name, event: 'started', requestId: context.requestId, durationMs: 0 });
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ function createOnlineBackupKeyring({
|
|||||||
return canonicalJson({ generation: document.generation, keys: document.keys });
|
return canonicalJson({ generation: document.generation, keys: document.keys });
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateEntry(entry) {
|
async function validateEntry(entry) {
|
||||||
const hasLegacyShape = hasExactKeys(entry, STORED_LEGACY_ENTRY_KEYS);
|
const hasLegacyShape = hasExactKeys(entry, STORED_LEGACY_ENTRY_KEYS);
|
||||||
const hasIpShape = hasExactKeys(entry, STORED_IP_ENTRY_KEYS);
|
const hasIpShape = hasExactKeys(entry, STORED_IP_ENTRY_KEYS);
|
||||||
const hasExpiringShape = hasExactKeys(entry, STORED_EXPIRING_ENTRY_KEYS) || hasIpShape;
|
const hasExpiringShape = hasExactKeys(entry, STORED_EXPIRING_ENTRY_KEYS) || hasIpShape;
|
||||||
@@ -214,7 +214,7 @@ function createOnlineBackupKeyring({
|
|||||||
}
|
}
|
||||||
let key;
|
let key;
|
||||||
try {
|
try {
|
||||||
key = decryptField(entry.encryptedKey);
|
key = await decryptField(entry.encryptedKey);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return { issue: decryptionIssue(error), id: entry.id };
|
return { issue: decryptionIssue(error), id: entry.id };
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ function createOnlineBackupKeyring({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function inspectSource(source) {
|
async function inspectSource(source) {
|
||||||
const idCounts = new Map();
|
const idCounts = new Map();
|
||||||
for (const entry of source.document.keys) {
|
for (const entry of source.document.keys) {
|
||||||
if (isCanonicalId(entry?.id)) idCounts.set(entry.id, (idCounts.get(entry.id) || 0) + 1);
|
if (isCanonicalId(entry?.id)) idCounts.set(entry.id, (idCounts.get(entry.id) || 0) + 1);
|
||||||
@@ -248,7 +248,7 @@ function createOnlineBackupKeyring({
|
|||||||
const problems = [];
|
const problems = [];
|
||||||
for (const entry of source.document.keys) {
|
for (const entry of source.document.keys) {
|
||||||
if (duplicateIds.has(entry?.id)) continue;
|
if (duplicateIds.has(entry?.id)) continue;
|
||||||
const result = validateEntry(entry);
|
const result = await validateEntry(entry);
|
||||||
if (result.entry) entries.push(result.entry);
|
if (result.entry) entries.push(result.entry);
|
||||||
else problems.push({ code: result.issue, id: result.id });
|
else problems.push({ code: result.issue, id: result.id });
|
||||||
}
|
}
|
||||||
@@ -307,12 +307,12 @@ function createOnlineBackupKeyring({
|
|||||||
modified = (await fsImpl.stat(candidatePath)).mtimeMs;
|
modified = (await fsImpl.stat(candidatePath)).mtimeMs;
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
states.push(inspectSource({ ...candidate, modified, recovered: candidatePath !== filePath }));
|
states.push(await inspectSource({ ...candidate, modified, recovered: candidatePath !== filePath }));
|
||||||
}
|
}
|
||||||
if (states.length === 0) {
|
if (states.length === 0) {
|
||||||
if (observedCandidate) throw issueError(KEYRING_ERROR_CODES.structure);
|
if (observedCandidate) throw issueError(KEYRING_ERROR_CODES.structure);
|
||||||
const document = { version: 1, generation: 0, keys: [] };
|
const document = { version: 1, generation: 0, keys: [] };
|
||||||
return inspectSource({
|
return await inspectSource({
|
||||||
status: 'valid',
|
status: 'valid',
|
||||||
path: filePath,
|
path: filePath,
|
||||||
contents: JSON.stringify({ version: 1, keys: [] }),
|
contents: JSON.stringify({ version: 1, keys: [] }),
|
||||||
@@ -408,7 +408,7 @@ function createOnlineBackupKeyring({
|
|||||||
async function validateStaging(stagingPath, generation, payload) {
|
async function validateStaging(stagingPath, generation, payload) {
|
||||||
const candidate = await readCandidate(stagingPath);
|
const candidate = await readCandidate(stagingPath);
|
||||||
if (candidate.status !== 'valid') throw issueError(KEYRING_ERROR_CODES.structure);
|
if (candidate.status !== 'valid') throw issueError(KEYRING_ERROR_CODES.structure);
|
||||||
const state = inspectSource({ ...candidate, recovered: false });
|
const state = await inspectSource({ ...candidate, recovered: false });
|
||||||
const blockingIssue = firstBlockingIssue(state);
|
const blockingIssue = firstBlockingIssue(state);
|
||||||
if (blockingIssue) throw issueError(blockingIssue);
|
if (blockingIssue) throw issueError(blockingIssue);
|
||||||
if (state.generation !== generation || state.payload !== payload) throw issueError(KEYRING_ERROR_CODES.structure);
|
if (state.generation !== generation || state.payload !== payload) throw issueError(KEYRING_ERROR_CODES.structure);
|
||||||
@@ -474,7 +474,7 @@ function createOnlineBackupKeyring({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare(key, createdAt, expiresAt = null) {
|
async function prepare(key, createdAt, expiresAt = null) {
|
||||||
let parsed;
|
let parsed;
|
||||||
try {
|
try {
|
||||||
parsed = parseKey(key);
|
parsed = parseKey(key);
|
||||||
@@ -483,7 +483,7 @@ function createOnlineBackupKeyring({
|
|||||||
}
|
}
|
||||||
let encryptedKey;
|
let encryptedKey;
|
||||||
try {
|
try {
|
||||||
encryptedKey = encryptField(key);
|
encryptedKey = await encryptField(key);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw encryptionError(error);
|
throw encryptionError(error);
|
||||||
}
|
}
|
||||||
@@ -505,7 +505,7 @@ function createOnlineBackupKeyring({
|
|||||||
|
|
||||||
function commit(entry) {
|
function commit(entry) {
|
||||||
return serialize(async () => {
|
return serialize(async () => {
|
||||||
const validated = validateEntry(entry);
|
const validated = await validateEntry(entry);
|
||||||
if (!validated.entry) throw issueError(validated.issue);
|
if (!validated.entry) throw issueError(validated.issue);
|
||||||
const state = await readState();
|
const state = await readState();
|
||||||
const blockingIssue = firstBlockingIssue(state);
|
const blockingIssue = firstBlockingIssue(state);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ function createOnlineBackupManager({
|
|||||||
const settings = await loadSettings();
|
const settings = await loadSettings();
|
||||||
const recoveryPublicKey = await loadRecoveryPublicKey();
|
const recoveryPublicKey = await loadRecoveryPublicKey();
|
||||||
const created = createBackup(settings, appVersion(), createdAt, retention, recoveryPublicKey);
|
const created = createBackup(settings, appVersion(), createdAt, retention, recoveryPublicKey);
|
||||||
let prepared = keyring.prepare(created.key, createdAt, created.expiresAt ?? null);
|
let prepared = await keyring.prepare(created.key, createdAt, created.expiresAt ?? null);
|
||||||
const metadata = await uploadBackup(created.record);
|
const metadata = await uploadBackup(created.record);
|
||||||
if (metadata?.sourceIp) prepared = Object.freeze({ ...prepared, sourceIp: metadata.sourceIp });
|
if (metadata?.sourceIp) prepared = Object.freeze({ ...prepared, sourceIp: metadata.sourceIp });
|
||||||
try {
|
try {
|
||||||
|
|||||||
+58
-30
@@ -20,12 +20,12 @@ class SecretStoreError extends Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let _safeStorageCache = undefined;
|
let _safeStorageCache = undefined;
|
||||||
function getSafeStorage() {
|
async function getSafeStorage() {
|
||||||
if (_safeStorageCache !== undefined) return _safeStorageCache;
|
if (_safeStorageCache !== undefined) return _safeStorageCache;
|
||||||
try {
|
try {
|
||||||
const { safeStorage } = require('electron');
|
const { safeStorage } = require('electron');
|
||||||
if (safeStorage && typeof safeStorage.isEncryptionAvailable === 'function'
|
if (safeStorage && typeof safeStorage.isAsyncEncryptionAvailable === 'function'
|
||||||
&& safeStorage.isEncryptionAvailable()) {
|
&& await safeStorage.isAsyncEncryptionAvailable()) {
|
||||||
_safeStorageCache = safeStorage;
|
_safeStorageCache = safeStorage;
|
||||||
return _safeStorageCache;
|
return _safeStorageCache;
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,14 @@ function getSafeStorage() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unavailableError() {
|
||||||
|
return new SecretStoreError('SECRET_STORE_UNAVAILABLE', 'Sicherer Zugangsdaten-Speicher ist nicht verfügbar');
|
||||||
|
}
|
||||||
|
|
||||||
|
function decryptFailedError(cause) {
|
||||||
|
return new SecretStoreError('SECRET_STORE_DECRYPT_FAILED', 'Gespeicherte Zugangsdaten konnten nicht entschlüsselt werden', cause);
|
||||||
|
}
|
||||||
|
|
||||||
function isEncrypted(value) {
|
function isEncrypted(value) {
|
||||||
if (typeof value !== 'string' || !value.startsWith(SENTINEL)) return false;
|
if (typeof value !== 'string' || !value.startsWith(SENTINEL)) return false;
|
||||||
const encoded = value.slice(SENTINEL.length);
|
const encoded = value.slice(SENTINEL.length);
|
||||||
@@ -41,68 +49,88 @@ function isEncrypted(value) {
|
|||||||
return decoded.length > 0 && decoded.toString('base64') === encoded;
|
return decoded.length > 0 && decoded.toString('base64') === encoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
function encryptField(value) {
|
async function encryptField(value) {
|
||||||
if (!value || typeof value !== 'string') return value;
|
if (!value || typeof value !== 'string') return value;
|
||||||
if (isEncrypted(value)) return value;
|
if (isEncrypted(value)) return value;
|
||||||
const ss = getSafeStorage();
|
const ss = await getSafeStorage();
|
||||||
if (!ss) {
|
if (!ss) throw unavailableError();
|
||||||
throw new SecretStoreError('SECRET_STORE_UNAVAILABLE', 'Sicherer Zugangsdaten-Speicher ist nicht verfügbar');
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const buf = ss.encryptString(value);
|
const buf = await ss.encryptStringAsync(value);
|
||||||
return SENTINEL + buf.toString('base64');
|
return SENTINEL + Buffer.from(buf).toString('base64');
|
||||||
} catch (cause) {
|
} catch (cause) {
|
||||||
throw new SecretStoreError('SECRET_STORE_ENCRYPT_FAILED', 'Zugangsdaten konnten nicht sicher verschlüsselt werden', cause);
|
throw new SecretStoreError('SECRET_STORE_ENCRYPT_FAILED', 'Zugangsdaten konnten nicht sicher verschlüsselt werden', cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function decryptField(value) {
|
async function decryptFieldWithStatus(value) {
|
||||||
if (!value || typeof value !== 'string') return value;
|
if (!value || typeof value !== 'string') return { value, shouldReEncrypt: false };
|
||||||
if (!isEncrypted(value)) {
|
if (!isEncrypted(value)) {
|
||||||
if (value.startsWith(SENTINEL)) {
|
if (value.startsWith(SENTINEL)) throw decryptFailedError();
|
||||||
throw new SecretStoreError('SECRET_STORE_DECRYPT_FAILED', 'Gespeicherte Zugangsdaten konnten nicht entschlüsselt werden');
|
return { value, shouldReEncrypt: false };
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
const ss = getSafeStorage();
|
|
||||||
if (!ss) {
|
|
||||||
throw new SecretStoreError('SECRET_STORE_UNAVAILABLE', 'Sicherer Zugangsdaten-Speicher ist nicht verfügbar');
|
|
||||||
}
|
}
|
||||||
|
const ss = await getSafeStorage();
|
||||||
|
if (!ss) throw unavailableError();
|
||||||
|
let decrypted;
|
||||||
try {
|
try {
|
||||||
const buf = Buffer.from(value.slice(SENTINEL.length), 'base64');
|
decrypted = await ss.decryptStringAsync(Buffer.from(value.slice(SENTINEL.length), 'base64'));
|
||||||
return ss.decryptString(buf);
|
|
||||||
} catch (cause) {
|
} catch (cause) {
|
||||||
throw new SecretStoreError('SECRET_STORE_DECRYPT_FAILED', 'Gespeicherte Zugangsdaten konnten nicht entschlüsselt werden', cause);
|
throw decryptFailedError(cause);
|
||||||
}
|
}
|
||||||
|
if (!decrypted || typeof decrypted.result !== 'string') throw decryptFailedError();
|
||||||
|
return { value: decrypted.result, shouldReEncrypt: decrypted.shouldReEncrypt === true };
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapHosterAccounts(config, fn) {
|
async function decryptField(value) {
|
||||||
if (config?.globalSettings?.cloudLogSync?.apiKey) {
|
return (await decryptFieldWithStatus(value)).value;
|
||||||
config.globalSettings.cloudLogSync.apiKey = fn(config.globalSettings.cloudLogSync.apiKey);
|
|
||||||
}
|
}
|
||||||
if (!config || !config.hosters || typeof config.hosters !== 'object') return config;
|
|
||||||
|
function credentialSlots(config) {
|
||||||
|
const slots = [];
|
||||||
|
const cloudLogSync = config?.globalSettings?.cloudLogSync;
|
||||||
|
if (cloudLogSync?.apiKey) slots.push([cloudLogSync, 'apiKey']);
|
||||||
|
if (!config || !config.hosters || typeof config.hosters !== 'object') return slots;
|
||||||
for (const accounts of Object.values(config.hosters)) {
|
for (const accounts of Object.values(config.hosters)) {
|
||||||
if (!Array.isArray(accounts)) continue;
|
if (!Array.isArray(accounts)) continue;
|
||||||
for (const acc of accounts) {
|
for (const acc of accounts) {
|
||||||
if (!acc || typeof acc !== 'object') continue;
|
if (!acc || typeof acc !== 'object') continue;
|
||||||
for (const f of CRED_FIELDS) {
|
for (const f of CRED_FIELDS) {
|
||||||
if (acc[f]) acc[f] = fn(acc[f]);
|
if (acc[f]) slots.push([acc, f]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return slots;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function mapHosterAccounts(config, fn) {
|
||||||
|
for (const [owner, field] of credentialSlots(config)) owner[field] = await fn(owner[field]);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
function encryptCredentials(config) {
|
function hasEncryptedCredentials(config) {
|
||||||
|
return credentialSlots(config).some(([owner, field]) => typeof owner[field] === 'string' && owner[field].startsWith(SENTINEL));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function encryptCredentials(config) {
|
||||||
return mapHosterAccounts(config, encryptField);
|
return mapHosterAccounts(config, encryptField);
|
||||||
}
|
}
|
||||||
function decryptCredentials(config) { return mapHosterAccounts(config, decryptField); }
|
|
||||||
|
async function decryptCredentials(config) {
|
||||||
|
let shouldReEncrypt = false;
|
||||||
|
await mapHosterAccounts(config, async value => {
|
||||||
|
const decrypted = await decryptFieldWithStatus(value);
|
||||||
|
if (decrypted.shouldReEncrypt) shouldReEncrypt = true;
|
||||||
|
return decrypted.value;
|
||||||
|
});
|
||||||
|
return { config, shouldReEncrypt };
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
SecretStoreError,
|
SecretStoreError,
|
||||||
encryptField,
|
encryptField,
|
||||||
decryptField,
|
decryptField,
|
||||||
|
decryptFieldWithStatus,
|
||||||
encryptCredentials,
|
encryptCredentials,
|
||||||
decryptCredentials,
|
decryptCredentials,
|
||||||
|
hasEncryptedCredentials,
|
||||||
isEncrypted
|
isEncrypted
|
||||||
};
|
};
|
||||||
@@ -3,6 +3,16 @@
|
|||||||
|
|
||||||
const pathApi = typeof require === 'function' ? require('path') : null;
|
const pathApi = typeof require === 'function' ? require('path') : null;
|
||||||
const protectedStatuses = new Set(['done', 'error', 'aborted', 'skipped']);
|
const protectedStatuses = new Set(['done', 'error', 'aborted', 'skipped']);
|
||||||
|
const stagedSourcePattern = /^\..+\.mhu-delete-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
||||||
|
|
||||||
|
function stagedSourceName(fileName, id) {
|
||||||
|
return `.${fileName}.mhu-delete-${id}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isStagedSourceFile(file) {
|
||||||
|
if (typeof file !== 'string' || !file) return false;
|
||||||
|
return stagedSourcePattern.test(file.split(/[\\/]/).pop());
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeFile(file, platform) {
|
function normalizeFile(file, platform) {
|
||||||
const value = typeof file === 'string' ? file.trim() : '';
|
const value = typeof file === 'string' ? file.trim() : '';
|
||||||
@@ -212,7 +222,9 @@
|
|||||||
prepareGroups,
|
prepareGroups,
|
||||||
markCompleted,
|
markCompleted,
|
||||||
removeRequirement,
|
removeRequirement,
|
||||||
applyFingerprints
|
applyFingerprints,
|
||||||
|
stagedSourceName,
|
||||||
|
isStagedSourceFile
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof module !== 'undefined' && module.exports) {
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const RETRY_DELAYS = [100, 250, 500, 1000, 2000];
|
const RETRY_DELAYS = [100, 250, 500, 1000, 2000];
|
||||||
const TERMINAL_STATUSES = new Set(['done', 'error', 'aborted', 'skipped', 'failed', 'missing-account']);
|
const TERMINAL_STATUSES = new Set(['done', 'error', 'aborted', 'skipped', 'failed', 'missing-account']);
|
||||||
const crypto = require('node:crypto');
|
const crypto = require('node:crypto');
|
||||||
|
const { stagedSourceName } = require('./source-cleanup-policy');
|
||||||
|
|
||||||
function createSourceFileCleanup(options) {
|
function createSourceFileCleanup(options) {
|
||||||
if (!options || !options.fs || !options.path) {
|
if (!options || !options.fs || !options.path) {
|
||||||
@@ -174,7 +175,12 @@ function createSourceFileCleanup(options) {
|
|||||||
const canonicalFile = canonicalize(input.file);
|
const canonicalFile = canonicalize(input.file);
|
||||||
const manifest = createManifest(input, canonicalFile);
|
const manifest = createManifest(input, canonicalFile);
|
||||||
const leaseToken = leases.get(canonicalFile);
|
const leaseToken = leases.get(canonicalFile);
|
||||||
if (leaseToken && leaseToken !== token) {
|
const previousOwner = leaseToken && leaseToken !== token ? groups.get(leaseToken) : null;
|
||||||
|
if (previousOwner && previousOwner.canonicalFile === canonicalFile && canBeSuperseded(previousOwner)) {
|
||||||
|
previousOwner.registrationOutcome = previousOwner.registrationOutcome || 'superseded';
|
||||||
|
leases.set(canonicalFile, token);
|
||||||
|
await inspectRegistration(manifest);
|
||||||
|
} else if (leaseToken && leaseToken !== token) {
|
||||||
manifest.registrationOutcome = 'blocked';
|
manifest.registrationOutcome = 'blocked';
|
||||||
manifest.registrationError = new Error('active-source-lease');
|
manifest.registrationError = new Error('active-source-lease');
|
||||||
const leaseOwner = groups.get(leaseToken);
|
const leaseOwner = groups.get(leaseToken);
|
||||||
@@ -208,6 +214,12 @@ function createSourceFileCleanup(options) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function canBeSuperseded(manifest) {
|
||||||
|
return !manifest.finalizationPromise
|
||||||
|
&& manifest.jobs.size > 0
|
||||||
|
&& [...manifest.jobs.values()].every((job) => job.status !== 'pending');
|
||||||
|
}
|
||||||
|
|
||||||
function isReady(manifest) {
|
function isReady(manifest) {
|
||||||
return !manifest.finalizationPromise
|
return !manifest.finalizationPromise
|
||||||
&& !manifest.registrationOutcome
|
&& !manifest.registrationOutcome
|
||||||
@@ -311,6 +323,7 @@ function createSourceFileCleanup(options) {
|
|||||||
await fs.promises.unlink(file);
|
await fs.promises.unlink(file);
|
||||||
return { attempts };
|
return { attempts };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
if (error && error.code === 'ENOENT') return { attempts, alreadyRemoved: true };
|
||||||
const retryable = platform === 'win32' && error && (error.code === 'EBUSY' || error.code === 'EPERM');
|
const retryable = platform === 'win32' && error && (error.code === 'EBUSY' || error.code === 'EPERM');
|
||||||
if (!retryable || attempts > RETRY_DELAYS.length) throw Object.assign(error, { cleanupAttempts: attempts });
|
if (!retryable || attempts > RETRY_DELAYS.length) throw Object.assign(error, { cleanupAttempts: attempts });
|
||||||
await wait(RETRY_DELAYS[attempts - 1]);
|
await wait(RETRY_DELAYS[attempts - 1]);
|
||||||
@@ -335,7 +348,7 @@ function createSourceFileCleanup(options) {
|
|||||||
async function stageSource(manifest) {
|
async function stageSource(manifest) {
|
||||||
const stagedFile = path.join(
|
const stagedFile = path.join(
|
||||||
path.dirname(manifest.file),
|
path.dirname(manifest.file),
|
||||||
`.${path.basename(manifest.file)}.mhu-delete-${crypto.randomUUID()}`
|
stagedSourceName(path.basename(manifest.file), crypto.randomUUID())
|
||||||
);
|
);
|
||||||
if (!journal || typeof journal.plan !== 'function') {
|
if (!journal || typeof journal.plan !== 'function') {
|
||||||
return { outcome: 'blocked', trigger: 'delete-journal-unavailable' };
|
return { outcome: 'blocked', trigger: 'delete-journal-unavailable' };
|
||||||
@@ -453,6 +466,7 @@ function createSourceFileCleanup(options) {
|
|||||||
await emitAudit(manifest, 'deleted', {
|
await emitAudit(manifest, 'deleted', {
|
||||||
trigger: 'all-selected-hosters-succeeded',
|
trigger: 'all-selected-hosters-succeeded',
|
||||||
attempts: result.attempts,
|
attempts: result.attempts,
|
||||||
|
...(result.alreadyRemoved ? { alreadyRemoved: true } : {}),
|
||||||
...scope
|
...scope
|
||||||
});
|
});
|
||||||
return 'deleted';
|
return 'deleted';
|
||||||
|
|||||||
@@ -435,6 +435,7 @@ class UploadManager extends EventEmitter {
|
|||||||
this._batchResults = results;
|
this._batchResults = results;
|
||||||
this._batchTaskCount = tasks.length;
|
this._batchTaskCount = tasks.length;
|
||||||
this._additionalPromises = []; // Track jobs added mid-batch via addJobs()
|
this._additionalPromises = []; // Track jobs added mid-batch via addJobs()
|
||||||
|
this._batchTaskCount = tasks.length;
|
||||||
|
|
||||||
const DEDUP_CHUNK = 200;
|
const DEDUP_CHUNK = 200;
|
||||||
for (let i = 0; i < tasks.length; i += DEDUP_CHUNK) {
|
for (let i = 0; i < tasks.length; i += DEDUP_CHUNK) {
|
||||||
@@ -1374,6 +1375,11 @@ class UploadManager extends EventEmitter {
|
|||||||
if (task.hoster === 'byse.sx') {
|
if (task.hoster === 'byse.sx') {
|
||||||
baselineOpts.byseBaseline = await this._getBaseline('byse.sx', task.apiKey, signal);
|
baselineOpts.byseBaseline = await this._getBaseline('byse.sx', task.apiKey, signal);
|
||||||
if (fileProbe && fileProbe.ok !== false) baselineOpts.probeIsVideoLike = fileProbe.isVideoLike === true;
|
if (fileProbe && fileProbe.ok !== false) baselineOpts.probeIsVideoLike = fileProbe.isVideoLike === true;
|
||||||
|
baselineOpts.onAttachmentsHidden = (count) => this._rotLog('byse-attachments-hidden', {
|
||||||
|
jobId: task.jobId,
|
||||||
|
fileName: path.basename(task.file),
|
||||||
|
count
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (task.hoster === 'doodstream.com') baselineOpts.doodBaseline = await this._getBaseline('doodstream.com', task.apiKey, signal);
|
if (task.hoster === 'doodstream.com') baselineOpts.doodBaseline = await this._getBaseline('doodstream.com', task.apiKey, signal);
|
||||||
return uploadFile(task.hoster, task.file, task.apiKey, progressCb, signal, throttle, baselineOpts);
|
return uploadFile(task.hoster, task.file, task.apiKey, progressCb, signal, throttle, baselineOpts);
|
||||||
@@ -1560,6 +1566,7 @@ class UploadManager extends EventEmitter {
|
|||||||
results.set(task.file, { name: fileName, size: 0, results: [] });
|
results.set(task.file, { name: fileName, size: 0, results: [] });
|
||||||
}
|
}
|
||||||
this._additionalPromises.push(this._runJob(task, results, signal));
|
this._additionalPromises.push(this._runJob(task, results, signal));
|
||||||
|
this._batchTaskCount++;
|
||||||
addResult.added++;
|
addResult.added++;
|
||||||
this._batchTaskCount++;
|
this._batchTaskCount++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2015,6 +2015,7 @@ async function runAutomaticUpdateCheck(forceRefresh) {
|
|||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
await mcpUpdate.load().catch(() => logError('MCP update state unavailable'));
|
await mcpUpdate.load().catch(() => logError('MCP update state unavailable'));
|
||||||
if (!_hasSingleInstanceLock) return;
|
if (!_hasSingleInstanceLock) return;
|
||||||
|
await configStore.init().catch(error => logError(`config load failed: ${error?.code || error?.message || error}`));
|
||||||
statisticsReady = configStore.loadHistory().then(history => uploadStatistics.init(history));
|
statisticsReady = configStore.loadHistory().then(history => uploadStatistics.init(history));
|
||||||
await statisticsReady.catch(error => debugLog(`statistics init failed: ${error.message}`));
|
await statisticsReady.catch(error => debugLog(`statistics init failed: ${error.message}`));
|
||||||
statisticsTimer = setInterval(() => { void uploadStatistics.flush().catch(error => debugLog(`statistics save failed: ${error.message}`)); }, 5000);
|
statisticsTimer = setInterval(() => { void uploadStatistics.flush().catch(error => debugLog(`statistics save failed: ${error.message}`)); }, 5000);
|
||||||
@@ -3662,8 +3663,8 @@ ipcMain.handle('import-upload-log', async () => {
|
|||||||
return { entries, path: filePaths[0] };
|
return { entries, path: filePaths[0] };
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('copy-to-clipboard', (_event, text) => {
|
ipcMain.handle('copy-to-clipboard', async (_event, text) => {
|
||||||
clipboard.writeText(text);
|
await clipboard.writeText(text);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4301,6 +4302,7 @@ async function startMcpService() {
|
|||||||
getSystemMetrics: args => systemMetrics.snapshot(args),
|
getSystemMetrics: args => systemMetrics.snapshot(args),
|
||||||
getGrants: () => mcpService?.store.value.grants || [], trashFile: file => require('electron').shell.trashItem(file), canWrite: assertConfigWriteAllowed,
|
getGrants: () => mcpService?.store.value.grants || [], trashFile: file => require('electron').shell.trashItem(file), canWrite: assertConfigWriteAllowed,
|
||||||
getCapabilities: () => mcpService?.capabilities() || [],
|
getCapabilities: () => mcpService?.capabilities() || [],
|
||||||
|
grantDirectory: (directory, options) => mcpService.grantDirectory(directory, options),
|
||||||
getProtectedPaths: () => [app.getPath('userData'), configStore.filePath, configStore.historyPath, configStore.automationCompletionPath],
|
getProtectedPaths: () => [app.getPath('userData'), configStore.filePath, configStore.historyPath, configStore.automationCompletionPath],
|
||||||
getInstallationId: () => mcpService?.store.value.identity?.installationId,
|
getInstallationId: () => mcpService?.store.value.identity?.installationId,
|
||||||
getRuntimeDiagnostics: () => ({
|
getRuntimeDiagnostics: () => ({
|
||||||
@@ -4338,7 +4340,7 @@ ipcMain.on('mcp:reply', (event, payload) => {
|
|||||||
});
|
});
|
||||||
ipcMain.handle('mcp:configure', async (event, args) => {
|
ipcMain.handle('mcp:configure', async (event, args) => {
|
||||||
if (!isTrustedOnlineBackupIpcEvent(event) || !mcpService) throw new Error('MCP_ACCESS_DENIED');
|
if (!isTrustedOnlineBackupIpcEvent(event) || !mcpService) throw new Error('MCP_ACCESS_DENIED');
|
||||||
if (args?.enabled && (args.capabilities?.includes('secrets') || (args.capabilities?.includes('updates') && !mcpService.capabilities().includes('updates')) || !mcpService.active)) {
|
if (args?.enabled && (args.capabilities?.includes('secrets') || (args.capabilities?.includes('full_access') && !mcpService.capabilities().includes('full_access')) || (args.capabilities?.includes('updates') && !mcpService.capabilities().includes('updates')) || !mcpService.active)) {
|
||||||
const result = await dialog.showMessageBox(mainWindow, { type: 'warning', title: 'MCP-Zugriff / MCP access', message: 'MCP-Zugriff mit diesen Berechtigungen aktivieren? / Enable MCP with these capabilities?',
|
const result = await dialog.showMessageBox(mainWindow, { type: 'warning', title: 'MCP-Zugriff / MCP access', message: 'MCP-Zugriff mit diesen Berechtigungen aktivieren? / Enable MCP with these capabilities?',
|
||||||
detail: String(args.capabilities?.join(', ') || '').slice(0, 100), buttons: ['Abbrechen / Cancel', 'Aktivieren / Enable'], defaultId: 0, cancelId: 0, noLink: true });
|
detail: String(args.capabilities?.join(', ') || '').slice(0, 100), buttons: ['Abbrechen / Cancel', 'Aktivieren / Enable'], defaultId: 0, cancelId: 0, noLink: true });
|
||||||
if (result.response !== 1) return mcpService.state();
|
if (result.response !== 1) return mcpService.state();
|
||||||
@@ -4350,9 +4352,9 @@ ipcMain.handle('mcp:rotate', async event => {
|
|||||||
const result = await dialog.showMessageBox(mainWindow, { type: 'warning', message: shellText('MCP-Zugang erneuern? Der bisherige Code wird ungültig.', 'Rotate MCP access? The previous code becomes invalid.'), buttons: ['Abbrechen / Cancel', 'Erneuern / Rotate'], defaultId: 0, cancelId: 0, noLink: true });
|
const result = await dialog.showMessageBox(mainWindow, { type: 'warning', message: shellText('MCP-Zugang erneuern? Der bisherige Code wird ungültig.', 'Rotate MCP access? The previous code becomes invalid.'), buttons: ['Abbrechen / Cancel', 'Erneuern / Rotate'], defaultId: 0, cancelId: 0, noLink: true });
|
||||||
return result.response === 1 ? mcpService.rotate() : mcpService.state();
|
return result.response === 1 ? mcpService.rotate() : mcpService.state();
|
||||||
});
|
});
|
||||||
ipcMain.handle('mcp:copy-code', event => {
|
ipcMain.handle('mcp:copy-code', async event => {
|
||||||
if (!isTrustedOnlineBackupIpcEvent(event) || !mcpService?.active) throw new Error('MCP_ACCESS_DENIED');
|
if (!isTrustedOnlineBackupIpcEvent(event) || !mcpService?.active) throw new Error('MCP_ACCESS_DENIED');
|
||||||
clipboard.writeText(mcpService.store.code());
|
await clipboard.writeText(mcpService.store.code());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
ipcMain.handle('mcp:add-grant', async event => {
|
ipcMain.handle('mcp:add-grant', async event => {
|
||||||
|
|||||||
Generated
+8
-8
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "2.1.79",
|
"version": "2.1.87",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "2.1.79",
|
"version": "2.1.87",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chokidar": "^4.0.3",
|
"chokidar": "^4.0.3",
|
||||||
"undici": "7.29.1",
|
"undici": "7.29.1",
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@modelcontextprotocol/sdk": "1.32.1",
|
"@modelcontextprotocol/sdk": "1.32.1",
|
||||||
"electron": "^41.10.6",
|
"electron": "^45.0.0",
|
||||||
"electron-builder": "^26.15.3",
|
"electron-builder": "^26.15.3",
|
||||||
"eslint": "^10.8.1",
|
"eslint": "^10.8.1",
|
||||||
"eslint-plugin-security": "^4.0.1",
|
"eslint-plugin-security": "^4.0.1",
|
||||||
@@ -2073,11 +2073,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/electron": {
|
"node_modules/electron": {
|
||||||
"version": "41.10.7",
|
"version": "45.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/electron/-/electron-41.10.7.tgz",
|
"resolved": "https://registry.npmjs.org/electron/-/electron-45.0.0.tgz",
|
||||||
"integrity": "sha512-AqIiefddlf5i+HYCGatr8VlBuEbWJpad4/yloBFYcMB2r57j7xhW1ogiJ+BfA5kxQyfmSs5yjwy54Me+wJn1jw==",
|
"integrity": "sha512-yjz4uhMBcO6L5X7CWgRMobf2EMJPnb9j4zuf+nu/TU/6E4Sqfx7fn/a2eACo4qngjml/0JnsoZhxYroJLxLd2w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron-internal/extract-zip": "^1.0.1",
|
"@electron-internal/extract-zip": "^1.0.1",
|
||||||
@@ -2085,7 +2084,8 @@
|
|||||||
"@types/node": "^24.9.0"
|
"@types/node": "^24.9.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"electron": "cli.js"
|
"electron": "cli.js",
|
||||||
|
"install-electron": "install.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 22.12.0"
|
"node": ">= 22.12.0"
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-hoster-uploader",
|
"name": "multi-hoster-uploader",
|
||||||
"version": "2.1.79",
|
"version": "2.1.87",
|
||||||
"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": {
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@modelcontextprotocol/sdk": "1.32.1",
|
"@modelcontextprotocol/sdk": "1.32.1",
|
||||||
"electron": "^41.10.6",
|
"electron": "^45.0.0",
|
||||||
"electron-builder": "^26.15.3",
|
"electron-builder": "^26.15.3",
|
||||||
"eslint": "^10.8.1",
|
"eslint": "^10.8.1",
|
||||||
"eslint-plugin-security": "^4.0.1",
|
"eslint-plugin-security": "^4.0.1",
|
||||||
|
|||||||
+10
-2
@@ -445,6 +445,13 @@ function isStartableQueueJob(job) {
|
|||||||
return !!job && isStartableQueueStatus(job.status);
|
return !!job && isStartableQueueStatus(job.status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isAutomaticallyStartableQueueJob(job) {
|
||||||
|
if (!isStartableQueueJob(job)) return false;
|
||||||
|
if (window.SourceCleanupPolicy?.isStagedSourceFile(job.file || job.fileName)) return false;
|
||||||
|
if (job.status !== 'error' || !window.Stats) return true;
|
||||||
|
return window.Stats.classifyErrorCategory(job.error) !== 'file-rejected';
|
||||||
|
}
|
||||||
|
|
||||||
// Queue state
|
// Queue state
|
||||||
let queueJobs = []; // { id, file, fileName, hoster, status, bytesUploaded, bytesTotal, speedKbs, elapsed, remaining, error, result, attempt, maxAttempts, link }
|
let queueJobs = []; // { id, file, fileName, hoster, status, bytesUploaded, bytesTotal, speedKbs, elapsed, remaining, error, result, attempt, maxAttempts, link }
|
||||||
const _jobIndexById = new Map(); // id -> job (O(1) lookup)
|
const _jobIndexById = new Map(); // id -> job (O(1) lookup)
|
||||||
@@ -1040,7 +1047,7 @@ async function applyAutomationEvaluation(evaluation) {
|
|||||||
renderQueueTable();
|
renderQueueTable();
|
||||||
persistQueueStateSoon(true);
|
persistQueueStateSoon(true);
|
||||||
} else if (action === 'start') {
|
} else if (action === 'start') {
|
||||||
const result = await startUpload();
|
const result = await startUpload({ _automationStart: true });
|
||||||
if (result?.ok === false) {
|
if (result?.ok === false) {
|
||||||
return freezeAutomationValue({ ok: false, error: result.error, warning: null, admittedFiles: [], deferredFiles, paused: /pausiert/i.test(result.error), dryRun: false });
|
return freezeAutomationValue({ ok: false, error: result.error, warning: null, admittedFiles: [], deferredFiles, paused: /pausiert/i.test(result.error), dryRun: false });
|
||||||
}
|
}
|
||||||
@@ -4810,7 +4817,8 @@ async function startUpload(opts) {
|
|||||||
buildQueuePreview();
|
buildQueuePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
const jobsToStart = queueJobs.filter((job) => isStartableQueueStatus(job.status));
|
const automaticStart = !!(opts && (opts._autoRetry || opts._automationStart));
|
||||||
|
const jobsToStart = queueJobs.filter(automaticStart ? isAutomaticallyStartableQueueJob : isStartableQueueJob);
|
||||||
if (jobsToStart.length === 0) {
|
if (jobsToStart.length === 0) {
|
||||||
uploading = false;
|
uploading = false;
|
||||||
updateQueueActionButtons();
|
updateQueueActionButtons();
|
||||||
|
|||||||
@@ -79,6 +79,8 @@
|
|||||||
['Geprüfte Updates ohne erneute Bestätigung installieren. Uploads abschließen und danach fortsetzen. Keine Portable-Versionen.', 'Install verified updates without another confirmation. Finish uploads and resume afterwards. No portable versions.'],
|
['Geprüfte Updates ohne erneute Bestätigung installieren. Uploads abschließen und danach fortsetzen. Keine Portable-Versionen.', 'Install verified updates without another confirmation. Finish uploads and resume afterwards. No portable versions.'],
|
||||||
['Zugangsdaten auslesen', 'Reveal credentials'],
|
['Zugangsdaten auslesen', 'Reveal credentials'],
|
||||||
['Gespeicherte Zugangsdaten ausdrücklich freigeben. Zusätzliche lokale Bestätigung erforderlich.', 'Explicitly allow saved credentials to be read. Additional local confirmation required.'],
|
['Gespeicherte Zugangsdaten ausdrücklich freigeben. Zusätzliche lokale Bestätigung erforderlich.', 'Explicitly allow saved credentials to be read. Additional local confirmation required.'],
|
||||||
|
['Vollzugriff ohne Bestätigung', 'Full access without confirmation'],
|
||||||
|
['Alle Aktionen ohne lokale Bestätigung ausführen, auch Löschen, Wiederholen mit Quelldatei-Löschung, Ordnerfreigaben und Zugangsdaten.', 'Run every action without local confirmation, including deletions, retries with source deletion, directory grants and credentials.'],
|
||||||
['Ordnerfreigaben', 'Directory access'],
|
['Ordnerfreigaben', 'Directory access'],
|
||||||
['Keine Ordner freigegeben.', 'No directories granted.'],
|
['Keine Ordner freigegeben.', 'No directories granted.'],
|
||||||
['Zugang verwalten', 'Manage access'],
|
['Zugang verwalten', 'Manage access'],
|
||||||
@@ -106,6 +108,7 @@
|
|||||||
['Letzter Kontakt', 'Last contact'],
|
['Letzter Kontakt', 'Last contact'],
|
||||||
['Ausstehende Widerrufe', 'Pending revocations'],
|
['Ausstehende Widerrufe', 'Pending revocations'],
|
||||||
['Der Verbindungscode ist ein Zugangsschlüssel. Er wird weder im Backup gespeichert noch auf andere Installationen übertragen. Löschungen und andere gefährliche Aktionen verlangen eine lokale Bestätigung.', 'The connection code is a credential. It is not stored in backups or transferred to other installations. Deletions and other dangerous actions require local confirmation.'],
|
['Der Verbindungscode ist ein Zugangsschlüssel. Er wird weder im Backup gespeichert noch auf andere Installationen übertragen. Löschungen und andere gefährliche Aktionen verlangen eine lokale Bestätigung.', 'The connection code is a credential. It is not stored in backups or transferred to other installations. Deletions and other dangerous actions require local confirmation.'],
|
||||||
|
['Der Verbindungscode ist ein Zugangsschlüssel. Er wird weder im Backup gespeichert noch auf andere Installationen übertragen. Löschungen und andere gefährliche Aktionen verlangen eine lokale Bestätigung, außer bei Vollzugriff.', 'The connection code is a credential. It is not stored in backups or transferred to other installations. Deletions and other dangerous actions require local confirmation unless full access is granted.'],
|
||||||
['Ordner freigeben', 'Grant directory'],
|
['Ordner freigeben', 'Grant directory'],
|
||||||
['Schreibzugriff', 'Write access'],
|
['Schreibzugriff', 'Write access'],
|
||||||
['MCP-Aktion fehlgeschlagen. Verbindung und lokale Berechtigungen prüfen.', 'MCP action failed. Check connection and local permissions.'],
|
['MCP-Aktion fehlgeschlagen. Verbindung und lokale Berechtigungen prüfen.', 'MCP action failed. Check connection and local permissions.'],
|
||||||
@@ -1031,6 +1034,7 @@
|
|||||||
[/^Clouddrop: Datei nicht lesbar: (.+)$/, 'Clouddrop: File cannot be read: $1'],
|
[/^Clouddrop: Datei nicht lesbar: (.+)$/, 'Clouddrop: File cannot be read: $1'],
|
||||||
[/^Doodstream: konnte Upload-Server nicht ermitteln \(Endpoint geändert\?\)\. (.+)$/, 'Doodstream: Could not determine the upload server (endpoint changed?). $1'],
|
[/^Doodstream: konnte Upload-Server nicht ermitteln \(Endpoint geändert\?\)\. (.+)$/, 'Doodstream: Could not determine the upload server (endpoint changed?). $1'],
|
||||||
[/^Doodstream Upload fehlgeschlagen: (.+)$/, 'Doodstream upload failed: $1'],
|
[/^Doodstream Upload fehlgeschlagen: (.+)$/, 'Doodstream upload failed: $1'],
|
||||||
|
[/^DoodStream: Upload-Seite antwortete mit HTTP (\d{3})$/, 'DoodStream: The upload page responded with HTTP $1'],
|
||||||
[/^Doodstream Upload: kein Filecode — Server gab leeren Link zurück (.+)$/, 'Doodstream upload: No file code — the server returned an empty link $1'],
|
[/^Doodstream Upload: kein Filecode — Server gab leeren Link zurück (.+)$/, 'Doodstream upload: No file code — the server returned an empty link $1'],
|
||||||
[/^Doodstream lehnt Datei ab \(Server-Status: (.+)\)\. CDN=(.+)$/, 'Doodstream rejected the file (server status: $1). CDN=$2'],
|
[/^Doodstream lehnt Datei ab \(Server-Status: (.+)\)\. CDN=(.+)$/, 'Doodstream rejected the file (server status: $1). CDN=$2'],
|
||||||
[/^Doodstream Upload: Redirect-Antwort ungültig \((.+)\)$/, 'Doodstream upload: Invalid redirect response ($1)'],
|
[/^Doodstream Upload: Redirect-Antwort ungültig \((.+)\)$/, 'Doodstream upload: Invalid redirect response ($1)'],
|
||||||
|
|||||||
+4
-3
@@ -222,8 +222,9 @@
|
|||||||
['control','App steuern','Control app','Uploads und Konten verwalten. Kritische Aktionen lokal bestätigen.','Manage uploads and accounts. Confirm critical actions locally.'],
|
['control','App steuern','Control app','Uploads und Konten verwalten. Kritische Aktionen lokal bestätigen.','Manage uploads and accounts. Confirm critical actions locally.'],
|
||||||
['files','Freigegebene Ordner','Granted directories','Auf ausgewählte Ordner zugreifen. Dateiinhalte separat freigeben.','Access selected directories. Allow file contents separately.'],
|
['files','Freigegebene Ordner','Granted directories','Auf ausgewählte Ordner zugreifen. Dateiinhalte separat freigeben.','Access selected directories. Allow file contents separately.'],
|
||||||
['updates','App-Updates installieren','Install app updates','Geprüfte Updates ohne erneute Bestätigung installieren. Uploads abschließen und danach fortsetzen. Keine Portable-Versionen.','Install verified updates without another confirmation. Finish uploads and resume afterwards. No portable versions.'],
|
['updates','App-Updates installieren','Install app updates','Geprüfte Updates ohne erneute Bestätigung installieren. Uploads abschließen und danach fortsetzen. Keine Portable-Versionen.','Install verified updates without another confirmation. Finish uploads and resume afterwards. No portable versions.'],
|
||||||
['secrets','Zugangsdaten auslesen','Reveal credentials','Gespeicherte Zugangsdaten ausdrücklich freigeben. Zusätzliche lokale Bestätigung erforderlich.','Explicitly allow saved credentials to be read. Additional local confirmation required.']
|
['secrets','Zugangsdaten auslesen','Reveal credentials','Gespeicherte Zugangsdaten ausdrücklich freigeben. Zusätzliche lokale Bestätigung erforderlich.','Explicitly allow saved credentials to be read. Additional local confirmation required.'],
|
||||||
].map(([value,de,en,description,englishDescription])=>`<label class="mcp-permission${value === 'secrets' ? ' mcp-permission-sensitive' : ''}" data-settings-search-entry data-settings-search-label="${de}"><input type="checkbox" value="${value}"${value === 'updates' ? ' data-mcp-updates' : ''} disabled><span><strong>${text(de,en)}</strong><span class="mcp-permission-description">${text(description,englishDescription)}</span></span></label>`).join('')}</fieldset>
|
['full_access','Vollzugriff ohne Bestätigung','Full access without confirmation','Alle Aktionen ohne lokale Bestätigung ausführen, auch Löschen, Wiederholen mit Quelldatei-Löschung, Ordnerfreigaben und Zugangsdaten.','Run every action without local confirmation, including deletions, retries with source deletion, directory grants and credentials.']
|
||||||
|
].map(([value,de,en,description,englishDescription])=>`<label class="mcp-permission${['secrets', 'full_access'].includes(value) ? ' mcp-permission-sensitive' : ''}" data-settings-search-entry data-settings-search-label="${de}"><input type="checkbox" value="${value}"${value === 'updates' ? ' data-mcp-updates' : ''} disabled><span><strong>${text(de,en)}</strong><span class="mcp-permission-description">${text(description,englishDescription)}</span></span></label>`).join('')}</fieldset>
|
||||||
<div class="mcp-save-row"><p data-mcp-save-state role="status">${text('Erst speichern und aktivieren, dann den Verbindungscode kopieren.', 'Save and enable first, then copy the connection code.')}</p><button type="button" class="btn btn-sm btn-primary" data-mcp-action="enable" disabled>${text('Speichern und aktivieren','Save and enable')}</button></div>
|
<div class="mcp-save-row"><p data-mcp-save-state role="status">${text('Erst speichern und aktivieren, dann den Verbindungscode kopieren.', 'Save and enable first, then copy the connection code.')}</p><button type="button" class="btn btn-sm btn-primary" data-mcp-action="enable" disabled>${text('Speichern und aktivieren','Save and enable')}</button></div>
|
||||||
</section>
|
</section>
|
||||||
<section class="mcp-card" aria-labelledby="mcpGrantsTitle">
|
<section class="mcp-card" aria-labelledby="mcpGrantsTitle">
|
||||||
@@ -233,7 +234,7 @@
|
|||||||
</section>
|
</section>
|
||||||
<section class="mcp-card" aria-labelledby="mcpAccessTitle">
|
<section class="mcp-card" aria-labelledby="mcpAccessTitle">
|
||||||
<div class="mcp-card-heading"><h4 id="mcpAccessTitle">${text('Zugang verwalten', 'Manage access')}</h4></div>
|
<div class="mcp-card-heading"><h4 id="mcpAccessTitle">${text('Zugang verwalten', 'Manage access')}</h4></div>
|
||||||
<p>${text('Der Verbindungscode ist ein Zugangsschlüssel. Er wird weder im Backup gespeichert noch auf andere Installationen übertragen. Löschungen und andere gefährliche Aktionen verlangen eine lokale Bestätigung.', 'The connection code is a credential. It is not stored in backups or transferred to other installations. Deletions and other dangerous actions require local confirmation.')}</p>
|
<p>${text('Der Verbindungscode ist ein Zugangsschlüssel. Er wird weder im Backup gespeichert noch auf andere Installationen übertragen. Löschungen und andere gefährliche Aktionen verlangen eine lokale Bestätigung, außer bei Vollzugriff.', 'The connection code is a credential. It is not stored in backups or transferred to other installations. Deletions and other dangerous actions require local confirmation unless full access is granted.')}</p>
|
||||||
<p>${text('Zugang erneuern macht den bisherigen Code ungültig. Deaktivieren beendet den Fernzugriff und widerruft den Zugang.', 'Rotating access invalidates the previous code. Disabling remote access revokes access.')}</p>
|
<p>${text('Zugang erneuern macht den bisherigen Code ungültig. Deaktivieren beendet den Fernzugriff und widerruft den Zugang.', 'Rotating access invalidates the previous code. Disabling remote access revokes access.')}</p>
|
||||||
<div class="mcp-actions"><button type="button" class="btn btn-sm btn-secondary" data-mcp-action="rotate" disabled>${text('Zugang erneuern','Rotate access')}</button><button type="button" class="btn btn-sm btn-secondary" data-mcp-action="disable" disabled>${text('Deaktivieren und widerrufen','Disable and revoke')}</button></div>
|
<div class="mcp-actions"><button type="button" class="btn btn-sm btn-secondary" data-mcp-action="rotate" disabled>${text('Zugang erneuern','Rotate access')}</button><button type="button" class="btn btn-sm btn-secondary" data-mcp-action="disable" disabled>${text('Deaktivieren und widerrufen','Disable and revoke')}</button></div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ const sourceFiles = [
|
|||||||
'lib/log-mode.js',
|
'lib/log-mode.js',
|
||||||
'lib/log-policy.js',
|
'lib/log-policy.js',
|
||||||
'lib/log-rotation.js',
|
'lib/log-rotation.js',
|
||||||
|
'lib/matroska-attachments.js',
|
||||||
'lib/mcp-access.js',
|
'lib/mcp-access.js',
|
||||||
'lib/mcp-app.js',
|
'lib/mcp-app.js',
|
||||||
'lib/mcp-diagnostics.js',
|
'lib/mcp-diagnostics.js',
|
||||||
|
|||||||
Reference in new issue
Block a user