pal-explorer-cli 0.4.12 → 0.4.13

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.
Files changed (99) hide show
  1. package/README.md +149 -149
  2. package/bin/pal.js +63 -2
  3. package/extensions/@palexplorer/analytics/extension.json +20 -1
  4. package/extensions/@palexplorer/analytics/index.js +19 -9
  5. package/extensions/@palexplorer/audit/extension.json +14 -0
  6. package/extensions/@palexplorer/auth-email/extension.json +15 -0
  7. package/extensions/@palexplorer/auth-oauth/extension.json +15 -0
  8. package/extensions/@palexplorer/chat/extension.json +14 -0
  9. package/extensions/@palexplorer/discovery/extension.json +17 -0
  10. package/extensions/@palexplorer/discovery/index.js +1 -1
  11. package/extensions/@palexplorer/email-notifications/extension.json +23 -0
  12. package/extensions/@palexplorer/groups/extension.json +15 -0
  13. package/extensions/@palexplorer/share-links/extension.json +15 -0
  14. package/extensions/@palexplorer/sync/extension.json +16 -0
  15. package/extensions/@palexplorer/user-mgmt/extension.json +15 -0
  16. package/lib/capabilities.js +24 -24
  17. package/lib/commands/analytics.js +175 -175
  18. package/lib/commands/api-keys.js +131 -131
  19. package/lib/commands/audit.js +235 -235
  20. package/lib/commands/auth.js +137 -137
  21. package/lib/commands/backup.js +76 -76
  22. package/lib/commands/billing.js +148 -148
  23. package/lib/commands/chat.js +217 -217
  24. package/lib/commands/cloud-backup.js +231 -231
  25. package/lib/commands/comment.js +99 -99
  26. package/lib/commands/completion.js +203 -203
  27. package/lib/commands/compliance.js +218 -218
  28. package/lib/commands/config.js +136 -136
  29. package/lib/commands/connect.js +44 -44
  30. package/lib/commands/dept.js +294 -294
  31. package/lib/commands/device.js +146 -146
  32. package/lib/commands/download.js +240 -226
  33. package/lib/commands/explorer.js +178 -178
  34. package/lib/commands/extension.js +1060 -970
  35. package/lib/commands/favorite.js +90 -90
  36. package/lib/commands/federation.js +270 -270
  37. package/lib/commands/file.js +533 -533
  38. package/lib/commands/group.js +271 -271
  39. package/lib/commands/gui-share.js +29 -29
  40. package/lib/commands/init.js +61 -61
  41. package/lib/commands/invite.js +59 -59
  42. package/lib/commands/list.js +58 -58
  43. package/lib/commands/log.js +116 -116
  44. package/lib/commands/nearby.js +108 -108
  45. package/lib/commands/network.js +251 -251
  46. package/lib/commands/notify.js +198 -198
  47. package/lib/commands/org.js +273 -273
  48. package/lib/commands/pal.js +403 -180
  49. package/lib/commands/permissions.js +216 -216
  50. package/lib/commands/pin.js +97 -97
  51. package/lib/commands/protocol.js +357 -357
  52. package/lib/commands/rbac.js +147 -147
  53. package/lib/commands/recover.js +36 -36
  54. package/lib/commands/register.js +171 -171
  55. package/lib/commands/relay.js +131 -131
  56. package/lib/commands/remote.js +368 -368
  57. package/lib/commands/revoke.js +50 -50
  58. package/lib/commands/scanner.js +280 -280
  59. package/lib/commands/schedule.js +344 -344
  60. package/lib/commands/scim.js +203 -203
  61. package/lib/commands/search.js +181 -181
  62. package/lib/commands/serve.js +438 -438
  63. package/lib/commands/server.js +350 -350
  64. package/lib/commands/share-link.js +199 -199
  65. package/lib/commands/share.js +336 -323
  66. package/lib/commands/sso.js +200 -200
  67. package/lib/commands/status.js +145 -145
  68. package/lib/commands/stream.js +562 -562
  69. package/lib/commands/su.js +187 -187
  70. package/lib/commands/sync.js +979 -979
  71. package/lib/commands/transfers.js +152 -152
  72. package/lib/commands/uninstall.js +188 -188
  73. package/lib/commands/update.js +204 -204
  74. package/lib/commands/user.js +276 -276
  75. package/lib/commands/vfs.js +84 -84
  76. package/lib/commands/web-login.js +79 -79
  77. package/lib/commands/web.js +52 -52
  78. package/lib/commands/webhook.js +180 -180
  79. package/lib/commands/whoami.js +59 -59
  80. package/lib/commands/workspace.js +121 -121
  81. package/lib/core/billing.js +16 -5
  82. package/lib/core/dhtDiscovery.js +9 -2
  83. package/lib/core/discoveryClient.js +13 -7
  84. package/lib/core/extensions.js +142 -1
  85. package/lib/core/identity.js +33 -2
  86. package/lib/core/imageProcessor.js +109 -0
  87. package/lib/core/imageTorrent.js +167 -0
  88. package/lib/core/permissions.js +1 -1
  89. package/lib/core/pro.js +11 -4
  90. package/lib/core/serverList.js +4 -1
  91. package/lib/core/shares.js +12 -1
  92. package/lib/core/signalingServer.js +14 -2
  93. package/lib/core/su.js +1 -1
  94. package/lib/core/users.js +1 -1
  95. package/lib/protocol/messages.js +12 -3
  96. package/lib/utils/explorer.js +1 -1
  97. package/lib/utils/help.js +357 -357
  98. package/lib/utils/torrent.js +1 -0
  99. package/package.json +4 -3
