nstantpage-agent 0.5.30 → 0.5.31
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/commands/start.js +15 -0
- package/package.json +1 -1
package/dist/commands/start.js
CHANGED
|
@@ -194,6 +194,21 @@ export async function startCommand(directory, options) {
|
|
|
194
194
|
if (!token && isLocalGateway) {
|
|
195
195
|
token = 'local-dev';
|
|
196
196
|
}
|
|
197
|
+
// Check token expiry before connecting
|
|
198
|
+
if (token && token !== 'local-dev') {
|
|
199
|
+
try {
|
|
200
|
+
const parts = token.split('.');
|
|
201
|
+
if (parts.length === 3) {
|
|
202
|
+
const payload = JSON.parse(Buffer.from(parts[1], 'base64').toString('utf-8'));
|
|
203
|
+
if (payload.exp && payload.exp < Date.now() / 1000) {
|
|
204
|
+
console.log(chalk.red('✗ Your authentication token has expired.'));
|
|
205
|
+
console.log(chalk.gray(' Run "nstantpage login" to re-authenticate.'));
|
|
206
|
+
process.exit(1);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
catch { }
|
|
211
|
+
}
|
|
197
212
|
// Determine project ID (optional — without it, agent enters standby mode)
|
|
198
213
|
// Only use explicitly passed --project-id, never fall back to stored value
|
|
199
214
|
let projectId = options.projectId;
|
package/package.json
CHANGED