@trap_stevo/filetide 0.0.74 → 0.0.76
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/FileTide.js +15 -8
- package/package.json +1 -1
package/dist/cjs/FileTide.js
CHANGED
|
@@ -58,6 +58,7 @@ class FileTide {
|
|
|
58
58
|
this.transferBarrier = false;
|
|
59
59
|
this.clientDetails = new Map();
|
|
60
60
|
this.clients = new Map();
|
|
61
|
+
this.currentChannel = "";
|
|
61
62
|
this.currentUserID = "";
|
|
62
63
|
this.runningOn = os.platform();
|
|
63
64
|
this.inDebugMode = debugMode;
|
|
@@ -131,9 +132,9 @@ class FileTide {
|
|
|
131
132
|
reconnectionAttempts: 15,
|
|
132
133
|
maxReconnectionDelay: 10000
|
|
133
134
|
}, roomName, userID, onLaunch, onIncomingFile, onIncomingTransfer, onTransferBarrier, onTransferProgress, enableTransferBarrier = true, options = {}, headers = {}, onConnect = null, onDisconnect = null, authURL = "", authHeaders = {}, useAuthentication = false, queryAuthToken = false) {
|
|
134
|
-
TideTokenEnforcer.protect(() => {
|
|
135
|
+
TideTokenEnforcer.protect(async () => {
|
|
135
136
|
if (this.clients.has(userID)) {
|
|
136
|
-
this.stopMessager(userID);
|
|
137
|
+
await this.stopMessager(userID);
|
|
137
138
|
}
|
|
138
139
|
const currentClientDetails = this.clientDetails.get(userID);
|
|
139
140
|
if (currentClientDetails && currentClientDetails.unauthorized) {
|
|
@@ -151,6 +152,7 @@ class FileTide {
|
|
|
151
152
|
}
|
|
152
153
|
const newClient = new FileMessagerClient(clientOptions, transportOptions, messagerSettings);
|
|
153
154
|
const enterRoom = newClient.joinRoom(userID, roomName, connectionOptions, headers, onConnect, onDisconnect, authURL, authHeaders, useAuthentication, queryAuthToken);
|
|
155
|
+
this.currentChannel = roomName;
|
|
154
156
|
this.transferBarrier = enableTransferBarrier;
|
|
155
157
|
this.clientShorePolicies.set(userID, [FileUtilityManager.getTidePath(">Downloads"), FileUtilityManager.getTidePath(">Documents"), FileUtilityManager.getTidePath(">Desktop"), FileUtilityManager.getTidePath(">Photos"), FileUtilityManager.getTidePath(">Videos"), FileUtilityManager.getTidePath(">Music")]);
|
|
156
158
|
this.clients.set(userID, newClient);
|
|
@@ -353,7 +355,7 @@ class FileTide {
|
|
|
353
355
|
* @param {Function} onCompletion - Executes upon messager disconnection completion
|
|
354
356
|
*/
|
|
355
357
|
async stopMessager(userID, onBeforeDisconnect, onDisconnect, onCompletion) {
|
|
356
|
-
TideTokenEnforcer.protect(async () => {
|
|
358
|
+
await TideTokenEnforcer.protect(async () => {
|
|
357
359
|
if (this.clients.has(userID)) {
|
|
358
360
|
FileTide.outputGradient(`Stopping messager for user ${userID}...`, significantMessageColors);
|
|
359
361
|
const connectionOrigin = this.clients.get(userID);
|
|
@@ -392,7 +394,7 @@ class FileTide {
|
|
|
392
394
|
* @param {Function} onCompletion - Executes upon all messager disconnection
|
|
393
395
|
*/
|
|
394
396
|
async stopAllMessagers(onBeforeClientDisconnect, onClientDisconnect, onCompletion) {
|
|
395
|
-
TideTokenEnforcer.protect(async () => {
|
|
397
|
+
await TideTokenEnforcer.protect(async () => {
|
|
396
398
|
FileTide.outputGradient("Stopping all messagers...", significantMessageColors);
|
|
397
399
|
const disconnectTasks = [];
|
|
398
400
|
for (let [userID, connectionOrigin] of this.clients.entries()) {
|
|
@@ -502,11 +504,15 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
|
|
|
502
504
|
}
|
|
503
505
|
});
|
|
504
506
|
if (Object.keys(currentClients).length <= 0) {
|
|
507
|
+
_FileTide.outputGradient(`\n✨ No Clients Online in ${this.currentChannel} ✨`, significantMessageColors);
|
|
508
|
+
if (onCurrentOnlineClients) {
|
|
509
|
+
onCurrentOnlineClients(currentClients, true);
|
|
510
|
+
}
|
|
505
511
|
return;
|
|
506
512
|
}
|
|
507
|
-
cliTable.setTitle(`✨
|
|
513
|
+
cliTable.setTitle(`✨ >${Object.keys(currentClients).length}< Online in ${this.currentChannel} ✨`, 1);
|
|
508
514
|
cliTable.setData(currentClients);
|
|
509
|
-
console.log(
|
|
515
|
+
console.log("\n", cliTable.render(), "\n");
|
|
510
516
|
if (onCurrentOnlineClients) {
|
|
511
517
|
onCurrentOnlineClients(currentClients, true);
|
|
512
518
|
}
|
|
@@ -526,9 +532,10 @@ function _setupFileEventListeners(userID, client, onTransferProgress, onIncoming
|
|
|
526
532
|
if (Object.keys(currentClients).length <= 0) {
|
|
527
533
|
return;
|
|
528
534
|
}
|
|
529
|
-
_FileTide.outputGradient(`\n[FileTide ~ FileNet]\n\n✨ Current Clients >${Object.keys(currentClients).length}< ✨\n`, significantMessageColors);
|
|
530
535
|
if (onCurrentOnlineClients) {
|
|
531
|
-
onCurrentOnlineClients(currentClients, false)
|
|
536
|
+
onCurrentOnlineClients(currentClients, false, () => {
|
|
537
|
+
_FileTide.outputGradient(`\n✨ >${Object.keys(currentClients).length}< Current Clients ✨\n`, significantMessageColors);
|
|
538
|
+
});
|
|
532
539
|
}
|
|
533
540
|
});
|
|
534
541
|
client.clientTide.onEvent(userID, "current-client-id-already-online", clientID => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
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": {
|