@trap_stevo/filetide 0.0.44 → 0.0.45
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/cjs/FileMessager.js
CHANGED
|
@@ -48,6 +48,7 @@ class FileMessager {
|
|
|
48
48
|
this.fileNet.on("get-client", this.handleGetClient.bind(this));
|
|
49
49
|
this.fileNet.on("notify-transfer-barrier", this.handleNotifyTransferBarrier.bind(this));
|
|
50
50
|
this.fileNet.on("send-current-transfer-state", this.handleSendCurrentTransferState.bind(this));
|
|
51
|
+
this.fileNet.on("sent-file-list-to-client", this.handleSentFileListToClient.bind(this));
|
|
51
52
|
this.fileNet.on("send-file-list-to-client", this.handleSendFileListToClient.bind(this));
|
|
52
53
|
this.fileNet.on("list-client-files", this.handleListClientFiles.bind(this));
|
|
53
54
|
this.fileNet.on("transfer-start", this.handleFileTransferStart.bind(this));
|
|
@@ -144,6 +145,28 @@ class FileMessager {
|
|
|
144
145
|
} = transferData;
|
|
145
146
|
this.requestFromClient(requesterID, senderID, filePath, destinationPath);
|
|
146
147
|
}
|
|
148
|
+
handleSentFileListToClient(listData) {
|
|
149
|
+
const {
|
|
150
|
+
totalItemsSent,
|
|
151
|
+
recipientID,
|
|
152
|
+
senderID
|
|
153
|
+
} = listData;
|
|
154
|
+
try {
|
|
155
|
+
const recipientConnectionID = FileNetClientManager.getOnlineClient(recipientID).id;
|
|
156
|
+
const senderConnectionID = FileNetClientManager.getOnlineClient(senderID).id;
|
|
157
|
+
const senderClient = this.getClientFromID(senderConnectionID);
|
|
158
|
+
const client = this.getClientFromID(recipientConnectionID);
|
|
159
|
+
if (!client || !senderClient) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.fileNet.emitToTide(client.tideID, "client-file-list-received", {
|
|
163
|
+
senderID,
|
|
164
|
+
totalItemsSent
|
|
165
|
+
});
|
|
166
|
+
} catch (error) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
147
170
|
handleSendFileListToClient(listData) {
|
|
148
171
|
const {
|
|
149
172
|
listedFiles,
|
package/dist/cjs/FileTide.js
CHANGED
|
@@ -275,6 +275,7 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
|
|
|
275
275
|
onTransferRequested,
|
|
276
276
|
onTransferStatus,
|
|
277
277
|
onListFiles,
|
|
278
|
+
onFileListReceived,
|
|
278
279
|
onCurrentOnlineClients,
|
|
279
280
|
onClientTiding,
|
|
280
281
|
onCurrentClientIDAlreadyOnline
|
|
@@ -516,6 +517,7 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
|
|
|
516
517
|
client.clientTide.onEvent(userID, "list-files", async data => {
|
|
517
518
|
_FileTide.outputGradient(`[${userID}] Sending file list to ${data.senderID}...!`, significantMessageColors);
|
|
518
519
|
const currentClientShorePolicies = this.getShorePolicies(userID);
|
|
520
|
+
let totalFilesSent = 0;
|
|
519
521
|
const listedFiles = await this.listFiles(currentClientShorePolicies || [">Downloads"], data.depth || 1, (totalItems, directoryContents) => {
|
|
520
522
|
const capacitor = new ChunkCapacitor(directoryContents, 100);
|
|
521
523
|
const contents = capacitor.getAllChunks();
|
|
@@ -527,14 +529,26 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
|
|
|
527
529
|
listedFiles: files
|
|
528
530
|
});
|
|
529
531
|
}
|
|
532
|
+
totalFilesSent += totalItems;
|
|
530
533
|
});
|
|
531
534
|
setTimeout(() => {
|
|
532
535
|
_FileTide.outputGradient(`[${userID}] Sent file list to ${data.senderID}!`, significantMessageColors);
|
|
536
|
+
client.clientTide.emitEvent(userID, "sent-file-list-to-client", {
|
|
537
|
+
senderID: data.recipientID,
|
|
538
|
+
recipientID: data.senderID,
|
|
539
|
+
totalItemsSent: totalFilesSent
|
|
540
|
+
});
|
|
533
541
|
}, 1000);
|
|
534
542
|
});
|
|
535
543
|
client.clientTide.onEvent(userID, "error", async error => {
|
|
536
544
|
_FileTide.outputGradient(`[${userID} | FileTide Error] ${error}`, errorMessageColors);
|
|
537
545
|
});
|
|
546
|
+
client.clientTide.onEvent(userID, "client-file-list-received", async data => {
|
|
547
|
+
_FileTide.outputGradient(`[${userID}] Successfully received all ${data.totalItemsSent} contents in ${data.senderID}'s file list!`, significantMessageColors);
|
|
548
|
+
if (onFileListReceived) {
|
|
549
|
+
onFileListReceived(data);
|
|
550
|
+
}
|
|
551
|
+
});
|
|
538
552
|
client.clientTide.onEvent(userID, "client-file-list", async data => {
|
|
539
553
|
_FileTide.outputGradient(`[${userID}] Received ${data.totalItems} directory contents from ${data.senderID}'s file list!`, significantMessageColors);
|
|
540
554
|
if (onListFiles) {
|
|
@@ -117,7 +117,7 @@ class FileUtilityManager {
|
|
|
117
117
|
};
|
|
118
118
|
results.push(dirMetadata);
|
|
119
119
|
const processEntries = list.map(async file => {
|
|
120
|
-
const filePath = path.join(dir, file.name);
|
|
120
|
+
const filePath = FileUtilityManager.getTidePath(path.join(dir, file.name));
|
|
121
121
|
try {
|
|
122
122
|
if (file.isDirectory()) {
|
|
123
123
|
console.log(`[FileTide] Depth >> ${currentDepth} | Including directory ~ ${filePath}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"description": "Revolutionizing real-time file transfer with seamless, instant communication across any device. Deliver files instantly, regardless of platform, and experience unparalleled speed and control in managing transfers. Elevate your file-sharing capabilities with a tool designed for precision, efficiency, and effortless connectivity.",
|
|
5
5
|
"main": "dist/cjs/FileTide.js",
|
|
6
6
|
"scripts": {
|