@moontra/moonui-pro 2.32.35 → 2.32.37

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.mjs CHANGED
@@ -99,6 +99,81 @@ var init_cli_token_reader = __esm({
99
99
  }
100
100
  return this.instance;
101
101
  }
102
+ /**
103
+ * Get real external IP address using WebRTC (browser-native method)
104
+ * This ensures browser and CLI use the same IP perspective
105
+ */
106
+ async getRealExternalIP() {
107
+ try {
108
+ const ip = await this.getWebRTCIP();
109
+ if (ip && ip !== "unknown") {
110
+ return ip;
111
+ }
112
+ if (typeof window !== "undefined") {
113
+ const currentHost = window.location.hostname;
114
+ if (currentHost !== "localhost" && currentHost !== "127.0.0.1") {
115
+ return currentHost;
116
+ }
117
+ }
118
+ return "192.168.1.2";
119
+ } catch (error) {
120
+ console.warn("[MoonUI Pro] External IP detection failed, using fallback");
121
+ return "192.168.1.2";
122
+ }
123
+ }
124
+ /**
125
+ * Get local IP address using WebRTC (no external service needed)
126
+ */
127
+ async getWebRTCIP() {
128
+ return new Promise((resolve) => {
129
+ console.log("[MoonUI Pro] WebRTC IP detection starting...");
130
+ try {
131
+ const pc = new RTCPeerConnection({
132
+ iceServers: [{ urls: "stun:stun.l.google.com:19302" }]
133
+ });
134
+ pc.createDataChannel("ip-detection");
135
+ let candidateCount = 0;
136
+ pc.onicecandidate = (event) => {
137
+ candidateCount++;
138
+ console.log(`[MoonUI Pro] WebRTC candidate ${candidateCount}:`, event.candidate?.candidate);
139
+ if (event.candidate) {
140
+ const candidate = event.candidate.candidate;
141
+ const ipMatch = candidate.match(/(\d+\.\d+\.\d+\.\d+)/);
142
+ if (ipMatch && ipMatch[1]) {
143
+ const ip = ipMatch[1];
144
+ console.log(`[MoonUI Pro] WebRTC IP found: ${ip}`);
145
+ if (!ip.startsWith("127.") && !ip.startsWith("0.")) {
146
+ console.log(`[MoonUI Pro] WebRTC IP accepted: ${ip}`);
147
+ pc.close();
148
+ resolve(ip);
149
+ return;
150
+ } else {
151
+ console.log(`[MoonUI Pro] WebRTC IP rejected (localhost): ${ip}`);
152
+ }
153
+ }
154
+ }
155
+ };
156
+ pc.onicecandidateerror = (event) => {
157
+ console.error("[MoonUI Pro] WebRTC ICE candidate error:", event);
158
+ };
159
+ pc.createOffer().then((offer) => {
160
+ console.log("[MoonUI Pro] WebRTC offer created successfully");
161
+ return pc.setLocalDescription(offer);
162
+ }).catch((error) => {
163
+ console.error("[MoonUI Pro] WebRTC offer creation failed:", error);
164
+ resolve("unknown");
165
+ });
166
+ setTimeout(() => {
167
+ console.log(`[MoonUI Pro] WebRTC timeout after ${candidateCount} candidates`);
168
+ pc.close();
169
+ resolve("unknown");
170
+ }, 5e3);
171
+ } catch (error) {
172
+ console.error("[MoonUI Pro] WebRTC initialization failed:", error);
173
+ resolve("unknown");
174
+ }
175
+ });
176
+ }
102
177
  /**
103
178
  * Generate TRULY secure browser-specific device fingerprint
104
179
  * COMPLETELY INDEPENDENT from environment variables
@@ -109,7 +184,7 @@ var init_cli_token_reader = __esm({
109
184
  async getDeviceFingerprint() {
110
185
  try {
111
186
  const platform2 = this.detectBrowserPlatform();
112
- const hostname = typeof window !== "undefined" ? window.location.hostname : "unknown";
187
+ const hostname = await this.getRealExternalIP();
113
188
  const browserUserHash = await this.generateBrowserSpecificUserHash();
114
189
  const browserMachineId = await this.generateBrowserMachineId();
115
190
  const fingerprint = `browser-${hostname}-${browserUserHash}-${browserMachineId}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.32.35",
3
+ "version": "2.32.37",
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",