@trap_stevo/filetide-client 0.0.1 → 0.0.3
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/FileTideClient.js +29 -6
- package/package.json +2 -2
|
@@ -156,7 +156,7 @@ class FileTideClient {
|
|
|
156
156
|
FileTide.outputGradient(`[${this.currentDeviceName}] Disconnected from the file net.`, ["#00C897", "#00E0FF"]);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
startClient(clientOptions = {}, connectionOptions = {}, ...clientConfigurations) {
|
|
159
|
+
startClient(clientOptions = {}, connectionOptions = {}, onConnect = null, ...clientConfigurations) {
|
|
160
160
|
if (this.fileMessagerInstance && this.fileMessagerInstance.clientTide) {
|
|
161
161
|
this.fileMessagerInstance.clientTide.closeSocket(this.currentDeviceName);
|
|
162
162
|
}
|
|
@@ -175,6 +175,9 @@ class FileTideClient {
|
|
|
175
175
|
FileTide.outputGradient(`[${this.deviceName}] Connected to FileTide ~ ${this.tideUrl} in ${this.currentRoom}!`, ["#00C897", "#00E0FF"]);
|
|
176
176
|
fileMessager.clientTide.emitEvent(this.deviceName, "client-online", this.deviceName, fileMessager.clientTide.sockets[this.deviceName].tideID, this.pDeviceName, fileMessager.clientTide.sockets[this.deviceName].id);
|
|
177
177
|
FileTide.outputGradient(`[${this.currentDeviceName}] Getting connected clients...`, ["#00C897", "#00E0FF"]);
|
|
178
|
+
if (onConnect) {
|
|
179
|
+
onConnect(fileMessager);
|
|
180
|
+
}
|
|
178
181
|
});
|
|
179
182
|
fileMessager.clientTide.onEvent(this.deviceName, "disconnect", () => {
|
|
180
183
|
this.broadcastClientOffline(fileMessager);
|
|
@@ -186,7 +189,7 @@ class FileTideClient {
|
|
|
186
189
|
this.fileMessagerInstance.requestTransfer(this.deviceName, senderID, filePath, destinationPath);
|
|
187
190
|
return;
|
|
188
191
|
}
|
|
189
|
-
|
|
192
|
+
transferFiles(recipientID, filePath, destinationPath) {
|
|
190
193
|
const fileDetails = fileTide.getPathData(filePath);
|
|
191
194
|
if (!fileDetails) {
|
|
192
195
|
FileTide.outputGradient(`[${this.deviceName}] File at path ${filePath} not found.`, ["#F94144", "#F3722C"]);
|
|
@@ -215,31 +218,51 @@ class FileTideClient {
|
|
|
215
218
|
}
|
|
216
219
|
return shortcuts;
|
|
217
220
|
}
|
|
221
|
+
clearShortcuts(inputShortcuts) {
|
|
222
|
+
for (const key of inputShortcuts) {
|
|
223
|
+
if (shortcuts[key]) {
|
|
224
|
+
delete this.shortcuts[key];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return shortcuts;
|
|
228
|
+
}
|
|
218
229
|
getShortcuts() {
|
|
219
230
|
return shortcuts;
|
|
220
231
|
}
|
|
221
|
-
getOnlineClients() {
|
|
232
|
+
getOnlineClients(completion) {
|
|
222
233
|
this.fileMessagerInstance.clientTide.emitEvent(this.deviceName, "clients-online", this.deviceName);
|
|
234
|
+
if (completion) {
|
|
235
|
+
completion();
|
|
236
|
+
}
|
|
223
237
|
return;
|
|
224
238
|
}
|
|
225
|
-
changeRoom(room) {
|
|
239
|
+
changeRoom(room, completion) {
|
|
226
240
|
this.currentRoom = room;
|
|
227
241
|
FileTide.outputGradient(`[${this.deviceName}] Updated room to ${this.currentRoom}`, ["#4D96FF", "#89CFF0"]);
|
|
228
242
|
this.startClient();
|
|
243
|
+
if (completion) {
|
|
244
|
+
completion();
|
|
245
|
+
}
|
|
229
246
|
return;
|
|
230
247
|
}
|
|
231
|
-
changeClientID(clientID) {
|
|
248
|
+
changeClientID(clientID, completion) {
|
|
232
249
|
this.currentDeviceName = this.deviceName;
|
|
233
250
|
this.deviceName = clientID;
|
|
234
251
|
this.fileMessagerInstance.clientTide.emitEvent(this.currentDeviceName, "client-offline", this.currentDeviceName);
|
|
235
252
|
FileTide.outputGradient(`[${this.deviceName}] Updated client name to ${this.deviceName}`, ["#4D96FF", "#89CFF0"]);
|
|
236
253
|
this.startClient();
|
|
254
|
+
if (completion) {
|
|
255
|
+
completion();
|
|
256
|
+
}
|
|
237
257
|
return;
|
|
238
258
|
}
|
|
239
|
-
changeTideUrl(url) {
|
|
259
|
+
changeTideUrl(url, completion) {
|
|
240
260
|
this.tideUrl = url;
|
|
241
261
|
FileTide.outputGradient(`[${this.deviceName}] Updated tide URL to ${this.tideUrl}`, ["#4D96FF", "#89CFF0"]);
|
|
242
262
|
this.startClient();
|
|
263
|
+
if (completion) {
|
|
264
|
+
completion();
|
|
265
|
+
}
|
|
243
266
|
return;
|
|
244
267
|
}
|
|
245
268
|
displayTitle(cli = false) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Seamless, real-time file transfers between devices with effortless connectivity. Allowing for powerful, instant, secure, and cross-platform file sharing, enabling efficient and reliable data transfers in any network environment.",
|
|
5
5
|
"main": "dist/cjs/FileTideClient.js",
|
|
6
6
|
"exports": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"author": "Steven Compton",
|
|
37
37
|
"license": "ISC",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@trap_stevo/filetide": "^0.0.
|
|
39
|
+
"@trap_stevo/filetide": "^0.0.32",
|
|
40
40
|
"@trap_stevo/iotide": "^0.0.37",
|
|
41
41
|
"@trap_stevo/legendarybuilderpronodejs-utilities": "^1.0.36",
|
|
42
42
|
"chalk": "^4.1.2",
|