@moontra/moonui-pro 2.33.18 → 2.33.20
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/index.d.ts +20 -20
- package/dist/index.global.js +122 -122
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +75 -44
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -102,17 +102,17 @@ var init_cli_token_reader = __esm({
|
|
|
102
102
|
/**
|
|
103
103
|
* Generate TRULY secure browser-specific device fingerprint
|
|
104
104
|
* COMPLETELY INDEPENDENT from environment variables
|
|
105
|
-
* Format:
|
|
105
|
+
* Format: browser-hostname-browser_user_hash-machine_hash
|
|
106
106
|
*
|
|
107
107
|
* SECURITY: Environment copying CANNOT bypass this!
|
|
108
108
|
*/
|
|
109
109
|
async getDeviceFingerprint() {
|
|
110
110
|
try {
|
|
111
111
|
const platform2 = this.detectBrowserPlatform();
|
|
112
|
-
const hostname =
|
|
112
|
+
const hostname = typeof window !== "undefined" ? window.location.hostname : "unknown";
|
|
113
113
|
const browserUserHash = await this.generateBrowserSpecificUserHash();
|
|
114
114
|
const browserMachineId = await this.generateBrowserMachineId();
|
|
115
|
-
const fingerprint =
|
|
115
|
+
const fingerprint = `browser-${hostname}-${browserUserHash}-${browserMachineId}`;
|
|
116
116
|
console.log("[MoonUI Pro] Environment-independent browser fingerprint generated:", {
|
|
117
117
|
platform: platform2,
|
|
118
118
|
hostname,
|
|
@@ -124,11 +124,7 @@ var init_cli_token_reader = __esm({
|
|
|
124
124
|
return fingerprint;
|
|
125
125
|
} catch (error) {
|
|
126
126
|
console.error("[MoonUI Pro] Device fingerprint generation failed:", error);
|
|
127
|
-
|
|
128
|
-
const fallbackHostname = typeof window !== "undefined" ? window.location.hostname : "localhost";
|
|
129
|
-
const fallbackUserHash = "fallback";
|
|
130
|
-
const fallbackMachineHash = "000000";
|
|
131
|
-
return `${fallbackPlatform}-${fallbackHostname}-${fallbackUserHash}-${fallbackMachineHash}`;
|
|
127
|
+
return "browser-fallback-device";
|
|
132
128
|
}
|
|
133
129
|
}
|
|
134
130
|
/**
|
|
@@ -161,7 +157,7 @@ var init_cli_token_reader = __esm({
|
|
|
161
157
|
return hash.substring(0, 8);
|
|
162
158
|
} catch (error) {
|
|
163
159
|
console.warn("[MoonUI Pro] Browser user hash generation failed, using fallback");
|
|
164
|
-
const fallback = `${navigator.userAgent.length}-${screen.width}-${
|
|
160
|
+
const fallback = `${navigator.userAgent.length}-${screen.width}-${Date.now() % 1e4}`;
|
|
165
161
|
return this.fallbackHash(fallback);
|
|
166
162
|
}
|
|
167
163
|
}
|
|
@@ -289,47 +285,30 @@ var init_cli_token_reader = __esm({
|
|
|
289
285
|
}
|
|
290
286
|
}
|
|
291
287
|
/**
|
|
292
|
-
* Validate device compatibility (CLI vs Browser)
|
|
288
|
+
* Validate device compatibility (CLI vs Browser)
|
|
293
289
|
* CLI: platform-hostname-userHash-macHash
|
|
294
290
|
* Browser: platform-hostname-userHash-browserHash
|
|
295
|
-
*
|
|
296
|
-
* - STRICT: All parts must match (prevent .env.local copying)
|
|
297
|
-
* - HYBRID: First 3 parts match, API validation required for hash differences
|
|
291
|
+
* Compatible if first 3 parts match
|
|
298
292
|
*/
|
|
299
293
|
validateDeviceCompatibility(tokenDeviceId, currentDeviceId) {
|
|
300
294
|
const tokenParts = tokenDeviceId.split("-");
|
|
301
295
|
const currentParts = currentDeviceId.split("-");
|
|
302
296
|
if (tokenParts.length < 3 || currentParts.length < 3) {
|
|
303
|
-
return { compatible: false,
|
|
297
|
+
return { compatible: false, reason: "Invalid device ID format" };
|
|
304
298
|
}
|
|
305
299
|
const platformMatch = tokenParts[0] === currentParts[0];
|
|
306
300
|
const hostnameMatch = tokenParts[1] === currentParts[1];
|
|
307
301
|
const userHashMatch = tokenParts[2] === currentParts[2];
|
|
308
|
-
console.log("[MoonUI Pro] Device ID comparison:", {
|
|
309
|
-
platform: { token: tokenParts[0], current: currentParts[0], match: platformMatch },
|
|
310
|
-
hostname: { token: tokenParts[1], current: currentParts[1], match: hostnameMatch },
|
|
311
|
-
userHash: { token: tokenParts[2], current: currentParts[2], match: userHashMatch },
|
|
312
|
-
machineHash: { token: tokenParts[3], current: currentParts[3], match: tokenParts[3] === currentParts[3] }
|
|
313
|
-
});
|
|
314
302
|
if (!platformMatch) {
|
|
315
|
-
return { compatible: false,
|
|
303
|
+
return { compatible: false, reason: "Platform mismatch (different OS)" };
|
|
316
304
|
}
|
|
317
305
|
if (!hostnameMatch) {
|
|
318
|
-
return { compatible: false,
|
|
306
|
+
return { compatible: false, reason: "Hostname mismatch (different machine)" };
|
|
319
307
|
}
|
|
320
308
|
if (!userHashMatch) {
|
|
321
|
-
|
|
322
|
-
console.log("[MoonUI Pro] Requiring API validation for security");
|
|
323
|
-
return { compatible: true, requiresAPIValidation: true, reason: `User hash difference expected: CLI=${tokenParts[2]}, Browser=${currentParts[2]}` };
|
|
324
|
-
}
|
|
325
|
-
const cliMachineHash = tokenParts[3] || "";
|
|
326
|
-
const browserMachineHash = currentParts[3] || "";
|
|
327
|
-
const machineHashMatch = cliMachineHash === browserMachineHash;
|
|
328
|
-
if (machineHashMatch) {
|
|
329
|
-
return { compatible: true, requiresAPIValidation: false };
|
|
330
|
-
} else {
|
|
331
|
-
return { compatible: true, requiresAPIValidation: true };
|
|
309
|
+
return { compatible: false, reason: "User account mismatch" };
|
|
332
310
|
}
|
|
311
|
+
return { compatible: true };
|
|
333
312
|
}
|
|
334
313
|
/**
|
|
335
314
|
* SHA256 hash function for consistency with CLI
|
|
@@ -448,12 +427,7 @@ var init_cli_token_reader = __esm({
|
|
|
448
427
|
console.log(" \u2022 Contact support for multi-device licensing options");
|
|
449
428
|
return null;
|
|
450
429
|
}
|
|
451
|
-
|
|
452
|
-
console.log("[MoonUI Pro] Device hash mismatch detected - performing API validation");
|
|
453
|
-
console.log("[MoonUI Pro] This is normal for CLI-Browser authentication");
|
|
454
|
-
} else {
|
|
455
|
-
console.log("[MoonUI Pro] Perfect device match - skipping API validation");
|
|
456
|
-
}
|
|
430
|
+
console.log("[MoonUI Pro] Device compatibility validated successfully");
|
|
457
431
|
}
|
|
458
432
|
const isValid2 = await this.validateWithAPI(tokenData.token, tokenDeviceId, currentDeviceId);
|
|
459
433
|
if (!isValid2) {
|
|
@@ -2861,6 +2835,64 @@ function createAIProvider(provider, config) {
|
|
|
2861
2835
|
|
|
2862
2836
|
// src/index.ts
|
|
2863
2837
|
init_use_subscription();
|
|
2838
|
+
async function sha256(message) {
|
|
2839
|
+
const msgBuffer = new TextEncoder().encode(message);
|
|
2840
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", msgBuffer);
|
|
2841
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
2842
|
+
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
2843
|
+
return hashHex;
|
|
2844
|
+
}
|
|
2845
|
+
async function generateStableBrowserFingerprint() {
|
|
2846
|
+
const components = [];
|
|
2847
|
+
try {
|
|
2848
|
+
const canvas = document.createElement("canvas");
|
|
2849
|
+
canvas.width = 200;
|
|
2850
|
+
canvas.height = 50;
|
|
2851
|
+
const ctx = canvas.getContext("2d");
|
|
2852
|
+
if (ctx) {
|
|
2853
|
+
ctx.textBaseline = "top";
|
|
2854
|
+
ctx.font = "14px Arial";
|
|
2855
|
+
ctx.textAlign = "center";
|
|
2856
|
+
ctx.fillStyle = "#f60";
|
|
2857
|
+
ctx.fillRect(125, 1, 62, 20);
|
|
2858
|
+
ctx.fillStyle = "#069";
|
|
2859
|
+
ctx.fillText("\u{1F510}MoonUI", 50, 25);
|
|
2860
|
+
ctx.fillStyle = "rgba(102, 204, 0, 0.7)";
|
|
2861
|
+
ctx.fillText("\u{1F510}MoonUI", 100, 25);
|
|
2862
|
+
const canvasData = canvas.toDataURL();
|
|
2863
|
+
const canvasHash = await sha256(canvasData);
|
|
2864
|
+
components.push(canvasHash.slice(0, 8));
|
|
2865
|
+
}
|
|
2866
|
+
const canvas2 = document.createElement("canvas");
|
|
2867
|
+
const gl = canvas2.getContext("webgl") || canvas2.getContext("experimental-webgl");
|
|
2868
|
+
if (gl) {
|
|
2869
|
+
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
|
|
2870
|
+
if (debugInfo) {
|
|
2871
|
+
const vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);
|
|
2872
|
+
const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
|
|
2873
|
+
const glHash = await sha256(`${vendor}|${renderer}`);
|
|
2874
|
+
components.push(glHash.slice(0, 8));
|
|
2875
|
+
} else {
|
|
2876
|
+
const vendor = gl.getParameter(gl.VENDOR);
|
|
2877
|
+
const renderer = gl.getParameter(gl.RENDERER);
|
|
2878
|
+
const glHash = await sha256(`${vendor}|${renderer}`);
|
|
2879
|
+
components.push(glHash.slice(0, 8));
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
const screenData = `${window.screen.width}x${window.screen.height}x${window.screen.colorDepth}`;
|
|
2883
|
+
const screenHash = await sha256(screenData);
|
|
2884
|
+
components.push(screenHash.slice(0, 8));
|
|
2885
|
+
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2886
|
+
const language = navigator.language;
|
|
2887
|
+
const localeHash = await sha256(`${timezone}|${language}`);
|
|
2888
|
+
components.push(localeHash.slice(0, 6));
|
|
2889
|
+
} catch (error) {
|
|
2890
|
+
console.error("[MoonUI Pro] Error generating browser fingerprint:", error);
|
|
2891
|
+
const fallbackHash = await sha256(`${Date.now()}-${Math.random()}`);
|
|
2892
|
+
components.push(fallbackHash.slice(0, 8));
|
|
2893
|
+
}
|
|
2894
|
+
return `browser-${components.join("-")}`;
|
|
2895
|
+
}
|
|
2864
2896
|
var CACHE_KEY2 = "moonui_license_cache";
|
|
2865
2897
|
var CLI_AUTH_CACHE_KEY2 = "moonui_cli_auth_cache";
|
|
2866
2898
|
var CACHE_DURATION = !process.env.VERCEL ? 1 * 60 * 1e3 : 24 * 60 * 60 * 1e3;
|
|
@@ -2905,14 +2937,13 @@ function SubscriptionProvider({ children }) {
|
|
|
2905
2937
|
try {
|
|
2906
2938
|
const decoded = JSON.parse(atob(devToken));
|
|
2907
2939
|
const jwtToken = decoded.token;
|
|
2908
|
-
const
|
|
2909
|
-
const userHash = deviceId.split("-")[2];
|
|
2910
|
-
const browserHash = Math.random().toString(36).substring(2, 8);
|
|
2940
|
+
const browserFingerprint = await generateStableBrowserFingerprint();
|
|
2911
2941
|
const requestBody = {
|
|
2912
2942
|
deviceId,
|
|
2913
|
-
browserDeviceId:
|
|
2943
|
+
browserDeviceId: browserFingerprint,
|
|
2914
2944
|
timestamp: Date.now(),
|
|
2915
|
-
validationType: "hybrid-
|
|
2945
|
+
validationType: "hybrid-browser-register",
|
|
2946
|
+
action: "registerBrowserIfNeeded"
|
|
2916
2947
|
};
|
|
2917
2948
|
console.log("[MoonUI Pro] Sending request to moonui.dev/api/cli/validate-session");
|
|
2918
2949
|
console.log("[MoonUI Pro] DeviceId:", deviceId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.33.
|
|
3
|
+
"version": "2.33.20",
|
|
4
4
|
"description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|