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,251 +1,251 @@
1
- import chalk from 'chalk';
2
- import {
3
- createNetwork,
4
- listNetworks,
5
- getNetwork,
6
- deleteNetwork,
7
- createInvite,
8
- joinNetwork,
9
- listMembers,
10
- listGroups,
11
- createGroup as createNetworkGroup,
12
- } from '../core/networks.js';
13
- import { connect, disconnect, getConnectionState } from '../core/connectionManager.js';
14
-
15
- export default function networkCommand(program) {
16
- const cmd = program
17
- .command('network')
18
- .description('manage networks')
19
- .addHelpText('after', `
20
- Examples:
21
- $ pe network create "My Network" Create a network
22
- $ pe network list List your networks
23
- $ pe network info <id> Show network details
24
- $ pe network invite <id> Create an invite link
25
- $ pe network join <code> Join via invite code
26
- $ pe network members <id> List members
27
- $ pe network groups <id> List groups
28
- $ pe network create-group <id> <name> Create a group in network
29
- $ pe network delete <id> Delete a network
30
- $ pe network connect Connect to the network
31
- $ pe network disconnect Disconnect from the network
32
- `);
33
-
34
- cmd
35
- .command('create <name>')
36
- .description('create a new network')
37
- .option('--slug <slug>', 'URL-friendly slug')
38
- .option('--description <desc>', 'Network description')
39
- .action(async (name, opts) => {
40
- try {
41
- const network = await createNetwork(name, opts.slug, opts.description);
42
- console.log(chalk.green(`Network '${name}' created.`));
43
- console.log(chalk.gray(`ID: ${network.id}`));
44
- if (network.slug) console.log(chalk.gray(`Slug: ${network.slug}`));
45
- } catch (err) {
46
- console.log(chalk.red(err.message));
47
- process.exitCode = 1;
48
- }
49
- });
50
-
51
- cmd
52
- .command('list')
53
- .description('list your networks')
54
- .action(async () => {
55
- try {
56
- const networks = await listNetworks();
57
- if (!networks || networks.length === 0) {
58
- console.log(chalk.gray('No networks. Create one with `pe network create <name>`.'));
59
- return;
60
- }
61
- console.log('');
62
- console.log(chalk.cyan('Networks:'));
63
- for (const n of networks) {
64
- const members = n.memberCount != null ? chalk.gray(` (${n.memberCount} members)`) : '';
65
- const role = n.role ? chalk.yellow(` [${n.role}]`) : '';
66
- console.log(` ${chalk.white(n.name)}${role}${members}`);
67
- console.log(` ${chalk.gray(`ID: ${n.id}`)}`);
68
- if (n.description) console.log(` ${chalk.gray(n.description)}`);
69
- }
70
- console.log('');
71
- } catch (err) {
72
- console.log(chalk.red(err.message));
73
- process.exitCode = 1;
74
- }
75
- });
76
-
77
- cmd
78
- .command('info <id>')
79
- .description('show network details')
80
- .action(async (id) => {
81
- try {
82
- const n = await getNetwork(id);
83
- console.log('');
84
- console.log(chalk.cyan(`Network: ${n.name}`));
85
- console.log(` ID: ${chalk.white(n.id)}`);
86
- if (n.slug) console.log(` Slug: ${chalk.white(n.slug)}`);
87
- if (n.description) console.log(` Description: ${chalk.white(n.description)}`);
88
- if (n.owner) console.log(` Owner: ${chalk.white(n.owner)}`);
89
- if (n.memberCount != null) console.log(` Members: ${chalk.white(n.memberCount)}`);
90
- if (n.createdAt) console.log(` Created: ${chalk.gray(n.createdAt)}`);
91
- console.log('');
92
- } catch (err) {
93
- console.log(chalk.red(err.message));
94
- process.exitCode = 1;
95
- }
96
- });
97
-
98
- cmd
99
- .command('delete <id>')
100
- .description('delete a network')
101
- .action(async (id) => {
102
- try {
103
- await deleteNetwork(id);
104
- console.log(chalk.green(`Network ${id} deleted.`));
105
- } catch (err) {
106
- console.log(chalk.red(err.message));
107
- process.exitCode = 1;
108
- }
109
- });
110
-
111
- cmd
112
- .command('invite <id>')
113
- .description('create an invite link')
114
- .option('--role <role>', 'Role for invited user: member or admin', 'member')
115
- .action(async (id, opts) => {
116
- try {
117
- const invite = await createInvite(id, opts.role);
118
- console.log(chalk.green('Invite created.'));
119
- console.log(` Code: ${chalk.white(invite.code)}`);
120
- if (invite.url) console.log(` Link: ${chalk.cyan(invite.url)}`);
121
- if (invite.expiresAt) console.log(` Expires: ${chalk.gray(invite.expiresAt)}`);
122
- } catch (err) {
123
- console.log(chalk.red(err.message));
124
- process.exitCode = 1;
125
- }
126
- });
127
-
128
- cmd
129
- .command('join <code>')
130
- .description('join a network via invite code')
131
- .action(async (code) => {
132
- try {
133
- const result = await joinNetwork(code);
134
- console.log(chalk.green(`Joined network '${result.name || result.networkId}'.`));
135
- } catch (err) {
136
- console.log(chalk.red(err.message));
137
- process.exitCode = 1;
138
- }
139
- });
140
-
141
- cmd
142
- .command('members <id>')
143
- .description('list network members')
144
- .action(async (id) => {
145
- try {
146
- const members = await listMembers(id);
147
- if (!members || members.length === 0) {
148
- console.log(chalk.gray('No members in this network.'));
149
- return;
150
- }
151
- console.log('');
152
- console.log(chalk.cyan('Members:'));
153
- for (const m of members) {
154
- const role = m.role ? chalk.yellow(` [${m.role}]`) : '';
155
- const handle = m.handle ? chalk.gray(` @${m.handle}`) : '';
156
- console.log(` ${chalk.white(m.name || m.userId)}${handle}${role}`);
157
- }
158
- console.log('');
159
- } catch (err) {
160
- console.log(chalk.red(err.message));
161
- process.exitCode = 1;
162
- }
163
- });
164
-
165
- cmd
166
- .command('groups <id>')
167
- .description('list groups in a network')
168
- .action(async (id) => {
169
- try {
170
- const groups = await listGroups(id);
171
- if (!groups || groups.length === 0) {
172
- console.log(chalk.gray('No groups in this network.'));
173
- return;
174
- }
175
- console.log('');
176
- console.log(chalk.cyan('Groups:'));
177
- for (const g of groups) {
178
- console.log(` ${chalk.white(g.name)} ${chalk.gray(`ID: ${g.id}`)}`);
179
- }
180
- console.log('');
181
- } catch (err) {
182
- console.log(chalk.red(err.message));
183
- process.exitCode = 1;
184
- }
185
- });
186
-
187
- cmd
188
- .command('create-group <network-id> <name>')
189
- .description('create a group in a network')
190
- .action(async (networkId, name) => {
191
- try {
192
- const group = await createNetworkGroup(networkId, name);
193
- console.log(chalk.green(`Group '${name}' created in network.`));
194
- console.log(chalk.gray(`ID: ${group.id}`));
195
- } catch (err) {
196
- console.log(chalk.red(err.message));
197
- process.exitCode = 1;
198
- }
199
- });
200
-
201
- cmd
202
- .command('connect')
203
- .description('connect to the Palexplorer network')
204
- .action(async () => {
205
- const current = getConnectionState();
206
- if (current.status === 'connected') {
207
- console.log(chalk.yellow('Already connected.'));
208
- return;
209
- }
210
- console.log(chalk.blue('Connecting to Palexplorer network...'));
211
- const result = await connect({
212
- onProgress: (step, progress) => {
213
- console.log(chalk.gray(` [${progress}%] ${step}`));
214
- },
215
- });
216
- if (result.connectedCount > 0) {
217
- console.log(chalk.green(`\nConnected to ${result.connectedCount} server(s).`));
218
- } else {
219
- console.log(chalk.yellow('\nWarning: No servers reachable.'));
220
- process.exitCode = 1;
221
- }
222
- });
223
-
224
- cmd
225
- .command('disconnect')
226
- .description('disconnect from the Palexplorer network')
227
- .action(async () => {
228
- const current = getConnectionState();
229
- if (current.status === 'disconnected') {
230
- console.log(chalk.yellow('Already disconnected.'));
231
- return;
232
- }
233
- console.log(chalk.blue('Disconnecting...'));
234
- await disconnect();
235
- console.log(chalk.green('Disconnected from network.'));
236
- });
237
-
238
- cmd.action(async () => {
239
- try {
240
- const networks = await listNetworks();
241
- if (!networks || networks.length === 0) {
242
- console.log(chalk.gray('No networks. Create one with `pe network create <name>`.'));
243
- } else {
244
- console.log(chalk.cyan(`${networks.length} network(s). Use \`pe network list\` for details.`));
245
- }
246
- } catch (err) {
247
- console.log(chalk.red(err.message));
248
- process.exitCode = 1;
249
- }
250
- });
251
- }
1
+ import chalk from 'chalk';
2
+ import {
3
+ createNetwork,
4
+ listNetworks,
5
+ getNetwork,
6
+ deleteNetwork,
7
+ createInvite,
8
+ joinNetwork,
9
+ listMembers,
10
+ listGroups,
11
+ createGroup as createNetworkGroup,
12
+ } from '../core/networks.js';
13
+ import { connect, disconnect, getConnectionState } from '../core/connectionManager.js';
14
+
15
+ export default function networkCommand(program) {
16
+ const cmd = program
17
+ .command('network')
18
+ .description('manage networks')
19
+ .addHelpText('after', `
20
+ Examples:
21
+ $ pal network create "My Network" Create a network
22
+ $ pal network list List your networks
23
+ $ pal network info <id> Show network details
24
+ $ pal network invite <id> Create an invite link
25
+ $ pal network join <code> Join via invite code
26
+ $ pal network members <id> List members
27
+ $ pal network groups <id> List groups
28
+ $ pal network create-group <id> <name> Create a group in network
29
+ $ pal network delete <id> Delete a network
30
+ $ pal network connect Connect to the network
31
+ $ pal network disconnect Disconnect from the network
32
+ `);
33
+
34
+ cmd
35
+ .command('create <name>')
36
+ .description('create a new network')
37
+ .option('--slug <slug>', 'URL-friendly slug')
38
+ .option('--description <desc>', 'Network description')
39
+ .action(async (name, opts) => {
40
+ try {
41
+ const network = await createNetwork(name, opts.slug, opts.description);
42
+ console.log(chalk.green(`Network '${name}' created.`));
43
+ console.log(chalk.gray(`ID: ${network.id}`));
44
+ if (network.slug) console.log(chalk.gray(`Slug: ${network.slug}`));
45
+ } catch (err) {
46
+ console.log(chalk.red(err.message));
47
+ process.exitCode = 1;
48
+ }
49
+ });
50
+
51
+ cmd
52
+ .command('list')
53
+ .description('list your networks')
54
+ .action(async () => {
55
+ try {
56
+ const networks = await listNetworks();
57
+ if (!networks || networks.length === 0) {
58
+ console.log(chalk.gray('No networks. Create one with `pal network create <name>`.'));
59
+ return;
60
+ }
61
+ console.log('');
62
+ console.log(chalk.cyan('Networks:'));
63
+ for (const n of networks) {
64
+ const members = n.memberCount != null ? chalk.gray(` (${n.memberCount} members)`) : '';
65
+ const role = n.role ? chalk.yellow(` [${n.role}]`) : '';
66
+ console.log(` ${chalk.white(n.name)}${role}${members}`);
67
+ console.log(` ${chalk.gray(`ID: ${n.id}`)}`);
68
+ if (n.description) console.log(` ${chalk.gray(n.description)}`);
69
+ }
70
+ console.log('');
71
+ } catch (err) {
72
+ console.log(chalk.red(err.message));
73
+ process.exitCode = 1;
74
+ }
75
+ });
76
+
77
+ cmd
78
+ .command('info <id>')
79
+ .description('show network details')
80
+ .action(async (id) => {
81
+ try {
82
+ const n = await getNetwork(id);
83
+ console.log('');
84
+ console.log(chalk.cyan(`Network: ${n.name}`));
85
+ console.log(` ID: ${chalk.white(n.id)}`);
86
+ if (n.slug) console.log(` Slug: ${chalk.white(n.slug)}`);
87
+ if (n.description) console.log(` Description: ${chalk.white(n.description)}`);
88
+ if (n.owner) console.log(` Owner: ${chalk.white(n.owner)}`);
89
+ if (n.memberCount != null) console.log(` Members: ${chalk.white(n.memberCount)}`);
90
+ if (n.createdAt) console.log(` Created: ${chalk.gray(n.createdAt)}`);
91
+ console.log('');
92
+ } catch (err) {
93
+ console.log(chalk.red(err.message));
94
+ process.exitCode = 1;
95
+ }
96
+ });
97
+
98
+ cmd
99
+ .command('delete <id>')
100
+ .description('delete a network')
101
+ .action(async (id) => {
102
+ try {
103
+ await deleteNetwork(id);
104
+ console.log(chalk.green(`Network ${id} deleted.`));
105
+ } catch (err) {
106
+ console.log(chalk.red(err.message));
107
+ process.exitCode = 1;
108
+ }
109
+ });
110
+
111
+ cmd
112
+ .command('invite <id>')
113
+ .description('create an invite link')
114
+ .option('--role <role>', 'Role for invited user: member or admin', 'member')
115
+ .action(async (id, opts) => {
116
+ try {
117
+ const invite = await createInvite(id, opts.role);
118
+ console.log(chalk.green('Invite created.'));
119
+ console.log(` Code: ${chalk.white(invite.code)}`);
120
+ if (invite.url) console.log(` Link: ${chalk.cyan(invite.url)}`);
121
+ if (invite.expiresAt) console.log(` Expires: ${chalk.gray(invite.expiresAt)}`);
122
+ } catch (err) {
123
+ console.log(chalk.red(err.message));
124
+ process.exitCode = 1;
125
+ }
126
+ });
127
+
128
+ cmd
129
+ .command('join <code>')
130
+ .description('join a network via invite code')
131
+ .action(async (code) => {
132
+ try {
133
+ const result = await joinNetwork(code);
134
+ console.log(chalk.green(`Joined network '${result.name || result.networkId}'.`));
135
+ } catch (err) {
136
+ console.log(chalk.red(err.message));
137
+ process.exitCode = 1;
138
+ }
139
+ });
140
+
141
+ cmd
142
+ .command('members <id>')
143
+ .description('list network members')
144
+ .action(async (id) => {
145
+ try {
146
+ const members = await listMembers(id);
147
+ if (!members || members.length === 0) {
148
+ console.log(chalk.gray('No members in this network.'));
149
+ return;
150
+ }
151
+ console.log('');
152
+ console.log(chalk.cyan('Members:'));
153
+ for (const m of members) {
154
+ const role = m.role ? chalk.yellow(` [${m.role}]`) : '';
155
+ const handle = m.handle ? chalk.gray(` @${m.handle}`) : '';
156
+ console.log(` ${chalk.white(m.name || m.userId)}${handle}${role}`);
157
+ }
158
+ console.log('');
159
+ } catch (err) {
160
+ console.log(chalk.red(err.message));
161
+ process.exitCode = 1;
162
+ }
163
+ });
164
+
165
+ cmd
166
+ .command('groups <id>')
167
+ .description('list groups in a network')
168
+ .action(async (id) => {
169
+ try {
170
+ const groups = await listGroups(id);
171
+ if (!groups || groups.length === 0) {
172
+ console.log(chalk.gray('No groups in this network.'));
173
+ return;
174
+ }
175
+ console.log('');
176
+ console.log(chalk.cyan('Groups:'));
177
+ for (const g of groups) {
178
+ console.log(` ${chalk.white(g.name)} ${chalk.gray(`ID: ${g.id}`)}`);
179
+ }
180
+ console.log('');
181
+ } catch (err) {
182
+ console.log(chalk.red(err.message));
183
+ process.exitCode = 1;
184
+ }
185
+ });
186
+
187
+ cmd
188
+ .command('create-group <network-id> <name>')
189
+ .description('create a group in a network')
190
+ .action(async (networkId, name) => {
191
+ try {
192
+ const group = await createNetworkGroup(networkId, name);
193
+ console.log(chalk.green(`Group '${name}' created in network.`));
194
+ console.log(chalk.gray(`ID: ${group.id}`));
195
+ } catch (err) {
196
+ console.log(chalk.red(err.message));
197
+ process.exitCode = 1;
198
+ }
199
+ });
200
+
201
+ cmd
202
+ .command('connect')
203
+ .description('connect to the Palexplorer network')
204
+ .action(async () => {
205
+ const current = getConnectionState();
206
+ if (current.status === 'connected') {
207
+ console.log(chalk.yellow('Already connected.'));
208
+ return;
209
+ }
210
+ console.log(chalk.blue('Connecting to Palexplorer network...'));
211
+ const result = await connect({
212
+ onProgress: (step, progress) => {
213
+ console.log(chalk.gray(` [${progress}%] ${step}`));
214
+ },
215
+ });
216
+ if (result.connectedCount > 0) {
217
+ console.log(chalk.green(`\nConnected to ${result.connectedCount} server(s).`));
218
+ } else {
219
+ console.log(chalk.yellow('\nWarning: No servers reachable.'));
220
+ process.exitCode = 1;
221
+ }
222
+ });
223
+
224
+ cmd
225
+ .command('disconnect')
226
+ .description('disconnect from the Palexplorer network')
227
+ .action(async () => {
228
+ const current = getConnectionState();
229
+ if (current.status === 'disconnected') {
230
+ console.log(chalk.yellow('Already disconnected.'));
231
+ return;
232
+ }
233
+ console.log(chalk.blue('Disconnecting...'));
234
+ await disconnect();
235
+ console.log(chalk.green('Disconnected from network.'));
236
+ });
237
+
238
+ cmd.action(async () => {
239
+ try {
240
+ const networks = await listNetworks();
241
+ if (!networks || networks.length === 0) {
242
+ console.log(chalk.gray('No networks. Create one with `pal network create <name>`.'));
243
+ } else {
244
+ console.log(chalk.cyan(`${networks.length} network(s). Use \`pal network list\` for details.`));
245
+ }
246
+ } catch (err) {
247
+ console.log(chalk.red(err.message));
248
+ process.exitCode = 1;
249
+ }
250
+ });
251
+ }