Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic proxy #10

Closed
wants to merge 1 commit into from
Closed

dynamic proxy #10

wants to merge 1 commit into from

Conversation

horaoen
Copy link

@horaoen horaoen commented Jun 14, 2023

Description

dynamically reading the proxy environment variables($http_proxy, $https_proxy, $all_proxy) of the terminal to adjust proxy.

Linked Issues

fixes #8

@horaoen horaoen changed the title #8 dynamic proxy dynamic proxy Jun 14, 2023
import { Main } from './components/Main'

const allProxy = process.env.all_proxy
Copy link
Sponsor Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it work?

Copy link
Author

@horaoen horaoen Jun 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have tested it, at least he works on my computer

Copy link
Sponsor Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you inspect it with console.log(process.env)? it appears that it has been trimmed.

11:37:43.005 {
  SUPPORT_PATH: '/Users/tmk/Library/Application Support/com.raycast.macos/extensions/multitranslate',
  ASSETS_PATH: '/Users/tmk/.config/raycast/extensions/multitranslate/assets',
  COMMAND_NAME: 'translate',
  EXTENSION_NAME: 'multitranslate',
  LC_ALL: 'en_CN-u-hc-h23-u-ca-gregory-u-nu-latn',
  __CF_USER_TEXT_ENCODING: '0x1F6:0x0:0x0',
  RAYCAST_BUNDLE_ID: 'com.raycast.macos',
  NODE_PATH: '/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules',
  NODE_ENV: 'development',
  RAYCAST_VERSION: '1.53.2',
  TMPDIR: '/var/folders/nx/jwrx4j956f54jg6jphnxd4mr0000gp/T',
  HOME: '/Users/tmk'
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I have tested it, at least he works on my computer

As long as we have configured the terminal proxy, node will read the proxy envs.

Copy link
Sponsor Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still no proxy related envs

image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image image image I am not familiar with nodejs,but what I'm sure is that you need to export environment variables in advance.And I don't know why your process.env hasn't proxy envs

@antfu
Copy link
Owner

antfu commented Jun 14, 2023

What's the reason not to use enhancement mode? I think it can be quite some overhead if every single tool needs to implement the logic for proxy.

@horaoen
Copy link
Author

horaoen commented Jun 14, 2023

What's the reason not to use enhancement mode? I think it can be quite some overhead if every single tool needs to implement the logic for proxy.

Because I use the clash software customized by the proxy provider,but it does not have an enhancement mode, it is also the first time I know the existence of the enhancement mode. I think what you said is right that the software should pay attention to the problem of the software

@horaoen horaoen closed this Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does it need a proxy?
3 participants