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.
- package/README.md +149 -149
- package/bin/pal.js +63 -2
- package/extensions/@palexplorer/analytics/extension.json +20 -1
- package/extensions/@palexplorer/analytics/index.js +19 -9
- package/extensions/@palexplorer/audit/extension.json +14 -0
- package/extensions/@palexplorer/auth-email/extension.json +15 -0
- package/extensions/@palexplorer/auth-oauth/extension.json +15 -0
- package/extensions/@palexplorer/chat/extension.json +14 -0
- package/extensions/@palexplorer/discovery/extension.json +17 -0
- package/extensions/@palexplorer/discovery/index.js +1 -1
- package/extensions/@palexplorer/email-notifications/extension.json +23 -0
- package/extensions/@palexplorer/groups/extension.json +15 -0
- package/extensions/@palexplorer/share-links/extension.json +15 -0
- package/extensions/@palexplorer/sync/extension.json +16 -0
- package/extensions/@palexplorer/user-mgmt/extension.json +15 -0
- package/lib/capabilities.js +24 -24
- package/lib/commands/analytics.js +175 -175
- package/lib/commands/api-keys.js +131 -131
- package/lib/commands/audit.js +235 -235
- package/lib/commands/auth.js +137 -137
- package/lib/commands/backup.js +76 -76
- package/lib/commands/billing.js +148 -148
- package/lib/commands/chat.js +217 -217
- package/lib/commands/cloud-backup.js +231 -231
- package/lib/commands/comment.js +99 -99
- package/lib/commands/completion.js +203 -203
- package/lib/commands/compliance.js +218 -218
- package/lib/commands/config.js +136 -136
- package/lib/commands/connect.js +44 -44
- package/lib/commands/dept.js +294 -294
- package/lib/commands/device.js +146 -146
- package/lib/commands/download.js +240 -226
- package/lib/commands/explorer.js +178 -178
- package/lib/commands/extension.js +1060 -970
- package/lib/commands/favorite.js +90 -90
- package/lib/commands/federation.js +270 -270
- package/lib/commands/file.js +533 -533
- package/lib/commands/group.js +271 -271
- package/lib/commands/gui-share.js +29 -29
- package/lib/commands/init.js +61 -61
- package/lib/commands/invite.js +59 -59
- package/lib/commands/list.js +58 -58
- package/lib/commands/log.js +116 -116
- package/lib/commands/nearby.js +108 -108
- package/lib/commands/network.js +251 -251
- package/lib/commands/notify.js +198 -198
- package/lib/commands/org.js +273 -273
- package/lib/commands/pal.js +403 -180
- package/lib/commands/permissions.js +216 -216
- package/lib/commands/pin.js +97 -97
- package/lib/commands/protocol.js +357 -357
- package/lib/commands/rbac.js +147 -147
- package/lib/commands/recover.js +36 -36
- package/lib/commands/register.js +171 -171
- package/lib/commands/relay.js +131 -131
- package/lib/commands/remote.js +368 -368
- package/lib/commands/revoke.js +50 -50
- package/lib/commands/scanner.js +280 -280
- package/lib/commands/schedule.js +344 -344
- package/lib/commands/scim.js +203 -203
- package/lib/commands/search.js +181 -181
- package/lib/commands/serve.js +438 -438
- package/lib/commands/server.js +350 -350
- package/lib/commands/share-link.js +199 -199
- package/lib/commands/share.js +336 -323
- package/lib/commands/sso.js +200 -200
- package/lib/commands/status.js +145 -145
- package/lib/commands/stream.js +562 -562
- package/lib/commands/su.js +187 -187
- package/lib/commands/sync.js +979 -979
- package/lib/commands/transfers.js +152 -152
- package/lib/commands/uninstall.js +188 -188
- package/lib/commands/update.js +204 -204
- package/lib/commands/user.js +276 -276
- package/lib/commands/vfs.js +84 -84
- package/lib/commands/web-login.js +79 -79
- package/lib/commands/web.js +52 -52
- package/lib/commands/webhook.js +180 -180
- package/lib/commands/whoami.js +59 -59
- package/lib/commands/workspace.js +121 -121
- package/lib/core/billing.js +16 -5
- package/lib/core/dhtDiscovery.js +9 -2
- package/lib/core/discoveryClient.js +13 -7
- package/lib/core/extensions.js +142 -1
- package/lib/core/identity.js +33 -2
- package/lib/core/imageProcessor.js +109 -0
- package/lib/core/imageTorrent.js +167 -0
- package/lib/core/permissions.js +1 -1
- package/lib/core/pro.js +11 -4
- package/lib/core/serverList.js +4 -1
- package/lib/core/shares.js +12 -1
- package/lib/core/signalingServer.js +14 -2
- package/lib/core/su.js +1 -1
- package/lib/core/users.js +1 -1
- package/lib/protocol/messages.js +12 -3
- package/lib/utils/explorer.js +1 -1
- package/lib/utils/help.js +357 -357
- package/lib/utils/torrent.js +1 -0
- package/package.json +4 -3
package/lib/commands/su.js
CHANGED
|
@@ -1,187 +1,187 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import readline from 'readline';
|
|
3
|
-
import config from '../utils/config.js';
|
|
4
|
-
import { setSuToken, hasSuToken, authenticate, isAuthenticated, requireSu, removeSuToken } from '../core/su.js';
|
|
5
|
-
import { getPrimaryServer, getServers, addServer as addDiscoveryServer, removeServer as removeDiscoveryServer, setPrimaryServer, addUserServer } from '../core/discoveryClient.js';
|
|
6
|
-
import { refreshServerList, healthCheckServers, getServerRoles, SERVER_ROLES, isWriteTrusted } from '../core/serverList.js';
|
|
7
|
-
import { parseCommaList } from '../utils/cli.js';
|
|
8
|
-
|
|
9
|
-
function prompt(question, { hidden = false } = {}) {
|
|
10
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
11
|
-
if (hidden) {
|
|
12
|
-
const origWrite = process.stdout.write.bind(process.stdout);
|
|
13
|
-
process.stdout.write = (s) => {
|
|
14
|
-
if (s === question) return origWrite(s);
|
|
15
|
-
return origWrite('');
|
|
16
|
-
};
|
|
17
|
-
return new Promise(resolve => rl.question(question, answer => {
|
|
18
|
-
process.stdout.write = origWrite;
|
|
19
|
-
origWrite('\n');
|
|
20
|
-
rl.close();
|
|
21
|
-
resolve(answer.trim());
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
return new Promise(resolve => rl.question(question, answer => { rl.close(); resolve(answer.trim()); }));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function confirm(question) {
|
|
28
|
-
return prompt(question).then(a => a.toLowerCase() === 'y');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default function suCommand(program) {
|
|
32
|
-
const su = program.command('su').description('super user commands (network-level administration)');
|
|
33
|
-
|
|
34
|
-
su.addHelpText('after', `
|
|
35
|
-
The super user (SU) controls the discovery server network.
|
|
36
|
-
SU is separate from the local device owner role.
|
|
37
|
-
|
|
38
|
-
Setup:
|
|
39
|
-
$
|
|
40
|
-
$
|
|
41
|
-
|
|
42
|
-
Server management:
|
|
43
|
-
$
|
|
44
|
-
$
|
|
45
|
-
$
|
|
46
|
-
|
|
47
|
-
Other:
|
|
48
|
-
$
|
|
49
|
-
`);
|
|
50
|
-
|
|
51
|
-
su
|
|
52
|
-
.command('setup')
|
|
53
|
-
.description('set the super user token (first time or reset)')
|
|
54
|
-
.action(async () => {
|
|
55
|
-
if (hasSuToken()) {
|
|
56
|
-
const current = await prompt('Enter current SU token: ', { hidden: true });
|
|
57
|
-
if (!authenticate(current)) {
|
|
58
|
-
console.log(chalk.red('Invalid SU token.'));
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const token = await prompt('Enter new SU token: ', { hidden: true });
|
|
63
|
-
if (!token || token.length < 8) {
|
|
64
|
-
console.log(chalk.red('Token must be at least 8 characters.'));
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const confirm2 = await prompt('Confirm SU token: ', { hidden: true });
|
|
68
|
-
if (token !== confirm2) {
|
|
69
|
-
console.log(chalk.red('Tokens do not match.'));
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
setSuToken(token);
|
|
73
|
-
authenticate(token);
|
|
74
|
-
console.log(chalk.green('SU token set and authenticated for this session.'));
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
su
|
|
78
|
-
.command('auth')
|
|
79
|
-
.description('authenticate as super user for this session')
|
|
80
|
-
.action(async () => {
|
|
81
|
-
if (!hasSuToken()) {
|
|
82
|
-
console.log(chalk.red('No SU token configured. Run "
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (isAuthenticated()) {
|
|
86
|
-
console.log(chalk.green('Already authenticated as SU.'));
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const token = await prompt('SU token: ', { hidden: true });
|
|
90
|
-
if (authenticate(token)) {
|
|
91
|
-
console.log(chalk.green('Authenticated as super user.'));
|
|
92
|
-
} else {
|
|
93
|
-
console.log(chalk.red('Invalid SU token.'));
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
su
|
|
98
|
-
.command('reset')
|
|
99
|
-
.description('remove the SU token')
|
|
100
|
-
.action(async () => {
|
|
101
|
-
if (!hasSuToken()) {
|
|
102
|
-
console.log(chalk.yellow('No SU token is set.'));
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const token = await prompt('Enter current SU token to confirm: ', { hidden: true });
|
|
106
|
-
if (!authenticate(token)) {
|
|
107
|
-
console.log(chalk.red('Invalid SU token.'));
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
removeSuToken();
|
|
111
|
-
console.log(chalk.green('SU token removed.'));
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// Server management subcommands
|
|
115
|
-
const server = su.command('server').description('manage discovery servers (SU only)');
|
|
116
|
-
|
|
117
|
-
server
|
|
118
|
-
.command('add <url>')
|
|
119
|
-
.description('add a discovery server to the network')
|
|
120
|
-
.option('-y, --yes', 'Skip confirmation prompt')
|
|
121
|
-
.option('--skip-verify', 'Skip server verification (not recommended)')
|
|
122
|
-
.option('--read-only', 'Add as read-only (no writes sent to this server)')
|
|
123
|
-
.option('--roles <roles>', 'Comma-separated roles (discovery,signaling,turn,stun,relay,billing)')
|
|
124
|
-
.action(async (url, opts) => {
|
|
125
|
-
try { requireSu(); } catch (e) { console.log(chalk.red(e.message)); return; }
|
|
126
|
-
const roles = parseCommaList(opts.roles).filter(r => SERVER_ROLES.includes(r));
|
|
127
|
-
const trustWrites = !opts.readOnly;
|
|
128
|
-
|
|
129
|
-
if (opts.skipVerify) {
|
|
130
|
-
addDiscoveryServer(url, { skipVerify: true });
|
|
131
|
-
if (roles.length > 0) {
|
|
132
|
-
await addUserServer(url, roles, { trustWrites });
|
|
133
|
-
}
|
|
134
|
-
console.log(chalk.yellow('Added without verification (no pinned key).'));
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
try {
|
|
139
|
-
console.log(chalk.blue(`Verifying server at ${url}...`));
|
|
140
|
-
const result = await addDiscoveryServer(url);
|
|
141
|
-
console.log('');
|
|
142
|
-
console.log(chalk.white(` Server key fingerprint: ${chalk.cyan(result.fingerprint)}`));
|
|
143
|
-
console.log(chalk.gray(` Trust: ${trustWrites ? 'read + write' : 'read-only'}`));
|
|
144
|
-
console.log('');
|
|
145
|
-
|
|
146
|
-
if (!opts.yes) {
|
|
147
|
-
const ok = await confirm(chalk.white(' Trust this server and add it? (y/N) '));
|
|
148
|
-
if (!ok) {
|
|
149
|
-
removeDiscoveryServer(url);
|
|
150
|
-
const pinned = config.get('pinnedServerKeys') || {};
|
|
151
|
-
delete pinned[url.replace(/\/+$/, '')];
|
|
152
|
-
config.set('pinnedServerKeys', pinned);
|
|
153
|
-
console.log(chalk.yellow(' Aborted.'));
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const roleResult = await addUserServer(url, roles, { trustWrites });
|
|
159
|
-
console.log(chalk.green(`Added server: ${url}`));
|
|
160
|
-
console.log(chalk.gray(` Roles: ${roleResult.roles.join(', ')}`));
|
|
161
|
-
console.log(chalk.gray(` Trust: ${trustWrites ? 'read + write' : 'read-only'}`));
|
|
162
|
-
console.log(chalk.gray(` Key pinned. Run '
|
|
163
|
-
} catch (err) {
|
|
164
|
-
console.log(chalk.red(`${err.message}`));
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
server
|
|
169
|
-
.command('remove <url>')
|
|
170
|
-
.description('remove a discovery server from the network')
|
|
171
|
-
.action((url) => {
|
|
172
|
-
try { requireSu(); } catch (e) { console.log(chalk.red(e.message)); return; }
|
|
173
|
-
const servers = removeDiscoveryServer(url);
|
|
174
|
-
console.log(chalk.green(`Removed: ${url}`));
|
|
175
|
-
console.log(chalk.gray(` Remaining: ${servers.length}`));
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
server
|
|
179
|
-
.command('set-primary <url>')
|
|
180
|
-
.description('set a discovery server as the primary')
|
|
181
|
-
.action((url) => {
|
|
182
|
-
try { requireSu(); } catch (e) { console.log(chalk.red(e.message)); return; }
|
|
183
|
-
const servers = setPrimaryServer(url);
|
|
184
|
-
console.log(chalk.green(`Primary set to: ${url}`));
|
|
185
|
-
console.log(chalk.gray(` Order: ${servers.join(', ')}`));
|
|
186
|
-
});
|
|
187
|
-
}
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import readline from 'readline';
|
|
3
|
+
import config from '../utils/config.js';
|
|
4
|
+
import { setSuToken, hasSuToken, authenticate, isAuthenticated, requireSu, removeSuToken } from '../core/su.js';
|
|
5
|
+
import { getPrimaryServer, getServers, addServer as addDiscoveryServer, removeServer as removeDiscoveryServer, setPrimaryServer, addUserServer } from '../core/discoveryClient.js';
|
|
6
|
+
import { refreshServerList, healthCheckServers, getServerRoles, SERVER_ROLES, isWriteTrusted } from '../core/serverList.js';
|
|
7
|
+
import { parseCommaList } from '../utils/cli.js';
|
|
8
|
+
|
|
9
|
+
function prompt(question, { hidden = false } = {}) {
|
|
10
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
11
|
+
if (hidden) {
|
|
12
|
+
const origWrite = process.stdout.write.bind(process.stdout);
|
|
13
|
+
process.stdout.write = (s) => {
|
|
14
|
+
if (s === question) return origWrite(s);
|
|
15
|
+
return origWrite('');
|
|
16
|
+
};
|
|
17
|
+
return new Promise(resolve => rl.question(question, answer => {
|
|
18
|
+
process.stdout.write = origWrite;
|
|
19
|
+
origWrite('\n');
|
|
20
|
+
rl.close();
|
|
21
|
+
resolve(answer.trim());
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
return new Promise(resolve => rl.question(question, answer => { rl.close(); resolve(answer.trim()); }));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function confirm(question) {
|
|
28
|
+
return prompt(question).then(a => a.toLowerCase() === 'y');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default function suCommand(program) {
|
|
32
|
+
const su = program.command('su').description('super user commands (network-level administration)');
|
|
33
|
+
|
|
34
|
+
su.addHelpText('after', `
|
|
35
|
+
The super user (SU) controls the discovery server network.
|
|
36
|
+
SU is separate from the local device owner role.
|
|
37
|
+
|
|
38
|
+
Setup:
|
|
39
|
+
$ pal su setup Set the SU token (first time only)
|
|
40
|
+
$ pal su auth Authenticate for this session
|
|
41
|
+
|
|
42
|
+
Server management:
|
|
43
|
+
$ pal su server add <url> Add a server to the network
|
|
44
|
+
$ pal su server remove <url> Remove a server
|
|
45
|
+
$ pal su server set-primary <url> Change primary server
|
|
46
|
+
|
|
47
|
+
Other:
|
|
48
|
+
$ pal su reset Remove the SU token
|
|
49
|
+
`);
|
|
50
|
+
|
|
51
|
+
su
|
|
52
|
+
.command('setup')
|
|
53
|
+
.description('set the super user token (first time or reset)')
|
|
54
|
+
.action(async () => {
|
|
55
|
+
if (hasSuToken()) {
|
|
56
|
+
const current = await prompt('Enter current SU token: ', { hidden: true });
|
|
57
|
+
if (!authenticate(current)) {
|
|
58
|
+
console.log(chalk.red('Invalid SU token.'));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const token = await prompt('Enter new SU token: ', { hidden: true });
|
|
63
|
+
if (!token || token.length < 8) {
|
|
64
|
+
console.log(chalk.red('Token must be at least 8 characters.'));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const confirm2 = await prompt('Confirm SU token: ', { hidden: true });
|
|
68
|
+
if (token !== confirm2) {
|
|
69
|
+
console.log(chalk.red('Tokens do not match.'));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
setSuToken(token);
|
|
73
|
+
authenticate(token);
|
|
74
|
+
console.log(chalk.green('SU token set and authenticated for this session.'));
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
su
|
|
78
|
+
.command('auth')
|
|
79
|
+
.description('authenticate as super user for this session')
|
|
80
|
+
.action(async () => {
|
|
81
|
+
if (!hasSuToken()) {
|
|
82
|
+
console.log(chalk.red('No SU token configured. Run "pal su setup" first.'));
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (isAuthenticated()) {
|
|
86
|
+
console.log(chalk.green('Already authenticated as SU.'));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const token = await prompt('SU token: ', { hidden: true });
|
|
90
|
+
if (authenticate(token)) {
|
|
91
|
+
console.log(chalk.green('Authenticated as super user.'));
|
|
92
|
+
} else {
|
|
93
|
+
console.log(chalk.red('Invalid SU token.'));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
su
|
|
98
|
+
.command('reset')
|
|
99
|
+
.description('remove the SU token')
|
|
100
|
+
.action(async () => {
|
|
101
|
+
if (!hasSuToken()) {
|
|
102
|
+
console.log(chalk.yellow('No SU token is set.'));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const token = await prompt('Enter current SU token to confirm: ', { hidden: true });
|
|
106
|
+
if (!authenticate(token)) {
|
|
107
|
+
console.log(chalk.red('Invalid SU token.'));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
removeSuToken();
|
|
111
|
+
console.log(chalk.green('SU token removed.'));
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// Server management subcommands
|
|
115
|
+
const server = su.command('server').description('manage discovery servers (SU only)');
|
|
116
|
+
|
|
117
|
+
server
|
|
118
|
+
.command('add <url>')
|
|
119
|
+
.description('add a discovery server to the network')
|
|
120
|
+
.option('-y, --yes', 'Skip confirmation prompt')
|
|
121
|
+
.option('--skip-verify', 'Skip server verification (not recommended)')
|
|
122
|
+
.option('--read-only', 'Add as read-only (no writes sent to this server)')
|
|
123
|
+
.option('--roles <roles>', 'Comma-separated roles (discovery,signaling,turn,stun,relay,billing)')
|
|
124
|
+
.action(async (url, opts) => {
|
|
125
|
+
try { requireSu(); } catch (e) { console.log(chalk.red(e.message)); return; }
|
|
126
|
+
const roles = parseCommaList(opts.roles).filter(r => SERVER_ROLES.includes(r));
|
|
127
|
+
const trustWrites = !opts.readOnly;
|
|
128
|
+
|
|
129
|
+
if (opts.skipVerify) {
|
|
130
|
+
addDiscoveryServer(url, { skipVerify: true });
|
|
131
|
+
if (roles.length > 0) {
|
|
132
|
+
await addUserServer(url, roles, { trustWrites });
|
|
133
|
+
}
|
|
134
|
+
console.log(chalk.yellow('Added without verification (no pinned key).'));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
console.log(chalk.blue(`Verifying server at ${url}...`));
|
|
140
|
+
const result = await addDiscoveryServer(url);
|
|
141
|
+
console.log('');
|
|
142
|
+
console.log(chalk.white(` Server key fingerprint: ${chalk.cyan(result.fingerprint)}`));
|
|
143
|
+
console.log(chalk.gray(` Trust: ${trustWrites ? 'read + write' : 'read-only'}`));
|
|
144
|
+
console.log('');
|
|
145
|
+
|
|
146
|
+
if (!opts.yes) {
|
|
147
|
+
const ok = await confirm(chalk.white(' Trust this server and add it? (y/N) '));
|
|
148
|
+
if (!ok) {
|
|
149
|
+
removeDiscoveryServer(url);
|
|
150
|
+
const pinned = config.get('pinnedServerKeys') || {};
|
|
151
|
+
delete pinned[url.replace(/\/+$/, '')];
|
|
152
|
+
config.set('pinnedServerKeys', pinned);
|
|
153
|
+
console.log(chalk.yellow(' Aborted.'));
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const roleResult = await addUserServer(url, roles, { trustWrites });
|
|
159
|
+
console.log(chalk.green(`Added server: ${url}`));
|
|
160
|
+
console.log(chalk.gray(` Roles: ${roleResult.roles.join(', ')}`));
|
|
161
|
+
console.log(chalk.gray(` Trust: ${trustWrites ? 'read + write' : 'read-only'}`));
|
|
162
|
+
console.log(chalk.gray(` Key pinned. Run 'pal server verify' to re-check.`));
|
|
163
|
+
} catch (err) {
|
|
164
|
+
console.log(chalk.red(`${err.message}`));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
server
|
|
169
|
+
.command('remove <url>')
|
|
170
|
+
.description('remove a discovery server from the network')
|
|
171
|
+
.action((url) => {
|
|
172
|
+
try { requireSu(); } catch (e) { console.log(chalk.red(e.message)); return; }
|
|
173
|
+
const servers = removeDiscoveryServer(url);
|
|
174
|
+
console.log(chalk.green(`Removed: ${url}`));
|
|
175
|
+
console.log(chalk.gray(` Remaining: ${servers.length}`));
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
server
|
|
179
|
+
.command('set-primary <url>')
|
|
180
|
+
.description('set a discovery server as the primary')
|
|
181
|
+
.action((url) => {
|
|
182
|
+
try { requireSu(); } catch (e) { console.log(chalk.red(e.message)); return; }
|
|
183
|
+
const servers = setPrimaryServer(url);
|
|
184
|
+
console.log(chalk.green(`Primary set to: ${url}`));
|
|
185
|
+
console.log(chalk.gray(` Order: ${servers.join(', ')}`));
|
|
186
|
+
});
|
|
187
|
+
}
|