tsvesync 1.0.104 → 1.0.106
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/lib/vesync.js +10 -6
- package/package.json +1 -1
- package/src/lib/vesync.ts +11 -6
package/dist/lib/vesync.js
CHANGED
|
@@ -564,13 +564,17 @@ class VeSync {
|
|
|
564
564
|
this.countryCode = countryCode;
|
|
565
565
|
this.enabled = true;
|
|
566
566
|
this.apiBaseUrl = (0, helpers_1.getApiBaseUrl)(); // Track the API endpoint being used
|
|
567
|
-
//
|
|
567
|
+
// DO NOT change the region/endpoint after successful authentication!
|
|
568
|
+
// The endpoint that successfully authenticated is the one we must continue using.
|
|
569
|
+
// Tokens are endpoint-specific and won't work if we switch endpoints.
|
|
570
|
+
// This is especially important for AU/NZ users who may authenticate via EU endpoint
|
|
571
|
+
// but have AU/NZ country codes.
|
|
572
|
+
// Log a warning if the country code doesn't match the successful region
|
|
568
573
|
if (countryCode) {
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
571
|
-
logger_1.logger.
|
|
572
|
-
|
|
573
|
-
(0, helpers_1.setCurrentRegion)(detectedRegion);
|
|
574
|
+
const expectedRegion = (0, helpers_1.getRegionFromCountryCode)(countryCode);
|
|
575
|
+
if (expectedRegion !== this._region) {
|
|
576
|
+
logger_1.logger.warn(`Note: Account authenticated with ${this._region} endpoint despite country code ${countryCode} typically using ${expectedRegion}`);
|
|
577
|
+
logger_1.logger.warn(`This is normal for accounts created through different regional apps`);
|
|
574
578
|
}
|
|
575
579
|
}
|
|
576
580
|
logger_1.logger.debug('Authentication successful!', {
|
package/package.json
CHANGED
package/src/lib/vesync.ts
CHANGED
|
@@ -693,13 +693,18 @@ export class VeSync {
|
|
|
693
693
|
this.enabled = true;
|
|
694
694
|
this.apiBaseUrl = getApiBaseUrl(); // Track the API endpoint being used
|
|
695
695
|
|
|
696
|
-
//
|
|
696
|
+
// DO NOT change the region/endpoint after successful authentication!
|
|
697
|
+
// The endpoint that successfully authenticated is the one we must continue using.
|
|
698
|
+
// Tokens are endpoint-specific and won't work if we switch endpoints.
|
|
699
|
+
// This is especially important for AU/NZ users who may authenticate via EU endpoint
|
|
700
|
+
// but have AU/NZ country codes.
|
|
701
|
+
|
|
702
|
+
// Log a warning if the country code doesn't match the successful region
|
|
697
703
|
if (countryCode) {
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
logger.
|
|
701
|
-
|
|
702
|
-
setCurrentRegion(detectedRegion);
|
|
704
|
+
const expectedRegion = getRegionFromCountryCode(countryCode);
|
|
705
|
+
if (expectedRegion !== this._region) {
|
|
706
|
+
logger.warn(`Note: Account authenticated with ${this._region} endpoint despite country code ${countryCode} typically using ${expectedRegion}`);
|
|
707
|
+
logger.warn(`This is normal for accounts created through different regional apps`);
|
|
703
708
|
}
|
|
704
709
|
}
|
|
705
710
|
|