pal-explorer-cli 0.4.8 → 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
 
@@ -1001,6 +1001,11 @@ function getContributedPages() {
1001
1001
 
1002
1002
  function ensureDefaultExtensions() {
1003
1003
  if (!fs.existsSync(BUNDLED_DIR)) return;
1004
+ // Ensure extensions dir has ESM package.json so import() works
1005
+ const extPkg = path.join(EXTENSIONS_DIR, 'package.json');
1006
+ if (!fs.existsSync(extPkg)) {
1007
+ fs.writeFileSync(extPkg, '{ "type": "module" }\n');
1008
+ }
1004
1009
  const enabled = config.get('enabledExtensions') || [];
1005
1010
  const disabled = config.get('disabledExtensions') || [];
1006
1011
  let changed = false;
package/package.json CHANGED
@@ -1,68 +1,68 @@
1
- {
2
- "name": "pal-explorer-cli",
3
- "version": "0.4.8",
4
- "description": "P2P encrypted file sharing CLI — share files directly with friends, not with the cloud",
5
- "main": "bin/pal.js",
6
- "bin": {
7
- "pe": "./bin/pal.js"
8
- },
9
- "files": [
10
- "bin/",
11
- "lib/",
12
- "extensions/@palexplorer/*/extension.json",
13
- "extensions/@palexplorer/*/index.js",
14
- "LICENSE.md"
15
- ],
16
- "scripts": {
17
- "start": "node bin/pal.js",
18
- "test": "node --experimental-test-module-mocks --test \"test/commands/*.test.js\" \"test/core/*.test.js\" \"test/crypto/*.test.js\" \"test/gui/*.test.js\" \"test/stress/*.test.js\" \"test/utils/*.test.js\" \"test/*.test.js\"",
19
- "test:e2e": "npx playwright test",
20
- "build": "node scripts/build.js",
21
- "build:win": "node scripts/build.js --win",
22
- "build:mac": "node scripts/build.js --mac",
23
- "build:linux": "node scripts/build.js --linux",
24
- "postinstall": "node -e \"console.log('\\n Run: pe init to get started\\n')\""
25
- },
26
- "engines": {
27
- "node": ">=20.0.0"
28
- },
29
- "keywords": [
30
- "p2p",
31
- "file-sharing",
32
- "encrypted",
33
- "e2e",
34
- "peer-to-peer",
35
- "webtorrent",
36
- "cli",
37
- "privacy"
38
- ],
39
- "dependencies": {
40
- "acorn": "^8.16.0",
41
- "acorn-walk": "^8.3.5",
42
- "bip39": "^3.1.0",
43
- "bittorrent-dht": "^11.0.11",
44
- "bonjour-service": "^1.3.0",
45
- "chalk": "^5.3.0",
46
- "commander": "^11.1.0",
47
- "conf": "^12.0.0",
48
- "express": "^5.2.1",
49
- "inquirer": "^9.2.12",
50
- "keytar": "^7.9.0",
51
- "ora": "^8.0.1",
52
- "posthog-node": "^5.28.4",
53
- "qrcode-terminal": "^0.12.0",
54
- "regedit": "^5.1.4",
55
- "sodium-native": "^5.0.10",
56
- "v8-compile-cache-lib": "^3.0.1",
57
- "webdav-server": "^2.6.2",
58
- "webtorrent": "^2.1.33",
59
- "ws": "^8.19.0"
60
- },
61
- "author": "Palexplorer",
62
- "license": "SEE LICENSE IN LICENSE.md",
63
- "homepage": "https://palexplorer.com",
64
- "type": "module",
65
- "devDependencies": {
66
- "@playwright/test": "^1.58.2"
67
- }
68
- }
1
+ {
2
+ "name": "pal-explorer-cli",
3
+ "version": "0.4.10",
4
+ "description": "P2P encrypted file sharing CLI — share files directly with friends, not with the cloud",
5
+ "main": "bin/pal.js",
6
+ "bin": {
7
+ "pe": "./bin/pal.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "lib/",
12
+ "extensions/@palexplorer/*/extension.json",
13
+ "extensions/@palexplorer/*/index.js",
14
+ "LICENSE.md"
15
+ ],
16
+ "scripts": {
17
+ "start": "node bin/pal.js",
18
+ "test": "node --experimental-test-module-mocks --test \"test/commands/*.test.js\" \"test/core/*.test.js\" \"test/crypto/*.test.js\" \"test/gui/*.test.js\" \"test/stress/*.test.js\" \"test/utils/*.test.js\" \"test/*.test.js\"",
19
+ "test:e2e": "npx playwright test",
20
+ "build": "node scripts/build.js",
21
+ "build:win": "node scripts/build.js --win",
22
+ "build:mac": "node scripts/build.js --mac",
23
+ "build:linux": "node scripts/build.js --linux",
24
+ "postinstall": "node -e \"console.log('\\n Run: pe init to get started\\n')\""
25
+ },
26
+ "engines": {
27
+ "node": ">=20.0.0"
28
+ },
29
+ "keywords": [
30
+ "p2p",
31
+ "file-sharing",
32
+ "encrypted",
33
+ "e2e",
34
+ "peer-to-peer",
35
+ "webtorrent",
36
+ "cli",
37
+ "privacy"
38
+ ],
39
+ "dependencies": {
40
+ "acorn": "^8.16.0",
41
+ "acorn-walk": "^8.3.5",
42
+ "bip39": "^3.1.0",
43
+ "bittorrent-dht": "^11.0.11",
44
+ "bonjour-service": "^1.3.0",
45
+ "chalk": "^5.3.0",
46
+ "commander": "^11.1.0",
47
+ "conf": "^12.0.0",
48
+ "express": "^5.2.1",
49
+ "inquirer": "^9.2.12",
50
+ "keytar": "^7.9.0",
51
+ "ora": "^8.0.1",
52
+ "posthog-node": "^5.28.4",
53
+ "qrcode-terminal": "^0.12.0",
54
+ "regedit": "^5.1.4",
55
+ "sodium-native": "^5.0.10",
56
+ "v8-compile-cache-lib": "^3.0.1",
57
+ "webdav-server": "^2.6.2",
58
+ "webtorrent": "^2.1.33",
59
+ "ws": "^8.19.0"
60
+ },
61
+ "author": "Palexplorer",
62
+ "license": "SEE LICENSE IN LICENSE.md",
63
+ "homepage": "https://palexplorer.com",
64
+ "type": "module",
65
+ "devDependencies": {
66
+ "@playwright/test": "^1.58.2"
67
+ }
68
+ }