@jacebenson/jsn 0.0.4 → 0.0.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/package.json +1 -1
- package/src/auth.js +15 -5
package/package.json
CHANGED
package/src/auth.js
CHANGED
|
@@ -177,12 +177,22 @@ export class AuthManager {
|
|
|
177
177
|
// Try to open browser
|
|
178
178
|
const open = (await import('node:child_process')).spawn;
|
|
179
179
|
const platform = process.platform;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
let cmd, args;
|
|
181
|
+
if (platform === 'darwin') {
|
|
182
|
+
cmd = 'open';
|
|
183
|
+
args = [authURL];
|
|
184
|
+
} else if (platform === 'win32') {
|
|
185
|
+
cmd = 'cmd';
|
|
186
|
+
args = ['/c', 'start', authURL];
|
|
187
|
+
} else {
|
|
188
|
+
cmd = 'xdg-open';
|
|
189
|
+
args = [authURL];
|
|
185
190
|
}
|
|
191
|
+
const child = open(cmd, args, { detached: true, stdio: 'ignore' });
|
|
192
|
+
child.on('error', () => {
|
|
193
|
+
// Browser open command not available — user will open the URL manually
|
|
194
|
+
});
|
|
195
|
+
child.unref();
|
|
186
196
|
|
|
187
197
|
console.log('After authenticating in the browser, copy the authorization code shown on the page.');
|
|
188
198
|
console.log('(input is hidden for security — just paste and press Enter)');
|