-
Notifications
You must be signed in to change notification settings - Fork 2k
fix: system proxy resolver logic updates
#6273
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
Open
lohit-bruno
wants to merge
1
commit into
usebruno:main
Choose a base branch
from
lohit-bruno:system_proxy_updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
89 changes: 89 additions & 0 deletions
89
packages/bruno-app/src/components/Preferences/ProxySettings/SystemProxy/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| import { useEffect, useState } from 'react'; | ||
| import { useDispatch, useSelector } from 'react-redux'; | ||
| import { IconLoader2 } from '@tabler/icons'; | ||
| import { getSystemProxyVariables } from 'providers/ReduxStore/slices/app'; | ||
|
|
||
| const SystemProxy = () => { | ||
| const dispatch = useDispatch(); | ||
| const systemProxyVariables = useSelector((state) => state.app.systemProxyVariables); | ||
| const { source, http_proxy, https_proxy, no_proxy } = systemProxyVariables || {}; | ||
| const [isFetching, setIsFetching] = useState(true); | ||
| const [error, setError] = useState(null); | ||
|
|
||
| const SOURCE_LABELS = { | ||
| 'environment': 'Environment Variables', | ||
| 'windows-system': 'Windows System Settings', | ||
| 'macos-system': 'macOS System Settings', | ||
| 'linux-system': 'Linux System Settings' | ||
| }; | ||
|
|
||
| useEffect(() => { | ||
| dispatch(getSystemProxyVariables()) | ||
| .then(() => setError(null)) | ||
| .catch((err) => setError(err.message || String(err))) | ||
| .finally(() => setIsFetching(false)); | ||
| }, [dispatch]); | ||
|
|
||
| return ( | ||
| <> | ||
| <div className="mb-3 text-muted system-proxy-settings space-y-4"> | ||
| <div className="flex items-start justify-start flex-col gap-2 mt-2"> | ||
| <div className="flex flex-row items-center gap-2"> | ||
| <div> | ||
| <h2 className="text-xs text-gray-900 dark:text-gray-100"> | ||
| System Proxy {isFetching ? <IconLoader2 className="animate-spin ml-1" size={18} strokeWidth={1.5} /> : null} | ||
| </h2> | ||
| <small className="text-gray-500 dark:text-gray-400"> | ||
| Below values are sourced from your system proxy settings. | ||
| </small> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| {error && ( | ||
| <div className="mb-2 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded"> | ||
| <small className="text-red-600 dark:text-red-400"> | ||
| Error loading system proxy settings: {error} | ||
| </small> | ||
| </div> | ||
| )} | ||
| {source && ( | ||
| <div className="mb-2"> | ||
| <small className="font-medium flex flex-row gap-2"> | ||
| <div className="opacity-70 text-xs"> | ||
| Proxy source: | ||
| </div> | ||
| <div> | ||
| {SOURCE_LABELS[source] || source} | ||
| </div> | ||
| </small> | ||
| </div> | ||
| )} | ||
| <small> | ||
| These values cannot be directly updated in Bruno. Please refer to your OS documentation to update these. | ||
| </small> | ||
| <div className="flex flex-col justify-start items-start pt-2"> | ||
| <div className="mb-1 flex items-center"> | ||
| <label className="settings-label"> | ||
| http_proxy | ||
| </label> | ||
| <div className="opacity-80 text-indigo-600 dark:text-indigo-400">{http_proxy || '-'}</div> | ||
| </div> | ||
| <div className="mb-1 flex items-center"> | ||
| <label className="settings-label"> | ||
| https_proxy | ||
| </label> | ||
| <div className="opacity-80 text-indigo-600 dark:text-indigo-400">{https_proxy || '-'}</div> | ||
| </div> | ||
| <div className="mb-1 flex items-center"> | ||
| <label className="settings-label"> | ||
| no_proxy | ||
| </label> | ||
| <div className="opacity-80 text-indigo-600 dark:text-indigo-400">{no_proxy || '-'}</div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default SystemProxy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling to prevent unhandled rejection.
If
getSystemProxy()throws (e.g., detection fails on all platforms), the renderer receives an unhandled promise rejection. Wrap in try/catch to return a graceful fallback or propagate a meaningful error.ipcMain.handle('renderer:get-system-proxy-variables', async () => { - const systemProxyConfig = await getSystemProxy(); - return systemProxyConfig; + try { + const systemProxyConfig = await getSystemProxy(); + return systemProxyConfig; + } catch (error) { + console.error('Failed to get system proxy:', error); + return { + http_proxy: null, + https_proxy: null, + no_proxy: null, + source: 'environment' + }; + } });🤖 Prompt for AI Agents