pal-explorer-cli 0.4.9 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@
8
8
  "hooks": ["on:app:ready"],
9
9
  "permissions": ["config:read", "config:write", "identity:read"],
10
10
  "config": {
11
- "enabled": { "type": "boolean", "default": true, "description": "Enable discovery server integration" },
11
+ "enabled": { "type": "boolean", "default": false, "description": "Enable discovery server integration" },
12
12
  "bootstrapServers": { "type": "array", "default": ["https://discovery-1.palexplorer.com", "https://discovery-2.palexplorer.com"], "description": "Bootstrap discovery server URLs" },
13
13
  "refreshInterval": { "type": "number", "default": 1800000, "description": "Server list refresh interval in ms (default: 30 min)" },
14
14
  "enableGossip": { "type": "boolean", "default": true, "description": "Exchange server lists with connected peers" }
@@ -25,17 +25,20 @@ Examples:
25
25
  const shares = listShares();
26
26
  const active = getTransfers() || [];
27
27
  const pidPath = path.join(path.dirname(config.path), 'serve.pid');
28
- const servers = getServers();
29
- const checks = await Promise.all(servers.map(s => checkServer(s)));
30
28
  const conn = getConnectionState();
29
+ const enabledExts = config.get('enabledExtensions') || [];
30
+ const hasDiscovery = enabledExts.includes('@palexplorer/discovery');
31
31
  const data = {
32
32
  identity: identity ? { name: identity.name, handle: identity.handle, publicKey: identity.publicKey?.slice(0, 16) } : null,
33
33
  network: { status: conn.status, connectedCount: conn.connectedCount || 0 },
34
34
  daemon: fs.existsSync(pidPath) ? 'running' : 'stopped',
35
35
  shares: { count: shares.length },
36
36
  transfers: { active: active.length },
37
- discoveryServers: checks
38
37
  };
38
+ if (hasDiscovery) {
39
+ const servers = getServers();
40
+ data.discoveryServers = await Promise.all(servers.map(s => checkServer(s)));
41
+ }
39
42
  console.log(JSON.stringify(data, null, 2));
40
43
  return;
41
44
  }
@@ -112,18 +115,24 @@ Examples:
112
115
  console.log(` Active: ${chalk.white(active.length)}`);
113
116
  }
114
117
 
115
- // Discovery servers
116
- console.log('');
117
- console.log(chalk.cyan.bold('Discovery Servers'));
118
- const servers = getServers();
119
- const checks = await Promise.all(servers.map(s => checkServer(s)));
120
- for (let i = 0; i < checks.length; i++) {
121
- const c = checks[i];
122
- const primary = i === 0 ? chalk.cyan(' (primary)') : '';
123
- if (c.reachable) {
124
- console.log(` ${chalk.green('●')} ${c.url}${primary}`);
118
+ // Discovery servers (only if discovery extension is enabled)
119
+ const enabled = config.get('enabledExtensions') || [];
120
+ const discoveryEnabled = enabled.includes('@palexplorer/discovery');
121
+ if (discoveryEnabled) {
122
+ console.log('');
123
+ console.log(chalk.cyan.bold('Discovery Servers'));
124
+ const servers = getServers();
125
+ if (servers.length === 0) {
126
+ console.log(chalk.gray(' No servers configured.'));
125
127
  } else {
126
- console.log(` ${chalk.red('●')} ${c.url} ${chalk.red('unreachable')}${primary}`);
128
+ const checks = await Promise.all(servers.map(s => checkServer(s)));
129
+ for (const c of checks) {
130
+ if (c.reachable) {
131
+ console.log(` ${chalk.green('●')} ${c.url}`);
132
+ } else {
133
+ console.log(` ${chalk.red('●')} ${c.url} ${chalk.red('unreachable')}`);
134
+ }
135
+ }
127
136
  }
128
137
  }
129
138
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pal-explorer-cli",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "description": "P2P encrypted file sharing CLI — share files directly with friends, not with the cloud",
5
5
  "main": "bin/pal.js",
6
6
  "bin": {