Retire legacy remote listeners after verifying MCP feature coverage
CI / verify (push) Canceled after 0s

This commit is contained in:
Sucukdeluxe committed 2026-10-15 17:03:41 +02:00
1 parent 93e0196dbe
commit 53706c44ea
12 files changed
+50 -829

No files matched your search

+6 -32
View File
@@ -108,23 +108,6 @@ const DEFAULTS = {
paused: false,
pausedAt: null
},
remote: {
enabled: false,
port: 9100,
token: '',
allowInput: true
},
diagnostics: {
enabled: false,
port: 9110,
token: '',
label: '',
codeIssuedAt: 0,
bindMode: 'local',
publicHost: '',
allowlist: [],
bindAddress: '127.0.0.1'
}
},
history: [],
rotationCursors: {}
@@ -466,6 +449,8 @@ class ConfigStore {
globalSettings[key] = { ...def, ...(savedGlobal[key] || {}) };
}
}
delete globalSettings.remote;
delete globalSettings.diagnostics;
// Normalize logMode at this single boundary. Legacy sessionLog: true
// means *daily* (the old field was named after a misnomer); see log-mode.js.
// Downstream readers consume logMode only and must NOT derive from
@@ -499,6 +484,8 @@ class ConfigStore {
_serializeForDisk(config) {
const hosters = this._clone(config.hosters || {});
const globalSettings = this._clone(config.globalSettings || {});
delete globalSettings.remote;
delete globalSettings.diagnostics;
delete globalSettings.allowPlaintextCredentialStorage;
secretStore.encryptCredentials({ hosters, globalSettings });
return JSON.stringify({ ...config, globalSettings, hosters }, null, 2);
@@ -712,8 +699,6 @@ class ConfigStore {
return this._enqueueWrite(() => {
const current = this.load();
const currentGlobalSettings = current.globalSettings || {};
const currentRemote = currentGlobalSettings.remote || {};
const incomingRemote = snapshot.remote || {};
const currentFolderMonitor = currentGlobalSettings.folderMonitor || {};
const incomingFolderMonitor = snapshot.folderMonitor || {};
current.globalSettings = {
@@ -721,7 +706,6 @@ class ConfigStore {
pendingQueue: currentGlobalSettings.pendingQueue ?? null,
uploadRecovery: currentGlobalSettings.uploadRecovery ?? null,
lastBrowseDirectory: currentGlobalSettings.lastBrowseDirectory || '',
diagnostics: this._clone(currentGlobalSettings.diagnostics || {}),
cloudLogSync: this._clone(currentGlobalSettings.cloudLogSync || {}),
historyRetention: currentGlobalSettings.historyRetention || 'all',
folderMonitor: {
@@ -729,10 +713,6 @@ class ConfigStore {
...incomingFolderMonitor,
paused: currentFolderMonitor.paused === true,
pausedAt: currentFolderMonitor.pausedAt ?? null
},
remote: {
...incomingRemote,
token: incomingRemote.token || currentRemote.token || ''
}
};
this._guardHosters(current, false);
@@ -749,18 +729,12 @@ class ConfigStore {
});
}
saveRemoteSettings(remoteSettings, createToken) {
const incoming = this._clone(remoteSettings || {});
saveRemoteSettings() {
return this._enqueueWrite(async () => {
const current = this.load();
const currentGlobalSettings = current.globalSettings || {};
const currentRemote = currentGlobalSettings.remote || {};
const token = incoming.token || currentRemote.token || (incoming.enabled && typeof createToken === 'function' ? createToken() : '');
const canonical = { ...incoming, token };
current.globalSettings = { ...currentGlobalSettings, remote: canonical };
this._guardHosters(current, false);
await this._commit(current);
return this._clone(canonical);
return { enabled: false, retired: true, token: '' };
});
}
+3 -2
View File
@@ -172,7 +172,8 @@ function createCollectors(deps) {
function listErrors(args) {
const a = args || {};
const cfg = loadConfig();
const { errors, byCategory } = _historyErrors(cfg.history, a);
const history = typeof loadHistory === 'function' ? loadHistory() : cfg.history;
const { errors, byCategory } = _historyErrors(history, a);
const limit = Math.min(Math.max(Number(a.limit) || 100, 1), 1000);
const window = Number.isFinite(a.sinceMs) ? `since ${new Date(a.sinceMs).toISOString()}` : 'all history';
return { window, total: errors.length, byCategory, errors: errors.slice(-limit) };
@@ -244,7 +245,7 @@ function createCollectors(deps) {
const hosters = cfg.hosters && typeof cfg.hosters === 'object' ? Object.keys(cfg.hosters).filter(h => Array.isArray(cfg.hosters[h]) && cfg.hosters[h].length > 0) : [];
return {
reachabilityKnown: false,
hint: 'Live hoster probing (run_health_check) is disabled in this build. Configured hosters with at least one account are listed.',
hint: 'Configured hosters with at least one account are listed. Use an explicit account check for live reachability.',
configuredHosters: hosters
};
}
+4 -1
View File
@@ -126,8 +126,11 @@ function createMcpApp({ loadConfig, invoke, invokeGuarded = (_context, channel,
return page(rows, args);
},
mhu_history_prune: args => invoke('prune-history', { retention: args.retention, dryRun: false }),
mhu_history_summary: args => collectors.getHistory({ limit: args.limit || 20 }),
mhu_history_clear: () => invoke('clear-history'),
mhu_diagnostics_summary: () => ({ system: collectors.getSystemInfo(), health: collectors.getHealth(), rotation: collectors.getRotationState() }),
mhu_diagnostics_summary: () => ({ system: collectors.getSystemInfo(), health: collectors.getHealth(), rotation: collectors.getRotationState(), server: collectors.serverHealth({ errorLimit: 20 }) }),
mhu_app_events: args => collectors.getAppEvents(args),
mhu_errors: args => collectors.listErrors(args),
mhu_logs_list: () => collectors.listLogs(),
mhu_logs_read: args => collectors.readLog(args),
mhu_cloud_status: () => invoke('cloud-log:status'),
+3
View File
@@ -58,9 +58,12 @@ const definitions = [
['automation_scan', 'Run a read-only folder monitoring test scan.', 'read', {}, []],
['automation_reconcile', 'Reconcile the monitored directory with the queue.', 'control', {}, []],
['history_list', 'Read a bounded page of upload history.', 'read', page, []],
['history_summary', 'Read aggregate hoster statistics and recent batch summaries.', 'read', { limit: integer(1, 200) }, []],
['history_prune', 'Apply a retention policy to upload history.', 'control', { retention }, ['retention'], true],
['history_clear', 'Clear upload history.', 'control', {}, [], true],
['diagnostics_summary', 'Read filtered application diagnostics.', 'diagnostics', {}, []],
['app_events', 'Read recent secret-filtered application events.', 'read', { limit: integer(1, 200) }, []],
['errors', 'Read classified upload failures from persisted history.', 'read', { limit: integer(1, 200), sinceMs: integer(0, 8640000000000000), category: text(80), hoster }, []],
['logs_list', 'List the application-managed diagnostic logs.', 'diagnostics', {}, []],
['logs_read', 'Read a bounded, secret-filtered application log tail.', 'diagnostics', {
name: enumeration(['debug', 'fileuploader', 'uploadAudit', 'accountRotation', 'crash']),
+2
View File
@@ -35,6 +35,8 @@ function createPortableSettingsSnapshot(config) {
snapshot.globalSettings.pendingQueue = null;
snapshot.globalSettings.uploadRecovery = null;
snapshot.globalSettings.lastBrowseDirectory = '';
delete snapshot.globalSettings.remote;
delete snapshot.globalSettings.diagnostics;
if (snapshot.globalSettings.cloudLogSync) {
delete snapshot.globalSettings.cloudLogSync.accountId;
delete snapshot.globalSettings.cloudLogSync.ip;