hedgequantx 2.6.109 → 2.6.111

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.6.109",
3
+ "version": "2.6.111",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -1029,53 +1029,51 @@ const setupProxyOAuth = async (provider, config) => {
1029
1029
  }
1030
1030
  console.log();
1031
1031
 
1032
- // Step 4: Wait for OAuth callback (with manual fallback for VPS/remote)
1033
- const waitSpinner = ora({ text: 'Waiting for authorization...', color: 'cyan' }).start();
1032
+ // Step 4: Wait for OAuth callback
1033
+ // Detect if we're on a remote server (SSH) - callback won't work automatically
1034
+ const isRemote = process.env.SSH_CONNECTION || process.env.SSH_CLIENT ||
1035
+ (process.env.DISPLAY === undefined && process.platform === 'linux');
1034
1036
 
1035
1037
  let authSuccess = false;
1036
1038
 
1037
- // First try: wait 3 seconds for automatic callback (instant for local, very fast fallback for VPS)
1038
- try {
1039
- await proxyManager.waitForAuth(authState, 3000, (status) => {
1040
- waitSpinner.text = status;
1041
- });
1042
- authSuccess = true;
1043
- waitSpinner.succeed('Authorization successful!');
1044
- } catch (error) {
1045
- // Timeout - offer manual callback entry
1046
- if (error.message === 'Authentication timeout') {
1047
- waitSpinner.stop();
1048
- console.log();
1049
- console.log(chalk.yellow(' Paste the callback URL from your browser:'));
1050
- console.log(chalk.gray(' (The page showing http://localhost:54545/callback?code=...)'));
1051
- console.log();
1052
-
1053
- const callbackUrl = await prompts.input(' Callback URL: ');
1054
-
1055
- if (callbackUrl && callbackUrl.trim()) {
1056
- const submitSpinner = ora({ text: 'Submitting callback...', color: 'cyan' }).start();
1057
- try {
1058
- await proxyManager.submitCallback(callbackUrl.trim());
1059
- submitSpinner.text = 'Verifying authorization...';
1060
-
1061
- // Wait a bit for the proxy to process the callback
1062
- await new Promise(resolve => setTimeout(resolve, 2000));
1063
-
1064
- // Verify auth status
1065
- await proxyManager.waitForAuth(authState, 10000, () => {});
1066
- authSuccess = true;
1067
- submitSpinner.succeed('Authorization successful!');
1068
- } catch (submitError) {
1069
- submitSpinner.fail(`Failed: ${submitError.message}`);
1070
- await prompts.waitForEnter();
1071
- return await selectProviderOption(provider);
1072
- }
1073
- } else {
1074
- console.log(chalk.gray(' Cancelled.'));
1039
+ if (isRemote) {
1040
+ // Remote/VPS: Ask for callback URL directly (no point waiting)
1041
+ console.log(chalk.yellow(' After authorizing, paste the callback URL from your browser:'));
1042
+ console.log(chalk.gray(' (The page showing http://localhost:54545/callback?code=...)'));
1043
+ console.log();
1044
+
1045
+ const callbackUrl = await prompts.textInput(' Callback URL: ');
1046
+
1047
+ if (callbackUrl && callbackUrl.trim()) {
1048
+ const submitSpinner = ora({ text: 'Submitting callback...', color: 'cyan' }).start();
1049
+ try {
1050
+ await proxyManager.submitCallback(callbackUrl.trim());
1051
+ submitSpinner.text = 'Verifying authorization...';
1052
+ await new Promise(resolve => setTimeout(resolve, 1000));
1053
+ await proxyManager.waitForAuth(authState, 10000, () => {});
1054
+ authSuccess = true;
1055
+ submitSpinner.succeed('Authorization successful!');
1056
+ } catch (submitError) {
1057
+ submitSpinner.fail(`Failed: ${submitError.message}`);
1075
1058
  await prompts.waitForEnter();
1076
1059
  return await selectProviderOption(provider);
1077
1060
  }
1078
1061
  } else {
1062
+ console.log(chalk.gray(' Cancelled.'));
1063
+ await prompts.waitForEnter();
1064
+ return await selectProviderOption(provider);
1065
+ }
1066
+ } else {
1067
+ // Local: Wait for automatic callback
1068
+ const waitSpinner = ora({ text: 'Waiting for authorization...', color: 'cyan' }).start();
1069
+
1070
+ try {
1071
+ await proxyManager.waitForAuth(authState, 300000, (status) => {
1072
+ waitSpinner.text = status;
1073
+ });
1074
+ authSuccess = true;
1075
+ waitSpinner.succeed('Authorization successful!');
1076
+ } catch (error) {
1079
1077
  waitSpinner.fail(`Authorization failed: ${error.message}`);
1080
1078
  await prompts.waitForEnter();
1081
1079
  return await selectProviderOption(provider);