Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What's Changed:
具体思路:
graph TD A[检测地理位置] --> B[中国大陆] A --> C[非中国大陆] B --> D[葫芦] B --> E[镜像源] D --> F[测速] E --> F[测速] F --> G[选择最快的] C --> H[直接使用 Github] G --> I[下载] H --> I[下载]由 AI 修改,并在本地测试
resolve #59
Copilot's Summary
This pull request introduces geographic-based source selection for asset downloads by detecting if the user is in mainland China and adjusting the asset mirror list accordingly. It adds a new utility class for location detection, updates the mirror selection logic, and improves logging and fallback behavior.Geographic source selection and location detection:
LocationDetectUtilclass to determine if the user is in mainland China using external geo-IP APIs, with result caching and fallback logic. (src/main/java/i18nupdatemod/util/LocationDetectUtil.java)AssetUtil.getFastestUrl()to useLocationDetectUtil.isMainlandChina()to select different asset sources: domestic mirrors and the legacy root for users in China, or GitHub for users elsewhere. (src/main/java/i18nupdatemod/util/AssetUtil.java)Mirror management and logging:
MIRRORSlist and instead added it as a separate constant, only used for overseas users. (src/main/java/i18nupdatemod/util/AssetUtil.java)getFastestUrl()to indicate which source list is being used and to clarify fallback behavior when all sources fail. (src/main/java/i18nupdatemod/util/AssetUtil.java) [1] [2]