@trap_stevo/filetide 0.0.70 → 0.0.72
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 +266 -143
- package/dist/cjs/FileMessagerClient.js +22 -17
- package/dist/cjs/FileTide.js +256 -179
- package/dist/cjs/FileTideEnvironment.js +8 -0
- package/dist/cjs/HUDComponents/FileTideCommunicationConfigurations.js +12 -0
- package/dist/cjs/HUDComponents/FileTideEnvironment.js +8 -0
- package/dist/cjs/HUDManagers/FileNetClientManager.js +8 -0
- package/dist/cjs/HUDManagers/FileTideDebugUtilityManager.js +44 -5
- package/dist/cjs/HUDManagers/FileTideUniversalUtilityManager.js +109 -0
- package/dist/cjs/HUDManagers/TideTokenEnforcementManager.js +149 -0
- package/package.json +6 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const LogicTide = require("@trap_stevo/logictide");
|
|
4
|
+
|
|
5
|
+
// ~ Universal FileTide Communication Configurations ~
|
|
6
|
+
|
|
7
|
+
LogicTide.defineLogic("filetide-api-origin-url", "development", () => {
|
|
8
|
+
return "http://localhost:19269";
|
|
9
|
+
});
|
|
10
|
+
LogicTide.defineLogic("filetide-api-origin-url", "production", () => {
|
|
11
|
+
return "https://api.filetide.com";
|
|
12
|
+
});
|
|
@@ -33,6 +33,14 @@ class FileNetClientManager {
|
|
|
33
33
|
currentOnlineClients.delete(clientID);
|
|
34
34
|
return currentOnlineClients;
|
|
35
35
|
}
|
|
36
|
+
static getOnlineClientByConnectionID(connectionID) {
|
|
37
|
+
for (const clientData of currentOnlineClients.values()) {
|
|
38
|
+
if (clientData.id === connectionID) {
|
|
39
|
+
return clientData;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
36
44
|
static getOnlineClient(clientID) {
|
|
37
45
|
return currentOnlineClients.get(clientID);
|
|
38
46
|
}
|
|
@@ -6,6 +6,7 @@ const {
|
|
|
6
6
|
const chalk = require("chalk");
|
|
7
7
|
const significantMessageColors = ["#00C897", "#00E0FF"];
|
|
8
8
|
const noticeMessageColors = ["#4A90E2", "#A3D8F4"];
|
|
9
|
+
const infoAccentMessageColors = ["#6B768F", "#8D99AB"];
|
|
9
10
|
const errorMessageColors = ["#F94144", "#F3722C"];
|
|
10
11
|
const infoMessageColors = ["#028090", "#56cfe1"];
|
|
11
12
|
const logHandler = {
|
|
@@ -26,14 +27,29 @@ const logHandler = {
|
|
|
26
27
|
outputGradient(log + message.join(" "), infoMessageColors);
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
|
-
function
|
|
30
|
+
function gradientText(text, colors, options = {
|
|
31
|
+
underline: false
|
|
32
|
+
}) {
|
|
30
33
|
const gradient = HUDUtilityManager.generateGradientColors(colors, text.length);
|
|
31
34
|
let coloredText = "";
|
|
35
|
+
const underlineRange = Array.isArray(options.underline) ? options.underline : null;
|
|
36
|
+
const underlineNone = options.underline === false;
|
|
37
|
+
const underlineAll = options.underline === true;
|
|
32
38
|
for (let i = 0; i < text.length; i++) {
|
|
33
39
|
const [r, g, b] = gradient[i];
|
|
34
|
-
|
|
40
|
+
let styledChar = chalk.rgb(r, g, b);
|
|
41
|
+
if (underlineAll || underlineRange && i >= underlineRange[0] && i < underlineRange[1]) {
|
|
42
|
+
styledChar = styledChar.underline;
|
|
43
|
+
}
|
|
44
|
+
coloredText += styledChar(text[i]);
|
|
35
45
|
}
|
|
36
|
-
|
|
46
|
+
return coloredText;
|
|
47
|
+
}
|
|
48
|
+
;
|
|
49
|
+
function outputGradient(text, colors, options = {
|
|
50
|
+
underline: false
|
|
51
|
+
}) {
|
|
52
|
+
console.log(gradientText(text, colors, options));
|
|
37
53
|
return;
|
|
38
54
|
}
|
|
39
55
|
;
|
|
@@ -45,13 +61,35 @@ class FileTideDebugUtilityManager {
|
|
|
45
61
|
this.debugMode = false;
|
|
46
62
|
FileTideDebugUtilityManager.instance = this;
|
|
47
63
|
}
|
|
48
|
-
outputGradient(text, colors
|
|
49
|
-
|
|
64
|
+
outputGradient(text, colors, options = {
|
|
65
|
+
underline: false
|
|
66
|
+
}) {
|
|
67
|
+
outputGradient(text, colors, options);
|
|
50
68
|
return;
|
|
51
69
|
}
|
|
70
|
+
gradientText(text, colors, options = {
|
|
71
|
+
underline: false
|
|
72
|
+
}) {
|
|
73
|
+
return gradientText(text, colors, options);
|
|
74
|
+
}
|
|
75
|
+
createHyperlink(text, url) {
|
|
76
|
+
const ESC = "\u001b";
|
|
77
|
+
const BEL = "\u0007";
|
|
78
|
+
return `${ESC}]8;;${url}${BEL}${text}${ESC}]8;;${BEL}`;
|
|
79
|
+
}
|
|
52
80
|
setDebugMode(mode) {
|
|
53
81
|
this.debugMode = mode;
|
|
54
82
|
}
|
|
83
|
+
logLink(displayText, url, prefix = "➜", colors = noticeMessageColors.slice(0)) {
|
|
84
|
+
const styledText = gradientText(displayText, colors, {
|
|
85
|
+
underline: true
|
|
86
|
+
});
|
|
87
|
+
const link = this.createHyperlink(styledText, url);
|
|
88
|
+
const styledPrefix = gradientText(prefix, colors);
|
|
89
|
+
process.stdout.write(`${styledPrefix} `);
|
|
90
|
+
process.stdout.write(link);
|
|
91
|
+
process.stdout.write("\n");
|
|
92
|
+
}
|
|
55
93
|
log(type = "info", includeDate = false, ...message) {
|
|
56
94
|
if (!this.debugMode && type !== "error") {
|
|
57
95
|
return;
|
|
@@ -69,5 +107,6 @@ module.exports = {
|
|
|
69
107
|
significantMessageColors,
|
|
70
108
|
noticeMessageColors,
|
|
71
109
|
errorMessageColors,
|
|
110
|
+
infoAccentMessageColors,
|
|
72
111
|
infoMessageColors
|
|
73
112
|
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
FileTideDebugUtilityManager
|
|
5
|
+
} = require("./FileTideDebugUtilityManager.js");
|
|
6
|
+
function displayFileTideLogo() {
|
|
7
|
+
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;;;;;;;;;;;;;;:;SS++;;;%#**::+#?::::;#S:,,:::::::::::::::::::::::::::::::::::::::,+#%::;;;;;;;;;;;;;;;;;;;;;;;;
|
|
33
|
+
;;;;;;;;;;;;;;;;;;;;;;::;SS?*+;;%#?*;:;#S::::+#?,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,S#;:::::;;;;;;;;;;;;;;;;;;;;
|
|
34
|
+
;;;;;;;;;;;;;;;;;;;;;;;:;S#S*+;;*#%*+::?#*:::+#?,;;;;;;;;;**;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:S#;::::;;;;;;;;;;;;;;;;;;;;;
|
|
35
|
+
;;;;;;;;;;;;;;;;;;;;;;::;S##?*;;;SS**;::%#*::+#?,;;;;;;;;;++;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:S#;::::;;;;;;;;;;;;;;;;;;;;;
|
|
36
|
+
;;;;;;;;;;;;;;;;;;;;;;::;S##S**;;*#%**;;:?#?:;#?,+++++++++;;+++++++++++++++++++++++++++++++;S#;:::::;;;;;;;;;;;;;;;;;;;;
|
|
37
|
+
;;;;;;;;;;;;;;;;;;;;;;::;S%?#?*+;;?#%**;;:*#S?#%:*++++++++++++++++++++++++++++++++++++++++*+S#;:::;;;;;;;;;;;;;;;;;;;;;;
|
|
38
|
+
;;;;;;;;;;;;;;;;;;;;;;::;S%:SS?*+;;?#%**+;;;?##S;******************************************+S#;::::;;;;;;;;;;;;;;;;;;;;;
|
|
39
|
+
;;;;;;;;;;;;;;;;;;;;;:::;SS,;#S??+;;*#S?*+;;:;?##%?******??%%SSSSSSS%%??********************##;::::::;;;;;;;;;;;;;;;;;;;
|
|
40
|
+
;;;;;;;;;;;;;;;;;;;;;;::;SS;,;#S??+;;;%#S?*+;;;;?S#S%??%SS?*+;:::::;+*%SSS%%????????????????##;::::::;;;;;;;;;;;;;;;;;;;
|
|
41
|
+
;;;;;;;;;;;;;;;;;;;;;;::;SS;;,:S#??*+;;+%#S%?*++;;+?##S*;,,,,:::::::,,,,;?##SSSS%%%???????%%##;::::;;;;;;;;;;;;;;;;;;;;;
|
|
42
|
+
;;;;;;;;;;;;;;;;;;;;;;::;SS*+;:,*#S??*+;;+?S#S%?**?SS+,,::;;;;;::::;;;;::,:?#%**?%SSSSSSSSS%%S;:::;;;;;;;;;;;;;;;;;;;;;;
|
|
43
|
+
;;;;;;;;;;;;;;;;;;;;;;::;S#%**+;,:?SS%?**+;;+?S###%+,,:;;;;;;+**???**;;;;;:,;%#S*;;;;;;;;;::?S;:::;;;;;;;;;;;;;;;;;;;;;;
|
|
44
|
+
;;;;;;;;;;;;;;;;;;;;;;::;S##S?*++;::*%SSSSS%%%S%*:,,:;;;;;;*%SS%???%SSS?*+;;:,;%##%?**+++++*S#;:::;;;;;;;;;;;;;;;;;;;;;;
|
|
45
|
+
;;;;;;;;;;;;;;;;;;;;;;;:;SS;%#%?*++;:::;++**+;:,,:;;;;;;;;%#?+;;;;;;;;*%SS?*+;;::+?%SSSSSSSSS#;:::;;;;;;;;;;;;;;;;;;;;;;
|
|
46
|
+
;;;;;;;;;;;;;;;;;;;;;;::;SS;:+S#S?**++;;;:::::;;;;;+*+++;*S?+++++++;;;;;;*S#%**+;;:::;;;;;;:*S;:::;;;;;;;;;;;;;;;;;;;;;;
|
|
47
|
+
;;;;;;;;;;;;;;;;;;;;;;;:;SS*+;;+?SSS%?**+++++++**?%S%+;;?#?*???????**++;;;;*%SS%?**++;;;;;;;%S;:::;;;;;;;;;;;;;;;;;;;;;;
|
|
48
|
+
;;;;;;;;;;;;;;;;;;;;;;;::?#%?*++;;+*%SSSSS%%%%SSS%?+;;+%#SSSSSSSSSSS%%?**++;;;*%SSSS%%????%%#S;:::;;;;;;;;;;;;;;;;;;;;;;
|
|
49
|
+
;;;;;;;;;;;;;;;;;;;;;;;;::%#%??**++;;;;+**???**++;;;+?S#S%%???**++*?%SSS%?**+++;;++*?%%%%%%##+:::;;;;;;;;;;;;;;;;;;;;;;;
|
|
50
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;::*##%???****+++;;;;;;+++*?S#S%??????***+++++*%SSS%??****+++++++*%S+:::;;;;;;;;;;;;;;;;;;;;;;;;
|
|
51
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;::;?S#SS%?????******??%%SSS%%%%SSSS%%%%????****?%SSSS%%??????%S#?;::::;;;;;;;;;;;;;;;;;;;;;;;;
|
|
52
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;:::;+?%S##SSSSSSSSS#####SSSSS#SS#######SSSSSSSSSSS#######SSS%*;::::;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
53
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::;+++********************************************+++;;::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
54
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::::::::::::::::::::::::::::::::::::::::::::::::::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
55
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::::::::::::::::::::::::::;;;::::::::::::;;;;;;;;:;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
56
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::::;::::::::::;;:;;;;;;;;;;::;;:::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
57
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::::::;;;;;:;;;;;;;;;;;;;;;::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
58
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
59
|
+
;;;;;;;;;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;;;;
|
|
67
|
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
68
|
+
`, ["#0077B6", "#00B4D8"]);
|
|
69
|
+
}
|
|
70
|
+
;
|
|
71
|
+
function displayFileTideTitle(cli = false) {
|
|
72
|
+
if (cli) {
|
|
73
|
+
FileTideDebugUtilityManager.outputGradient(`
|
|
74
|
+
\t\t _______ ___ ___ _______ _______ ___ ______ _______ _______ ___ ___
|
|
75
|
+
\t\t| || | | | | || || | | | | | | || | | |
|
|
76
|
+
\t\t| ___|| | | | | ___||_ _|| | | _ || ___| | || | | |
|
|
77
|
+
\t\t| |___ | | | | | |___ | | | | | | | || |___ | || | | |
|
|
78
|
+
\t\t| ___|| | | |___ | ___| | | | | | |_| || ___| | _|| |___ | |
|
|
79
|
+
\t\t| | | | | || |___ | | | | | || |___ | |_ | || |
|
|
80
|
+
\t\t|___| |___| |_______||_______| |___| |___| |______| |_______| |_______||_______||___|
|
|
81
|
+
`, ["#028090", "#56cfe1"]);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
FileTideDebugUtilityManager.outputGradient(`
|
|
85
|
+
\t\t\t\t _______ ___ ___ _______ _______ ___ ______ _______
|
|
86
|
+
\t\t\t\t| || | | | | || || | | | | |
|
|
87
|
+
\t\t\t\t| ___|| | | | | ___||_ _|| | | _ || ___|
|
|
88
|
+
\t\t\t\t| |___ | | | | | |___ | | | | | | | || |___
|
|
89
|
+
\t\t\t\t| ___|| | | |___ | ___| | | | | | |_| || ___|
|
|
90
|
+
\t\t\t\t| | | | | || |___ | | | | | || |___
|
|
91
|
+
\t\t\t\t|___| |___| |_______||_______| |___| |___| |______| |_______|
|
|
92
|
+
`, ["#028090", "#56cfe1"]);
|
|
93
|
+
}
|
|
94
|
+
;
|
|
95
|
+
function displayFileTideAuthor() {
|
|
96
|
+
FileTideDebugUtilityManager.outputGradient(`
|
|
97
|
+
▄▄· ▄▄▄ ▄▄▄ . ▄▄▄· ▄▄▄▄▄▄▄▄ .·▄▄▄▄ ▄▄▄▄· ▄· ▄▌ .▄▄ · ▄▄▄▄▄▄▄▄ . ▌ ▐·▄▄▄ . ▐ ▄ ▄▄· • ▌ ▄ ·. ▄▄▄·▄▄▄▄▄ ▐ ▄
|
|
98
|
+
▐█ ▌▪▀▄ █·▀▄.▀·▐█ ▀█ •██ ▀▄.▀·██▪ ██ ▐█ ▀█▪▐█▪██▌ ▐█ ▀. •██ ▀▄.▀·▪█·█▌▀▄.▀·•█▌▐█ ▐█ ▌▪▪ ·██ ▐███▪▐█ ▄█•██ ▪ •█▌▐█
|
|
99
|
+
██ ▄▄▐▀▀▄ ▐▀▀▪▄▄█▀▀█ ▐█.▪▐▀▀▪▄▐█· ▐█▌ ▐█▀▀█▄▐█▌▐█▪ ▄▀▀▀█▄ ▐█.▪▐▀▀▪▄▐█▐█•▐▀▀▪▄▐█▐▐▌ ██ ▄▄ ▄█▀▄ ▐█ ▌▐▌▐█· ██▀· ▐█.▪ ▄█▀▄ ▐█▐▐▌
|
|
100
|
+
▐███▌▐█•█▌▐█▄▄▌▐█ ▪▐▌ ▐█▌·▐█▄▄▌██. ██ ██▄▪▐█ ▐█▀·. ▐█▄▪▐█ ▐█▌·▐█▄▄▌ ███ ▐█▄▄▌██▐█▌ ▐███▌▐█▌.▐▌██ ██▌▐█▌▐█▪·• ▐█▌·▐█▌.▐▌██▐█▌
|
|
101
|
+
·▀▀▀ .▀ ▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀ ▀▀▀▀▀• ·▀▀▀▀ ▀ • ▀▀▀▀ ▀▀▀ ▀▀▀ . ▀ ▀▀▀ ▀▀ █▪ ·▀▀▀ ▀█▄▀▪▀▀ █▪▀▀▀.▀ ▀▀▀ ▀█▄▀▪▀▀ █▪
|
|
102
|
+
`, ["#1a73e8", "#a0c4ff"]);
|
|
103
|
+
}
|
|
104
|
+
;
|
|
105
|
+
module.exports = {
|
|
106
|
+
displayFileTideAuthor,
|
|
107
|
+
displayFileTideTitle,
|
|
108
|
+
displayFileTideLogo
|
|
109
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const LogicTide = require("@trap_stevo/logictide");
|
|
4
|
+
const Lockline = require("@trap_stevo/lockline");
|
|
5
|
+
const axios = require("axios");
|
|
6
|
+
const {
|
|
7
|
+
FileTideDebugUtilityManager,
|
|
8
|
+
significantMessageColors,
|
|
9
|
+
noticeMessageColors,
|
|
10
|
+
infoMessageColors,
|
|
11
|
+
infoAccentMessageColors,
|
|
12
|
+
errorMessageColors
|
|
13
|
+
} = require("./FileTideDebugUtilityManager.js");
|
|
14
|
+
const {
|
|
15
|
+
displayFileTideAuthor,
|
|
16
|
+
displayFileTideTitle,
|
|
17
|
+
displayFileTideLogo
|
|
18
|
+
} = require("./FileTideUniversalUtilityManager.js");
|
|
19
|
+
class TideTokenEnforcementManager {
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
const {
|
|
22
|
+
tideTokenEnforcementCallbackConfigurations = {},
|
|
23
|
+
onDidNotLoadRecentTideTokens
|
|
24
|
+
} = options;
|
|
25
|
+
this.tideTokenEnforcementCallbackConfigurations = tideTokenEnforcementCallbackConfigurations;
|
|
26
|
+
this.tideTokenEnforcementComplianceHandlers = this.generateTideTokenEnforcementHandlers();
|
|
27
|
+
this.lock = new Lockline();
|
|
28
|
+
this.lock.setStorage(Lockline.lockbox("./lockbox", {
|
|
29
|
+
namespace: "tide-tokens",
|
|
30
|
+
encrypt: true
|
|
31
|
+
}));
|
|
32
|
+
this.lock.registerValidator("tide-token-authorization", async ({
|
|
33
|
+
key
|
|
34
|
+
}) => {
|
|
35
|
+
const fileTideAPIURL = await LogicTide.run("filetide-api-origin-url");
|
|
36
|
+
const response = await axios.get(`${fileTideAPIURL}/tide-token-auth/authorized-tide-token`, {
|
|
37
|
+
params: {
|
|
38
|
+
inputTideToken: key
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
valid: response.data.authorizedTideToken,
|
|
43
|
+
raw: response.data.details,
|
|
44
|
+
reason: response.data.message
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
this.lock.setDefaultValidator("tide-token-authorization");
|
|
48
|
+
this.loadedRecentLicenseKeys = this.lock.loadRecentLicenseKeys().catch(error => {
|
|
49
|
+
if (typeof onDidNotLoadRecentTideTokens === "function") {
|
|
50
|
+
onDidNotLoadRecentTideTokens(error);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
this.enforcerOverviewMetrics = {
|
|
54
|
+
"tide-token-authorized": 0,
|
|
55
|
+
"tide-token-blocked": 0,
|
|
56
|
+
"tide-token-missing": 0,
|
|
57
|
+
"tide-token-invalid": 0
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
updateTideTokenEnforcementCallbackConfigurations(updatedConfigurations = {}) {
|
|
61
|
+
this.tideTokenEnforcementCallbackConfigurations = {
|
|
62
|
+
...this.tideTokenEnforcementCallbackConfigurations,
|
|
63
|
+
...updatedConfigurations
|
|
64
|
+
};
|
|
65
|
+
this.tideTokenEnforcementComplianceHandlers = this.generateTideTokenEnforcementHandlers();
|
|
66
|
+
}
|
|
67
|
+
generateTideTokenEnforcementHandlers() {
|
|
68
|
+
const {
|
|
69
|
+
onLicenseBlocked,
|
|
70
|
+
onMissingLicense,
|
|
71
|
+
onInvalidLicense,
|
|
72
|
+
onSuccess
|
|
73
|
+
} = this.tideTokenEnforcementCallbackConfigurations;
|
|
74
|
+
const url = "https://filetide.com/tider-portal";
|
|
75
|
+
return {
|
|
76
|
+
onLicenseBlocked: enforcedDetails => {
|
|
77
|
+
FileTideDebugUtilityManager.outputGradient(`[FileTide | ${new Date().toLocaleString()}] ~ ❌ TideToken Blocked\n`, errorMessageColors);
|
|
78
|
+
FileTideDebugUtilityManager.outputGradient(`\t→ Visit ~ ${url} to configure / create TideTokens.\n`, infoAccentMessageColors);
|
|
79
|
+
FileTideDebugUtilityManager.outputGradient(`| ${new Date().toLocaleString()} |`, infoAccentMessageColors);
|
|
80
|
+
FileTideDebugUtilityManager.outputGradient(`${"-".repeat(130)}\n`, infoAccentMessageColors);
|
|
81
|
+
this.enforcerOverviewMetrics["tide-token-blocked"] += 1;
|
|
82
|
+
onLicenseBlocked?.(enforcedDetails);
|
|
83
|
+
},
|
|
84
|
+
onMissingKey: enforcedDetails => {
|
|
85
|
+
displayFileTideLogo();
|
|
86
|
+
displayFileTideTitle();
|
|
87
|
+
FileTideDebugUtilityManager.outputGradient(`[FileTide] ~ Welcome!\n`, significantMessageColors);
|
|
88
|
+
FileTideDebugUtilityManager.outputGradient("\t~ No TideToken(s) Detected\n", significantMessageColors);
|
|
89
|
+
FileTideDebugUtilityManager.outputGradient(`\t→ Visit ~ ${url} to create TideTokens.\n`, infoMessageColors);
|
|
90
|
+
FileTideDebugUtilityManager.outputGradient(`| ${new Date().toLocaleString()} |`, infoAccentMessageColors);
|
|
91
|
+
FileTideDebugUtilityManager.outputGradient(`${"-".repeat(130)}\n`, infoAccentMessageColors);
|
|
92
|
+
this.enforcerOverviewMetrics["tide-token-missing"] += 1;
|
|
93
|
+
onMissingLicense?.(enforcedDetails);
|
|
94
|
+
},
|
|
95
|
+
onInvalidKey: enforcedDetails => {
|
|
96
|
+
FileTideDebugUtilityManager.outputGradient(`[FileTide | ${new Date().toLocaleString()}] ~ ❌ TideToken Unauthorized\n`, errorMessageColors);
|
|
97
|
+
FileTideDebugUtilityManager.outputGradient(`\t→ Visit ~ ${url} to configure / create TideTokens.\n`, infoAccentMessageColors);
|
|
98
|
+
FileTideDebugUtilityManager.outputGradient(`| ${new Date().toLocaleString()} |`, infoAccentMessageColors);
|
|
99
|
+
FileTideDebugUtilityManager.outputGradient(`${"-".repeat(130)}\n`, infoAccentMessageColors);
|
|
100
|
+
this.enforcerOverviewMetrics["tide-token-invalid"] += 1;
|
|
101
|
+
onInvalidLicense?.(enforcedDetails);
|
|
102
|
+
},
|
|
103
|
+
onSuccess: enforcedDetails => {
|
|
104
|
+
FileTideDebugUtilityManager.outputGradient(`[FileTide | ${new Date().toLocaleString()}] ~ ✅ TideToken Authorized\n`, significantMessageColors);
|
|
105
|
+
if (this.enforcerOverviewMetrics["tide-token-authorized"] <= 0) {
|
|
106
|
+
FileTideDebugUtilityManager.outputGradient(`\t→ Configure TideTokens at ${url}\n`, noticeMessageColors);
|
|
107
|
+
}
|
|
108
|
+
FileTideDebugUtilityManager.outputGradient(`| ${new Date().toLocaleString()} |`, infoAccentMessageColors);
|
|
109
|
+
FileTideDebugUtilityManager.outputGradient(`${"-".repeat(130)}\n`, infoAccentMessageColors);
|
|
110
|
+
this.enforcerOverviewMetrics["tide-token-authorized"] += 1;
|
|
111
|
+
onSuccess?.(enforcedDetails);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
protect(handler, scope, options = {}) {
|
|
116
|
+
return async (...args) => {
|
|
117
|
+
await this.loadedRecentLicenseKeys;
|
|
118
|
+
const protectedHandler = this.lock.withLicenseProtection(handler, scope, {
|
|
119
|
+
...(options ?? {}),
|
|
120
|
+
...this.tideTokenEnforcementComplianceHandlers
|
|
121
|
+
});
|
|
122
|
+
return await protectedHandler(...args);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
getKey(scope = "default") {
|
|
126
|
+
return this.lock.getCurrentLicenseKey(scope);
|
|
127
|
+
}
|
|
128
|
+
async seal(key, meta = {}) {
|
|
129
|
+
return await this.lock.sealKey(key, {
|
|
130
|
+
validators: [{
|
|
131
|
+
name: "tide-token-authorization"
|
|
132
|
+
}],
|
|
133
|
+
meta
|
|
134
|
+
}, {
|
|
135
|
+
assumePreviouslyValid: true,
|
|
136
|
+
fallbackIfOffline: true,
|
|
137
|
+
autoRemoveExpired: true,
|
|
138
|
+
storeInvalid: true
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async validate(key) {
|
|
142
|
+
return await this.lock.validate(key);
|
|
143
|
+
}
|
|
144
|
+
async inspect(key) {
|
|
145
|
+
return await this.lock.inspectKey(key);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
;
|
|
149
|
+
module.exports = new TideTokenEnforcementManager();
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trap_stevo/filetide",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.72",
|
|
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": {
|
|
7
7
|
"build": "babel src -d dist/cjs --env-name cjs",
|
|
8
|
+
"start-tide-token-server": "node demos/tideTokenServerDemo.js",
|
|
8
9
|
"start-file-generation": "node demos/FileGenerator.js",
|
|
9
10
|
"start-messager": "node demos/FileTideClientDemo.js",
|
|
10
11
|
"start-net": "node demos/FileTideNetDemo.js",
|
|
@@ -37,8 +38,10 @@
|
|
|
37
38
|
"@trap_stevo/iotide": "^0.0.44",
|
|
38
39
|
"@trap_stevo/iotide-client": "^0.0.26",
|
|
39
40
|
"@trap_stevo/legendarybuilderpronodejs-utilities": "^1.0.49",
|
|
40
|
-
"@trap_stevo/
|
|
41
|
-
"@trap_stevo/
|
|
41
|
+
"@trap_stevo/lockline": "^0.0.11",
|
|
42
|
+
"@trap_stevo/logictide": "^0.0.1",
|
|
43
|
+
"@trap_stevo/metrictide": "^0.0.5",
|
|
44
|
+
"@trap_stevo/timelyst": "^0.0.7",
|
|
42
45
|
"chalk": "^4.1.2",
|
|
43
46
|
"readline": "^1.3.0"
|
|
44
47
|
},
|