pal-explorer-cli 0.4.11 → 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,198 +1,198 @@
1
- import chalk from 'chalk';
2
-
3
- const VALID_PROVIDERS = ['sendgrid', 'mailgun', 'ses', 'smtp'];
4
- const VALID_EVENTS = ['share:invite', 'transfer:complete', 'peer:online', 'peer:offline', 'security:alert'];
5
-
6
- export default function notifyCommand(program) {
7
- const cmd = program
8
- .command('notify')
9
- .description('email notifications (Pro)')
10
- .addHelpText('after', `
11
- Examples:
12
- $ pe notify configure --provider sendgrid --api-key SG.xxx --to user@example.com
13
- $ pe notify configure --provider smtp --smtp-host smtp.gmail.com --smtp-port 587
14
- $ pe notify test Send a test notification
15
- $ pe notify status Show notification config
16
- $ pe notify events List event subscriptions
17
- $ pe notify events --enable share:invite Enable an event type
18
- $ pe notify events --disable peer:online Disable an event type
19
- `)
20
- .action(() => { cmd.outputHelp(); });
21
-
22
- cmd
23
- .command('configure')
24
- .description('set up email notification provider')
25
- .requiredOption('--provider <provider>', 'notification provider (sendgrid|mailgun|ses|smtp)')
26
- .option('--api-key <key>', 'API key (for sendgrid/mailgun)')
27
- .option('--to <email>', 'recipient email')
28
- .option('--from <email>', 'sender email')
29
- .option('--smtp-host <host>', 'SMTP host')
30
- .option('--smtp-port <port>', 'SMTP port')
31
- .action(async (opts) => {
32
- try {
33
- if (!VALID_PROVIDERS.includes(opts.provider)) {
34
- console.log(chalk.red(`Invalid provider. Must be one of: ${VALID_PROVIDERS.join(', ')}`));
35
- process.exitCode = 1;
36
- return;
37
- }
38
-
39
- if (['sendgrid', 'mailgun'].includes(opts.provider) && !opts.apiKey) {
40
- console.log(chalk.red(`--api-key is required for ${opts.provider}`));
41
- process.exitCode = 1;
42
- return;
43
- }
44
-
45
- if (opts.provider === 'smtp' && !opts.smtpHost) {
46
- console.log(chalk.red('--smtp-host is required for SMTP provider'));
47
- process.exitCode = 1;
48
- return;
49
- }
50
-
51
- const extConfig = (await import('../utils/config.js')).default;
52
- const existing = extConfig.get('ext.email-notifications') || {};
53
- const config = {
54
- ...existing,
55
- provider: opts.provider,
56
- };
57
- if (opts.apiKey) {
58
- try {
59
- const keytar = (await import('keytar')).default;
60
- await keytar.setPassword('palexplorer', 'notify.apiKey', opts.apiKey);
61
- } catch {
62
- config.apiKey = opts.apiKey;
63
- }
64
- }
65
- if (opts.to) config.toAddress = opts.to;
66
- if (opts.from) config.fromAddress = opts.from;
67
- if (opts.smtpHost) config.smtpHost = opts.smtpHost;
68
- if (opts.smtpPort) config.smtpPort = parseInt(opts.smtpPort, 10);
69
- if (!config.events) config.events = [];
70
-
71
- extConfig.set('ext.email-notifications', config);
72
- console.log(chalk.green(`✔ Notification provider configured: ${opts.provider}`));
73
- if (config.toAddress) console.log(` To: ${chalk.white(config.toAddress)}`);
74
- if (config.fromAddress) console.log(` From: ${chalk.white(config.fromAddress)}`);
75
- if (config.smtpHost) console.log(` SMTP: ${chalk.white(config.smtpHost)}:${chalk.white(config.smtpPort || 587)}`);
76
- } catch (err) {
77
- console.log(chalk.red(`Configure failed: ${err.message}`));
78
- process.exitCode = 1;
79
- }
80
- });
81
-
82
- cmd
83
- .command('test')
84
- .description('send a test notification email')
85
- .action(async () => {
86
- try {
87
- const extConfig = (await import('../utils/config.js')).default;
88
- const config = extConfig.get('ext.email-notifications') || {};
89
- if (!config.provider) {
90
- console.log(chalk.red('No provider configured. Run: pe notify configure --provider <provider>'));
91
- process.exitCode = 1;
92
- return;
93
- }
94
- if (!config.toAddress) {
95
- console.log(chalk.red('No recipient configured. Run: pe notify configure --provider <provider> --to <email>'));
96
- process.exitCode = 1;
97
- return;
98
- }
99
- console.log(chalk.cyan(`Sending test email via ${config.provider} to ${config.toAddress}...`));
100
- console.log(chalk.green('✔ Test notification sent.'));
101
- console.log(chalk.dim(' Note: Actual delivery depends on provider configuration and credentials.'));
102
- } catch (err) {
103
- console.log(chalk.red(`Test failed: ${err.message}`));
104
- process.exitCode = 1;
105
- }
106
- });
107
-
108
- cmd
109
- .command('status')
110
- .description('show notification config and provider')
111
- .action(async () => {
112
- try {
113
- const extConfig = (await import('../utils/config.js')).default;
114
- const config = extConfig.get('ext.email-notifications') || {};
115
- if (!config.provider) {
116
- console.log(chalk.dim('Email notifications not configured.'));
117
- console.log(chalk.dim(' pe notify configure --provider <provider> --to <email>'));
118
- return;
119
- }
120
- console.log(chalk.bold('Email Notification Status\n'));
121
- console.log(` Provider: ${chalk.cyan(config.provider)}`);
122
- console.log(` To: ${chalk.white(config.toAddress || 'not set')}`);
123
- console.log(` From: ${chalk.white(config.fromAddress || 'not set')}`);
124
- if (config.provider === 'smtp') {
125
- console.log(` SMTP: ${chalk.white(config.smtpHost || 'not set')}:${chalk.white(config.smtpPort || 587)}`);
126
- }
127
- let apiKeyConfigured = !!config.apiKey;
128
- if (!apiKeyConfigured) {
129
- try {
130
- const keytar = (await import('keytar')).default;
131
- apiKeyConfigured = !!(await keytar.getPassword('palexplorer', 'notify.apiKey'));
132
- } catch {}
133
- }
134
- console.log(` API Key: ${apiKeyConfigured ? chalk.green('configured') : chalk.gray('not set')}`);
135
- const events = config.events || [];
136
- console.log(` Events: ${events.length > 0 ? chalk.white(events.join(', ')) : chalk.dim('none')}`);
137
- } catch (err) {
138
- console.log(chalk.red(`Status failed: ${err.message}`));
139
- process.exitCode = 1;
140
- }
141
- });
142
-
143
- cmd
144
- .command('events')
145
- .description('manage subscribed events')
146
- .option('--enable <event>', 'enable an event type')
147
- .option('--disable <event>', 'disable an event type')
148
- .action(async (opts) => {
149
- try {
150
- const extConfig = (await import('../utils/config.js')).default;
151
- const config = extConfig.get('ext.email-notifications') || {};
152
-
153
- if (opts.enable) {
154
- if (!VALID_EVENTS.includes(opts.enable)) {
155
- console.log(chalk.red(`Invalid event. Must be one of: ${VALID_EVENTS.join(', ')}`));
156
- process.exitCode = 1;
157
- return;
158
- }
159
- const events = config.events || [];
160
- if (events.includes(opts.enable)) {
161
- console.log(chalk.yellow(`Event already enabled: ${opts.enable}`));
162
- return;
163
- }
164
- events.push(opts.enable);
165
- config.events = events;
166
- extConfig.set('ext.email-notifications', config);
167
- console.log(chalk.green(`✔ Event enabled: ${opts.enable}`));
168
- return;
169
- }
170
-
171
- if (opts.disable) {
172
- const events = config.events || [];
173
- const idx = events.indexOf(opts.disable);
174
- if (idx === -1) {
175
- console.log(chalk.yellow(`Event not enabled: ${opts.disable}`));
176
- return;
177
- }
178
- events.splice(idx, 1);
179
- config.events = events;
180
- extConfig.set('ext.email-notifications', config);
181
- console.log(chalk.green(`✔ Event disabled: ${opts.disable}`));
182
- return;
183
- }
184
-
185
- // List events
186
- console.log(chalk.bold('Event Subscriptions\n'));
187
- const events = config.events || [];
188
- for (const e of VALID_EVENTS) {
189
- const enabled = events.includes(e);
190
- const icon = enabled ? chalk.green('●') : chalk.dim('○');
191
- console.log(` ${icon} ${enabled ? chalk.white(e) : chalk.dim(e)}`);
192
- }
193
- } catch (err) {
194
- console.log(chalk.red(`Events failed: ${err.message}`));
195
- process.exitCode = 1;
196
- }
197
- });
198
- }
1
+ import chalk from 'chalk';
2
+
3
+ const VALID_PROVIDERS = ['sendgrid', 'mailgun', 'ses', 'smtp'];
4
+ const VALID_EVENTS = ['share:invite', 'transfer:complete', 'peer:online', 'peer:offline', 'security:alert'];
5
+
6
+ export default function notifyCommand(program) {
7
+ const cmd = program
8
+ .command('notify')
9
+ .description('email notifications (Pro)')
10
+ .addHelpText('after', `
11
+ Examples:
12
+ $ pal notify configure --provider sendgrid --api-key SG.xxx --to user@example.com
13
+ $ pal notify configure --provider smtp --smtp-host smtp.gmail.com --smtp-port 587
14
+ $ pal notify test Send a test notification
15
+ $ pal notify status Show notification config
16
+ $ pal notify events List event subscriptions
17
+ $ pal notify events --enable share:invite Enable an event type
18
+ $ pal notify events --disable peer:online Disable an event type
19
+ `)
20
+ .action(() => { cmd.outputHelp(); });
21
+
22
+ cmd
23
+ .command('configure')
24
+ .description('set up email notification provider')
25
+ .requiredOption('--provider <provider>', 'notification provider (sendgrid|mailgun|ses|smtp)')
26
+ .option('--api-key <key>', 'API key (for sendgrid/mailgun)')
27
+ .option('--to <email>', 'recipient email')
28
+ .option('--from <email>', 'sender email')
29
+ .option('--smtp-host <host>', 'SMTP host')
30
+ .option('--smtp-port <port>', 'SMTP port')
31
+ .action(async (opts) => {
32
+ try {
33
+ if (!VALID_PROVIDERS.includes(opts.provider)) {
34
+ console.log(chalk.red(`Invalid provider. Must be one of: ${VALID_PROVIDERS.join(', ')}`));
35
+ process.exitCode = 1;
36
+ return;
37
+ }
38
+
39
+ if (['sendgrid', 'mailgun'].includes(opts.provider) && !opts.apiKey) {
40
+ console.log(chalk.red(`--api-key is required for ${opts.provider}`));
41
+ process.exitCode = 1;
42
+ return;
43
+ }
44
+
45
+ if (opts.provider === 'smtp' && !opts.smtpHost) {
46
+ console.log(chalk.red('--smtp-host is required for SMTP provider'));
47
+ process.exitCode = 1;
48
+ return;
49
+ }
50
+
51
+ const extConfig = (await import('../utils/config.js')).default;
52
+ const existing = extConfig.get('ext.email-notifications') || {};
53
+ const config = {
54
+ ...existing,
55
+ provider: opts.provider,
56
+ };
57
+ if (opts.apiKey) {
58
+ try {
59
+ const keytar = (await import('keytar')).default;
60
+ await keytar.setPassword('palexplorer', 'notify.apiKey', opts.apiKey);
61
+ } catch {
62
+ config.apiKey = opts.apiKey;
63
+ }
64
+ }
65
+ if (opts.to) config.toAddress = opts.to;
66
+ if (opts.from) config.fromAddress = opts.from;
67
+ if (opts.smtpHost) config.smtpHost = opts.smtpHost;
68
+ if (opts.smtpPort) config.smtpPort = parseInt(opts.smtpPort, 10);
69
+ if (!config.events) config.events = [];
70
+
71
+ extConfig.set('ext.email-notifications', config);
72
+ console.log(chalk.green(`✔ Notification provider configured: ${opts.provider}`));
73
+ if (config.toAddress) console.log(` To: ${chalk.white(config.toAddress)}`);
74
+ if (config.fromAddress) console.log(` From: ${chalk.white(config.fromAddress)}`);
75
+ if (config.smtpHost) console.log(` SMTP: ${chalk.white(config.smtpHost)}:${chalk.white(config.smtpPort || 587)}`);
76
+ } catch (err) {
77
+ console.log(chalk.red(`Configure failed: ${err.message}`));
78
+ process.exitCode = 1;
79
+ }
80
+ });
81
+
82
+ cmd
83
+ .command('test')
84
+ .description('send a test notification email')
85
+ .action(async () => {
86
+ try {
87
+ const extConfig = (await import('../utils/config.js')).default;
88
+ const config = extConfig.get('ext.email-notifications') || {};
89
+ if (!config.provider) {
90
+ console.log(chalk.red('No provider configured. Run: pal notify configure --provider <provider>'));
91
+ process.exitCode = 1;
92
+ return;
93
+ }
94
+ if (!config.toAddress) {
95
+ console.log(chalk.red('No recipient configured. Run: pal notify configure --provider <provider> --to <email>'));
96
+ process.exitCode = 1;
97
+ return;
98
+ }
99
+ console.log(chalk.cyan(`Sending test email via ${config.provider} to ${config.toAddress}...`));
100
+ console.log(chalk.green('✔ Test notification sent.'));
101
+ console.log(chalk.dim(' Note: Actual delivery depends on provider configuration and credentials.'));
102
+ } catch (err) {
103
+ console.log(chalk.red(`Test failed: ${err.message}`));
104
+ process.exitCode = 1;
105
+ }
106
+ });
107
+
108
+ cmd
109
+ .command('status')
110
+ .description('show notification config and provider')
111
+ .action(async () => {
112
+ try {
113
+ const extConfig = (await import('../utils/config.js')).default;
114
+ const config = extConfig.get('ext.email-notifications') || {};
115
+ if (!config.provider) {
116
+ console.log(chalk.dim('Email notifications not configured.'));
117
+ console.log(chalk.dim(' pal notify configure --provider <provider> --to <email>'));
118
+ return;
119
+ }
120
+ console.log(chalk.bold('Email Notification Status\n'));
121
+ console.log(` Provider: ${chalk.cyan(config.provider)}`);
122
+ console.log(` To: ${chalk.white(config.toAddress || 'not set')}`);
123
+ console.log(` From: ${chalk.white(config.fromAddress || 'not set')}`);
124
+ if (config.provider === 'smtp') {
125
+ console.log(` SMTP: ${chalk.white(config.smtpHost || 'not set')}:${chalk.white(config.smtpPort || 587)}`);
126
+ }
127
+ let apiKeyConfigured = !!config.apiKey;
128
+ if (!apiKeyConfigured) {
129
+ try {
130
+ const keytar = (await import('keytar')).default;
131
+ apiKeyConfigured = !!(await keytar.getPassword('palexplorer', 'notify.apiKey'));
132
+ } catch {}
133
+ }
134
+ console.log(` API Key: ${apiKeyConfigured ? chalk.green('configured') : chalk.gray('not set')}`);
135
+ const events = config.events || [];
136
+ console.log(` Events: ${events.length > 0 ? chalk.white(events.join(', ')) : chalk.dim('none')}`);
137
+ } catch (err) {
138
+ console.log(chalk.red(`Status failed: ${err.message}`));
139
+ process.exitCode = 1;
140
+ }
141
+ });
142
+
143
+ cmd
144
+ .command('events')
145
+ .description('manage subscribed events')
146
+ .option('--enable <event>', 'enable an event type')
147
+ .option('--disable <event>', 'disable an event type')
148
+ .action(async (opts) => {
149
+ try {
150
+ const extConfig = (await import('../utils/config.js')).default;
151
+ const config = extConfig.get('ext.email-notifications') || {};
152
+
153
+ if (opts.enable) {
154
+ if (!VALID_EVENTS.includes(opts.enable)) {
155
+ console.log(chalk.red(`Invalid event. Must be one of: ${VALID_EVENTS.join(', ')}`));
156
+ process.exitCode = 1;
157
+ return;
158
+ }
159
+ const events = config.events || [];
160
+ if (events.includes(opts.enable)) {
161
+ console.log(chalk.yellow(`Event already enabled: ${opts.enable}`));
162
+ return;
163
+ }
164
+ events.push(opts.enable);
165
+ config.events = events;
166
+ extConfig.set('ext.email-notifications', config);
167
+ console.log(chalk.green(`✔ Event enabled: ${opts.enable}`));
168
+ return;
169
+ }
170
+
171
+ if (opts.disable) {
172
+ const events = config.events || [];
173
+ const idx = events.indexOf(opts.disable);
174
+ if (idx === -1) {
175
+ console.log(chalk.yellow(`Event not enabled: ${opts.disable}`));
176
+ return;
177
+ }
178
+ events.splice(idx, 1);
179
+ config.events = events;
180
+ extConfig.set('ext.email-notifications', config);
181
+ console.log(chalk.green(`✔ Event disabled: ${opts.disable}`));
182
+ return;
183
+ }
184
+
185
+ // List events
186
+ console.log(chalk.bold('Event Subscriptions\n'));
187
+ const events = config.events || [];
188
+ for (const e of VALID_EVENTS) {
189
+ const enabled = events.includes(e);
190
+ const icon = enabled ? chalk.green('●') : chalk.dim('○');
191
+ console.log(` ${icon} ${enabled ? chalk.white(e) : chalk.dim(e)}`);
192
+ }
193
+ } catch (err) {
194
+ console.log(chalk.red(`Events failed: ${err.message}`));
195
+ process.exitCode = 1;
196
+ }
197
+ });
198
+ }