@moneybar.online/moneybar 4.1.0 → 4.2.0

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/src/index.ts CHANGED
@@ -226,6 +226,19 @@ export class MoneyBar {
226
226
  if (forceRefresh || !this.cachedStatus) {
227
227
  // Get download count only if we don't have it cached
228
228
  count = await this.getDownloadCount();
229
+
230
+ // CRITICAL: Check if security key validation failed
231
+ // Don't proceed with normal status if there's a security error
232
+ if (this.securityKeyFailed) {
233
+ // Return a minimal error status
234
+ return {
235
+ currentCount: 0,
236
+ limit: this.config.freeAttemptLimit,
237
+ isPremium: false,
238
+ isAuthenticated: false,
239
+ remaining: 0
240
+ };
241
+ }
229
242
  } else {
230
243
  // Use cached count if available to avoid unnecessary API call
231
244
  count = this.cachedStatus.currentCount;
@@ -3181,12 +3194,13 @@ User Agent: ${feedbackData.userAgent}
3181
3194
 
3182
3195
  // Check if it's a security key validation error
3183
3196
  if (errorMsg.toLowerCase().includes('security key')) {
3184
- console.error(`❌ Security Key Validation Failed: ${errorMsg}`);
3197
+ console.error(`❌ Security Key Validation Failed [check-download-limit]: ${errorMsg}`);
3198
+ console.error(`💡 Backend Function: check-download-limit`);
3185
3199
  console.error(`💡 Please check your security_key in the MoneyBar configuration`);
3186
3200
  this.securityKeyFailed = true; // Set security key error flag
3187
3201
  this.supabaseConnectionFailed = true; // Also mark connection as failed to disable downloads
3188
3202
  } else {
3189
- console.warn(`Supabase authentication failed: ${response.status} - ${errorMsg}`);
3203
+ console.warn(`Supabase authentication failed [check-download-limit]: ${response.status} - ${errorMsg}`);
3190
3204
  this.supabaseConnectionFailed = true;
3191
3205
  }
3192
3206
  } catch (e) {
@@ -3256,12 +3270,13 @@ User Agent: ${feedbackData.userAgent}
3256
3270
 
3257
3271
  // Check if it's a security key validation error
3258
3272
  if (errorMsg.toLowerCase().includes('security key')) {
3259
- console.error(`❌ Security Key Validation Failed: ${errorMsg}`);
3273
+ console.error(`❌ Security Key Validation Failed [check-download-limit]: ${errorMsg}`);
3274
+ console.error(`💡 Backend Function: check-download-limit`);
3260
3275
  console.error(`💡 Please check your security_key in the MoneyBar configuration`);
3261
3276
  this.securityKeyFailed = true; // Set security key error flag
3262
3277
  this.supabaseConnectionFailed = true; // Also mark connection as failed to disable downloads
3263
3278
  } else {
3264
- console.warn(`Supabase authentication failed: ${response.status} - ${errorMsg}`);
3279
+ console.warn(`Supabase authentication failed [check-download-limit]: ${response.status} - ${errorMsg}`);
3265
3280
  this.supabaseConnectionFailed = true;
3266
3281
  }
3267
3282
  } catch (e) {