filefive 1.8.0 → 2.0.0
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/dist/App.js +6 -8
- package/dist/Connection.js +7 -8
- package/dist/FileWatcher.js +4 -5
- package/dist/Local.js +62 -22
- package/dist/LocalWatcher.js +21 -16
- package/dist/Password.js +5 -5
- package/dist/Queue.js +8 -8
- package/dist/RemoteFiles.js +5 -5
- package/dist/RemoteWatcher.js +1 -2
- package/dist/commands/checkVer.js +6 -3
- package/dist/commands/clear.js +2 -2
- package/dist/commands/connect.js +9 -8
- package/dist/commands/duplicate.js +2 -2
- package/dist/commands/mkdir.js +4 -4
- package/dist/commands/open.js +3 -2
- package/dist/commands/remove.js +2 -3
- package/dist/commands/rename.js +3 -3
- package/dist/commands/saveConnection.js +4 -6
- package/dist/commands/saveSettings.js +2 -2
- package/dist/commands/settings.js +7 -6
- package/dist/commands/write.js +2 -2
- package/dist/fs/Ftp.js +8 -7
- package/dist/fs/Local.js +7 -7
- package/dist/fs/S3.js +12 -11
- package/dist/fs/SFtp.js +11 -10
- package/dist/index.js +9 -8
- package/dist/public/index.js +1 -1
- package/dist/queues/Copy.js +5 -5
- package/dist/queues/Download.js +2 -2
- package/dist/queues/Queue.js +9 -9
- package/dist/queues/Remove.js +4 -4
- package/dist/queues/Upload.js +3 -3
- package/dist/transformers/git.js +11 -10
- package/dist/utils/os.js +17 -0
- package/dist/utils/path.js +4 -4
- package/dist/win.js +20 -0
- package/package.json +13 -13
package/dist/queues/Copy.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const posix_1 = require("node:path/posix");
|
|
7
7
|
const Queue_1 = __importDefault(require("./Queue"));
|
|
8
8
|
const types_1 = require("../types");
|
|
9
9
|
const URI_1 = require("../utils/URI");
|
|
@@ -19,7 +19,7 @@ class CopyQueue extends Queue_1.default {
|
|
|
19
19
|
if (this.move) { // No filter
|
|
20
20
|
const stat = this.stat(this.from);
|
|
21
21
|
await Promise.all(paths
|
|
22
|
-
.filter(path => path != dest && (0,
|
|
22
|
+
.filter(path => path != dest && (0, posix_1.dirname)(path) != dest)
|
|
23
23
|
.map(async (path) => {
|
|
24
24
|
const from = await stat(path);
|
|
25
25
|
if (from) {
|
|
@@ -44,12 +44,12 @@ class CopyQueue extends Queue_1.default {
|
|
|
44
44
|
try {
|
|
45
45
|
let p;
|
|
46
46
|
if (this.move) {
|
|
47
|
-
p = fs.mv(from.path, (0,
|
|
48
|
-
const parent = (0,
|
|
47
|
+
p = fs.mv(from.path, (0, posix_1.join)(to, ...dirs, from.name));
|
|
48
|
+
const parent = (0, posix_1.dirname)(from.path);
|
|
49
49
|
this.touched.set(parent, [...(this.touched.get(parent) ?? []), p]);
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
p = fs.cp(from.path, (0,
|
|
52
|
+
p = fs.cp(from.path, (0, posix_1.join)(to, ...dirs, from.name), from.dir);
|
|
53
53
|
}
|
|
54
54
|
await p;
|
|
55
55
|
this.touched.set(to, [...(this.touched.get(to) ?? []), p]);
|
package/dist/queues/Download.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const posix_1 = require("node:path/posix");
|
|
7
7
|
const Queue_1 = __importDefault(require("./Queue"));
|
|
8
8
|
const types_1 = require("../types");
|
|
9
9
|
const Local_1 = require("../Local");
|
|
@@ -16,7 +16,7 @@ class DownloadQueue extends Queue_1.default {
|
|
|
16
16
|
if (this.stopped) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const dest = (0,
|
|
19
|
+
const dest = (0, posix_1.join)(to, ...dirs, from.name);
|
|
20
20
|
await (0, Local_1.touch)(dest);
|
|
21
21
|
try {
|
|
22
22
|
await fs.get(from.path, dest);
|
package/dist/queues/Queue.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.queues = exports.lsRemote = void 0;
|
|
7
|
-
const
|
|
7
|
+
const posix_1 = require("node:path/posix");
|
|
8
8
|
const types_1 = require("../types");
|
|
9
9
|
const rxjs_1 = require("rxjs");
|
|
10
10
|
const ramda_1 = require("ramda");
|
|
@@ -61,7 +61,7 @@ class TransmitQueue {
|
|
|
61
61
|
const stat = this.stat(this.to);
|
|
62
62
|
this.processing = this.queue$.subscribe(async ({ from, dirs, to, action }) => {
|
|
63
63
|
const a = action ?? this.action;
|
|
64
|
-
const existing = await stat((0,
|
|
64
|
+
const existing = await stat((0, posix_1.join)(to, ...dirs, from.name));
|
|
65
65
|
if (existing) {
|
|
66
66
|
if (a) {
|
|
67
67
|
if (a.type == types_1.QueueActionType.Skip) {
|
|
@@ -111,16 +111,16 @@ class TransmitQueue {
|
|
|
111
111
|
return this.filter?.invert ?? false ? found === null : found !== null;
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
paths = paths.map(
|
|
114
|
+
paths = paths.map(posix_1.normalize).filter(path => !paths.find(ancestor => path.startsWith(ancestor + posix_1.sep)));
|
|
115
115
|
const add = async (path, to, dirs = []) => {
|
|
116
116
|
if (this.stopped) {
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
|
-
const parent = (0,
|
|
119
|
+
const parent = (0, posix_1.dirname)(path);
|
|
120
120
|
const from = (await ls(parent))?.find((0, ramda_1.whereEq)({ path }));
|
|
121
121
|
if (from) {
|
|
122
122
|
if (from.dir) {
|
|
123
|
-
return Promise.all((await ls(from.path))?.map(child => add(child.path, to, [...dirs, (0,
|
|
123
|
+
return Promise.all((await ls(from.path))?.map(child => add(child.path, to, [...dirs, (0, posix_1.basename)(path)])));
|
|
124
124
|
}
|
|
125
125
|
else {
|
|
126
126
|
if (matchFilter(from)) {
|
|
@@ -131,7 +131,7 @@ class TransmitQueue {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
|
-
await Promise.all(paths.map(path => add(path, dest, this.fromRoot ? (0,
|
|
134
|
+
await Promise.all(paths.map(path => add(path, dest, this.fromRoot ? (0, posix_1.dirname)(path).substring(this.fromRoot.length + 1).split('/') : [])));
|
|
135
135
|
}
|
|
136
136
|
stop() {
|
|
137
137
|
if (!this.stopped) {
|
|
@@ -188,7 +188,7 @@ class TransmitQueue {
|
|
|
188
188
|
break;
|
|
189
189
|
}
|
|
190
190
|
case types_1.QueueActionType.Rename: {
|
|
191
|
-
from.name = await this.rename(from.name, (0,
|
|
191
|
+
from.name = await this.rename(from.name, (0, posix_1.join)(to, ...dirs));
|
|
192
192
|
await transmit(from, dirs, to);
|
|
193
193
|
break;
|
|
194
194
|
}
|
|
@@ -214,10 +214,10 @@ class TransmitQueue {
|
|
|
214
214
|
return (path) => Promise.resolve((0, Local_1.stat)(path));
|
|
215
215
|
}
|
|
216
216
|
const ls = this.ls(connId);
|
|
217
|
-
return async (path) => (await ls((0,
|
|
217
|
+
return async (path) => (await ls((0, posix_1.dirname)(path)))?.find((0, ramda_1.whereEq)({ path }));
|
|
218
218
|
}
|
|
219
219
|
async rename(name, dir) {
|
|
220
|
-
let { name: oldName, ext } = (0,
|
|
220
|
+
let { name: oldName, ext } = (0, posix_1.parse)(name);
|
|
221
221
|
const parts = oldName.match(/^(.+) copy ?(\d*)$/);
|
|
222
222
|
oldName = (parts && parts.length > 2) ? parts[1] : oldName;
|
|
223
223
|
let counter = (parts && parts.length > 2) ? (parts[2] ? parseInt(parts[2]) + 1 : 1) : 1;
|
package/dist/queues/Remove.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const posix_1 = require("node:path/posix");
|
|
7
7
|
const Connection_1 = __importDefault(require("../Connection"));
|
|
8
8
|
const URI_1 = require("../utils/URI");
|
|
9
9
|
const Queue_1 = require("./Queue");
|
|
@@ -19,13 +19,13 @@ class RemoveQueue {
|
|
|
19
19
|
this.stopped = false;
|
|
20
20
|
}
|
|
21
21
|
async create() {
|
|
22
|
-
const paths = this.paths.map(
|
|
22
|
+
const paths = this.paths.map(posix_1.normalize).filter(path => !this.paths.find(ancestor => path.startsWith(ancestor + posix_1.sep)));
|
|
23
23
|
let totalCnt = 0;
|
|
24
24
|
let doneCnt = 0;
|
|
25
25
|
const ls = (0, Queue_1.lsRemote)(this.connId);
|
|
26
26
|
const add = async (path, tree) => {
|
|
27
|
-
const parent = (0,
|
|
28
|
-
const file = (await ls(parent))?.find(f => f.name == (0,
|
|
27
|
+
const parent = (0, posix_1.dirname)(path);
|
|
28
|
+
const file = (await ls(parent))?.find(f => f.name == (0, posix_1.basename)(path));
|
|
29
29
|
if (!file) {
|
|
30
30
|
return tree;
|
|
31
31
|
}
|
package/dist/queues/Upload.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const posix_1 = require("node:path/posix");
|
|
7
7
|
const Queue_1 = __importDefault(require("./Queue"));
|
|
8
8
|
const types_1 = require("../types");
|
|
9
9
|
const Local_1 = require("../Local");
|
|
@@ -25,7 +25,7 @@ class UploadQueue extends Queue_1.default {
|
|
|
25
25
|
try {
|
|
26
26
|
let targetDir = to;
|
|
27
27
|
for (const dir of dirs) {
|
|
28
|
-
targetDir = (0,
|
|
28
|
+
targetDir = (0, posix_1.join)(targetDir, dir);
|
|
29
29
|
if (this.touched.has(targetDir)) {
|
|
30
30
|
await this.touched.get(targetDir);
|
|
31
31
|
}
|
|
@@ -42,7 +42,7 @@ class UploadQueue extends Queue_1.default {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
if (!this.stopped) {
|
|
45
|
-
await fs.put(from.path, (0,
|
|
45
|
+
await fs.put(from.path, (0, posix_1.join)(targetDir, from.name));
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
catch (error) {
|
package/dist/transformers/git.js
CHANGED
|
@@ -3,19 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const node_util_1 = require("node:util");
|
|
5
5
|
const node_child_process_1 = require("node:child_process");
|
|
6
|
-
const
|
|
6
|
+
const posix_1 = require("node:path/posix");
|
|
7
7
|
const types_1 = require("../types");
|
|
8
|
+
const Local_1 = require("../Local");
|
|
8
9
|
const ramda_1 = require("ramda");
|
|
9
10
|
async function default_1(path, files) {
|
|
10
11
|
const run = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
11
12
|
try {
|
|
12
|
-
let { stdout: repoRoot } = await run('git', ['rev-parse', '--show-toplevel'], { cwd: path });
|
|
13
|
-
repoRoot = repoRoot.trim();
|
|
14
|
-
const { stdout: statuses } = await run('git', ['status', '-z', '.'], { cwd: path });
|
|
15
|
-
const [inRoot, inSubfolders] = (0, ramda_1.partition)(([p]) => (0,
|
|
13
|
+
let { stdout: repoRoot } = await run('git', ['rev-parse', '--show-toplevel'], { cwd: (0, Local_1.osify)(path) });
|
|
14
|
+
repoRoot = (0, Local_1.unosify)(repoRoot.trim());
|
|
15
|
+
const { stdout: statuses } = await run('git', ['status', '-z', '.'], { cwd: (0, Local_1.osify)(path) });
|
|
16
|
+
const [inRoot, inSubfolders] = (0, ramda_1.partition)(([p]) => (0, posix_1.dirname)(p) == path, (0, Local_1.unosify)(statuses)
|
|
16
17
|
.replace(/\0$/, '')
|
|
17
18
|
.split('\0')
|
|
18
|
-
.map(s => [(0,
|
|
19
|
+
.map(s => [(0, posix_1.join)(repoRoot, s.substring(3)), s.substring(0, 2)])
|
|
19
20
|
.map(([path, status]) => [path.replace(/\/$/, ''), status]));
|
|
20
21
|
if (inSubfolders.length == 1 && inSubfolders[0][0] == path && inSubfolders[0][1].includes('?')) {
|
|
21
22
|
files.forEach(f => {
|
|
@@ -28,7 +29,7 @@ async function default_1(path, files) {
|
|
|
28
29
|
[...inRoot
|
|
29
30
|
.map(([path, s]) => [path, getStatusCode(s)])
|
|
30
31
|
.filter(([, status]) => status),
|
|
31
|
-
...[...new Set(inSubfolders.map(([p]) => topDir.exec(p.substring(path.length + 1))?.[1]).filter(s => s))].map(dir => [(0,
|
|
32
|
+
...[...new Set(inSubfolders.map(([p]) => topDir.exec(p.substring(path.length + 1))?.[1]).filter(s => s))].map(dir => [(0, posix_1.join)(path, dir), GitStatus.Contains])
|
|
32
33
|
].forEach(([path, status]) => {
|
|
33
34
|
const f = files.find(f => f.path == path);
|
|
34
35
|
if (f) {
|
|
@@ -39,15 +40,15 @@ async function default_1(path, files) {
|
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
const { stdout: ignored } = await run('git', ['ls-files', '--others', '--ignored', '--exclude-standard', '--directory', '-z'], { cwd: path });
|
|
43
|
+
const { stdout: ignored } = await run('git', ['ls-files', '--others', '--ignored', '--exclude-standard', '--directory', '-z'], { cwd: (0, Local_1.osify)(path) });
|
|
43
44
|
if (ignored == './\0') {
|
|
44
45
|
files.forEach(f => f[types_1.FileAttrsAttr][GitStatus.Ignored] = statusNames[GitStatus.Ignored]);
|
|
45
46
|
}
|
|
46
47
|
else {
|
|
47
|
-
ignored
|
|
48
|
+
(0, Local_1.unosify)(ignored)
|
|
48
49
|
.replace(/\0$/, '')
|
|
49
50
|
.split('\0')
|
|
50
|
-
.map(s => (0,
|
|
51
|
+
.map(s => (0, posix_1.join)(path, s.replace(/\/$/, '')))
|
|
51
52
|
.forEach(path => {
|
|
52
53
|
const f = files.find(f => f.path == path);
|
|
53
54
|
f && (f[types_1.FileAttrsAttr][GitStatus.Ignored] = statusNames[GitStatus.Ignored]);
|
package/dist/utils/os.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.winToUnix = winToUnix;
|
|
4
|
+
exports.unixToWin = unixToWin;
|
|
5
|
+
function winToUnix(path) {
|
|
6
|
+
return '/' + path.replace(/\\/g, '/');
|
|
7
|
+
}
|
|
8
|
+
function unixToWin(path) {
|
|
9
|
+
path = path.replace(/^\//, '').replace(/\//g, '\\');
|
|
10
|
+
if (!path) {
|
|
11
|
+
path = '\\';
|
|
12
|
+
}
|
|
13
|
+
else if (path.match(/^[a-zA-Z]:$/)) {
|
|
14
|
+
path += '\\';
|
|
15
|
+
}
|
|
16
|
+
return path;
|
|
17
|
+
}
|
package/dist/utils/path.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.split = split;
|
|
4
|
-
const
|
|
4
|
+
const posix_1 = require("node:path/posix");
|
|
5
5
|
function split(path) {
|
|
6
6
|
const parts = [];
|
|
7
|
-
while (path && path !=
|
|
8
|
-
parts.push((0,
|
|
9
|
-
path = (0,
|
|
7
|
+
while (path && path != '/' && path != '.') {
|
|
8
|
+
parts.push((0, posix_1.basename)(path));
|
|
9
|
+
path = (0, posix_1.dirname)(path);
|
|
10
10
|
}
|
|
11
11
|
return parts.reverse();
|
|
12
12
|
}
|
package/dist/win.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDrives = getDrives;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
let drives = null;
|
|
6
|
+
function getDrives() {
|
|
7
|
+
if (drives !== null) {
|
|
8
|
+
return drives;
|
|
9
|
+
}
|
|
10
|
+
drives = [];
|
|
11
|
+
for (let i = 65; i <= 90; i++) { // A: to Z:
|
|
12
|
+
const drive = String.fromCharCode(i) + ':\\';
|
|
13
|
+
try {
|
|
14
|
+
(0, node_fs_1.accessSync)(drive, node_fs_1.constants.F_OK);
|
|
15
|
+
drives.push(drive);
|
|
16
|
+
}
|
|
17
|
+
catch (err) { }
|
|
18
|
+
}
|
|
19
|
+
return drives;
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "filefive",
|
|
3
3
|
"description": "SFTP/FTP/Amazon S3 client and dual-panel file manager for macOS and Linux",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"author": "Max Miroshnikov",
|
|
7
7
|
"bin": {
|
|
@@ -36,39 +36,39 @@
|
|
|
36
36
|
"publish": "tsc -p . && npm publish"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@aws-sdk/client-s3": "^3.
|
|
39
|
+
"@aws-sdk/client-s3": "^3.1002.0",
|
|
40
40
|
"chalk": "^5.6.2",
|
|
41
|
-
"commander": "^14.0.
|
|
41
|
+
"commander": "^14.0.3",
|
|
42
42
|
"express": "^5.2.1",
|
|
43
43
|
"ftp": "^0.3.10",
|
|
44
|
-
"multer": "^2.
|
|
44
|
+
"multer": "^2.1.1",
|
|
45
45
|
"open": "^11.0.0",
|
|
46
46
|
"ramda": "^0.32.0",
|
|
47
47
|
"rxjs": "^7.8.2",
|
|
48
48
|
"ssh2": "^1.17.0",
|
|
49
|
-
"trash": "^10.
|
|
50
|
-
"whatwg-url": "^
|
|
51
|
-
"ws": "^8.
|
|
49
|
+
"trash": "^10.1.1",
|
|
50
|
+
"whatwg-url": "^16.0.1",
|
|
51
|
+
"ws": "^8.19.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@eslint/js": "^
|
|
54
|
+
"@eslint/js": "^10.0.1",
|
|
55
55
|
"@types/express": "^5.0.6",
|
|
56
56
|
"@types/ftp": "^0.3.36",
|
|
57
57
|
"@types/jest": "^30.0.0",
|
|
58
58
|
"@types/multer": "^2.0.0",
|
|
59
|
-
"@types/node": "^25.
|
|
59
|
+
"@types/node": "^25.3.3",
|
|
60
60
|
"@types/ramda": "^0.31.1",
|
|
61
61
|
"@types/ssh2": "^1.15.5",
|
|
62
62
|
"@types/whatwg-url": "^13.0.0",
|
|
63
63
|
"@types/ws": "^8.18.1",
|
|
64
|
-
"dotenv": "^17.
|
|
65
|
-
"eslint": "^
|
|
64
|
+
"dotenv": "^17.3.1",
|
|
65
|
+
"eslint": "^10.0.2",
|
|
66
66
|
"jest": "^30.2.0",
|
|
67
|
-
"nodemon": "^3.1.
|
|
67
|
+
"nodemon": "^3.1.14",
|
|
68
68
|
"ts-jest": "^29.4.6",
|
|
69
69
|
"ts-node": "^10.9.2",
|
|
70
70
|
"typescript": "^5.9.3",
|
|
71
|
-
"typescript-eslint": "^8.
|
|
71
|
+
"typescript-eslint": "^8.56.1"
|
|
72
72
|
},
|
|
73
73
|
"nodemonConfig": {
|
|
74
74
|
"ignore": [
|