figmanage 1.2.4 → 1.2.6
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/auth/cookie.js +2 -3
- package/dist/cli/login.js +6 -3
- package/package.json +1 -1
package/dist/auth/cookie.js
CHANGED
|
@@ -287,13 +287,12 @@ export async function resolveAccountInfo(account) {
|
|
|
287
287
|
'X-CSRF-Bypass': 'yes',
|
|
288
288
|
'X-Figma-User-Id': account.userId,
|
|
289
289
|
};
|
|
290
|
-
const res = await axios.get(
|
|
290
|
+
const res = await axios.get(`https://www.figma.com/api/user/${account.userId}`, {
|
|
291
291
|
headers,
|
|
292
292
|
timeout: 5000,
|
|
293
293
|
});
|
|
294
294
|
const meta = res.data?.meta || {};
|
|
295
|
-
|
|
296
|
-
return { profileName, figmaEmail: email };
|
|
295
|
+
return { profileName, figmaEmail: meta.email };
|
|
297
296
|
}
|
|
298
297
|
catch {
|
|
299
298
|
return { profileName };
|
package/dist/cli/login.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createInterface } from 'node:readline';
|
|
2
2
|
import { platform } from 'node:os';
|
|
3
3
|
import { setActiveWorkspace, deleteConfig, getConfigPath } from '../config.js';
|
|
4
|
-
import { extractCookies, validateSession, validatePat } from '../auth/cookie.js';
|
|
4
|
+
import { extractCookies, validateSession, validatePat, resolveAccountInfo } from '../auth/cookie.js';
|
|
5
5
|
async function prompt(question) {
|
|
6
6
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
7
7
|
const answer = await new Promise(resolve => rl.question(question, resolve));
|
|
@@ -33,9 +33,12 @@ export async function handleLogin(options = {}) {
|
|
|
33
33
|
// Pick account if multiple
|
|
34
34
|
let selected = accounts[0];
|
|
35
35
|
if (accounts.length > 1) {
|
|
36
|
-
console.log(`\n Found ${accounts.length} Figma accounts
|
|
36
|
+
console.log(`\n Found ${accounts.length} Figma accounts. Identifying...\n`);
|
|
37
|
+
const infos = await Promise.all(accounts.map(a => resolveAccountInfo(a)));
|
|
37
38
|
for (let i = 0; i < accounts.length; i++) {
|
|
38
|
-
|
|
39
|
+
const info = infos[i];
|
|
40
|
+
const label = info.figmaEmail || `User ${accounts[i].userId}`;
|
|
41
|
+
console.log(` [${i + 1}] ${label} (Chrome: ${info.profileName})`);
|
|
39
42
|
}
|
|
40
43
|
const answer = await prompt(`\n Select account [1-${accounts.length}]: `);
|
|
41
44
|
const idx = parseInt(answer, 10) - 1;
|
package/package.json
CHANGED