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,203 +1,203 @@
1
- import chalk from 'chalk';
2
-
3
- export default function scimCommand(program) {
4
- const cmd = program
5
- .command('scim')
6
- .description('SCIM 2.0 provisioning server (Enterprise)')
7
- .addHelpText('after', `
8
- Examples:
9
- $ pe scim configure --token myBearerToken --port 7475
10
- $ pe scim start Start SCIM server
11
- $ pe scim stop Stop SCIM server
12
- $ pe scim status Show server status
13
- $ pe scim users List provisioned users
14
- $ pe scim groups List provisioned groups
15
- `)
16
- .action(() => { cmd.outputHelp(); });
17
-
18
- cmd
19
- .command('configure')
20
- .description('set SCIM configuration')
21
- .option('--token <bearerToken>', 'bearer token for auth')
22
- .option('--port <port>', 'server port', '7475')
23
- .option('--endpoint <path>', 'base path', '/scim/v2')
24
- .action(async (opts) => {
25
- try {
26
- const extConfig = (await import('../utils/config.js')).default;
27
- const existing = extConfig.get('ext.scim-provisioning') || {};
28
- const token = opts.token || existing.bearerToken || null;
29
- const config = {
30
- ...existing,
31
- bearerToken: null,
32
- port: parseInt(opts.port, 10) || existing.port || 7475,
33
- endpoint: opts.endpoint || existing.endpoint || '/scim/v2',
34
- autoDeactivate: existing.autoDeactivate ?? true,
35
- };
36
-
37
- if (token) {
38
- try {
39
- const keytar = (await import('keytar')).default;
40
- await keytar.setPassword('palexplorer', 'scim.token', token);
41
- } catch {
42
- config.bearerToken = token;
43
- }
44
- }
45
-
46
- extConfig.set('ext.scim-provisioning', config);
47
-
48
- console.log(chalk.green('✔ SCIM configuration updated'));
49
- console.log(` Port: ${chalk.white(config.port)}`);
50
- console.log(` Endpoint: ${chalk.white(config.endpoint)}`);
51
- console.log(` Token: ${token ? chalk.gray(token.slice(0, 8) + '...') : chalk.yellow('not set')}`);
52
- } catch (err) {
53
- console.error(chalk.red(`Configure failed: ${err.message}`));
54
- process.exitCode = 1;
55
- }
56
- });
57
-
58
- cmd
59
- .command('start')
60
- .description('start SCIM server')
61
- .action(async () => {
62
- try {
63
- const extConfig = (await import('../utils/config.js')).default;
64
- const config = extConfig.get('ext.scim-provisioning') || {};
65
-
66
- let hasToken = !!config.bearerToken;
67
- if (!hasToken) {
68
- try {
69
- const keytar = (await import('keytar')).default;
70
- hasToken = !!(await keytar.getPassword('palexplorer', 'scim.token'));
71
- } catch {}
72
- }
73
- if (!hasToken) {
74
- console.error(chalk.red('No bearer token configured. Run: pe scim configure --token <token>'));
75
- process.exitCode = 1;
76
- return;
77
- }
78
-
79
- config.running = true;
80
- extConfig.set('ext.scim-provisioning', config);
81
- console.log(chalk.green(`✔ SCIM server marked as running`));
82
- console.log(` Port: ${chalk.white(config.port || 7475)}`);
83
- console.log(` Endpoint: ${chalk.white(config.endpoint || '/scim/v2')}`);
84
- console.log(chalk.gray(' Server lifecycle managed by extension on app startup.'));
85
- } catch (err) {
86
- console.error(chalk.red(`Start failed: ${err.message}`));
87
- process.exitCode = 1;
88
- }
89
- });
90
-
91
- cmd
92
- .command('stop')
93
- .description('stop SCIM server')
94
- .action(async () => {
95
- try {
96
- const extConfig = (await import('../utils/config.js')).default;
97
- const config = extConfig.get('ext.scim-provisioning') || {};
98
- config.running = false;
99
- extConfig.set('ext.scim-provisioning', config);
100
- console.log(chalk.green('✔ SCIM server marked as stopped'));
101
- } catch (err) {
102
- console.error(chalk.red(`Stop failed: ${err.message}`));
103
- process.exitCode = 1;
104
- }
105
- });
106
-
107
- cmd
108
- .command('status')
109
- .description('show server status')
110
- .action(async () => {
111
- try {
112
- const extConfig = (await import('../utils/config.js')).default;
113
- const config = extConfig.get('ext.scim-provisioning') || {};
114
- const store = extConfig.get('ext_store.scim-provisioning') || {};
115
-
116
- const userCount = Object.keys(store).filter(k => k.startsWith('scim:user:')).length;
117
- const groupCount = Object.keys(store).filter(k => k.startsWith('scim:group:')).length;
118
-
119
- console.log('');
120
- console.log(chalk.cyan.bold('SCIM Server Status'));
121
- console.log(chalk.gray('─'.repeat(40)));
122
- console.log(` Status: ${config.running ? chalk.green('running') : chalk.red('stopped')}`);
123
- console.log(` Port: ${chalk.white(config.port || 7475)}`);
124
- console.log(` Endpoint: ${chalk.white(config.endpoint || '/scim/v2')}`);
125
- let tokenConfigured = !!config.bearerToken;
126
- if (!tokenConfigured) {
127
- try {
128
- const keytar = (await import('keytar')).default;
129
- tokenConfigured = !!(await keytar.getPassword('palexplorer', 'scim.token'));
130
- } catch {}
131
- }
132
- console.log(` Token: ${tokenConfigured ? chalk.green('configured') : chalk.yellow('not set')}`);
133
- console.log(` Users: ${chalk.white(userCount)}`);
134
- console.log(` Groups: ${chalk.white(groupCount)}`);
135
- console.log('');
136
- } catch (err) {
137
- console.error(chalk.red(`Status failed: ${err.message}`));
138
- process.exitCode = 1;
139
- }
140
- });
141
-
142
- cmd
143
- .command('users')
144
- .description('list provisioned users')
145
- .action(async () => {
146
- try {
147
- const extConfig = (await import('../utils/config.js')).default;
148
- const store = extConfig.get('ext_store.scim-provisioning') || {};
149
- const users = Object.entries(store)
150
- .filter(([k]) => k.startsWith('scim:user:'))
151
- .map(([, v]) => v);
152
-
153
- if (!users.length) {
154
- console.log(chalk.gray('No provisioned users.'));
155
- return;
156
- }
157
-
158
- console.log('');
159
- console.log(chalk.cyan.bold('Provisioned Users'));
160
- console.log(chalk.gray('─'.repeat(50)));
161
- for (const user of users) {
162
- const status = user.active !== false ? chalk.green('active') : chalk.red('deactivated');
163
- console.log(` ${chalk.white(user.displayName || user.userName || user.id)} ${status}`);
164
- if (user.userName) console.log(` Username: ${chalk.gray(user.userName)}`);
165
- if (user.email) console.log(` Email: ${chalk.gray(user.email)}`);
166
- }
167
- console.log('');
168
- } catch (err) {
169
- console.error(chalk.red(`Users failed: ${err.message}`));
170
- process.exitCode = 1;
171
- }
172
- });
173
-
174
- cmd
175
- .command('groups')
176
- .description('list provisioned groups')
177
- .action(async () => {
178
- try {
179
- const extConfig = (await import('../utils/config.js')).default;
180
- const store = extConfig.get('ext_store.scim-provisioning') || {};
181
- const groups = Object.entries(store)
182
- .filter(([k]) => k.startsWith('scim:group:'))
183
- .map(([, v]) => v);
184
-
185
- if (!groups.length) {
186
- console.log(chalk.gray('No provisioned groups.'));
187
- return;
188
- }
189
-
190
- console.log('');
191
- console.log(chalk.cyan.bold('Provisioned Groups'));
192
- console.log(chalk.gray('─'.repeat(50)));
193
- for (const group of groups) {
194
- const memberCount = group.members?.length || 0;
195
- console.log(` ${chalk.white(group.displayName || group.id)} ${chalk.gray(`(${memberCount} members)`)}`);
196
- }
197
- console.log('');
198
- } catch (err) {
199
- console.error(chalk.red(`Groups failed: ${err.message}`));
200
- process.exitCode = 1;
201
- }
202
- });
203
- }
1
+ import chalk from 'chalk';
2
+
3
+ export default function scimCommand(program) {
4
+ const cmd = program
5
+ .command('scim')
6
+ .description('SCIM 2.0 provisioning server (Enterprise)')
7
+ .addHelpText('after', `
8
+ Examples:
9
+ $ pal scim configure --token myBearerToken --port 7475
10
+ $ pal scim start Start SCIM server
11
+ $ pal scim stop Stop SCIM server
12
+ $ pal scim status Show server status
13
+ $ pal scim users List provisioned users
14
+ $ pal scim groups List provisioned groups
15
+ `)
16
+ .action(() => { cmd.outputHelp(); });
17
+
18
+ cmd
19
+ .command('configure')
20
+ .description('set SCIM configuration')
21
+ .option('--token <bearerToken>', 'bearer token for auth')
22
+ .option('--port <port>', 'server port', '7475')
23
+ .option('--endpoint <path>', 'base path', '/scim/v2')
24
+ .action(async (opts) => {
25
+ try {
26
+ const extConfig = (await import('../utils/config.js')).default;
27
+ const existing = extConfig.get('ext.scim-provisioning') || {};
28
+ const token = opts.token || existing.bearerToken || null;
29
+ const config = {
30
+ ...existing,
31
+ bearerToken: null,
32
+ port: parseInt(opts.port, 10) || existing.port || 7475,
33
+ endpoint: opts.endpoint || existing.endpoint || '/scim/v2',
34
+ autoDeactivate: existing.autoDeactivate ?? true,
35
+ };
36
+
37
+ if (token) {
38
+ try {
39
+ const keytar = (await import('keytar')).default;
40
+ await keytar.setPassword('palexplorer', 'scim.token', token);
41
+ } catch {
42
+ config.bearerToken = token;
43
+ }
44
+ }
45
+
46
+ extConfig.set('ext.scim-provisioning', config);
47
+
48
+ console.log(chalk.green('✔ SCIM configuration updated'));
49
+ console.log(` Port: ${chalk.white(config.port)}`);
50
+ console.log(` Endpoint: ${chalk.white(config.endpoint)}`);
51
+ console.log(` Token: ${token ? chalk.gray(token.slice(0, 8) + '...') : chalk.yellow('not set')}`);
52
+ } catch (err) {
53
+ console.error(chalk.red(`Configure failed: ${err.message}`));
54
+ process.exitCode = 1;
55
+ }
56
+ });
57
+
58
+ cmd
59
+ .command('start')
60
+ .description('start SCIM server')
61
+ .action(async () => {
62
+ try {
63
+ const extConfig = (await import('../utils/config.js')).default;
64
+ const config = extConfig.get('ext.scim-provisioning') || {};
65
+
66
+ let hasToken = !!config.bearerToken;
67
+ if (!hasToken) {
68
+ try {
69
+ const keytar = (await import('keytar')).default;
70
+ hasToken = !!(await keytar.getPassword('palexplorer', 'scim.token'));
71
+ } catch {}
72
+ }
73
+ if (!hasToken) {
74
+ console.error(chalk.red('No bearer token configured. Run: pal scim configure --token <token>'));
75
+ process.exitCode = 1;
76
+ return;
77
+ }
78
+
79
+ config.running = true;
80
+ extConfig.set('ext.scim-provisioning', config);
81
+ console.log(chalk.green(`✔ SCIM server marked as running`));
82
+ console.log(` Port: ${chalk.white(config.port || 7475)}`);
83
+ console.log(` Endpoint: ${chalk.white(config.endpoint || '/scim/v2')}`);
84
+ console.log(chalk.gray(' Server lifecycle managed by extension on app startup.'));
85
+ } catch (err) {
86
+ console.error(chalk.red(`Start failed: ${err.message}`));
87
+ process.exitCode = 1;
88
+ }
89
+ });
90
+
91
+ cmd
92
+ .command('stop')
93
+ .description('stop SCIM server')
94
+ .action(async () => {
95
+ try {
96
+ const extConfig = (await import('../utils/config.js')).default;
97
+ const config = extConfig.get('ext.scim-provisioning') || {};
98
+ config.running = false;
99
+ extConfig.set('ext.scim-provisioning', config);
100
+ console.log(chalk.green('✔ SCIM server marked as stopped'));
101
+ } catch (err) {
102
+ console.error(chalk.red(`Stop failed: ${err.message}`));
103
+ process.exitCode = 1;
104
+ }
105
+ });
106
+
107
+ cmd
108
+ .command('status')
109
+ .description('show server status')
110
+ .action(async () => {
111
+ try {
112
+ const extConfig = (await import('../utils/config.js')).default;
113
+ const config = extConfig.get('ext.scim-provisioning') || {};
114
+ const store = extConfig.get('ext_store.scim-provisioning') || {};
115
+
116
+ const userCount = Object.keys(store).filter(k => k.startsWith('scim:user:')).length;
117
+ const groupCount = Object.keys(store).filter(k => k.startsWith('scim:group:')).length;
118
+
119
+ console.log('');
120
+ console.log(chalk.cyan.bold('SCIM Server Status'));
121
+ console.log(chalk.gray('─'.repeat(40)));
122
+ console.log(` Status: ${config.running ? chalk.green('running') : chalk.red('stopped')}`);
123
+ console.log(` Port: ${chalk.white(config.port || 7475)}`);
124
+ console.log(` Endpoint: ${chalk.white(config.endpoint || '/scim/v2')}`);
125
+ let tokenConfigured = !!config.bearerToken;
126
+ if (!tokenConfigured) {
127
+ try {
128
+ const keytar = (await import('keytar')).default;
129
+ tokenConfigured = !!(await keytar.getPassword('palexplorer', 'scim.token'));
130
+ } catch {}
131
+ }
132
+ console.log(` Token: ${tokenConfigured ? chalk.green('configured') : chalk.yellow('not set')}`);
133
+ console.log(` Users: ${chalk.white(userCount)}`);
134
+ console.log(` Groups: ${chalk.white(groupCount)}`);
135
+ console.log('');
136
+ } catch (err) {
137
+ console.error(chalk.red(`Status failed: ${err.message}`));
138
+ process.exitCode = 1;
139
+ }
140
+ });
141
+
142
+ cmd
143
+ .command('users')
144
+ .description('list provisioned users')
145
+ .action(async () => {
146
+ try {
147
+ const extConfig = (await import('../utils/config.js')).default;
148
+ const store = extConfig.get('ext_store.scim-provisioning') || {};
149
+ const users = Object.entries(store)
150
+ .filter(([k]) => k.startsWith('scim:user:'))
151
+ .map(([, v]) => v);
152
+
153
+ if (!users.length) {
154
+ console.log(chalk.gray('No provisioned users.'));
155
+ return;
156
+ }
157
+
158
+ console.log('');
159
+ console.log(chalk.cyan.bold('Provisioned Users'));
160
+ console.log(chalk.gray('─'.repeat(50)));
161
+ for (const user of users) {
162
+ const status = user.active !== false ? chalk.green('active') : chalk.red('deactivated');
163
+ console.log(` ${chalk.white(user.displayName || user.userName || user.id)} ${status}`);
164
+ if (user.userName) console.log(` Username: ${chalk.gray(user.userName)}`);
165
+ if (user.email) console.log(` Email: ${chalk.gray(user.email)}`);
166
+ }
167
+ console.log('');
168
+ } catch (err) {
169
+ console.error(chalk.red(`Users failed: ${err.message}`));
170
+ process.exitCode = 1;
171
+ }
172
+ });
173
+
174
+ cmd
175
+ .command('groups')
176
+ .description('list provisioned groups')
177
+ .action(async () => {
178
+ try {
179
+ const extConfig = (await import('../utils/config.js')).default;
180
+ const store = extConfig.get('ext_store.scim-provisioning') || {};
181
+ const groups = Object.entries(store)
182
+ .filter(([k]) => k.startsWith('scim:group:'))
183
+ .map(([, v]) => v);
184
+
185
+ if (!groups.length) {
186
+ console.log(chalk.gray('No provisioned groups.'));
187
+ return;
188
+ }
189
+
190
+ console.log('');
191
+ console.log(chalk.cyan.bold('Provisioned Groups'));
192
+ console.log(chalk.gray('─'.repeat(50)));
193
+ for (const group of groups) {
194
+ const memberCount = group.members?.length || 0;
195
+ console.log(` ${chalk.white(group.displayName || group.id)} ${chalk.gray(`(${memberCount} members)`)}`);
196
+ }
197
+ console.log('');
198
+ } catch (err) {
199
+ console.error(chalk.red(`Groups failed: ${err.message}`));
200
+ process.exitCode = 1;
201
+ }
202
+ });
203
+ }