@trap_stevo/filetide 0.0.41 → 0.0.42
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
|
@@ -326,7 +326,7 @@ class FileMessager {
|
|
|
326
326
|
}
|
|
327
327
|
handleGetClientTransferState(data) {
|
|
328
328
|
const filePath = data.filePath || data.path;
|
|
329
|
-
console.log(`[FileTide ~ Net] Getting ${data.recipientID}'s transfer state for ~ ${filePath}...`);
|
|
329
|
+
console.log(`[FileTide ~ Net] ~ Getting ${data.recipientID}'s transfer state for ~ ${filePath}...`);
|
|
330
330
|
try {
|
|
331
331
|
const recipientConnectionID = FileNetClientManager.getOnlineClient(data.recipientID).id;
|
|
332
332
|
const client = this.getClientFromID(recipientConnectionID);
|
|
@@ -335,6 +335,7 @@ class FileMessager {
|
|
|
335
335
|
}
|
|
336
336
|
this.fileNet.emitToTide(client.tideID, "current-transfer-state", {
|
|
337
337
|
senderID: data.senderID,
|
|
338
|
+
fileName: data.fileName,
|
|
338
339
|
filePath
|
|
339
340
|
});
|
|
340
341
|
} catch (error) {
|
|
@@ -342,7 +343,7 @@ class FileMessager {
|
|
|
342
343
|
}
|
|
343
344
|
}
|
|
344
345
|
handleGetClient(data) {
|
|
345
|
-
console.log(`[FileTide ~ Net] Getting client ~ ${data.clientID}...`);
|
|
346
|
+
console.log(`[FileTide ~ Net] ~ Getting client ~ ${data.clientID}...`);
|
|
346
347
|
try {
|
|
347
348
|
const senderConnectionID = FileNetClientManager.getOnlineClient(data.senderID).id;
|
|
348
349
|
const clientConnectionID = FileNetClientManager.getOnlineClient(data.clientID).id;
|
|
@@ -456,12 +457,13 @@ class FileMessager {
|
|
|
456
457
|
clientID,
|
|
457
458
|
activeTransferBarrier
|
|
458
459
|
});
|
|
459
|
-
|
|
460
|
-
this.fileNet.emit("current-clients",
|
|
460
|
+
const currentOnlineClients = Object.fromEntries(FileNetClientManager.getOnlineClients());
|
|
461
|
+
this.fileNet.emit("current-online-clients", currentOnlineClients);
|
|
462
|
+
this.fileNet.emit("current-clients", currentOnlineClients);
|
|
461
463
|
return;
|
|
462
464
|
}
|
|
463
465
|
handleClientOffline(clientData) {
|
|
464
|
-
console.log(`Client ~ ${clientData.clientID} | connection origin ~ ${clientData.connectionID} going offline...`);
|
|
466
|
+
console.log(`[FileTide ~ Net Activity] ~ Client ~ ${clientData.clientID} | connection origin ~ ${clientData.connectionID} going offline...`);
|
|
465
467
|
try {
|
|
466
468
|
const clientDetails = FileNetClientManager.getOnlineClient(clientData.clientID);
|
|
467
469
|
if (!clientDetails || clientDetails.id !== clientData.connectionID) {
|
|
@@ -469,7 +471,9 @@ class FileMessager {
|
|
|
469
471
|
return;
|
|
470
472
|
}
|
|
471
473
|
FileNetClientManager.clearOnlineClient(clientData.clientID);
|
|
472
|
-
|
|
474
|
+
const currentOnlineClients = Object.fromEntries(FileNetClientManager.getOnlineClients());
|
|
475
|
+
this.fileNet.emit("current-online-clients", currentOnlineClients);
|
|
476
|
+
this.fileNet.emit("current-clients", currentOnlineClients);
|
|
473
477
|
this.fileNet.emit("save-current-transfer-states", {
|
|
474
478
|
clientID: clientData.clientID
|
|
475
479
|
});
|
package/dist/cjs/FileTide.js
CHANGED
|
@@ -176,6 +176,13 @@ class FileTide {
|
|
|
176
176
|
FileTide.outputGradient(`[FileTide] Client ~ ${clientID} not found.`, ["#F94144", "#F3722C"]);
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
|
+
const recipientOnline = await clientMessager.clientTide.emitEventWithResponse(clientID, "check-client-online", "retrieved-client-online", {
|
|
180
|
+
clientID: recipientID
|
|
181
|
+
}, 5000);
|
|
182
|
+
if (!recipientOnline || !recipientOnline.online) {
|
|
183
|
+
FileTide.outputGradient(`[FileTide] ${recipientID} currently not tiding.`, ["#F94144", "#F3722C"]);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
179
186
|
const fileDetails = await this.getPathData(filePath, filterDirectoryContent);
|
|
180
187
|
if (!fileDetails) {
|
|
181
188
|
FileTide.outputGradient(`[${clientID}] File at path ${filePath} not found.`, ["#F94144", "#F3722C"]);
|
|
@@ -350,9 +357,10 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
|
|
|
350
357
|
client.clientTide.onEvent(userID, "current-transfer-state", async data => {
|
|
351
358
|
const {
|
|
352
359
|
senderID,
|
|
360
|
+
fileName,
|
|
353
361
|
filePath
|
|
354
362
|
} = data;
|
|
355
|
-
const currentTransferState = FileTransferRecoveryManager.getTransferState(userID, senderID, filePath);
|
|
363
|
+
const currentTransferState = FileTransferRecoveryManager.getTransferState(userID, senderID, `${filePath}-${fileName}`);
|
|
356
364
|
client.clientTide.emitEvent(userID, "send-current-transfer-state", {
|
|
357
365
|
recipientID: userID,
|
|
358
366
|
senderID,
|
|
@@ -439,11 +447,11 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
|
|
|
439
447
|
}
|
|
440
448
|
await fileTransferReceiver.handleTransferProgress(data);
|
|
441
449
|
this.progressBarManager.updateTaskProgress(data.fileName, data.chunkSize || 512 * 1024);
|
|
442
|
-
const currentTransferState = FileTransferRecoveryManager.getTransferState(userID, data.senderName, data.path) || {
|
|
450
|
+
const currentTransferState = FileTransferRecoveryManager.getTransferState(userID, data.senderName, `${data.path}-${data.fileName}`) || {
|
|
443
451
|
transferredSize: 0
|
|
444
452
|
};
|
|
445
453
|
currentTransferState.transferredSize += data.chunkSize || 512 * 1024;
|
|
446
|
-
FileTransferRecoveryManager.saveTransferState(userID, data.senderName, data.path
|
|
454
|
+
FileTransferRecoveryManager.saveTransferState(userID, data.senderName, `${data.path}-${data.fileName}`, data.chunkIndex, currentTransferState.transferredSize);
|
|
447
455
|
if (onTransferProgress) {
|
|
448
456
|
onTransferProgress(data);
|
|
449
457
|
}
|
|
@@ -473,11 +481,12 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
|
|
|
473
481
|
_FileTide.outputGradient(`[${userID}] File transfer complete : ${data.fileName}`, significantMessageColors);
|
|
474
482
|
const transferState = fileTransferReceiver.activeTransfers.get(data.fileName);
|
|
475
483
|
if (!transferState) {
|
|
484
|
+
FileTransferRecoveryManager.clearTransferState(userID, data.senderID, `${data.filePath}-${data.fileName}`);
|
|
476
485
|
return;
|
|
477
486
|
}
|
|
478
487
|
fileTransferReceiver.completeTransfer(data, (transferData, transfers, success, error) => {
|
|
479
488
|
if (success) {
|
|
480
|
-
FileTransferRecoveryManager.clearTransferState(userID, data.senderID, data.filePath);
|
|
489
|
+
FileTransferRecoveryManager.clearTransferState(userID, data.senderID, `${data.filePath}-${data.fileName}`);
|
|
481
490
|
_FileTide.outputGradient(`[${userID}] File saved at : ${savePath}\n`, significantMessageColors);
|
|
482
491
|
} else if (!success) {
|
|
483
492
|
_FileTide.outputGradient(`[${userID}] Did not save file at : ${savePath}\n\t${error}\n`, errorMessageColors);
|
|
@@ -43,7 +43,8 @@ class FileTransferManager {
|
|
|
43
43
|
const recoveredTransferState = (await clientTide.emitEventWithResponse(originDetails.senderID, "get-client-transfer-state", "sent-current-transfer-state", {
|
|
44
44
|
recipientID,
|
|
45
45
|
senderID: originDetails.senderID,
|
|
46
|
-
filePath: fileDetails.destinationPath
|
|
46
|
+
filePath: fileDetails.destinationPath,
|
|
47
|
+
fileName: fileDetails.name
|
|
47
48
|
}, 30000)) || {
|
|
48
49
|
transferredSize: 0,
|
|
49
50
|
lastChunkSent: 0
|
|
@@ -134,7 +135,8 @@ async function _startTransfer(file, transferId, fileDetails, originDetails, onSe
|
|
|
134
135
|
const recoveredTransferState = (await clientTide.emitEventWithResponse(originDetails.senderID, "get-client-transfer-state", "sent-current-transfer-state", {
|
|
135
136
|
recipientID: originDetails.recipientID,
|
|
136
137
|
senderID: originDetails.senderID,
|
|
137
|
-
filePath: fileDetails.destinationPath
|
|
138
|
+
filePath: fileDetails.destinationPath,
|
|
139
|
+
fileName: fileDetails.name
|
|
138
140
|
}, 30000)) || {
|
|
139
141
|
transferredSize: 0,
|
|
140
142
|
lastChunkSent: 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42",
|
|
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": {
|