switchman-dev 0.1.12 → 0.1.13
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/package.json +1 -1
- package/src/core/licence.js +7 -0
package/package.json
CHANGED
package/src/core/licence.js
CHANGED
|
@@ -123,6 +123,13 @@ export async function checkLicence() {
|
|
|
123
123
|
return { valid: false, reason: 'not_logged_in' };
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
// Proactively refresh if token expires within 5 minutes
|
|
127
|
+
if (creds.expires_at && Date.now() > creds.expires_at - 5 * 60 * 1000) {
|
|
128
|
+
if (creds.refresh_token) {
|
|
129
|
+
await refreshToken(creds.refresh_token);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
126
133
|
// Check the 24-hour cache first
|
|
127
134
|
const cache = readLicenceCache();
|
|
128
135
|
if (cache?.valid && cache.cached_at) {
|