Skip to content

Conversation

@SYM01
Copy link
Collaborator

@SYM01 SYM01 commented Jun 8, 2025

This pull request introduces significant updates to improve proxy profile handling, enhance type safety, and modernize dependencies. The most important changes include replacing ProfileAuthSwitch with ProfileAutoSwitch, adding a new ProfileAuthProvider class to manage authentication information, and updating dependencies in package.json. Additionally, new tests have been added to ensure the functionality of the ProfileAuthProvider.

Proxy Profile Refactoring:

  • Replaced ProfileAuthSwitch with ProfileAutoSwitch across 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))
  • Updated ProfileConverter to handle ProfileAutoSwitch when generating PAC scripts. ([src/services/proxy/profile2config.tsL302-R308](https://github.com/bytevet/proxyverse/pull/45/files#diff-c1956cc8f38ae392595a3a47f4ff07f78a4dc0ed66516f22c4fffa8bf1a3a6caL302-R308))

Authentication Enhancements:

  • Introduced a new ProfileAuthProvider class 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))
  • Refactored the getAuthInfos function to use ProfileAuthProvider, replacing the previous inline logic. ([src/services/proxy/index.tsL93-R99](https://github.com/bytevet/proxyverse/pull/45/files#diff-56acf68fc693e8b3abdca177e77e9ce18ed464b470cd323e639ae1bbcf0acdbfL93-R99))

Dependency Updates:

  • Updated multiple dependencies in package.json, including @sentry/vue, @vueuse/core, vue, and typescript, 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:

  • Enhanced type safety for validator functions 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:

  • Added comprehensive unit tests for ProfileAuthProvider to 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))

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 ProfileAuthSwitch has been renamed to ProfileAutoSwitch across 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 @vitest and @rollup packages, have been updated to their latest versions.
  • Type Safety: Explicit type annotations have been added to validator functions in Vue components to enhance type safety and code clarity.
  • Testing: New unit tests have been added specifically for the ProfileAuthProvider to 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-router in dependencies.
    • Updated versions for @arco-design/web-vue, @sentry/vite-plugin, @vitejs/plugin-vue, @vitest/coverage-v8, typescript, vite, vitest, vue-tsc in devDependencies.
    • Added @types/chai and @types/deep-eql to devDependencies.
    • Updated peer dependency range for @sentry/vue to include pinia 3.x.
    • Added fdir, picomatch, tinyglobby as dependencies for vite and vitest.
    • Updated tinypool and tinyspy versions.
    • Updated peer dependency range for vite and vite-node to include vite 7.x.
    • Added ast-v8-to-istanbul dependency for @vitest/coverage-v8.
  • src/components/ProfileConfig.vue
    • Renamed ProfileAuthSwitch type reference to ProfileAutoSwitch (L20, L41, L430).
    • Added explicit type annotations to validator functions for proxyServerFieldRule (L135-R138) and pacScriptFieldRule (L154-R160).
  • src/components/configs/AutoSwitchInput.vue
    • Changed FieldRule import to type FieldRule (L3).
    • Added explicit type annotations to validator functions for 'url' (L104-R104) and 'cidr' (L137-R137) types.
  • src/components/configs/AutoSwitchPacPreview.vue
    • Renamed ProfileAuthSwitch type reference to ProfileAutoSwitch (L3).
    • Updated the type annotation for the profile prop (L12).
  • src/services/profile.ts
    • Renamed the type ProfileAuthSwitch to ProfileAutoSwitch (L71).
    • Updated the ProxyProfile union type to include ProfileAutoSwitch (L75).
  • src/services/proxy/auth.ts
    • Added a new file auth.ts containing the ProfileAuthProvider class (R1-R112).
    • The ProfileAuthProvider includes methods to get authentication information for proxy and auto profiles, handling recursion and circular references.
  • src/services/proxy/index.ts
    • Imported ProfileAutoSwitch (L7) and ProfileAuthProvider (L11).
    • Refactored the getAuthInfos function to use the new ProfileAuthProvider class, removing the previous inline logic (L93-R99).
  • src/services/proxy/profile2config.ts
    • Imported ProfileAutoSwitch instead of ProfileAuthSwitch (L5).
    • Exported the ProfileLoader type (L17-R19).
    • Updated the type annotation for the prepareAutoProfilePrecedence method to use ProfileAutoSwitch (L308).
    • Added a JSDoc comment to the toPAC method (L49-R52).
  • tests/services/proxy/auth.test.ts
    • Added a new file auth.test.ts with unit tests for ProfileAuthProvider (R1-R130).
    • Tests cover simple proxy profiles, auto profiles, default profiles, and circular references.
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

  1. 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.

@SYM01 SYM01 merged commit 4213518 into develop Jun 8, 2025
6 checks passed
Copy link

@gemini-code-assist gemini-code-assist bot left a 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.log statement was found in src/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, within getAuthInfosForProxyProfile, an array map is used for side effects (populating an array). While functional, using forEach or a for...of loop would be more idiomatic for iterations where the returned array from map isn'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");

Choose a reason for hiding this comment

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

medium

It looks like there's a console.log("test") statement here. Could this be a leftover debugging statement that should be removed before merging?

SYM01 added a commit that referenced this pull request Jun 8, 2025
* 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>
SYM01 added a commit that referenced this pull request Dec 7, 2025
* 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>
SYM01 added a commit that referenced this pull request Dec 7, 2025
* 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>
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.

2 participants