-
Notifications
You must be signed in to change notification settings - Fork 9
v1.2.3: Support Auto Switch Authentication #46
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
Conversation
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8. - [Release notes](https://github.com/ai/nanoid/releases) - [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md) - [Commits](ai/nanoid@3.3.7...3.3.8) --- updated-dependencies: - dependency-name: nanoid dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Adapt firefox * support firefore auto publish * support firefox, and optimized UX
* [i18n] Translate messages.json in pt_BR 100% reviewed source file: 'messages.json' on 'pt_BR'. * [i18n] Translate messages.json in zh_CN 100% reviewed source file: 'messages.json' on 'zh_CN'. * [i18n] Translate messages.json in zh_TW 100% reviewed source file: 'messages.json' on 'zh_TW'. * [i18n] Translate messages.json in pt_BR 100% reviewed source file: 'messages.json' on 'pt_BR'. * update English i18n msg --------- Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com> Co-authored-by: SYM01 <33443792+SYM01@users.noreply.github.com>
* [i18n] Translate messages.json in pt_BR 100% reviewed source file: 'messages.json' on 'pt_BR'. * [i18n] Translate messages.json in zh_TW 100% reviewed source file: 'messages.json' on 'zh_TW'. * [i18n] Translate messages.json in zh_CN 100% reviewed source file: 'messages.json' on 'zh_CN'. --------- Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
* [WIP] support chrome auto deploy * finalize Chrome auto deploy * npm audit fix * npm audit fix
* [i18n] Translate messages.json in pt_BR 100% reviewed source file: 'messages.json' on 'pt_BR'. * [i18n] Translate messages.json in zh_TW 100% reviewed source file: 'messages.json' on 'zh_TW'. * [i18n] Translate messages.json in zh_CN 100% reviewed source file: 'messages.json' on 'zh_CN'. --------- Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
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.
Hello @SYM01, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
Hello team,
Gemini here to provide a summary of this pull request titled "v1.2.3: Support Auto Switch Authentication".
Based on the title and the changes, the primary goal of this PR is to enhance the functionality of the 'Auto Switch' proxy profile type. This includes adding validation for the conditions used in auto-switch rules (specifically URL and CIDR types) and, importantly, implementing a mechanism to correctly retrieve authentication information from profiles that are referenced within an auto-switch profile structure. This ensures that when an auto-switch profile directs traffic to another profile requiring authentication, the necessary credentials can be provided.
The PR also includes various dependency updates and some minor code structure improvements.
Highlights
- Enhanced Auto Switch Profile: The 'auto' proxy profile type has been significantly enhanced. It now includes validation for the 'condition' field in its rules, specifically for URL and CIDR types. A new
ProfileAuthProviderclass has been introduced to recursively traverse the profile structure (including nested auto-switch profiles) to find relevant authentication information for a given host and port. - Input Validation for Auto Switch Rules: Validation rules have been added to the Auto Switch input component (
AutoSwitchInput.vue) to check the format of URL and CIDR conditions. This includes a specific warning message for Chrome users regarding limitations on path matching in HTTPS URLs. - Dependency Updates: Several project dependencies have been updated in
package.json, including@sentry/vue,@vueuse/core,acorn,vue,vue-router,@arco-design/web-vue,@sentry/vite-plugin,@vitest/coverage-v8,typescript,vite, andvitest. - Code Structure and Refactoring: Introduced a
BrowserFlavorenum and getter in the adapter layer. RenamedProfileAuthSwitchtoProfileAutoSwitchfor clarity across the codebase. Added asaveManyProfilesfunction for more efficient bulk profile saving. Implemented theProfileAuthProviderfor handling authentication lookup in complex profile setups. - Localization Updates: Added new localization strings in English, Brazilian Portuguese, Simplified Chinese, and Traditional Chinese for the new URL and CIDR validation error messages.
Changelog
Click here to see the changelog
- package.json
- Updated various dependencies to newer versions (e.g., @sentry/vue from 8.51.0 to 8.55.0, vue from 3.5.13 to 3.5.16, vite from 6.0.7 to 6.3.5).
- public/_locales/en/messages.json
- Added new localization keys for URL validation errors (
config_section_auto_switch_type_url_malformed,config_section_auto_switch_type_url_malformed_chrome) and CIDR validation errors (config_section_auto_switch_type_cidr_malformed) (lines 110-120). - Removed empty lines (lines 203-204).
- Added new localization keys for URL validation errors (
- public/_locales/pt_BR/messages.json
- Added new localization keys for URL validation errors (
config_section_auto_switch_type_url_malformed,config_section_auto_switch_type_url_malformed_chrome) and CIDR validation errors (config_section_auto_switch_type_cidr_malformed) in Portuguese (lines 110-120). - Removed empty lines (lines 203-204).
- Added new localization keys for URL validation errors (
- public/_locales/zh_CN/messages.json
- Added new localization keys for URL validation errors (
config_section_auto_switch_type_url_malformed,config_section_auto_switch_type_url_malformed_chrome) and CIDR validation errors (config_section_auto_switch_type_cidr_malformed) in Simplified Chinese (lines 110-120). - Removed empty lines (lines 203-204).
- Added new localization keys for URL validation errors (
- public/_locales/zh_TW/messages.json
- Added new localization keys for URL validation errors (
config_section_auto_switch_type_url_malformed,config_section_auto_switch_type_url_malformed_chrome) and CIDR validation errors (config_section_auto_switch_type_cidr_malformed) in Traditional Chinese (lines 110-120). - Removed empty lines (lines 203-204).
- Added new localization keys for URL validation errors (
- src/adapters/base.ts
- Added
BrowserFlavorenum (lines 53-57). - Added abstract
flavorgetter (lines 60-62).
- Added
- src/adapters/chrome.ts
- Imported
BrowserFlavor(line 6). - Implemented
flavorgetter returningBrowserFlavor.Chrome(lines 16-18).
- Imported
- src/adapters/web.ts
- Imported
BrowserFlavor(line 6). - Implemented
flavorgetter returningBrowserFlavor.Web(lines 24-26).
- Imported
- src/components/PreferencePage.vue
- Imported
saveManyProfilesinstead ofsaveProfile(line 4). - Updated profile import logic to use
saveManyProfiles(line 26).
- Imported
- src/components/ProfileConfig.vue
- Renamed import
ProfileAuthSwitchtoProfileAutoSwitch(line 20). - Updated
ConfigStatetype definition to useProfileAutoSwitch(line 41). - Added type annotations to
proxyServerFieldRulevalidator function signature (lines 135-138). - Added type annotations to
pacScriptFieldRulevalidator function signature (lines 157-160). - Updated template to cast profile config to
ProfileAutoSwitchforAutoSwitchPacPreview(line 430).
- Renamed import
- src/components/configs/AutoSwitchInput.vue
- Imported
FieldRuletype (line 3). - Imported
BrowserFlavorandisValidCIDR(lines 13-14). - Added
getConditionInputRulefunction to provide validation rules based on rule type (lines 97-154). - Wrapped the table in a
<form>element (line 158). - Wrapped select and input elements in
<a-form-item>components and applied validation rules (lines 175-180, 192-203, 215-221). - Added CSS class
auto-switch-formto remove bottom margin from form items within the table (lines 288-292).
- Imported
- src/components/configs/AutoSwitchPacPreview.vue
- Renamed import
ProfileAuthSwitchtoProfileAutoSwitch(line 3). - Updated prop type definition to use
ProfileAutoSwitch(line 12).
- Renamed import
- src/components/configs/ProfileSelector.vue
- Made the
profileIDmodel required (lines 16-18). - Adjusted the setter logic for
selectedProfileto only setprofileID.valueifvalueis defined (lines 34-36). - Disabled the 'System' profile option when
currentProfileIDprop is provided (line 104).
- Made the
- src/components/configs/ProxyServerInput.vue
- Cast
proxyTypemodel tostringin the template select element (line 118).
- Cast
- src/services/profile.ts
- Renamed type
ProfileAuthSwitchtoProfileAutoSwitch(line 71). - Updated type
ProxyProfileto includeProfileAutoSwitch(line 75). - Added JSDoc comment to
saveProfilewarning about promise safety (lines 111-116). - Added new asynchronous function
saveManyProfilesto save multiple profiles efficiently (lines 123-128).
- Renamed type
- src/services/proxy/auth.ts
- Added new file
src/services/proxy/auth.tscontaining theProfileAuthProviderclass. - The
ProfileAuthProviderclass provides a methodgetAuthInfosto recursively find authentication information within a profile structure, including nested auto-switch profiles, preventing infinite loops with asearchedProfilesset.
- Added new file
- src/services/proxy/index.ts
- Imported
ProfileAutoSwitch(line 7). - Imported
ProfileAuthProvider(line 11). - Updated the type hint for
previewAutoSwitchPacparameter toProfileAutoSwitch(line 84). - Refactored
getAuthInfosfunction to use the newProfileAuthProviderclass for retrieving authentication information from any profile type, not just 'proxy' type (lines 93-99). Removed the previous manual check for 'proxy' type and the manual iteration over proxy rules.
- Imported
- src/services/proxy/profile2config.ts
- Imported
ProfileAutoSwitch(line 5). - Exported the
ProfileLoadertype (lines 17-19). - Added JSDoc comment to the
toPACmethod (lines 49-52). - Updated the type hint for
prepareAutoProfilePrecedenceparameter toProfileAutoSwitch(line 308).
- Imported
- tests/services/proxy/auth.test.ts
- Added a new test file
tests/services/proxy/auth.test.ts. - Includes tests for the
ProfileAuthProviderclass, covering simple proxy profiles, auto-switch profiles, and auto-switch profiles with a default.
- Added a new test file
- vite.config.ts
- Added Sentry release configuration to the Sentry plugin settings, including
injectanddistbased on the CRX version and build mode (lines 108-111).
- Added Sentry release configuration to the Sentry plugin settings, including
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request significantly enhances the auto-switch functionality by adding robust authentication support, especially for nested profiles. The introduction of ProfileAuthProvider is a well-designed solution for managing authentication information and preventing cycles. The new validation rules for URL and CIDR conditions in the auto-switch configuration improve user experience and data integrity.
Key improvements include:
ProfileAuthProvider: Centralizes authentication logic for all profile types, including complex auto-switch scenarios with nested profiles and cycle detection.- Input Validation: Added validation for URL and CIDR inputs in auto-switch rules, with browser-specific considerations for Chrome.
saveManyProfiles: Improves efficiency and atomicity for operations like profile import.- Code Clarity: Renaming
ProfileAuthSwitchtoProfileAutoSwitchenhances readability. - Testing: New unit tests for
ProfileAuthProviderensure the correctness of the new authentication logic.
Overall, the changes are well-implemented and improve the feature set and robustness of the application. There's one minor cleanup item noted below.
Summary of Findings
- Debugging Code: A
console.logstatement was found insrc/components/configs/AutoSwitchInput.vuewhich should likely be removed. - Enhanced Authentication Logic: The new
ProfileAuthProviderclass effectively handles authentication credential retrieval for various profile types, including complex auto-switch configurations with nested profiles and cycle detection. This is a strong addition. - Improved Input Validation: Validation for URL and CIDR conditions in auto-switch rules, including browser-specific checks (e.g., Chrome's HTTPS path matching restriction), has been added, improving data quality and user feedback.
- Refactoring and Efficiency: The introduction of
saveManyProfilesfor bulk profile operations and the consistent renaming ofProfileAuthSwitchtoProfileAutoSwitchare good improvements for efficiency and code clarity.
Merge Readiness
The pull request is in good shape and introduces valuable improvements. There is one minor medium severity issue (a leftover console.log) that should be addressed. Once that's resolved, the PR should be ready for merging. As an AI, I am not authorized to approve pull requests; please ensure further review and approval by authorized team members.
| case "url": | ||
| return { | ||
| validator: async (value: string, cb: (message?: string) => void) => { | ||
| console.log("test"); |
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.
No description provided.