soulsync 1.0.17 → 1.0.18
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/index.js +5 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -88,17 +88,18 @@ function detectAuthMode(api) {
|
|
|
88
88
|
|
|
89
89
|
async function startOAuthLocal() {
|
|
90
90
|
const { createOAuthServer } = require('./src/oauth-server');
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
|
|
93
92
|
try {
|
|
94
93
|
const { server, port } = await createOAuthServer();
|
|
95
94
|
const callbackUrl = `http://localhost:${port}/callback`;
|
|
96
95
|
const state = crypto.randomBytes(16).toString('hex');
|
|
97
96
|
const authUrl = `${getCloudUrl()}/auth/oauth/start?port=${port}&callback=${encodeURIComponent(callbackUrl)}&state=${state}`;
|
|
98
|
-
|
|
97
|
+
|
|
99
98
|
console.log('[SoulSync] Opening browser for authorization...');
|
|
99
|
+
|
|
100
|
+
const open = (await import('open')).default;
|
|
100
101
|
await open(authUrl);
|
|
101
|
-
|
|
102
|
+
|
|
102
103
|
console.log('[SoulSync] Waiting for authorization...');
|
|
103
104
|
|
|
104
105
|
const { token } = await new Promise((resolve, reject) => {
|