@trap_stevo/filetide 0.0.83 → 0.0.85

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.
@@ -1887,7 +1887,7 @@ class FileMessager {
1887
1887
  ...data,
1888
1888
  transferType: "send"
1889
1889
  });
1890
- this.transferQueue.waitForData(data.transferID, () => this.currentTransferBarrierTransfers.get(data.transferID), [true, false], 100, data.transferExpirationTime ? data.transferExpirationTime : 50000).then(accepted => {
1890
+ this.transferQueue.waitForData(data.transferID, () => this.currentTransferBarrierTransfers.get(data.transferID), [true, false], 100, data.transferExpirationTime && typeof data.transferExpirationTime === "number" ? data.transferExpirationTime : 30000).then(accepted => {
1891
1891
  console.log(`[FileTide ~ Net Barrier] ~ Transfer ${accepted ? "accepted!" : "denied."}`);
1892
1892
  this.fileNet.emitToTide(senderClient.tideID, "transfer-barrier-response", accepted);
1893
1893
  this.currentTransferBarrierTransfers.delete(data.transferID);
@@ -6,6 +6,7 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
6
6
  const {
7
7
  HUDIoTide
8
8
  } = require("@trap_stevo/iotide-client");
9
+ const LogicTide = require("@trap_stevo/logictide");
9
10
  const chalk = require("chalk");
10
11
  const path = require("path");
11
12
  const fs = require("fs");
@@ -49,7 +50,9 @@ class FileMessagerClient {
49
50
  this.clientTide = new HUDIoTide(maxReconnectionAttempts, reconnectionAttempts, maxReconnectionDelay, {
50
51
  persistentTideIDs: true,
51
52
  persistentTideID: true,
52
- ...messagerConfigurations
53
+ ...messagerConfigurations,
54
+ tideIDsPath: LogicTide.runSync("tide-session-ids-path"),
55
+ tideIDPath: LogicTide.runSync("tide-session-id-path")
53
56
  });
54
57
  this.clients = new Map();
55
58
  }
@@ -11,8 +11,9 @@ const chalk = require("chalk");
11
11
  const path = require("path");
12
12
  const fs = require("fs");
13
13
  const os = require("os");
14
- require("./HUDComponents/FileTideCommunicationConfigurations.js");
15
14
  require("./HUDComponents/FileTideEnvironment.js");
15
+ require("./HUDComponents/FileTideCommunicationConfigurations.js");
16
+ require("./HUDComponents/FileTidePathsConfigurations.js");
16
17
  const {
17
18
  FileTideDebugUtilityManager,
18
19
  significantMessageColors,
@@ -299,7 +300,7 @@ class FileTide {
299
300
  }
300
301
  if (fileDetails.type === "directory") {
301
302
  FileTide.outputGradient(`[${clientID}] Sending ${fileDetails.content.length} files in directory ~ ${path.basename(filePath)} to client ~ ${recipientID}...`, significantMessageColors);
302
- await clientMessager.sendDirectoryFiles(clientID, recipientID, fileDetails.content, this.getTidePath(filePath), destinationPath, tideSize, minTideSize, maxTideSize, true, true, false, transferRequestExpirationTime, transferMetadata);
303
+ await clientMessager.sendDirectoryFiles(clientID, recipientID, fileDetails.content, this.getTidePath(filePath), destinationPath, tideSize, minTideSize, maxTideSize, transferRequestExpirationTime, transferMetadata);
303
304
  return true;
304
305
  }
305
306
  FileTide.outputGradient(`[FileTide] ~ No active client ~ ${recipientID} found.`, errorMessageColors);
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ const LogicTide = require("@trap_stevo/logictide");
4
+ const {
5
+ getUniversalPrefix
6
+ } = require("../HUDManagers/FileTideUniversalPathsUtilityManager.js");
7
+
8
+ // ~ Universal FileTide Root Path Configurations ~
9
+
10
+ LogicTide.defineLogic("filetide-root-path", "development", () => {
11
+ return ".filetide";
12
+ });
13
+ LogicTide.defineLogic("filetide-root-path", "production", () => {
14
+ return `${getUniversalPrefix()}/.filetide`;
15
+ });
16
+
17
+ // ~ Universal Tidalytics Path Configurations ~
18
+
19
+ LogicTide.defineLogic("tidalytics-path", "development", () => {
20
+ return ".filetide/filetide_core/.tidalytics";
21
+ });
22
+ LogicTide.defineLogic("tidalytics-path", "production", () => {
23
+ return `${getUniversalPrefix()}/.filetide/filetide_core/.tidalytics`;
24
+ });
25
+
26
+ // ~ Universal Tide Sentinel Path Configurations ~
27
+
28
+ LogicTide.defineLogic("tide-sentinel-path", "development", () => {
29
+ return ".filetide/filetide_core/tide_sentinel";
30
+ });
31
+ LogicTide.defineLogic("tide-sentinel-path", "production", () => {
32
+ return `${getUniversalPrefix()}/.filetide/filetide_core/tide_sentinel`;
33
+ });
34
+
35
+ // ~ Universal Tidal Core Path Configurations ~
36
+
37
+ LogicTide.defineLogic("tidal-core-path", "development", () => {
38
+ return ".filetide/tidal_core";
39
+ });
40
+ LogicTide.defineLogic("tidal-core-path", "production", () => {
41
+ return `${getUniversalPrefix()}/.filetide/tidal_core`;
42
+ });
43
+
44
+ // ~ Universal Tide Sessions Path Configurations ~
45
+
46
+ LogicTide.defineLogic("tide-session-ids-path", "development", () => {
47
+ return ".filetide/tidal_client/tide_session_ids.json";
48
+ });
49
+ LogicTide.defineLogic("tide-session-ids-path", "production", () => {
50
+ return `${getUniversalPrefix()}/.filetide/tidal_client/tide_session_ids.json`;
51
+ });
52
+ LogicTide.defineLogic("tide-session-id-path", "development", () => {
53
+ return ".filetide/tidal_client/tide_session_id.json";
54
+ });
55
+ LogicTide.defineLogic("tide-session-id-path", "production", () => {
56
+ return `${getUniversalPrefix()}/.filetide/tidal_client/tide_session_id.json`;
57
+ });
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ const LogicTide = require("@trap_stevo/logictide");
3
4
  class FileMessagerConfigManager {
4
5
  static getServerOptions({
5
6
  maxHttpBufferSize = 1e9,
@@ -16,6 +17,7 @@ class FileMessagerConfigManager {
16
17
  useCors,
17
18
  port,
18
19
  tidalCoreOptions: {
20
+ tidalCorePath: LogicTide.runSync("tidal-core-path"),
19
21
  persist: true
20
22
  },
21
23
  socketOptions: {
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ const path = require("path");
4
+ function getUniversalPrefix() {
5
+ if (process.platform === "win32") {
6
+ const winAppDataRoot = process.env.PROGRAMDATA || process.env.APPDATA || path.join(process.env.SYSTEMDRIVE || "C:", "ProgramData");
7
+ return path.join(winAppDataRoot);
8
+ }
9
+ return path.join("/var", "lib");
10
+ }
11
+ ;
12
+ module.exports = {
13
+ getUniversalPrefix
14
+ };
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ const LogicTide = require("@trap_stevo/logictide");
3
4
  const path = require("path");
4
5
  const fsAsync = require("fs").promises;
5
6
  const fs = require("fs");
6
7
  const os = require("os");
7
- const filesPath = path.join(__dirname, "../files");
8
+ const filesPath = LogicTide.runSync("filetide-root-path") ? path.join(LogicTide.runSync("filetide-root-path"), "files") : path.join(__dirname, "../files");
8
9
  class FileUtilityManager {
9
10
  /**
10
11
  * Recursively calculates the total size of files in a directory.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const MetricTide = require("@trap_stevo/metrictide");
4
+ const LogicTide = require("@trap_stevo/logictide");
4
5
  class TidalyticsInstanceManager {
5
6
  constructor() {
6
7
  this.instances = new Map();
@@ -10,7 +11,7 @@ class TidalyticsInstanceManager {
10
11
  return this.instances.get(name);
11
12
  }
12
13
  const defaultConfig = {
13
- dbPath: "./filetide_core/.tidalytics",
14
+ dbPath: LogicTide.runSync("tidalytics-path"),
14
15
  persistence: {
15
16
  alwaysOn: true
16
17
  },
@@ -6,26 +6,27 @@ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("C
6
6
  function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
7
7
  function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
8
8
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
9
+ const LogicTide = require("@trap_stevo/logictide");
9
10
  const Timelyst = require("@trap_stevo/timelyst");
10
- var _config = /*#__PURE__*/new WeakMap();
11
- var _lists = /*#__PURE__*/new WeakMap();
12
- var _manager = /*#__PURE__*/new WeakMap();
13
11
  var _onEntryAddedHooks = /*#__PURE__*/new WeakMap();
14
12
  var _onExpireHooks = /*#__PURE__*/new WeakMap();
13
+ var _manager = /*#__PURE__*/new WeakMap();
14
+ var _config = /*#__PURE__*/new WeakMap();
15
+ var _lists = /*#__PURE__*/new WeakMap();
15
16
  var _TideSentinelManager_brand = /*#__PURE__*/new WeakSet();
16
17
  class TideSentinelManager {
17
18
  constructor(config = {}) {
18
19
  _classPrivateMethodInitSpec(this, _TideSentinelManager_brand);
19
- _classPrivateFieldInitSpec(this, _config, void 0);
20
- _classPrivateFieldInitSpec(this, _lists, void 0);
21
- _classPrivateFieldInitSpec(this, _manager, void 0);
22
20
  _classPrivateFieldInitSpec(this, _onEntryAddedHooks, {});
23
21
  _classPrivateFieldInitSpec(this, _onExpireHooks, {});
22
+ _classPrivateFieldInitSpec(this, _manager, void 0);
23
+ _classPrivateFieldInitSpec(this, _config, void 0);
24
+ _classPrivateFieldInitSpec(this, _lists, void 0);
24
25
  const {
25
26
  lists = {},
26
27
  enableOfflineStorage = true,
27
28
  autoCleanupInterval = "15s",
28
- basePath = "./filetide_core/tide_sentinel",
29
+ basePath = LogicTide.runSync("tide-sentinel-path"),
29
30
  ...rest
30
31
  } = config;
31
32
  _classPrivateFieldSet(_config, this, {
@@ -25,7 +25,8 @@ class TideTokenEnforcementManager {
25
25
  this.tideTokenEnforcementCallbackConfigurations = tideTokenEnforcementCallbackConfigurations;
26
26
  this.tideTokenEnforcementComplianceHandlers = this.generateTideTokenEnforcementHandlers();
27
27
  this.lock = new Lockline();
28
- this.lock.setStorage(Lockline.lockbox("./lockbox", {
28
+ const lockboxPath = LogicTide.runSync("filetide-root-path") ? `${LogicTide.runSync("filetide-root-path")}/.lockbox` : "./lockbox";
29
+ this.lock.setStorage(Lockline.lockbox(lockboxPath, {
29
30
  namespace: "tide-tokens",
30
31
  encrypt: true
31
32
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trap_stevo/filetide",
3
- "version": "0.0.83",
3
+ "version": "0.0.85",
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": {