@@ -1,136 +1,136 @@
1
- import chalk from 'chalk';
2
- import config from '../utils/config.js';
3
-
4
- const KNOWN_KEYS = {
5
- port: 'Local seeder port (default: auto)',
6
- downloadDir: 'Download folder (default: ~/Downloads/Palexplorer)',
7
- max_connections: 'Max P2P connections',
8
- bandwidth_cap: 'Upload bandwidth cap in KB/s (0 = unlimited)',
9
- bandwidth_up: 'Upload bandwidth limit in KB/s',
10
- bandwidth_down: 'Download bandwidth limit in KB/s',
11
- discovery_servers: 'Discovery server URLs (comma-separated list)',
12
- announce_interval: 'DHT announce interval in seconds',
13
- logLevel: 'Log level: debug, info, warn, error, silent',
14
- };
15
-
16
- export default function configCommand(program) {
17
- const cmd = program
18
- .command('config')
19
- .description('view and manage Palexplorer configuration')
20
- .addHelpText('after', `
21
- Examples:
22
- $ pe config list Show all settings
23
- $ pe config get theme Get a specific setting
24
- $ pe config set theme dark Set a value
25
- $ pe config reset theme Reset to default
26
- `);
27
-
28
- cmd
29
- .command('list')
30
- .description('show all current settings')
31
- .action(() => {
32
- const settings = config.get('settings') || {};
33
- if (program.opts().json) {
34
- console.log(JSON.stringify({ settings, knownKeys: KNOWN_KEYS }, null, 2));
35
- return;
36
- }
37
- console.log('');
38
- console.log(chalk.cyan('Current Settings:'));
39
- const SENSITIVE_KEYS = new Set(['apiKey', 'api_key', 'token', 'secret', 'password', 'privateKey']);
40
- if (Object.keys(settings).length === 0) {
41
- console.log(chalk.gray(' (no custom settings — all defaults active)'));
42
- } else {
43
- for (const [k, v] of Object.entries(settings)) {
44
- const desc = KNOWN_KEYS[k] ? chalk.gray(` — ${KNOWN_KEYS[k]}`) : '';
45
- const display = SENSITIVE_KEYS.has(k) ? '***' : v;
46
- console.log(` ${chalk.white(k)} = ${chalk.yellow(display)}${desc}`);
47
- }
48
- }
49
- console.log('');
50
- console.log(chalk.gray('Known keys:'));
51
- for (const [k, desc] of Object.entries(KNOWN_KEYS)) {
52
- console.log(` ${chalk.white(k.padEnd(22))} ${chalk.gray(desc)}`);
53
- }
54
- });
55
-
56
- cmd
57
- .command('get <key>')
58
- .description('get a single config value')
59
- .action((key) => {
60
- const settings = config.get('settings') || {};
61
- if (!(key in settings)) {
62
- if (program.opts().json) {
63
- console.log(JSON.stringify({ key, value: null, isDefault: true }, null, 2));
64
- return;
65
- }
66
- console.log(chalk.gray(`'${key}' is not set (using default).`));
67
- return;
68
- }
69
- if (program.opts().json) {
70
- console.log(JSON.stringify({ key, value: settings[key] }, null, 2));
71
- return;
72
- }
73
- console.log(`${key} = ${chalk.yellow(settings[key])}`);
74
- });
75
-
76
- cmd
77
- .command('set <key> <value>')
78
- .description('set a config value')
79
- .action((key, value) => {
80
- const DANGEROUS_KEYS = ['__proto__', 'constructor', 'prototype'];
81
- if (!key || !key.trim()) {
82
- console.log(chalk.red(`Rejected: config key cannot be empty.`));
83
- process.exitCode = 1;
84
- return;
85
- }
86
- const keyParts = key.split('.');
87
- if (DANGEROUS_KEYS.some(d => keyParts.includes(d)) || key.startsWith('__')) {
88
- console.log(chalk.red(`Rejected: '${key}' is not a valid config key.`));
89
- process.exitCode = 1;
90
- return;
91
- }
92
- if (!(key in KNOWN_KEYS)) {
93
- console.log(chalk.yellow(`Warning: unknown config key '${key}'. Known keys: ${Object.keys(KNOWN_KEYS).join(', ')}`));
94
- }
95
- const settings = config.get('settings') || {};
96
- settings[key] = value;
97
- config.set('settings', settings);
98
- console.log(chalk.green(`✔ ${key} = ${value}`));
99
- });
100
-
101
- cmd
102
- .command('reset [key]')
103
- .description('reset a single key or all settings to defaults')
104
- .action((key) => {
105
- if (key && key.trim()) {
106
- const settings = config.get('settings') || {};
107
- if (!(key in settings)) {
108
- console.log(chalk.gray(`'${key}' is not set.`));
109
- return;
110
- }
111
- delete settings[key];
112
- config.set('settings', settings);
113
- console.log(chalk.green(`✔ '${key}' reset to default.`));
114
- } else {
115
- config.set('settings', {});
116
- console.log(chalk.green('✔ All settings reset to defaults.'));
117
- }
118
- });
119
-
120
- // Running `pe config` without subcommand shows list
121
- cmd.action(() => {
122
- const settings = config.get('settings') || {};
123
- console.log('');
124
- console.log(chalk.cyan('Current Settings:'));
125
- if (Object.keys(settings).length === 0) {
126
- console.log(chalk.gray(' (no custom settings — all defaults active)'));
127
- } else {
128
- for (const [k, v] of Object.entries(settings)) {
129
- console.log(` ${chalk.white(k)} = ${chalk.yellow(v)}`);
130
- }
131
- }
132
- console.log('');
133
- console.log(chalk.gray('Use `pe config set <key> <value>` to change a setting.'));
134
- console.log(chalk.gray('Use `pe config list` to see all known keys.'));
135
- });
136
- }
1
+ import chalk from 'chalk';
2
+ import config from '../utils/config.js';
3
+
4
+ const KNOWN_KEYS = {
5
+ port: 'Local seeder port (default: auto)',
6
+ downloadDir: 'Download folder (default: ~/Downloads/Palexplorer)',
7
+ max_connections: 'Max P2P connections',
8
+ bandwidth_cap: 'Upload bandwidth cap in KB/s (0 = unlimited)',
9
+ bandwidth_up: 'Upload bandwidth limit in KB/s',
10
+ bandwidth_down: 'Download bandwidth limit in KB/s',
11
+ discovery_servers: 'Discovery server URLs (comma-separated list)',
12
+ announce_interval: 'DHT announce interval in seconds',
13
+ logLevel: 'Log level: debug, info, warn, error, silent',
14
+ };
15
+
16
+ export default function configCommand(program) {
17
+ const cmd = program
18
+ .command('config')
19
+ .description('view and manage Palexplorer configuration')
20
+ .addHelpText('after', `
21
+ Examples:
22
+ $ pal config list Show all settings
23
+ $ pal config get theme Get a specific setting
24
+ $ pal config set theme dark Set a value
25
+ $ pal config reset theme Reset to default
26
+ `);
27
+
28
+ cmd
29
+ .command('list')
30
+ .description('show all current settings')
31
+ .action(() => {
32
+ const settings = config.get('settings') || {};
33
+ if (program.opts().json) {
34
+ console.log(JSON.stringify({ settings, knownKeys: KNOWN_KEYS }, null, 2));
35
+ return;
36
+ }
37
+ console.log('');
38
+ console.log(chalk.cyan('Current Settings:'));
39
+ const SENSITIVE_KEYS = new Set(['apiKey', 'api_key', 'token', 'secret', 'password', 'privateKey']);
40
+ if (Object.keys(settings).length === 0) {
41
+ console.log(chalk.gray(' (no custom settings — all defaults active)'));
42
+ } else {
43
+ for (const [k, v] of Object.entries(settings)) {
44
+ const desc = KNOWN_KEYS[k] ? chalk.gray(` — ${KNOWN_KEYS[k]}`) : '';
45
+ const display = SENSITIVE_KEYS.has(k) ? '***' : v;
46
+ console.log(` ${chalk.white(k)} = ${chalk.yellow(display)}${desc}`);
47
+ }
48
+ }
49
+ console.log('');
50
+ console.log(chalk.gray('Known keys:'));
51
+ for (const [k, desc] of Object.entries(KNOWN_KEYS)) {
52
+ console.log(` ${chalk.white(k.padEnd(22))} ${chalk.gray(desc)}`);
53
+ }
54
+ });
55
+
56
+ cmd
57
+ .command('get <key>')
58
+ .description('get a single config value')
59
+ .action((key) => {
60
+ const settings = config.get('settings') || {};
61
+ if (!(key in settings)) {
62
+ if (program.opts().json) {
63
+ console.log(JSON.stringify({ key, value: null, isDefault: true }, null, 2));
64
+ return;
65
+ }
66
+ console.log(chalk.gray(`'${key}' is not set (using default).`));
67
+ return;
68
+ }
69
+ if (program.opts().json) {
70
+ console.log(JSON.stringify({ key, value: settings[key] }, null, 2));
71
+ return;
72
+ }
73
+ console.log(`${key} = ${chalk.yellow(settings[key])}`);
74
+ });
75
+
76
+ cmd
77
+ .command('set <key> <value>')
78
+ .description('set a config value')
79
+ .action((key, value) => {
80
+ const DANGEROUS_KEYS = ['__proto__', 'constructor', 'prototype'];
81
+ if (!key || !key.trim()) {
82
+ console.log(chalk.red(`Rejected: config key cannot be empty.`));
83
+ process.exitCode = 1;
84
+ return;
85
+ }
86
+ const keyParts = key.split('.');
87
+ if (DANGEROUS_KEYS.some(d => keyParts.includes(d)) || key.startsWith('__')) {
88
+ console.log(chalk.red(`Rejected: '${key}' is not a valid config key.`));
89
+ process.exitCode = 1;
90
+ return;
91
+ }
92
+ if (!(key in KNOWN_KEYS)) {
93
+ console.log(chalk.yellow(`Warning: unknown config key '${key}'. Known keys: ${Object.keys(KNOWN_KEYS).join(', ')}`));
94
+ }
95
+ const settings = config.get('settings') || {};
96
+ settings[key] = value;
97
+ config.set('settings', settings);
98
+ console.log(chalk.green(`✔ ${key} = ${value}`));
99
+ });
100
+
101
+ cmd
102
+ .command('reset [key]')
103
+ .description('reset a single key or all settings to defaults')
104
+ .action((key) => {
105
+ if (key && key.trim()) {
106
+ const settings = config.get('settings') || {};
107
+ if (!(key in settings)) {
108
+ console.log(chalk.gray(`'${key}' is not set.`));
109
+ return;
110
+ }
111
+ delete settings[key];
112
+ config.set('settings', settings);
113
+ console.log(chalk.green(`✔ '${key}' reset to default.`));
114
+ } else {
115
+ config.set('settings', {});
116
+ console.log(chalk.green('✔ All settings reset to defaults.'));
117
+ }
118
+ });
119
+
120
+ // Running `pal config` without subcommand shows list
121
+ cmd.action(() => {
122
+ const settings = config.get('settings') || {};
123
+ console.log('');
124
+ console.log(chalk.cyan('Current Settings:'));
125
+ if (Object.keys(settings).length === 0) {
126
+ console.log(chalk.gray(' (no custom settings — all defaults active)'));
127
+ } else {
128
+ for (const [k, v] of Object.entries(settings)) {
129
+ console.log(` ${chalk.white(k)} = ${chalk.yellow(v)}`);
130
+ }
131
+ }
132
+ console.log('');
133
+ console.log(chalk.gray('Use `pal config set <key> <value>` to change a setting.'));
134
+ console.log(chalk.gray('Use `pal config list` to see all known keys.'));
135
+ });
136
+ }
@@ -1,44 +1,44 @@
1
- import chalk from 'chalk';
2
- import { connect, disconnect, getConnectionState } from '../core/connectionManager.js';
3
-
4
- export default function connectCommand(program) {
5
- program
6
- .command('connect')
7
- .description('connect to the Palexplorer network')
8
- .action(async () => {
9
- const current = getConnectionState();
10
- if (current.status === 'connected') {
11
- console.log(chalk.yellow('Already connected.'));
12
- return;
13
- }
14
-
15
- console.log(chalk.blue('Connecting to Palexplorer network...'));
16
- const result = await connect({
17
- onProgress: (step, progress) => {
18
- console.log(chalk.gray(` [${progress}%] ${step}`));
19
- },
20
- });
21
-
22
- if (result.connectedCount > 0) {
23
- console.log(chalk.green(`\nConnected to ${result.connectedCount} server(s).`));
24
- } else {
25
- console.log(chalk.yellow('\nWarning: No servers reachable.'));
26
- process.exitCode = 1;
27
- }
28
- });
29
-
30
- program
31
- .command('disconnect')
32
- .description('disconnect from the Palexplorer network')
33
- .action(async () => {
34
- const current = getConnectionState();
35
- if (current.status === 'disconnected') {
36
- console.log(chalk.yellow('Already disconnected.'));
37
- return;
38
- }
39
-
40
- console.log(chalk.blue('Disconnecting...'));
41
- await disconnect();
42
- console.log(chalk.green('Disconnected from network.'));
43
- });
44
- }
1
+ import chalk from 'chalk';
2
+ import { connect, disconnect, getConnectionState } from '../core/connectionManager.js';
3
+
4
+ export default function connectCommand(program) {
5
+ program
6
+ .command('connect')
7
+ .description('connect to the Palexplorer network')
8
+ .action(async () => {
9
+ const current = getConnectionState();
10
+ if (current.status === 'connected') {
11
+ console.log(chalk.yellow('Already connected.'));
12
+ return;
13
+ }
14
+
15
+ console.log(chalk.blue('Connecting to Palexplorer network...'));
16
+ const result = await connect({
17
+ onProgress: (step, progress) => {
18
+ console.log(chalk.gray(` [${progress}%] ${step}`));
19
+ },
20
+ });
21
+
22
+ if (result.connectedCount > 0) {
23
+ console.log(chalk.green(`\nConnected to ${result.connectedCount} server(s).`));
24
+ } else {
25
+ console.log(chalk.yellow('\nWarning: No servers reachable.'));
26
+ process.exitCode = 1;
27
+ }
28
+ });
29
+
30
+ program
31
+ .command('disconnect')
32
+ .description('disconnect from the Palexplorer network')
33
+ .action(async () => {
34
+ const current = getConnectionState();
35
+ if (current.status === 'disconnected') {
36
+ console.log(chalk.yellow('Already disconnected.'));
37
+ return;
38
+ }
39
+
40
+ console.log(chalk.blue('Disconnecting...'));
41
+ await disconnect();
42
+ console.log(chalk.green('Disconnected from network.'));
43
+ });
44
+ }