Skip to content

Add plugin GitHubProxy v1.0.1#164

Merged
lzx8589561 merged 5 commits into
ZToolsCenter:mainfrom
wangbin-blog:plugin/githubproxy
May 12, 2026
Merged

Add plugin GitHubProxy v1.0.1#164
lzx8589561 merged 5 commits into
ZToolsCenter:mainfrom
wangbin-blog:plugin/githubproxy

Conversation

@wangbin-blog
Copy link
Copy Markdown
Contributor

@wangbin-blog wangbin-blog commented May 11, 2026

插件信息

  • 名称: GitHubProxy
  • 插件ID: githubproxy
  • 版本: 1.0.1
  • 描述: GitHub 文件代理加速工具
  • 作者: thinkw
  • 类型: 新增

本次变更

Changed

  • HTTP 重定向处理:GitHub 文件下载链接(如 Release 附件或 Raw 文件)通常会重定向到 objects.githubusercontent.com,现已支持自动跟随 301/302/307/308 重定向
  • 深色主题下输入框、表格、卡片等组件样式适配
  • 页面滚动问题修复
  • 修改拼写错误

截图 / 演示

自检清单

  • plugin.json 的 name / title / version / description / author 字段均已检查
  • 已移除调试日志、未使用文件、敏感信息(.env、token、密钥等)
  • 本次 PR 的 diff 仅涉及 plugins/githubproxy/ 目录
  • 已在本地 ZTools 客户端实际加载并测试过此插件,主要功能正常
  • 同意以仓库声明的开源协议发布此插件

此 PR 由 ztools-plugin-cli 自动管理:每次 ztools publish 在分支上追加一个 commit,PR 链接保持不变。

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

This pull request introduces the githubproxy plugin for ZTools, a Vue 3 based tool for GitHub file proxy acceleration, command generation, and file downloading. Feedback identifies a bug in the proxy editing logic where renaming a server breaks the update process, and suggests optimizing the speed test feature through parallel execution. Further recommendations include refining download progress estimation for files with unknown sizes and adopting a more robust database update pattern to avoid data loss during configuration changes.

const saveEdit = () => {
if (!editingServer.value) return

const index = proxyServers.value.findIndex(s => s.name === editingServer.value?.name)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

saveEdit 函数中,通过 editingServer.value.name 来查找索引。如果用户在编辑对话框中修改了服务器地址(name),findIndex 将无法找到原始条目,导致修改无法应用到列表中。建议在进入编辑模式时记录原始名称或直接使用索引进行定位。

Comment on lines +98 to +100
for (const server of proxyServers.value) {
await testServer(server)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

testAllServers 函数目前采用顺序执行 await 的方式测试每个服务器,这在列表较长时会导致明显的等待。建议重构测速逻辑,使用 Promise.all 并行执行测试任务,以显著提升测速效率。

// 没有content-length头,显示动态进度
// 根据下载字节数估算进度,确保进度会变化
const estimatedProgress = Math.min(99, Math.round((downloadedSize / (1024 * 1024)) * 10));
onProgress(estimatedProgress);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

当 HTTP 响应缺少 content-length 时,目前的进度估算逻辑 (downloadedSize / (1024 * 1024)) * 10 基于 10MB 的固定假设,这对于不同大小的文件会产生误导性的百分比。建议在无法确定总大小时,向 UI 返回已下载的字节数或特定的状态码(如 -1),由 UI 显示不确定的进度条或仅显示已下载大小。

Comment on lines +58 to +59
await window.ztools.db.remove('proxyServers')
await window.ztools.db.put({ _id: 'proxyServers', data: JSON.stringify(proxyServers.value)})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

先执行 remove 再执行 put 的更新模式不具备原子性。如果 remove 成功但随后的 put 失败(例如由于数据库连接中断),会导致用户的代理服务器配置完全丢失。建议直接使用 put 进行覆盖更新,或者在更新前获取最新的 _rev 标签以确保安全更新。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

单独使用db.put 数据未更新

- GitHub 文件代理加速工具 V1.0.0
- fix: 修复拼写错误并添加重定向处理
- fix(下载进度): 优化无content-length时的进度显示逻辑
@wangbin-blog wangbin-blog marked this pull request as ready for review May 11, 2026 02:46
- GitHub 文件代理加速工具 V1.0.0
- fix: 修复拼写错误并添加重定向处理
- fix(下载进度): 优化无content-length时的进度显示逻辑
- chore: 更新插件版本号至1.0.3
- GitHub 文件代理加速工具 V1.0.0
- fix: 修复拼写错误并添加重定向处理
- fix(下载进度): 优化无content-length时的进度显示逻辑
- chore: 更新插件版本号至1.0.3
- feat: add github proxy url copy function and update about page link
@wangbin-blog
Copy link
Copy Markdown
Contributor Author

image image image

@lzx8589561 lzx8589561 merged commit 3b483bc into ZToolsCenter:main May 12, 2026
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