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.
- 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/explorer.js
CHANGED
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
|
|
6
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
-
|
|
8
|
-
export default function explorerCommand(program) {
|
|
9
|
-
const explorer = program
|
|
10
|
-
.command('explorer')
|
|
11
|
-
.description('manage file manager integration (Explorer, Finder, Nautilus)')
|
|
12
|
-
.addHelpText('after', `
|
|
13
|
-
Examples:
|
|
14
|
-
$
|
|
15
|
-
$
|
|
16
|
-
`);
|
|
17
|
-
|
|
18
|
-
explorer
|
|
19
|
-
.command('install')
|
|
20
|
-
.description('install "Share with Pal" context menu for your platform')
|
|
21
|
-
.action(async () => {
|
|
22
|
-
const platform = process.platform;
|
|
23
|
-
try {
|
|
24
|
-
if (platform === 'win32') {
|
|
25
|
-
const { installExplorerContextMenu } = await import('../utils/explorer.js');
|
|
26
|
-
await installExplorerContextMenu();
|
|
27
|
-
console.log(chalk.green('Windows Explorer context menu installed.'));
|
|
28
|
-
} else if (platform === 'darwin') {
|
|
29
|
-
await installFinderAction();
|
|
30
|
-
} else if (platform === 'linux') {
|
|
31
|
-
await installNautilusScript();
|
|
32
|
-
} else {
|
|
33
|
-
console.log(chalk.yellow(`No file manager integration available for ${platform}.`));
|
|
34
|
-
}
|
|
35
|
-
} catch (err) {
|
|
36
|
-
console.error(chalk.red('Failed to install context menu:'), err.message);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
explorer
|
|
41
|
-
.command('uninstall')
|
|
42
|
-
.description('remove "Share with Pal" context menu')
|
|
43
|
-
.action(async () => {
|
|
44
|
-
const platform = process.platform;
|
|
45
|
-
try {
|
|
46
|
-
if (platform === 'win32') {
|
|
47
|
-
const { uninstallExplorerContextMenu } = await import('../utils/explorer.js');
|
|
48
|
-
await uninstallExplorerContextMenu();
|
|
49
|
-
console.log(chalk.green('Windows Explorer context menu removed.'));
|
|
50
|
-
} else if (platform === 'darwin') {
|
|
51
|
-
await uninstallFinderAction();
|
|
52
|
-
} else if (platform === 'linux') {
|
|
53
|
-
await uninstallNautilusScript();
|
|
54
|
-
} else {
|
|
55
|
-
console.log(chalk.yellow(`No file manager integration available for ${platform}.`));
|
|
56
|
-
}
|
|
57
|
-
} catch (err) {
|
|
58
|
-
console.error(chalk.red('Failed to remove context menu:'), err.message);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function installFinderAction() {
|
|
64
|
-
const workflowDir = path.join(
|
|
65
|
-
process.env.HOME,
|
|
66
|
-
'Library/Services/Share with Pal.workflow/Contents'
|
|
67
|
-
);
|
|
68
|
-
const plistPath = path.join(workflowDir, 'Info.plist');
|
|
69
|
-
|
|
70
|
-
fs.mkdirSync(workflowDir, { recursive: true });
|
|
71
|
-
|
|
72
|
-
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
73
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
74
|
-
<plist version="1.0">
|
|
75
|
-
<dict>
|
|
76
|
-
<key>NSServices</key>
|
|
77
|
-
<array>
|
|
78
|
-
<dict>
|
|
79
|
-
<key>NSMenuItem</key>
|
|
80
|
-
<dict>
|
|
81
|
-
<key>default</key>
|
|
82
|
-
<string>Share with Pal</string>
|
|
83
|
-
</dict>
|
|
84
|
-
<key>NSMessage</key>
|
|
85
|
-
<string>runWorkflowAsService</string>
|
|
86
|
-
<key>NSSendFileTypes</key>
|
|
87
|
-
<array>
|
|
88
|
-
<string>public.item</string>
|
|
89
|
-
</array>
|
|
90
|
-
</dict>
|
|
91
|
-
</array>
|
|
92
|
-
</dict>
|
|
93
|
-
</plist>
|
|
94
|
-
`;
|
|
95
|
-
|
|
96
|
-
const script = `#!/bin/bash
|
|
97
|
-
# Share with Pal - Finder Quick Action
|
|
98
|
-
for f in "$@"; do
|
|
99
|
-
|
|
100
|
-
done
|
|
101
|
-
`;
|
|
102
|
-
|
|
103
|
-
const documentWf = path.join(workflowDir, 'document.wflow');
|
|
104
|
-
fs.writeFileSync(plistPath, plist);
|
|
105
|
-
fs.writeFileSync(path.join(workflowDir, 'share-with-pal.sh'), script, { mode: 0o755 });
|
|
106
|
-
|
|
107
|
-
console.log(chalk.green('Finder Quick Action created at:'));
|
|
108
|
-
console.log(chalk.gray(` ${workflowDir}`));
|
|
109
|
-
console.log(chalk.yellow('Note: You may need to enable it in System Preferences > Extensions > Finder.'));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
async function uninstallFinderAction() {
|
|
113
|
-
const workflowDir = path.join(
|
|
114
|
-
process.env.HOME,
|
|
115
|
-
'Library/Services/Share with Pal.workflow'
|
|
116
|
-
);
|
|
117
|
-
if (fs.existsSync(workflowDir)) {
|
|
118
|
-
fs.rmSync(workflowDir, { recursive: true });
|
|
119
|
-
console.log(chalk.green('Finder Quick Action removed.'));
|
|
120
|
-
} else {
|
|
121
|
-
console.log(chalk.yellow('Finder Quick Action not found.'));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
async function installNautilusScript() {
|
|
126
|
-
const scriptDir = path.join(process.env.HOME, '.local/share/nautilus/scripts');
|
|
127
|
-
const scriptPath = path.join(scriptDir, 'Share with Pal');
|
|
128
|
-
|
|
129
|
-
fs.mkdirSync(scriptDir, { recursive: true });
|
|
130
|
-
|
|
131
|
-
const script = `#!/bin/bash
|
|
132
|
-
# Share with Pal - Nautilus Script
|
|
133
|
-
IFS=$'\\n'
|
|
134
|
-
for f in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
|
|
135
|
-
|
|
136
|
-
done
|
|
137
|
-
`;
|
|
138
|
-
|
|
139
|
-
fs.writeFileSync(scriptPath, script, { mode: 0o755 });
|
|
140
|
-
|
|
141
|
-
// Also create a .desktop action
|
|
142
|
-
const desktopActionsDir = path.join(process.env.HOME, '.local/share/file-manager/actions');
|
|
143
|
-
fs.mkdirSync(desktopActionsDir, { recursive: true });
|
|
144
|
-
|
|
145
|
-
const desktopAction = `[Desktop Action]
|
|
146
|
-
Name=Share with Pal
|
|
147
|
-
Icon=palexplorer
|
|
148
|
-
Exec=
|
|
149
|
-
MimeType=inode/directory;application/octet-stream;
|
|
150
|
-
`;
|
|
151
|
-
|
|
152
|
-
fs.writeFileSync(path.join(desktopActionsDir, 'palexplorer-share.desktop'), desktopAction);
|
|
153
|
-
|
|
154
|
-
console.log(chalk.green('Nautilus script installed at:'));
|
|
155
|
-
console.log(chalk.gray(` ${scriptPath}`));
|
|
156
|
-
console.log(chalk.yellow('Right-click a file in Nautilus > Scripts > Share with Pal'));
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
async function uninstallNautilusScript() {
|
|
160
|
-
const scriptPath = path.join(process.env.HOME, '.local/share/nautilus/scripts/Share with Pal');
|
|
161
|
-
const actionPath = path.join(process.env.HOME, '.local/share/file-manager/actions/palexplorer-share.desktop');
|
|
162
|
-
|
|
163
|
-
let removed = false;
|
|
164
|
-
if (fs.existsSync(scriptPath)) {
|
|
165
|
-
fs.unlinkSync(scriptPath);
|
|
166
|
-
removed = true;
|
|
167
|
-
}
|
|
168
|
-
if (fs.existsSync(actionPath)) {
|
|
169
|
-
fs.unlinkSync(actionPath);
|
|
170
|
-
removed = true;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (removed) {
|
|
174
|
-
console.log(chalk.green('Nautilus integration removed.'));
|
|
175
|
-
} else {
|
|
176
|
-
console.log(chalk.yellow('No Nautilus integration found.'));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
export default function explorerCommand(program) {
|
|
9
|
+
const explorer = program
|
|
10
|
+
.command('explorer')
|
|
11
|
+
.description('manage file manager integration (Explorer, Finder, Nautilus)')
|
|
12
|
+
.addHelpText('after', `
|
|
13
|
+
Examples:
|
|
14
|
+
$ pal explorer install Add "Share with Palexplorer" to context menu
|
|
15
|
+
$ pal explorer uninstall Remove context menu entry
|
|
16
|
+
`);
|
|
17
|
+
|
|
18
|
+
explorer
|
|
19
|
+
.command('install')
|
|
20
|
+
.description('install "Share with Pal" context menu for your platform')
|
|
21
|
+
.action(async () => {
|
|
22
|
+
const platform = process.platform;
|
|
23
|
+
try {
|
|
24
|
+
if (platform === 'win32') {
|
|
25
|
+
const { installExplorerContextMenu } = await import('../utils/explorer.js');
|
|
26
|
+
await installExplorerContextMenu();
|
|
27
|
+
console.log(chalk.green('Windows Explorer context menu installed.'));
|
|
28
|
+
} else if (platform === 'darwin') {
|
|
29
|
+
await installFinderAction();
|
|
30
|
+
} else if (platform === 'linux') {
|
|
31
|
+
await installNautilusScript();
|
|
32
|
+
} else {
|
|
33
|
+
console.log(chalk.yellow(`No file manager integration available for ${platform}.`));
|
|
34
|
+
}
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.error(chalk.red('Failed to install context menu:'), err.message);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
explorer
|
|
41
|
+
.command('uninstall')
|
|
42
|
+
.description('remove "Share with Pal" context menu')
|
|
43
|
+
.action(async () => {
|
|
44
|
+
const platform = process.platform;
|
|
45
|
+
try {
|
|
46
|
+
if (platform === 'win32') {
|
|
47
|
+
const { uninstallExplorerContextMenu } = await import('../utils/explorer.js');
|
|
48
|
+
await uninstallExplorerContextMenu();
|
|
49
|
+
console.log(chalk.green('Windows Explorer context menu removed.'));
|
|
50
|
+
} else if (platform === 'darwin') {
|
|
51
|
+
await uninstallFinderAction();
|
|
52
|
+
} else if (platform === 'linux') {
|
|
53
|
+
await uninstallNautilusScript();
|
|
54
|
+
} else {
|
|
55
|
+
console.log(chalk.yellow(`No file manager integration available for ${platform}.`));
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
console.error(chalk.red('Failed to remove context menu:'), err.message);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function installFinderAction() {
|
|
64
|
+
const workflowDir = path.join(
|
|
65
|
+
process.env.HOME,
|
|
66
|
+
'Library/Services/Share with Pal.workflow/Contents'
|
|
67
|
+
);
|
|
68
|
+
const plistPath = path.join(workflowDir, 'Info.plist');
|
|
69
|
+
|
|
70
|
+
fs.mkdirSync(workflowDir, { recursive: true });
|
|
71
|
+
|
|
72
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
73
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
74
|
+
<plist version="1.0">
|
|
75
|
+
<dict>
|
|
76
|
+
<key>NSServices</key>
|
|
77
|
+
<array>
|
|
78
|
+
<dict>
|
|
79
|
+
<key>NSMenuItem</key>
|
|
80
|
+
<dict>
|
|
81
|
+
<key>default</key>
|
|
82
|
+
<string>Share with Pal</string>
|
|
83
|
+
</dict>
|
|
84
|
+
<key>NSMessage</key>
|
|
85
|
+
<string>runWorkflowAsService</string>
|
|
86
|
+
<key>NSSendFileTypes</key>
|
|
87
|
+
<array>
|
|
88
|
+
<string>public.item</string>
|
|
89
|
+
</array>
|
|
90
|
+
</dict>
|
|
91
|
+
</array>
|
|
92
|
+
</dict>
|
|
93
|
+
</plist>
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
const script = `#!/bin/bash
|
|
97
|
+
# Share with Pal - Finder Quick Action
|
|
98
|
+
for f in "$@"; do
|
|
99
|
+
pal share "$f"
|
|
100
|
+
done
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
const documentWf = path.join(workflowDir, 'document.wflow');
|
|
104
|
+
fs.writeFileSync(plistPath, plist);
|
|
105
|
+
fs.writeFileSync(path.join(workflowDir, 'share-with-pal.sh'), script, { mode: 0o755 });
|
|
106
|
+
|
|
107
|
+
console.log(chalk.green('Finder Quick Action created at:'));
|
|
108
|
+
console.log(chalk.gray(` ${workflowDir}`));
|
|
109
|
+
console.log(chalk.yellow('Note: You may need to enable it in System Preferences > Extensions > Finder.'));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async function uninstallFinderAction() {
|
|
113
|
+
const workflowDir = path.join(
|
|
114
|
+
process.env.HOME,
|
|
115
|
+
'Library/Services/Share with Pal.workflow'
|
|
116
|
+
);
|
|
117
|
+
if (fs.existsSync(workflowDir)) {
|
|
118
|
+
fs.rmSync(workflowDir, { recursive: true });
|
|
119
|
+
console.log(chalk.green('Finder Quick Action removed.'));
|
|
120
|
+
} else {
|
|
121
|
+
console.log(chalk.yellow('Finder Quick Action not found.'));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function installNautilusScript() {
|
|
126
|
+
const scriptDir = path.join(process.env.HOME, '.local/share/nautilus/scripts');
|
|
127
|
+
const scriptPath = path.join(scriptDir, 'Share with Pal');
|
|
128
|
+
|
|
129
|
+
fs.mkdirSync(scriptDir, { recursive: true });
|
|
130
|
+
|
|
131
|
+
const script = `#!/bin/bash
|
|
132
|
+
# Share with Pal - Nautilus Script
|
|
133
|
+
IFS=$'\\n'
|
|
134
|
+
for f in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
|
|
135
|
+
pal share "$f"
|
|
136
|
+
done
|
|
137
|
+
`;
|
|
138
|
+
|
|
139
|
+
fs.writeFileSync(scriptPath, script, { mode: 0o755 });
|
|
140
|
+
|
|
141
|
+
// Also create a .desktop action
|
|
142
|
+
const desktopActionsDir = path.join(process.env.HOME, '.local/share/file-manager/actions');
|
|
143
|
+
fs.mkdirSync(desktopActionsDir, { recursive: true });
|
|
144
|
+
|
|
145
|
+
const desktopAction = `[Desktop Action]
|
|
146
|
+
Name=Share with Pal
|
|
147
|
+
Icon=palexplorer
|
|
148
|
+
Exec=pal share %f
|
|
149
|
+
MimeType=inode/directory;application/octet-stream;
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
fs.writeFileSync(path.join(desktopActionsDir, 'palexplorer-share.desktop'), desktopAction);
|
|
153
|
+
|
|
154
|
+
console.log(chalk.green('Nautilus script installed at:'));
|
|
155
|
+
console.log(chalk.gray(` ${scriptPath}`));
|
|
156
|
+
console.log(chalk.yellow('Right-click a file in Nautilus > Scripts > Share with Pal'));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async function uninstallNautilusScript() {
|
|
160
|
+
const scriptPath = path.join(process.env.HOME, '.local/share/nautilus/scripts/Share with Pal');
|
|
161
|
+
const actionPath = path.join(process.env.HOME, '.local/share/file-manager/actions/palexplorer-share.desktop');
|
|
162
|
+
|
|
163
|
+
let removed = false;
|
|
164
|
+
if (fs.existsSync(scriptPath)) {
|
|
165
|
+
fs.unlinkSync(scriptPath);
|
|
166
|
+
removed = true;
|
|
167
|
+
}
|
|
168
|
+
if (fs.existsSync(actionPath)) {
|
|
169
|
+
fs.unlinkSync(actionPath);
|
|
170
|
+
removed = true;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (removed) {
|
|
174
|
+
console.log(chalk.green('Nautilus integration removed.'));
|
|
175
|
+
} else {
|
|
176
|
+
console.log(chalk.yellow('No Nautilus integration found.'));
|
|
177
|
+
}
|
|
178
|
+
}
|