openyida 2026.7.18-1 → 2026.7.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/lib/auth/oauth-loopback.js +8 -16
- package/lib/bridge/bridge.js +13 -6
- package/package.json +1 -1
|
@@ -11,26 +11,19 @@ function randomToken(bytes = 24) {
|
|
|
11
11
|
return crypto.randomBytes(bytes).toString('base64url');
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function resolveBrowserLauncher(url, platform = process.platform) {
|
|
15
|
-
if (platform === 'darwin') {
|
|
16
|
-
return { command: 'open', args: [url] };
|
|
17
|
-
}
|
|
18
|
-
if (platform === 'win32') {
|
|
19
|
-
// rundll32 hands the URL to the default browser as a single argument.
|
|
20
|
-
// Going through `cmd /c start` would let cmd.exe treat the `&` in the
|
|
21
|
-
// OAuth URL as command separators and truncate the query string after
|
|
22
|
-
// redirect_uri, dropping client_id/state and breaking login.
|
|
23
|
-
return { command: 'rundll32', args: ['url.dll,FileProtocolHandler', url] };
|
|
24
|
-
}
|
|
25
|
-
return { command: 'xdg-open', args: [url] };
|
|
26
|
-
}
|
|
27
|
-
|
|
28
14
|
function openBrowser(url) {
|
|
29
15
|
if (process.env.OPENYIDA_NO_BROWSER === '1') {
|
|
30
16
|
return false;
|
|
31
17
|
}
|
|
32
18
|
|
|
33
|
-
|
|
19
|
+
let command = 'xdg-open';
|
|
20
|
+
let args = [url];
|
|
21
|
+
if (process.platform === 'darwin') {
|
|
22
|
+
command = 'open';
|
|
23
|
+
} else if (process.platform === 'win32') {
|
|
24
|
+
command = 'cmd';
|
|
25
|
+
args = ['/c', 'start', '', url];
|
|
26
|
+
}
|
|
34
27
|
|
|
35
28
|
try {
|
|
36
29
|
const child = spawn(command, args, {
|
|
@@ -159,6 +152,5 @@ function runDingtalkLoopback(options = {}) {
|
|
|
159
152
|
module.exports = {
|
|
160
153
|
runDingtalkLoopback,
|
|
161
154
|
buildDingtalkOAuthUrl,
|
|
162
|
-
resolveBrowserLauncher,
|
|
163
155
|
CALLBACK_PATH,
|
|
164
156
|
};
|
package/lib/bridge/bridge.js
CHANGED
|
@@ -6,7 +6,6 @@ const path = require('path');
|
|
|
6
6
|
const { spawn } = require('child_process');
|
|
7
7
|
|
|
8
8
|
const { parseOpenOption } = require('../core/browser-handoff');
|
|
9
|
-
const { resolveBrowserLauncher } = require('../auth/oauth-loopback');
|
|
10
9
|
const { banner, label, success, hint, fail } = require('../core/chalk');
|
|
11
10
|
|
|
12
11
|
const DEFAULT_HOST = '127.0.0.1';
|
|
@@ -1129,11 +1128,19 @@ async function startBridgeServer(options = {}) {
|
|
|
1129
1128
|
}
|
|
1130
1129
|
|
|
1131
1130
|
function openExternalUrl(url) {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1131
|
+
const platform = process.platform;
|
|
1132
|
+
let command;
|
|
1133
|
+
let args;
|
|
1134
|
+
if (platform === 'darwin') {
|
|
1135
|
+
command = 'open';
|
|
1136
|
+
args = [url];
|
|
1137
|
+
} else if (platform === 'win32') {
|
|
1138
|
+
command = 'cmd';
|
|
1139
|
+
args = ['/c', 'start', '', url];
|
|
1140
|
+
} else {
|
|
1141
|
+
command = 'xdg-open';
|
|
1142
|
+
args = [url];
|
|
1143
|
+
}
|
|
1137
1144
|
|
|
1138
1145
|
const child = spawn(command, args, {
|
|
1139
1146
|
detached: true,
|