Skip to content

[Feature] 重制GH加速功能(代理重试+缓存+可配置)#101

Open
DeterMination-Wind wants to merge 4 commits into
TinyLake:mainfrom
DeterMination-Wind:gh-issue
Open

[Feature] 重制GH加速功能(代理重试+缓存+可配置)#101
DeterMination-Wind wants to merge 4 commits into
TinyLake:mainfrom
DeterMination-Wind:gh-issue

Conversation

@DeterMination-Wind
Copy link
Copy Markdown

Summary

  • 重制 GitHub 加速为独立 GithubAcceleration 模块:支持代理列表配置(Asset/API 分流)、多轮自动重试和静态资源缓存。
  • 扩展 Arc Http hook 能力(onBeforeRequest + request success/directResponse):支持请求级重试链路与缓存命中直返,并让 HttpResponse 可复读响应内容用于缓存。
  • 接入 QuickSettings(NewToolTable 新增 GH 按钮,长按打开配置面板),并保留旧 githubMirror 配置向新开关迁移。

Changes

  • 新增 src/mindustryX/features/GithubAcceleration.kt(单文件实现代理、重试、缓存、设置 UI)。
  • 更新 patches/arc/0001-API-Http.onBeforeRequest.patch,为 HttpRequest/HttpResponse 增加重试与缓存直返所需能力。
  • Hooks.beforeInit() 改为初始化 GithubAcceleration;移除旧 Hooks.onHttp 单镜像替换逻辑。
  • 删除 VarsX.githubMirror 旧设置项,新增中英文设置文案键(githubAcceleration.*)。

Verify

  • gradle :core:compileKotlin
  • gradle :core:compileJava:core:patchGeneratedSources 既有补丁冲突影响(与本改动无关)

Fixes #89

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @DeterMination-Wind, 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!

此拉取请求旨在通过引入一个全新的、功能更强大的GitHub加速模块来显著提升GitHub相关请求的可靠性和性能。通过支持可配置的代理列表、智能的自动重试机制以及静态资源缓存,它解决了访问GitHub资源时可能遇到的连接问题和延迟,从而为用户提供更流畅的体验。

Highlights

  • GitHub加速功能重构: 将GitHub加速功能重构为一个独立的GithubAcceleration模块,支持代理列表配置(资产/API分流)、多轮自动重试和静态资源缓存。
  • Arc Http Hook能力扩展: 扩展了Arc Http的hook能力(onBeforeRequest + 请求成功/直接响应),以支持请求级别的重试链路和缓存命中直返,并使HttpResponse可复读响应内容用于缓存。
  • QuickSettings集成与旧配置迁移: 集成了QuickSettings,在NewToolTable中新增了GH按钮,长按可打开配置面板,并保留了旧的githubMirror配置向新开关迁移的逻辑。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • assets/bundles/bundle-mdtx.properties
    • 新增了GitHub加速功能的中文配置项,包括类别、启用开关、缓存、缓存过期时间、最大尝试次数和代理列表。
  • assets/bundles/bundle-mdtx_en.properties
    • 新增了GitHub加速功能的英文配置项,包括类别、启用开关、缓存、缓存过期时间、最大尝试次数和代理列表。
  • patches/arc/0001-API-Http.onBeforeRequest.patch
    • 更新了Http.java补丁,为HttpResponse增加了缓存结果的能力,并引入了directResponse字段和success回调到HttpRequest中,以支持请求重试和缓存直返逻辑。
  • src/mindustryX/Hooks.java
    • 移除了旧的Http.onBeforeRequest镜像替换逻辑。
    • beforeInit()方法中初始化了新的GithubAcceleration模块。
  • src/mindustryX/VarsX.kt
    • 移除了旧的githubMirror设置项。
  • src/mindustryX/features/GithubAcceleration.kt
    • 新增了GithubAcceleration文件,实现了GitHub请求的代理、重试、缓存和设置UI逻辑。
  • src/mindustryX/features/ui/toolTable/NewToolTable.kt
    • 在工具面板中添加了一个“GH”按钮,用于快速访问和配置GitHub加速功能。
Activity
  • 此拉取请求目前没有人工活动,例如评论或审查。
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

Copy link
Copy Markdown

@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

重构了 GitHub 加速功能,将其独立为 GithubAcceleration 模块,支持代理列表配置、多轮重试和静态资源缓存。这是一个非常实用的改进,增强了网络请求的鲁棒性。主要建议关注 Http 补丁对全局内存占用的影响以及域名匹配的安全性。

Comment thread patches/arc/0001-API-Http.onBeforeRequest.patch
Comment thread src/mindustryX/features/GithubAcceleration.kt
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.

[Feature] 重制GH加速功能

2 participants