Skip to content

feat: 当ENABLE_RANDOM_CN_IP为true时,除非请求参数randomCNIP显式为false,默认开启randomCNIP#179

Open
SunsetMkt wants to merge 5 commits into
NeteaseCloudMusicApiEnhanced:mainfrom
SunsetMkt:ENABLE_RANDOM_CN_IP
Open

feat: 当ENABLE_RANDOM_CN_IP为true时,除非请求参数randomCNIP显式为false,默认开启randomCNIP#179
SunsetMkt wants to merge 5 commits into
NeteaseCloudMusicApiEnhanced:mainfrom
SunsetMkt:ENABLE_RANDOM_CN_IP

Conversation

@SunsetMkt
Copy link
Copy Markdown

No description provided.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
api-enhanced Ready Ready Preview, Comment May 25, 2026 5:05am

@SunsetMkt
Copy link
Copy Markdown
Author

此PR关闭#177

Copy link
Copy Markdown
Contributor

@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 introduces a new feature to enable random Chinese IPs via a global environment variable or a request parameter, updating the configuration examples, documentation, and option parsing logic. Feedback indicates that the current implementation in util/option.js does not align with the "unless explicitly false" logic described in the documentation. Furthermore, a critical issue was identified where the randomCNIP option is not yet utilized within the request handling logic in util/request.js, meaning the feature currently has no effect on network requests.

Comment thread util/option.js Outdated
Comment thread README.MD Outdated
@SunsetMkt SunsetMkt marked this pull request as draft May 24, 2026 18:20
@SunsetMkt
Copy link
Copy Markdown
Author

TODO: 保持旧行为,也不应该覆盖realIP

@SunsetMkt SunsetMkt marked this pull request as ready for review May 25, 2026 01:48
@SunsetMkt
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown
Contributor

@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 introduces a global configuration setting, ENABLE_RANDOM_CN_IP, which allows users to enable random Chinese IP addresses by default across the application. The changes include updates to the environment variable template, documentation in the README, and the logic in util/option.js. A critical logic flaw was identified in the implementation of the randomCNIP option: since query parameters are typically strings, a value of "false" would be treated as truthy in JavaScript, preventing users from explicitly disabling the feature via URL parameters. A code suggestion was provided to correctly handle both string and boolean inputs.

Comment thread util/option.js Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@SunsetMkt
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown
Contributor

@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 introduces a new environment variable ENABLE_RANDOM_CN_IP to allow defaulting to random Chinese IPs for requests, along with corresponding documentation in the README. A logic issue was identified in util/option.js where the feature would be disabled by any query parameter value other than true when the global setting is enabled; a suggestion was provided to ensure it only disables when explicitly set to false.

Comment thread util/option.js Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@SunsetMkt
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown
Contributor

@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 introduces a global configuration ENABLE_RANDOM_CN_IP to enable random Chinese IP usage by default, updating the environment template, documentation, and option parsing logic. Feedback indicates that while the flag is correctly parsed, it is not yet implemented in the actual request handling logic in util/request.js, and a readability improvement was suggested for the complex conditional logic in util/option.js.

Comment thread util/option.js Outdated
Comment thread util/option.js Outdated
@SunsetMkt
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown
Contributor

@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 introduces a new environment variable, ENABLE_RANDOM_CN_IP, to enable random Chinese IPs by default, including updates to documentation and the option parsing logic in util/option.js. Review feedback suggests simplifying the boolean logic for better readability and points out that the randomCNIP parameter is currently not utilized in the underlying request implementation, which prevents the feature from working as intended.

Comment thread util/option.js Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@SunsetMkt
Copy link
Copy Markdown
Author

@MoeFurina 此PR需要Squash

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.

1 participant