-
Notifications
You must be signed in to change notification settings - Fork 9
Support Authentication in Auto Switch Profiles, fixing #34 #45
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
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 everyone, gemini-code-assist here with a summary of this pull request. This PR addresses issue #34 by adding support for authentication within 'auto switch' proxy profiles. The changes involve a significant refactoring of proxy profile handling, introducing a dedicated class for managing authentication information, updating dependencies, improving type safety, and adding comprehensive tests.
Highlights
- Proxy Profile Refactoring: The type
ProfileAuthSwitchhas been renamed toProfileAutoSwitchacross the codebase to better reflect its purpose as an 'auto' proxy type. This includes updates in type definitions, components, and service methods. - Authentication Provider: A new class,
ProfileAuthProvider, has been introduced to centralize the logic for fetching authentication information for proxy profiles. This provider supports both 'proxy' and 'auto' profile types and handles potential circular references in 'auto' profile rules. - Dependency Updates: Several project dependencies, including
@sentry/vue,@vueuse/core,vue,typescript, and various@vitestand@rolluppackages, have been updated to their latest versions. - Type Safety: Explicit type annotations have been added to
validatorfunctions in Vue components to enhance type safety and code clarity. - Testing: New unit tests have been added specifically for the
ProfileAuthProviderto ensure its correct behavior in various scenarios, including simple proxies, auto proxies, default profiles, and circular references.
Changelog
Click here to see the changelog
- package-lock.json
- Updated numerous dependency versions and their integrity hashes.
- Changed registry URLs for several packages to npmmirror.com.
- package.json
- Updated versions for
@sentry/vue,@vueuse/core,acorn,vue,vue-routerin dependencies. - Updated versions for
@arco-design/web-vue,@sentry/vite-plugin,@vitejs/plugin-vue,@vitest/coverage-v8,typescript,vite,vitest,vue-tscin devDependencies. - Added
@types/chaiand@types/deep-eqlto devDependencies. - Updated peer dependency range for
@sentry/vueto includepinia3.x. - Added
fdir,picomatch,tinyglobbyas dependencies forviteandvitest. - Updated
tinypoolandtinyspyversions. - Updated peer dependency range for
viteandvite-nodeto includevite7.x. - Added
ast-v8-to-istanbuldependency for@vitest/coverage-v8.
- Updated versions for
- src/components/ProfileConfig.vue
- Renamed
ProfileAuthSwitchtype reference toProfileAutoSwitch(L20, L41, L430). - Added explicit type annotations to
validatorfunctions forproxyServerFieldRule(L135-R138) andpacScriptFieldRule(L154-R160).
- Renamed
- src/components/configs/AutoSwitchInput.vue
- Changed
FieldRuleimport totype FieldRule(L3). - Added explicit type annotations to
validatorfunctions for 'url' (L104-R104) and 'cidr' (L137-R137) types.
- Changed
- src/components/configs/AutoSwitchPacPreview.vue
- Renamed
ProfileAuthSwitchtype reference toProfileAutoSwitch(L3). - Updated the type annotation for the
profileprop (L12).
- Renamed
- src/services/profile.ts
- Renamed the type
ProfileAuthSwitchtoProfileAutoSwitch(L71). - Updated the
ProxyProfileunion type to includeProfileAutoSwitch(L75).
- Renamed the type
- src/services/proxy/auth.ts
- Added a new file
auth.tscontaining theProfileAuthProviderclass (R1-R112). - The
ProfileAuthProviderincludes methods to get authentication information for proxy and auto profiles, handling recursion and circular references.
- Added a new file
- src/services/proxy/index.ts
- Imported
ProfileAutoSwitch(L7) andProfileAuthProvider(L11). - Refactored the
getAuthInfosfunction to use the newProfileAuthProviderclass, removing the previous inline logic (L93-R99).
- Imported
- src/services/proxy/profile2config.ts
- Imported
ProfileAutoSwitchinstead ofProfileAuthSwitch(L5). - Exported the
ProfileLoadertype (L17-R19). - Updated the type annotation for the
prepareAutoProfilePrecedencemethod to useProfileAutoSwitch(L308). - Added a JSDoc comment to the
toPACmethod (L49-R52).
- Imported
- tests/services/proxy/auth.test.ts
- Added a new file
auth.test.tswith unit tests forProfileAuthProvider(R1-R130). - Tests cover simple proxy profiles, auto profiles, default profiles, and circular references.
- Added a new file
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 proxy profile handling, particularly by introducing authentication support for auto-switch profiles and refactoring key components for clarity and type safety. The introduction of ProfileAuthProvider is a solid architectural improvement, centralizing authentication logic. The renaming of ProfileAuthSwitch to ProfileAutoSwitch better reflects its functionality. Dependency updates and type safety improvements are also valuable additions. The new tests for ProfileAuthProvider cover essential scenarios, including edge cases like circular references.
Overall, the changes are well-implemented and improve the codebase's quality and maintainability.
Summary of Findings
- Leftover Debug Statement: A
console.logstatement was found insrc/components/configs/AutoSwitchInput.vue. This should typically be removed to avoid cluttering the console output. - Idiomatic Array Iteration (Not Commented): In
src/services/proxy/auth.ts, withingetAuthInfosForProxyProfile, an arraymapis used for side effects (populating an array). While functional, usingforEachor afor...ofloop would be more idiomatic for iterations where the returned array frommapisn't used. This was deemed low severity and not commented on per review settings.
Merge Readiness
The pull request is in good shape and introduces valuable improvements. There is one medium-severity issue (a leftover console.log) that should be addressed. Once that is resolved, the PR should be ready for merging. As an AI, I am not authorized to approve pull requests; please ensure another reviewer approves these changes before merging.
| return { | ||
| validator: async (value, cb) => { | ||
| 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.
* update github action * minor change to System profile * Build(deps): Bump nanoid from 3.3.7 to 3.3.8 (#21) 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> * Avoid blocking 401 authentication request (#22) (#23) * fix 401 issue (#22) * enablle github action on develop branch * Support Firefox (#18) * Adapt firefox * support firefore auto publish * support firefox, and optimized UX * [i18n] Updates for file public/_locales/en/messages.json (#25) * [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> * sentry integration (#29) * [WIP] support exporting * [WIP] support import/export settings (#7) * Support import/export profiles and close #7 (#30) * implemented an utility to export/import settings * optimized description * [i18n] Updates for file public/_locales/en/messages.json (#32) * [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> * fix an import issue (#33) (#35) * optimized sentry release * Optimize Development Flow (#37) * [WIP] support chrome auto deploy * finalize Chrome auto deploy * npm audit fix * npm audit fix * UX improvement and close #28 (#38) * minor bug fixed * improve UX and close #28 * use the same CIDR validator as PAC script * [i18n] Updates for file public/_locales/en/messages.json (#40) * [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> * Support Authentication in Auto Switch Profiles, fixing #34 (#45) * update deps * fix the auth issue in auto switch profiles * fix typo --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
* update github action * minor change to System profile * Build(deps): Bump nanoid from 3.3.7 to 3.3.8 (#21) 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> * Avoid blocking 401 authentication request (#22) (#23) * fix 401 issue (#22) * enablle github action on develop branch * Support Firefox (#18) * Adapt firefox * support firefore auto publish * support firefox, and optimized UX * [i18n] Updates for file public/_locales/en/messages.json (#25) * [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> * sentry integration (#29) * [WIP] support exporting * [WIP] support import/export settings (#7) * Support import/export profiles and close #7 (#30) * implemented an utility to export/import settings * optimized description * [i18n] Updates for file public/_locales/en/messages.json (#32) * [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> * fix an import issue (#33) (#35) * optimized sentry release * Optimize Development Flow (#37) * [WIP] support chrome auto deploy * finalize Chrome auto deploy * npm audit fix * npm audit fix * UX improvement and close #28 (#38) * minor bug fixed * improve UX and close #28 * use the same CIDR validator as PAC script * [i18n] Updates for file public/_locales/en/messages.json (#40) * [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> * Support Authentication in Auto Switch Profiles, fixing #34 (#45) * update deps * fix the auth issue in auto switch profiles * fix typo * Support Profile Detection for the Auto Profiles (#42) (#50) * [WIP] Reflect current profile when using auto profile (#42) * Show detected profile in the popup * simplify test cases --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
* update github action * minor change to System profile * Build(deps): Bump nanoid from 3.3.7 to 3.3.8 (#21) 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> * Avoid blocking 401 authentication request (#22) (#23) * fix 401 issue (#22) * enablle github action on develop branch * Support Firefox (#18) * Adapt firefox * support firefore auto publish * support firefox, and optimized UX * [i18n] Updates for file public/_locales/en/messages.json (#25) * [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> * sentry integration (#29) * [WIP] support exporting * [WIP] support import/export settings (#7) * Support import/export profiles and close #7 (#30) * implemented an utility to export/import settings * optimized description * [i18n] Updates for file public/_locales/en/messages.json (#32) * [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> * fix an import issue (#33) (#35) * optimized sentry release * Optimize Development Flow (#37) * [WIP] support chrome auto deploy * finalize Chrome auto deploy * npm audit fix * npm audit fix * UX improvement and close #28 (#38) * minor bug fixed * improve UX and close #28 * use the same CIDR validator as PAC script * [i18n] Updates for file public/_locales/en/messages.json (#40) * [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> * Support Authentication in Auto Switch Profiles, fixing #34 (#45) * update deps * fix the auth issue in auto switch profiles * fix typo * Support Profile Detection for the Auto Profiles (#42) (#50) * [WIP] Reflect current profile when using auto profile (#42) * Show detected profile in the popup * simplify test cases * [i18n] Updates for file public/_locales/en/messages.json (#52) * [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'. * [i18n] Translate messages.json in pt_BR 100% reviewed source file: 'messages.json' on 'pt_BR'. --------- Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
This pull request introduces significant updates to improve proxy profile handling, enhance type safety, and modernize dependencies. The most important changes include replacing
ProfileAuthSwitchwithProfileAutoSwitch, adding a newProfileAuthProviderclass to manage authentication information, and updating dependencies inpackage.json. Additionally, new tests have been added to ensure the functionality of theProfileAuthProvider.Proxy Profile Refactoring:
ProfileAuthSwitchwithProfileAutoSwitchacross the codebase to better represent the "auto" proxy type, including updates to type definitions, components, and service methods. ([[1]](https://github.com/bytevet/proxyverse/pull/45/files#diff-82e925460759290ebaa36232a1745184c409fa56a04a09208c0d1fc97f842ed3L20-R20),[[2]](https://github.com/bytevet/proxyverse/pull/45/files#diff-82e925460759290ebaa36232a1745184c409fa56a04a09208c0d1fc97f842ed3L41-R41),[[3]](https://github.com/bytevet/proxyverse/pull/45/files#diff-71fa036dc1105d2847b38d3e751f4bfc2dfd900a335a860e5401827b4c68839dL71-R75),[[4]](https://github.com/bytevet/proxyverse/pull/45/files#diff-b5fae4f9b5cb88786896b7c6206447ebbe4977ab2ec976e5c9f5f84a6ffe0225L3-R3),[[5]](https://github.com/bytevet/proxyverse/pull/45/files#diff-56acf68fc693e8b3abdca177e77e9ce18ed464b470cd323e639ae1bbcf0acdbfL7-R11),[[6]](https://github.com/bytevet/proxyverse/pull/45/files#diff-c1956cc8f38ae392595a3a47f4ff07f78a4dc0ed66516f22c4fffa8bf1a3a6caL5-R5))ProfileConverterto handleProfileAutoSwitchwhen generating PAC scripts. ([src/services/proxy/profile2config.tsL302-R308](https://github.com/bytevet/proxyverse/pull/45/files#diff-c1956cc8f38ae392595a3a47f4ff07f78a4dc0ed66516f22c4fffa8bf1a3a6caL302-R308))Authentication Enhancements:
ProfileAuthProviderclass to fetch authentication information for proxy profiles, supporting both "proxy" and "auto" types. ([src/services/proxy/auth.tsR1-R112](https://github.com/bytevet/proxyverse/pull/45/files#diff-99f7838c57a65147d183996add3827901bb45901a0cce4976a7b8fa77896f0cbR1-R112))getAuthInfosfunction to useProfileAuthProvider, replacing the previous inline logic. ([src/services/proxy/index.tsL93-R99](https://github.com/bytevet/proxyverse/pull/45/files#diff-56acf68fc693e8b3abdca177e77e9ce18ed464b470cd323e639ae1bbcf0acdbfL93-R99))Dependency Updates:
package.json, including@sentry/vue,@vueuse/core,vue, andtypescript, to their latest versions for better performance and compatibility. ([package.jsonL20-R47](https://github.com/bytevet/proxyverse/pull/45/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L20-R47))Type Safety Improvements:
validatorfunctions in various components by explicitly specifying parameter types. ([[1]](https://github.com/bytevet/proxyverse/pull/45/files#diff-82e925460759290ebaa36232a1745184c409fa56a04a09208c0d1fc97f842ed3L135-R138),[[2]](https://github.com/bytevet/proxyverse/pull/45/files#diff-82e925460759290ebaa36232a1745184c409fa56a04a09208c0d1fc97f842ed3L154-R160),[[3]](https://github.com/bytevet/proxyverse/pull/45/files#diff-774798f236e14c9904d714491522a53c58e3fa81acf97734531f25359acacda6L104-R104),[[4]](https://github.com/bytevet/proxyverse/pull/45/files#diff-774798f236e14c9904d714491522a53c58e3fa81acf97734531f25359acacda6L137-R137))Testing:
ProfileAuthProviderto validate its behavior with different proxy profiles, including edge cases like circular references and default profiles. ([tests/services/proxy/auth.test.tsR1-R130](https://github.com/bytevet/proxyverse/pull/45/files#diff-7408733902bfe9d8b8b902be3399174844597520c1ed614758c73f33576d2264R1-R130))