@plaud-ai/cli 0.1.0 → 0.1.2
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.js +14 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -128,8 +128,12 @@ var OAuth = class {
|
|
|
128
128
|
return null;
|
|
129
129
|
if (tokenSet.expires_at && Date.now() > tokenSet.expires_at - 6e4) {
|
|
130
130
|
if (tokenSet.refresh_token) {
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
try {
|
|
132
|
+
const refreshed = await this.refresh(tokenSet.refresh_token);
|
|
133
|
+
return refreshed.access_token;
|
|
134
|
+
} catch {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
133
137
|
}
|
|
134
138
|
return null;
|
|
135
139
|
}
|
|
@@ -261,10 +265,14 @@ var CORS_HEADERS = {
|
|
|
261
265
|
};
|
|
262
266
|
var loginCommand = new Command("login").description("Authenticate with Plaud via OAuth").action(async () => {
|
|
263
267
|
const client2 = getClient();
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
+
try {
|
|
269
|
+
const token = await client2.auth.getAccessToken();
|
|
270
|
+
if (token) {
|
|
271
|
+
console.log(chalk.yellow("Already logged in. Run `plaud logout` first to switch accounts."));
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
} catch {
|
|
275
|
+
await client2.auth.logout();
|
|
268
276
|
}
|
|
269
277
|
const { url, codeVerifier } = client2.auth.createAuthorizationRequest();
|
|
270
278
|
const spinner = ora("Waiting for browser authentication...").start();
|