Showing preview only (766K chars total). Download the full file or copy to clipboard to get everything.
Repository: xixu-me/xget
Branch: main
Commit: 0d9360a003ef
Files: 117
Total size: 728.7 KB
Directory structure:
gitextract_0eq81jzj/
├── .dockerignore
├── .editorconfig
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ ├── config.yml
│ │ ├── documentation.yml
│ │ ├── feature_request.yml
│ │ ├── performance_issue.yml
│ │ └── platform_request.yml
│ ├── dependabot.yml
│ ├── pull_request_template.md
│ └── workflows/
│ ├── ci.yml
│ ├── commitlint.yml
│ ├── dependabot-auto-merge.yml
│ ├── functions-ntl.yml
│ ├── functions-vc.yml
│ ├── image.yml
│ ├── pages-cf.yml
│ ├── pages-eo.yml
│ ├── sync.yml
│ └── workers.yml
├── .gitignore
├── .prettierignore
├── .prettierrc.json
├── AGENTS.md
├── CLAUDE.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── README.md
├── README.zh-Hans.md
├── README.zh-Hant.md
├── SECURITY.md
├── adapters/
│ ├── functions/
│ │ ├── api/
│ │ │ └── index.js
│ │ ├── deno.js
│ │ ├── netlify/
│ │ │ └── edge-functions/
│ │ │ └── edge-handler.js
│ │ ├── netlify.toml
│ │ ├── package.json
│ │ └── vercel.json
│ └── pages/
│ ├── functions/
│ │ └── [[path]].js
│ └── wrangler.toml
├── codecov.yml
├── commitlint.config.mjs
├── config.capnp
├── docs/
│ └── deploy-on-digitalocean.md
├── eslint.config.js
├── package.json
├── scripts/
│ └── fix-badge-colors.js
├── skills/
│ └── xget/
│ ├── SKILL.md
│ ├── references/
│ │ └── REFERENCE.md
│ └── scripts/
│ └── xget.mjs
├── src/
│ ├── app/
│ │ ├── handle-request.js
│ │ └── request-context.js
│ ├── config/
│ │ ├── index.js
│ │ ├── platform-catalog.js
│ │ └── platforms.js
│ ├── index.js
│ ├── protocols/
│ │ ├── ai.js
│ │ ├── docker.js
│ │ ├── git.js
│ │ └── huggingface.js
│ ├── response/
│ │ └── finalize-response.js
│ ├── routing/
│ │ ├── platform-index.js
│ │ ├── platform-transformers.js
│ │ └── resolve-target.js
│ ├── types.d.ts
│ ├── upstream/
│ │ ├── cache.js
│ │ └── fetch-upstream.js
│ └── utils/
│ ├── performance.js
│ ├── rewrite.js
│ ├── security.js
│ └── validation.js
├── test/
│ ├── benchmark/
│ │ └── performance.bench.js
│ ├── features/
│ │ ├── auth.test.js
│ │ ├── git-lfs.test.js
│ │ ├── git.test.js
│ │ ├── performance.test.js
│ │ ├── range-cache.test.js
│ │ └── security.test.js
│ ├── fixtures/
│ │ └── responses.js
│ ├── helpers/
│ │ ├── assertions.js
│ │ ├── generators.js
│ │ ├── index.js
│ │ ├── mocks.js
│ │ └── test-utils.js
│ ├── index.test.js
│ ├── integration.test.js
│ ├── platforms/
│ │ ├── container-registry.test.js
│ │ ├── cran.test.js
│ │ ├── crates.test.js
│ │ ├── flathub.test.js
│ │ ├── homebrew.test.js
│ │ ├── jenkins.test.js
│ │ ├── npm-fix.test.js
│ │ └── opensuse.test.js
│ ├── setup.js
│ ├── types.d.ts
│ └── unit/
│ ├── app-structure.test.js
│ ├── cache-privacy.test.js
│ ├── cors-and-proxy-options.test.js
│ ├── docker-helpers.test.js
│ ├── flathub-rewrite.test.js
│ ├── package-manifest.test.js
│ ├── pipeline-modules.test.js
│ ├── platform-boundaries.test.js
│ ├── platforms.test.js
│ ├── protocol-helpers.test.js
│ ├── protocols.test.js
│ ├── runtime-helpers.test.js
│ ├── utils.test.js
│ ├── worker-regressions.test.js
│ └── xget-skill-script.test.js
├── tsconfig.json
├── vitest.config.js
├── vitest.coverage.config.js
└── wrangler.toml
================================================
FILE CONTENTS
================================================
================================================
FILE: .dockerignore
================================================
# Dependencies
node_modules/
npm-debug.log
# Build outputs
dist/
.wrangler/
wrangler-dist/
# Tests
test/
coverage/
*.test.js
# Documentation
*.md
docs/
.github/
# Git
.git/
.gitignore
.gitattributes
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
# OS
.DS_Store
Thumbs.db
# CI/CD
.github/workflows/
# Config files not needed in build
.prettierrc
.prettierignore
.eslintrc*
tsconfig.json
vitest.config.js
# Misc
*.log
.env
.env.*
================================================
FILE: .editorconfig
================================================
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.yml]
indent_style = space
================================================
FILE: .github/FUNDING.yml
================================================
custom: https://xi-xu.me/#sponsorships
buy_me_a_coffee: xixu
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: 🐛 bug 报告
description: 报告一个问题或错误
title: "[Bug]: "
labels: ["bug", "需要分类"]
assignees: []
body:
- type: markdown
attributes:
value: |
感谢你花时间填写这个 bug 报告!请尽可能详细地描述问题,这将帮助我们更快地定位和修复问题。
- type: checkboxes
id: prerequisites
attributes:
label: 前置检查
description: 在提交 Issue 之前,请确认以下事项
options:
- label: 我已经搜索过现有的 Issues,确认这不是重复问题
required: true
- label: 我已经查看过文档和 README
required: true
- label: 我使用的是最新版本的 Xget
required: false
- type: textarea
id: description
attributes:
label: 问题描述
description: 清晰简洁地描述遇到的问题
placeholder: 描述你遇到了什么问题...
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: 重现步骤
description: 提供重现问题的详细步骤
placeholder: |
1. 访问 '...'
2. 执行命令 '...'
3. 观察到错误 '...'
value: |
1.
2.
3.
validations:
required: true
- type: textarea
id: expected
attributes:
label: 期望行为
description: 描述你期望发生什么
placeholder: 应该...
validations:
required: true
- type: textarea
id: actual
attributes:
label: 实际行为
description: 描述实际发生了什么
placeholder: 但实际上...
validations:
required: true
- type: dropdown
id: platform
attributes:
label: 受影响的平台
description: 选择问题相关的平台(可多选)
multiple: true
options:
- GitHub
- GitLab
- npm
- PyPI
- Docker Hub
- crates.io
- Maven Central
- Homebrew
- Jenkins
- OpenAI API
- Anthropic API
- 其他 AI 推理 API
- 不确定/不适用
validations:
required: true
- type: dropdown
id: request_type
attributes:
label: 请求类型
description: 选择问题相关的请求类型
options:
- Git 克隆/拉取
- Git LFS
- Docker 镜像拉取
- 包下载 (npm/PyPI/Maven 等)
- AI API 推理请求
- 其他
validations:
required: true
- type: textarea
id: environment
attributes:
label: 环境信息
description: 提供你的环境详细信息
value: |
- 操作系统: [例如 Ubuntu 22.04, macOS 14, Windows 11]
- 客户端工具: [例如 git 2.40, docker 24.0, npm 10.2]
- 浏览器 (如适用): [例如 Chrome 120, Firefox 121]
- Xget 部署方式: [Cloudflare Workers / 自托管 / 其他]
validations:
required: true
- type: textarea
id: logs
attributes:
label: 错误日志
description: |
提供相关的错误日志、堆栈跟踪或控制台输出
提示: 你可以在代码块中粘贴日志以保持格式
render: shell
placeholder: |
粘贴错误日志...
- type: textarea
id: curl
attributes:
label: cURL 命令或请求示例
description: 如果可能,提供能重现问题的 cURL 命令或请求示例(请移除敏感信息)
render: shell
placeholder: |
curl -X GET "https://your-xget-instance/gh/microsoft/vscode" -H "User-Agent: git/2.40"
- type: textarea
id: additional
attributes:
label: 附加信息
description: |
提供任何其他有助于理解问题的上下文、截图或信息
提示: 你可以拖拽图片到这里上传
- type: dropdown
id: severity
attributes:
label: 严重程度
description: 这个问题对你的影响有多大?
options:
- 严重 - 核心功能完全无法使用
- 高 - 重要功能受阻
- 中 - 功能可用但有明显问题
- 低 - 轻微问题或不便
validations:
required: true
- type: checkboxes
id: contribution
attributes:
label: 贡献意愿
description: 你是否愿意提交 PR 来修复这个问题?
options:
- label: 我愿意提交 PR 来修复这个问题
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: 📚 文档
url: https://github.com/xixu-me/Xget/blob/main/README.zh-Hans.md
about: 查看存储库的 README 文档
- name: 🔁 URL 转换器
url: https://xuc.xi-xu.me
about: 访问配套 web 应用程序
- name: 🔐 安全漏洞报告
url: https://github.com/xixu-me/xget/security/policy#-%E6%8A%A5%E5%91%8A%E5%AE%89%E5%85%A8%E6%BC%8F%E6%B4%9E
about: 报告安全漏洞
================================================
FILE: .github/ISSUE_TEMPLATE/documentation.yml
================================================
name: 📝 文档改进
description: 报告文档问题或建议文档改进
title: "[Docs]: "
labels: ["documentation", "需要分类"]
assignees: []
body:
- type: markdown
attributes:
value: |
感谢你帮助改进文档!清晰准确的文档对存储库至关重要。
- type: dropdown
id: doc_type
attributes:
label: 文档类型
description: 这涉及哪种类型的文档?
options:
- README
- CLAUDE.md
- API 文档
- 部署指南
- 配置说明
- 使用教程
- 开发文档
- 代码注释
- 其他
validations:
required: true
- type: dropdown
id: issue_category
attributes:
label: 问题类别
description: 选择文档问题的类别
options:
- 内容缺失
- 内容过时
- 内容错误
- 不够清晰
- 示例缺失
- 示例错误
- 格式问题
- 翻译问题
- 组织结构问题
- 新内容建议
validations:
required: true
- type: textarea
id: location
attributes:
label: 文档位置
description: 指出具体的文档位置
placeholder: |
- 文件: README.md
- 章节: "部署到 Cloudflare Workers"
- 行号: 约 L123-L145
- URL: https://github.com/.../blob/main/...
validations:
required: true
- type: textarea
id: current_content
attributes:
label: 当前内容
description: 引用当前的文档内容(如果适用)
placeholder: |
当前文档中写的是:
> "..."
render: markdown
- type: textarea
id: issue_description
attributes:
label: 问题描述
description: 详细描述文档存在的问题
placeholder: |
这个文档有以下问题:
1.
2.
validations:
required: true
- type: textarea
id: suggested_content
attributes:
label: 建议的改进
description: 提供具体的改进建议或修正后的内容
placeholder: |
建议改为:
"..."
或者添加以下内容:
"..."
render: markdown
validations:
required: true
- type: textarea
id: why_important
attributes:
label: 重要性说明
description: 解释为什么这个改进很重要
placeholder: |
这个改进很重要因为:
- 现在的文档导致用户...
- 这是新用户常见的困惑点...
- 可以帮助用户更快地...
- type: textarea
id: user_perspective
attributes:
label: 用户视角
description: 从哪种用户的角度看这个文档问题?
placeholder: |
- 新用户首次部署
- 开发者集成 Xget
- 贡献者了解代码结构
- 运维人员配置环境
- type: textarea
id: examples
attributes:
label: 示例需求
description: 如果需要添加示例,请描述所需的示例类型
placeholder: |
希望添加以下示例:
- Git 克隆的完整命令示例
- Docker 拉取镜像的配置示例
- 环境变量配置的实际案例
- type: checkboxes
id: language
attributes:
label: 语言版本
description: 这个问题涉及哪些语言版本?(可多选)
options:
- label: 中文文档
- label: 英文文档
- label: 其他语言
- type: checkboxes
id: related_areas
attributes:
label: 相关领域
description: 这个文档改进可能涉及哪些领域?(可多选)
options:
- label: 快速开始指南
- label: 安装部署
- label: 配置说明
- label: 平台使用
- label: API 参考
- label: 故障排查
- label: 性能优化
- label: 安全配置
- label: 开发贡献
- label: 架构设计
- type: checkboxes
id: contribution
attributes:
label: 贡献意愿
options:
- label: 我愿意提交 PR 来改进这个文档
- label: 我可以帮助审阅文档改进
- type: textarea
id: additional
attributes:
label: 附加信息
description: 提供任何其他有助于改进文档的信息或建议
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.yml
================================================
name: ✨ 功能请求
description: 建议一个新功能或改进
title: "[Feature]: "
labels: ["enhancement", "需要分类"]
assignees: []
body:
- type: markdown
attributes:
value: |
感谢你提出新功能建议!请详细描述你的想法,这将帮助我们更好地评估和实现。
- type: checkboxes
id: prerequisites
attributes:
label: 前置检查
description: 在提交功能请求之前,请确认以下事项
options:
- label: 我已经搜索过现有的 Issues 和 PR,确认这不是重复请求
required: true
- label: 我已经查看过存储库文档
required: true
- type: dropdown
id: feature_type
attributes:
label: 功能类型
description: 这个请求属于什么类型?
options:
- 新协议支持
- 性能优化
- 缓存改进
- 安全增强
- 监控/日志功能
- 配置选项
- API 改进
- 文档改进
- 开发体验改进
- 其他
validations:
required: true
- type: textarea
id: problem
attributes:
label: 问题背景
description: 描述你想解决的问题或痛点
placeholder: |
我在使用 Xget 时遇到了...
当前的方式是...,但是...
validations:
required: true
- type: textarea
id: solution
attributes:
label: 建议的解决方案
description: 清晰地描述你希望实现的功能
placeholder: 我希望 Xget 能够...
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: 备选方案
description: 描述你考虑过的其他替代解决方案
placeholder: |
我也考虑过...
但这个方案的问题是...
- type: textarea
id: use_case
attributes:
label: 使用场景
description: 描述具体的使用场景和预期效果
placeholder: |
场景 1: 当用户...时,这个功能可以...
场景 2: 在...情况下,能够...
validations:
required: true
- type: dropdown
id: priority
attributes:
label: 优先级
description: 这个功能对你有多重要?
options:
- 高 - 对我的工作流程至关重要
- 中 - 会显著改善使用体验
- 低 - 有更好,但不是必需的
validations:
required: true
- type: textarea
id: platform_specific
attributes:
label: 特定平台需求
description: 如果这是平台相关的功能请求,请提供详细信息
placeholder: |
- 平台名称:
- 平台 URL:
- API 文档:
- 认证方式:
- 特殊要求:
- type: textarea
id: technical_details
attributes:
label: 技术细节
description: 如果你有技术实现建议,请在此描述
placeholder: |
实现方式可能包括:
1. 在 platforms.js 中添加...
2. 需要处理...协议
3. 可能的挑战是...
- type: textarea
id: examples
attributes:
label: 示例和参考
description: 提供相关的示例、链接或参考实现
placeholder: |
- 类似实现:
- 官方文档:
- 示例请求:
- type: checkboxes
id: impact
attributes:
label: 影响范围
description: 这个功能可能影响哪些方面?(可多选)
options:
- label: 核心请求处理逻辑
- label: 平台配置
- label: 协议处理
- label: 缓存策略
- label: 安全性
- label: 性能
- label: 配置选项
- label: 文档
- label: 部署流程
- type: checkboxes
id: breaking
attributes:
label: 破坏性变更
description: 这个功能是否可能引入破坏性变更?
options:
- label: 可能需要破坏性变更
- label: 向后兼容
- type: checkboxes
id: contribution
attributes:
label: 贡献意愿
description: 你是否愿意参与实现这个功能?
options:
- label: 我愿意提交 PR 来实现这个功能
- label: 我可以提供测试和反馈
- label: 我可以帮助编写文档
- type: textarea
id: additional
attributes:
label: 附加信息
description: 提供任何其他有助于理解这个功能请求的信息
================================================
FILE: .github/ISSUE_TEMPLATE/performance_issue.yml
================================================
name: ⚡ 性能问题
description: 报告性能相关的问题或建议性能优化
title: "[Performance]: "
labels: ["performance", "需要分类"]
assignees: []
body:
- type: markdown
attributes:
value: |
感谢你报告性能问题!请提供详细的性能指标和场景,这将帮助我们诊断和优化。
- type: checkboxes
id: prerequisites
attributes:
label: 前置检查
options:
- label: 我已经搜索过现有的性能相关 Issues
required: true
- label: 我已经确认这不是上游平台本身的性能问题
required: true
- type: dropdown
id: issue_type
attributes:
label: 问题类型
description: 选择性能问题的类型
options:
- 响应时间过长
- 超时错误
- 高延迟
- 带宽限制
- 缓存未命中
- 内存使用过高
- 并发性能问题
- 其他
validations:
required: true
- type: dropdown
id: affected_platform
attributes:
label: 受影响的平台
description: 哪个平台的性能出现问题?
options:
- GitHub
- GitLab
- npm
- PyPI
- Docker Hub
- crates.io
- Maven Central
- Homebrew
- Jenkins
- OpenAI API
- Anthropic API
- 多个平台
- 所有平台
validations:
required: true
- type: dropdown
id: operation_type
attributes:
label: 操作类型
description: 什么类型的操作性能有问题?
options:
- Git 克隆
- Git 拉取
- Git LFS 下载
- Docker 镜像拉取
- 包下载
- AI API 请求
- 元数据获取
- 其他
validations:
required: true
- type: textarea
id: description
attributes:
label: 问题描述
description: 详细描述性能问题
placeholder: |
在执行...操作时,性能明显低于预期...
相比直接访问上游,速度慢了...
validations:
required: true
- type: textarea
id: metrics
attributes:
label: 性能指标
description: 提供具体的性能数据
placeholder: |
- 响应时间: XX ms (预期 < YY ms)
- 下载速度: XX KB/s (上游直连: YY KB/s)
- 首字节时间 (TTFB): XX ms
- 总耗时: XX 秒
- X-Performance-Metrics 头信息: {...}
render: markdown
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: 重现步骤
description: 提供详细的重现步骤和测试命令
render: shell
placeholder: |
# 测试命令
time git clone https://your-xget-instance/gh/user/repo
# 或使用 curl 测试
curl -w "@curl-format.txt" -o /dev/null https://your-xget-instance/...
validations:
required: true
- type: textarea
id: environment
attributes:
label: 环境信息
description: 提供详细的环境信息
value: |
- Xget 部署方式: [Cloudflare Workers / 自托管 / ...]
- Xget 区域: [US/EU/ASIA/...]
- 客户端位置: [国家/地区]
- 网络环境: [家庭宽带 / 公司网络 / VPS / ...]
- ISP:
- 客户端工具版本:
- 操作系统:
validations:
required: true
- type: textarea
id: resource_size
attributes:
label: 资源规模
description: 描述涉及的资源大小
placeholder: |
- 存储库大小: XX MB
- 文件数量: XX 个
- 单个文件大小: XX MB
- Docker 镜像大小: XX GB
- 镜像层数: XX 层
- type: textarea
id: comparison
attributes:
label: 性能对比
description: 对比 Xget 与直接访问上游的性能差异
placeholder: |
| 操作 | 通过 Xget | 直接访问上游 | 差异 |
|------|-----------|--------------|------|
| 克隆 | 30s | 10s | +200% |
| 拉取 | 5s | 2s | +150% |
render: markdown
- type: textarea
id: cache_info
attributes:
label: 缓存信息
description: 检查响应的缓存相关 Header
placeholder: |
- CF-Cache-Status:
- X-Cache-Status:
- Age:
- Cache-Control:
render: markdown
- type: textarea
id: network_trace
attributes:
label: 网络追踪
description: 如果可能,提供网络追踪信息(如 curl -v 输出的关键部分)
render: shell
placeholder: |
* Connected to your-xget-instance (...)
* TLS handshake...
< HTTP/2 200
< x-performance-metrics: {...}
- type: dropdown
id: frequency
attributes:
label: 问题频率
description: 这个性能问题多久发生一次?
options:
- 每次都发生
- 经常发生 (>50%)
- 偶尔发生 (10-50%)
- 很少发生 (<10%)
validations:
required: true
- type: dropdown
id: impact
attributes:
label: 影响程度
description: 这个性能问题的影响有多大?
options:
- 严重 - 完全无法使用
- 高 - 严重影响工作效率
- 中 - 造成明显不便
- 低 - 轻微影响
validations:
required: true
- type: textarea
id: expected_performance
attributes:
label: 期望的性能
description: 描述你期望的性能指标
placeholder: |
- 理想响应时间: < 100ms
- 可接受的下载速度: > 1MB/s
- 目标改进: 减少 50% 的延迟
- type: textarea
id: suggestions
attributes:
label: 优化建议
description: 如果你有优化建议,请在此描述
placeholder: |
可能的优化方向:
- 增加缓存时长
- 使用流式传输
- 优化重试策略
- ...
- type: textarea
id: additional
attributes:
label: 附加信息
description: 提供任何其他有助于诊断性能问题的信息
================================================
FILE: .github/ISSUE_TEMPLATE/platform_request.yml
================================================
name: 🌐 新平台支持请求
description: 请求添加对新平台的支持
title: "[Platform]: "
labels: ["platform", "enhancement", "需要分类"]
assignees: []
body:
- type: markdown
attributes:
value: |
感谢你提出新平台支持请求!请提供尽可能详细的平台信息,以便我们评估和实现。
- type: checkboxes
id: prerequisites
attributes:
label: 前置检查
options:
- label: 我已经搜索过现有的 Issues,确认这个平台还未被请求或支持
required: true
- label: 这个平台是公开可访问的服务
required: true
- type: input
id: platform_name
attributes:
label: 平台名称
description: 请提供平台的官方名称
placeholder: "例如: GitLab, Bitbucket, Quay.io"
validations:
required: true
- type: input
id: platform_url
attributes:
label: 平台 URL
description: 平台的主要域名或网址
placeholder: "例如: https://registry.example.com"
validations:
required: true
- type: dropdown
id: platform_category
attributes:
label: 平台类别
description: 这个平台属于什么类别?
options:
- 代码存储库 (Git)
- 容器注册表 (Docker/OCI)
- 软件包注册表 (npm/PyPI/Maven 等)
- AI 推理提供商
- CDN/文件存储
- 其他
validations:
required: true
- type: textarea
id: platform_description
attributes:
label: 平台描述
description: 简要描述这个平台的用途和特点
placeholder: 这个平台是一个...,主要用于...
validations:
required: true
- type: textarea
id: use_case
attributes:
label: 使用场景
description: 为什么需要加速这个平台?具体的使用场景是什么?
placeholder: |
在中国大陆访问该平台时...
我的团队经常需要从该平台下载...
加速该平台可以帮助...
validations:
required: true
- type: textarea
id: api_documentation
attributes:
label: API 文档
description: 提供平台的 API 文档链接(如果有)
placeholder: |
- 官方 API 文档:
- 认证文档:
- 其他相关文档:
- type: dropdown
id: authentication
attributes:
label: 认证方式
description: 该平台使用什么认证方式?
options:
- 无需认证(公开访问)
- API Token
- OAuth 2.0
- Basic Auth
- Bearer Token
- 自定义认证
- 不确定
validations:
required: true
- type: textarea
id: auth_details
attributes:
label: 认证详情
description: 如果需要认证,请提供详细的认证流程说明
placeholder: |
该平台的认证流程:
1.
2.
3.
- type: dropdown
id: protocol
attributes:
label: 主要协议
description: 访问该平台主要使用什么协议?
options:
- HTTP/HTTPS (RESTful API)
- Git Protocol
- Docker Registry V2
- OCI Distribution Spec
- 其他/混合
validations:
required: true
- type: textarea
id: url_structure
attributes:
label: URL 结构示例
description: 提供该平台的典型 URL 结构和示例
placeholder: |
示例 URL:
- 下载包: https://example.com/packages/{name}/{version}
- 存储库克隆: https://example.com/repos/{owner}/{repo}.git
- API 端点: https://api.example.com/v1/...
render: markdown
validations:
required: true
- type: textarea
id: special_requirements
attributes:
label: 特殊要求
description: 该平台是否有特殊的 Header、参数或处理要求?
placeholder: |
- 必需的 Headers:
- 特殊的查询参数:
- 响应格式:
- URL 重写需求:
- 其他特殊处理:
- type: textarea
id: request_examples
attributes:
label: 请求示例
description: 提供一些典型的请求示例(请移除敏感信息)
render: shell
placeholder: |
# 示例 1: 获取包信息
curl -X GET "https://example.com/api/packages/foo"
# 示例 2: 下载文件
curl -X GET "https://example.com/files/bar.tar.gz"
- type: textarea
id: response_examples
attributes:
label: 响应示例
description: 提供典型响应的示例(可以是简化版本)
render: json
placeholder: |
{
"name": "example-package",
"version": "1.0.0",
"download_url": "https://example.com/files/..."
}
- type: textarea
id: challenges
attributes:
label: 潜在挑战
description: 你认为支持这个平台可能遇到哪些挑战?
placeholder: |
- 该平台使用自定义的认证方式...
- URL 结构比较复杂...
- 需要处理特殊的重定向...
- type: textarea
id: similar_platforms
attributes:
label: 类似平台
description: 列出 Xget 已支持的类似平台(如果有)
placeholder: |
这个平台类似于已支持的:
- npm (软件包注册表)
- Docker Hub (容器注册表)
- type: input
id: estimated_users
attributes:
label: 用户基数
description: 该平台的大致用户规模或你所在团队/社区的使用情况
placeholder: "例如: 国内有约 XX 万开发者使用,我的团队有 20 人使用"
- type: dropdown
id: priority
attributes:
label: 优先级
description: 这个平台支持对你有多重要?
options:
- 高 - 我们团队急需
- 中 - 会显著改善工作流程
- 低 - 有更好,但不紧急
validations:
required: true
- type: checkboxes
id: contribution
attributes:
label: 贡献意愿
options:
- label: 我愿意提供该平台的测试账号(如果需要)
- label: 我愿意协助测试平台支持
- label: 我愿意提交 PR 来实现平台支持
- label: 我可以提供更多技术文档和细节
- type: textarea
id: additional
attributes:
label: 附加信息
description: 提供任何其他有助于实现这个平台支持的信息
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
# GitHub Actions dependencies
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
open-pull-requests-limit: 5
commit-message:
prefix: "ci"
include: "scope"
labels:
- "dependencies"
- "github-actions"
groups:
docker-actions:
applies-to: version-updates
patterns:
- "docker/build-push-action"
- "docker/login-action"
- "docker/metadata-action"
- "docker/setup-buildx-action"
reviewers:
- "xixu-me"
assignees:
- "xixu-me"
# npm dependencies
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
open-pull-requests-limit: 5
commit-message:
prefix: "deps"
include: "scope"
labels:
- "dependencies"
- "npm"
groups:
cloudflare-dev:
applies-to: version-updates
patterns:
- "@cloudflare/vitest-pool-workers"
- "@cloudflare/workers-types"
- "wrangler"
linting:
applies-to: version-updates
patterns:
- "@eslint/js"
- "eslint"
- "eslint-*"
reviewers:
- "xixu-me"
assignees:
- "xixu-me"
versioning-strategy: increase
# Docker base images
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
open-pull-requests-limit: 5
commit-message:
prefix: "deps"
include: "scope"
labels:
- "dependencies"
- "docker"
reviewers:
- "xixu-me"
assignees:
- "xixu-me"
================================================
FILE: .github/pull_request_template.md
================================================
## 概述
<!-- 请简要描述此 PR 的目的和改动内容 -->
## 改动类型
<!-- 请勾选适用的改动类型 -->
- [ ] 🐛 bug 修复
- [ ] ✨ 新功能
- [ ] 📝 文档更新
- [ ] 🎨 代码风格/格式调整
- [ ] ♻️ 代码重构
- [ ] ⚡️ 性能优化
- [ ] ✅ 测试相关
- [ ] 🔧 配置文件修改
- [ ] 🌐 新增平台支持
- [ ] 🔒 安全相关
## 相关 Issue
<!-- 如果此 PR 解决了某个 Issue,请在此关联 -->
Closes #
Related to #
## 改动说明
<!-- 详细描述你做了什么改动,以及为什么这样做 -->
### 主要改动
-
### 技术细节
-
## 测试
<!-- 描述你如何测试了这些改动 -->
- [ ] 已通过所有现有测试 (`npm run test:run`)
- [ ] 已添加新的测试用例
- [ ] 已在本地开发环境测试 (`npm run dev`)
- [ ] 已验证代码格式 (`npm run format:check`)
- [ ] 已通过类型检查 (`npm run type-check`)
- [ ] 已通过 lint 检查 (`npm run lint`)
### 测试环境
<!-- 描述测试的环境和场景 -->
-
## 影响范围
<!-- 此改动会影响哪些部分? -->
- [ ] 核心请求处理逻辑
- [ ] 平台配置
- [ ] 协议处理 (Git/Docker/AI)
- [ ] 缓存策略
- [ ] 安全功能
- [ ] 性能监控
- [ ] 文档
- [ ] CI/CD 流程
## 破坏性变更
<!-- 此 PR 是否包含破坏性变更?如果是,请详细说明 -->
- [ ] 是
- [ ] 否
<details>
<summary>破坏性变更详情</summary>
<!-- 如果有破坏性变更,请在此详细说明 -->
</details>
## 部署说明
<!-- 部署此改动时需要注意什么?是否需要环境变量配置? -->
-
## 截图/演示
<!-- 如果适用,请提供截图或演示 -->
## Checklist
- [ ] 代码遵循存储库的编码规范
- [ ] 已进行自我代码审查
- [ ] 代码注释清晰,特别是复杂逻辑部分
- [ ] 已更新相关文档
- [ ] 改动不会产生新的警告
- [ ] 已添加必要的测试,且测试通过
- [ ] 新增和现有的单元测试都通过
- [ ] 依赖的改动已合并并发布
## 附加说明
<!-- 其他需要审查者知道的信息 -->
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on:
push:
branches:
- main
paths-ignore:
- "**.md"
- "LICENSE"
- ".gitignore"
- ".editorconfig"
- ".vscode/**"
- "docs/**"
- ".prettierrc*"
- ".eslintrc*"
- ".github/ISSUE_TEMPLATE/**"
- ".github/PULL_REQUEST_TEMPLATE/**"
pull_request:
branches:
- main
paths-ignore:
- "**.md"
- "LICENSE"
- ".gitignore"
- ".editorconfig"
- ".vscode/**"
- "docs/**"
- ".prettierrc*"
- ".eslintrc*"
- ".github/ISSUE_TEMPLATE/**"
- ".github/PULL_REQUEST_TEMPLATE/**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
- name: Check formatting
run: npm run format:check
test:
name: Test and Coverage
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:run
env:
CI: true
- name: Generate coverage report
run: npm run test:coverage
env:
CI: true
- name: Normalize coverage paths for Codecov
run: |
python - <<'PY'
from pathlib import Path
path = Path("coverage/lcov.info")
lines = path.read_text(encoding="utf-8").splitlines()
normalized = []
for line in lines:
if line.startswith("SF:"):
normalized.append("SF:" + line[3:].replace("\\", "/"))
else:
normalized.append(line)
path.write_text("\n".join(normalized) + "\n", encoding="utf-8")
PY
- name: Show normalized coverage file entries
run: grep '^SF:' coverage/lcov.info | head
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage/lcov.info
flags: unit
name: unit-coverage
disable_search: true
fail_ci_if_error: true
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
typecheck:
name: Type Check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run type check
run: npm run type-check
================================================
FILE: .github/workflows/commitlint.yml
================================================
name: Commit Lint
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
commitlint:
name: Validate Commit Messages
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Lint commit messages
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
FROM="${{ github.event.pull_request.base.sha }}"
TO="${{ github.event.pull_request.head.sha }}"
else
FROM="${{ github.event.before }}"
TO="${{ github.sha }}"
fi
if [[ "$FROM" == "0000000000000000000000000000000000000000" ]]; then
npx commitlint --last --verbose
else
npx commitlint --from "$FROM" --to "$TO" --verbose
fi
================================================
FILE: .github/workflows/dependabot-auto-merge.yml
================================================
name: Dependabot Auto Merge
on:
workflow_run:
workflows:
- CI
- Commit Lint
types:
- completed
concurrency:
group: dependabot-auto-merge-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
jobs:
merge:
name: Auto-merge Dependabot PRs
if: ${{ github.event.workflow_run.event == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Find matching Dependabot PR
id: pr
uses: actions/github-script@v8
with:
script: |
const branch = context.payload.workflow_run.head_branch;
const { owner, repo } = context.repo;
const { data: pulls } = await github.rest.pulls.list({
owner,
repo,
state: "open",
head: `${owner}:${branch}`,
per_page: 10,
});
const pr = pulls.find((item) => item.user?.login === "dependabot[bot]");
if (!pr) {
core.info(`No open Dependabot PR found for branch ${branch}.`);
core.setOutput("should_merge", "false");
return;
}
core.setOutput("should_merge", "true");
core.setOutput("number", String(pr.number));
- name: Merge PR when checks pass
if: steps.pr.outputs.should_merge == 'true'
uses: actions/github-script@v8
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const pull_number = Number("${{ steps.pr.outputs.number }}");
const isSuccessful = (status) =>
status === "SUCCESS" ||
status === "SKIPPED" ||
status === "NEUTRAL";
const { data: pr } = await github.rest.pulls.get({
owner,
repo,
pull_number,
});
if (pr.user?.login !== "dependabot[bot]") {
core.info(`PR #${pull_number} is no longer a Dependabot PR.`);
return;
}
if (pr.draft) {
core.info(`PR #${pull_number} is still a draft.`);
return;
}
if (pr.mergeable === false) {
core.info(`PR #${pull_number} has merge conflicts.`);
return;
}
const { data: checks } = await github.rest.checks.listForRef({
owner,
repo,
ref: pr.head.sha,
});
const requiredChecks = ["Lint", "Test", "Type Check"];
const checkMap = new Map(checks.check_runs.map((run) => [run.name, run]));
const missing = requiredChecks.filter((name) => !checkMap.has(name));
if (missing.length > 0) {
core.info(`PR #${pull_number} is missing checks: ${missing.join(", ")}.`);
return;
}
const failed = requiredChecks.filter((name) => {
const run = checkMap.get(name);
return run.status !== "completed" || !isSuccessful(String(run.conclusion).toUpperCase());
});
if (failed.length > 0) {
core.info(`PR #${pull_number} still has pending or failing checks: ${failed.join(", ")}.`);
return;
}
await github.rest.pulls.merge({
owner,
repo,
pull_number,
merge_method: "merge",
});
await github.rest.git.deleteRef({
owner,
repo,
ref: `heads/${pr.head.ref}`,
});
core.info(`Merged Dependabot PR #${pull_number} and deleted ${pr.head.ref}.`);
================================================
FILE: .github/workflows/functions-ntl.yml
================================================
name: Deploy to Netlify
on:
workflow_run:
workflows: ["Sync to Pages and Functions"]
types:
- completed
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
deployments: write
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout functions branch
uses: actions/checkout@v6
with:
ref: functions
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
- name: Install Netlify CLI
run: npm install --global netlify-cli@latest
- name: Deploy to Netlify
run: netlify deploy --prod --dir=. --auth=${{ secrets.NETLIFY_AUTH_TOKEN }} --site=${{ secrets.NETLIFY_SITE_ID }}
================================================
FILE: .github/workflows/functions-vc.yml
================================================
name: Deploy to Vercel
on:
workflow_run:
workflows: ["Sync to Pages and Functions"]
types:
- completed
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
deployments: write
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- name: Checkout functions branch
uses: actions/checkout@v6
with:
ref: functions
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
================================================
FILE: .github/workflows/image.yml
================================================
name: Build and Push Image
on:
workflow_run:
workflows: ["CI"]
types:
- completed
branches:
- main
push:
tags:
- "v*"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
id-token: write
attestations: write
if: >-
${{
github.event_name == 'workflow_dispatch' ||
startsWith(github.ref, 'refs/tags/v') ||
(
github.event_name == 'workflow_run' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
github.event.workflow_run.head_branch == 'main' &&
github.event.workflow_run.head_repository.full_name == github.repository
)
}}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Generate artifact attestation
if: github.event_name != 'pull_request'
uses: actions/attest-build-provenance@v4
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.build-and-push.outputs.digest }}
push-to-registry: true
================================================
FILE: .github/workflows/pages-cf.yml
================================================
name: Deploy to Cloudflare Pages
on:
workflow_run:
workflows: ["Sync to Pages and Functions"]
types:
- completed
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
WRANGLER_VERSION: "4.76.0"
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
deployments: write
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout pages branch
uses: actions/checkout@v6
with:
ref: pages
- name: Ensure Cloudflare Pages project exists
env:
CF_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CF_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CF_PAGES_PROJECT: xget
CF_PRODUCTION_BRANCH: main
shell: bash
run: |
set -euo pipefail
api_base="https://api.cloudflare.com/client/v4/accounts/${CF_ACCOUNT_ID}/pages/projects"
auth_header="Authorization: Bearer ${CF_API_TOKEN}"
echo "Checking Pages project: ${CF_PAGES_PROJECT}"
if curl -fsS -H "${auth_header}" "${api_base}/${CF_PAGES_PROJECT}" >/dev/null; then
echo "Pages project exists."
exit 0
fi
echo "Pages project not found. Creating..."
create_payload="$(printf '{"name":"%s","production_branch":"%s"}' "${CF_PAGES_PROJECT}" "${CF_PRODUCTION_BRANCH}")"
curl -fsS -X POST -H "${auth_header}" -H "Content-Type: application/json" \
--data "${create_payload}" \
"${api_base}" >/dev/null
echo "Pages project created."
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Install Wrangler CLI
run: npm install --global wrangler@${{ env.WRANGLER_VERSION }}
- name: Deploy to Cloudflare Pages
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: wrangler pages deploy . --project-name=xget --branch=${{ github.ref_name }}
================================================
FILE: .github/workflows/pages-eo.yml
================================================
name: Deploy to EdgeOne Pages
on:
workflow_run:
workflows: ["Sync to Pages and Functions"]
types:
- completed
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
deployments: write
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.event == 'push' || github.event.workflow_run.event == 'workflow_run' || github.event.workflow_run.event == 'workflow_dispatch') && github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.head_repository.full_name == github.repository) }}
steps:
- name: Checkout pages branch
uses: actions/checkout@v6
with:
ref: pages
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "22.11.0"
- name: Deploy to EdgeOne Pages
run: npx edgeone pages deploy . -n xget6 -t ${{ secrets.EDGEONE_API_TOKEN }}
================================================
FILE: .github/workflows/sync.yml
================================================
name: Sync to Pages and Functions
on:
workflow_run:
workflows: ["CI"]
types:
- completed
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
convert-and-sync-pages:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.head_repository.full_name == github.repository) }}
steps:
- name: Checkout main branch
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Setup adapter files
run: |
mkdir -p /tmp/pages-conversion
cp -r adapters/pages/* /tmp/pages-conversion/
- name: Copy source code files
run: |
cp -r src /tmp/pages-conversion/
cp package.json /tmp/pages-conversion/
cp package-lock.json /tmp/pages-conversion/ 2>/dev/null || true
cp LICENSE /tmp/pages-conversion/
- name: Rewrite Pages adapter imports for converted layout
run: |
cd /tmp/pages-conversion
python3 - <<'PY'
from pathlib import Path
path = Path("functions/[[path]].js")
old = "../../../src/app/handle-request.js"
new = "../src/app/handle-request.js"
text = path.read_text(encoding="utf-8")
if old not in text:
raise SystemExit(f"expected import path not found in {path}")
path.write_text(text.replace(old, new), encoding="utf-8")
PY
- name: Update package.json for Pages
run: |
cd /tmp/pages-conversion
# Update deployment commands to use Pages
cat package.json | \
sed 's/"deploy": "wrangler deploy"/"deploy": "wrangler pages deploy ."/' | \
sed 's/"start": "wrangler dev"/"start": "wrangler pages dev ."/' \
> package.json.tmp && mv package.json.tmp package.json
- name: Initialize pages branch
run: |
cd /tmp/pages-conversion
git init
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b pages
git add .
git commit -m "Convert Workers to Pages
Auto-converted from main branch commit ${{ github.sha }}
Runtime files only (documentation, tests, and dev configs excluded)."
- name: Force push to pages branch
run: |
cd /tmp/pages-conversion
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git push -f origin pages
- name: Clean up
if: always()
run: |
rm -rf /tmp/pages-conversion
convert-and-sync-functions:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.head_repository.full_name == github.repository) }}
steps:
- name: Checkout main branch
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Setup adapter files
run: |
mkdir -p /tmp/functions-conversion
# Copy all content from adapters/functions excluding package.json first
cp -r adapters/functions/* /tmp/functions-conversion/
# Copy the specific package.json for functions (overwriting if needed, but we do it later anyway)
- name: Copy source code files
run: |
# Copy only runtime-required files
cp -r src /tmp/functions-conversion/
# Note: We do NOT copy the root package.json here as we use the one from adapters/functions
cp package-lock.json /tmp/functions-conversion/ 2>/dev/null || true
cp LICENSE /tmp/functions-conversion/
- name: Rewrite Functions adapter imports for converted layout
run: |
cd /tmp/functions-conversion
python3 - <<'PY'
from pathlib import Path
replacements = {
Path("api/index.js"): (
"../../../src/app/handle-request.js",
"../src/app/handle-request.js",
),
Path("deno.js"): (
"../../src/app/handle-request.js",
"./src/app/handle-request.js",
),
}
for path, (old, new) in replacements.items():
text = path.read_text(encoding="utf-8")
if old not in text:
raise SystemExit(f"expected import path not found in {path}")
path.write_text(text.replace(old, new), encoding="utf-8")
PY
- name: Initialize functions branch
run: |
cd /tmp/functions-conversion
git init
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b functions
git add .
git commit -m "Convert Workers to Functions
Auto-converted from main branch commit ${{ github.sha }}
Runtime files only (documentation, tests, and dev configs excluded)."
- name: Force push to functions branch
run: |
cd /tmp/functions-conversion
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git push -f origin functions
- name: Clean up
if: always()
run: |
rm -rf /tmp/functions-conversion
================================================
FILE: .github/workflows/workers.yml
================================================
name: Deploy to Cloudflare Workers
on:
workflow_run:
workflows: ["CI"]
types:
- completed
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
WRANGLER_VERSION: "4.76.0"
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
deployments: write
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.head_repository.full_name == github.repository) }}
steps:
- name: Checkout main branch
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Install Wrangler CLI
run: npm install --global wrangler@${{ env.WRANGLER_VERSION }}
- name: Deploy to Cloudflare Workers
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: wrangler deploy
================================================
FILE: .gitignore
================================================
# Logs
logs
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# Runtime data
pids
_.pid
_.seed
\*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
\*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
\*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
\*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.\*
# wrangler project
.dev.vars
.wrangler/
================================================
FILE: .prettierignore
================================================
# Dependencies
node_modules/
.pnp
.pnp.js
# Production builds
dist/
build/
# Environment files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# Logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Coverage directory used by tools like istanbul
coverage/
*.lcov
# Dependency directories
node_modules/
jspm_packages/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Storybook build outputs
.out
.storybook-out
# Temporary folders
tmp/
temp/
# Editor directories and files
.vscode/
.idea/
*.swp
*.swo
*~
# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# Wrangler
.wrangler/
# Git
.git/
# Lock files (optional - uncomment if you want to format them)
# package-lock.json
# yarn.lock
# pnpm-lock.yaml
================================================
FILE: .prettierrc.json
================================================
{
"arrowParens": "avoid",
"bracketSameLine": false,
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"endOfLine": "lf",
"insertPragma": false,
"jsxSingleQuote": true,
"overrides": [
{
"files": "*.md",
"options": {
"printWidth": 80,
"proseWrap": "always"
}
},
{
"files": "*.json",
"options": {
"printWidth": 120
}
},
{
"files": "*.yml",
"options": {
"singleQuote": false,
"tabWidth": 2
}
}
],
"printWidth": 100,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
}
================================================
FILE: AGENTS.md
================================================
CLAUDE.md
================================================
FILE: CLAUDE.md
================================================
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with
code in this repository.
## Project Overview
Xget is a high-performance, Cloudflare Workers-based acceleration engine for
developer resources. It provides unified acceleration for code repositories
(GitHub, GitLab, etc.), package registries (npm, PyPI, Maven, etc.), container
registries (Docker Hub, GHCR, etc.), and AI inference APIs (OpenAI, Anthropic,
etc.).
The project operates as a reverse proxy that transforms incoming requests to
match various platform APIs while adding security headers, caching, retry logic,
and performance monitoring.
## Development Commands
### Core Commands
```bash
# Start development server (Cloudflare Workers local environment)
npm run dev # Runs on http://localhost:8787
# Deploy to Cloudflare Workers production
npm run deploy
# Build and run tests
npm run test # Run tests in watch mode
npm run test:run # Run tests once
npm run test:coverage # Generate coverage report
npm run test:ui # Open Vitest UI
# Code quality
npm run lint # Check code quality
npm run lint:fix # Fix linting issues
npm run format # Format code with Prettier
npm run format:check # Check formatting without changes
npm run type-check # TypeScript type checking (no emit)
npm run commitlint # Validate the latest commit message
```
## Commit Messages
- Use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for
every commit
- Preferred format: `type(scope): description`
- Common types: `feat`, `fix`, `docs`, `refactor`, `perf`, `test`, `chore`
- The repository installs a `commit-msg` hook via `npm install`; do not bypass
it unless explicitly required
## Pre-Commit Requirements
- Before every commit, run the local CI-equivalent checks from
`.github/workflows/ci.yml`
- Required commands: `npm run lint`, `npm run format:check`, `npm run test:run`,
and `npm run type-check`
- If any required check fails, do not commit until the failure is resolved
- Apply this rule to every commit, including documentation-only changes, unless
the user explicitly asks for a different workflow
### Testing Workflow
- Tests use Vitest with `@cloudflare/vitest-pool-workers` for Workers-specific
testing
- Run `npm run test:run` before committing to ensure all tests pass
- Coverage reports are generated in `coverage/` directory
## Architecture
### Request Flow
1. **Entry Point**: `src/index.js` - Exports default Worker with `fetch()`
handler
2. **Validation**: `src/utils/validation.js` - Validates HTTP methods, path
length, detects protocol types
3. **Platform Detection**: URL path is parsed to identify platform (e.g., `/gh/`
→ GitHub)
4. **Path Transformation**:
`src/routing/platform-transformers.js#transformPath()` converts request paths
to upstream URLs
5. **Protocol Handling**: Different handlers for Git, Docker, AI inference
requests
6. **Upstream Fetch**: Request forwarded with appropriate headers and retry
logic
7. **Response Processing**: URL rewriting for certain platforms (npm, PyPI),
cache storage
8. **Security Headers**: Added via `src/utils/security.js` before returning to
client
### Key Components
#### Configuration (`src/config/`)
- **`index.js`**: Runtime configuration with environment variable overrides
- `TIMEOUT_SECONDS`: Request timeout (default: 30s)
- `MAX_RETRIES`: Retry attempts (default: 3)
- `CACHE_DURATION`: Cache TTL (default: 1800s = 30 minutes)
- `SECURITY.ALLOWED_METHODS`: HTTP methods (default: GET, HEAD)
- **`platform-catalog.js`**: Platform base URL definitions
- `PLATFORM_CATALOG`: Object mapping platform keys to base URLs
- **`routing/platform-index.js`**: Pre-sorted keys for efficient matching
- `SORTED_PLATFORMS`: Longest-prefix-first platform matching order
- **`routing/platform-transformers.js`**: Platform-specific path rewriting
- `transformPath()`: Converts request paths to platform-specific URLs
- Special handling for crates.io (adds `/api/v1/crates` prefix) and Jenkins
(adds `/current/` prefix)
#### Protocol Handlers (`src/protocols/`)
- **`git.js`**: Git protocol detection and header configuration
- Detects Git operations via User-Agent, endpoints (`/info/refs`,
`/git-upload-pack`)
- Handles Git LFS via `Accept: application/vnd.git-lfs+json`
- **`docker.js`**: Container registry protocol (OCI/Docker)
- Parses WWW-Authenticate headers for token authentication
- Handles Docker registry v2 API authentication flow
- Special redirect handling to prevent leaking auth tokens to blob storage
- **`ai.js`**: AI inference API detection and header forwarding
- Detects requests to `/ip/*` platforms
- Preserves all headers for AI API compatibility
#### Utilities (`src/utils/`)
- **`validation.js`**: Request validation logic
- `isDockerRequest()`: Detects Docker/OCI operations
- `validateRequest()`: Enforces security policies
- **`security.js`**: Security headers and error responses
- Adds HSTS, X-Frame-Options, CSP, X-XSS-Protection
- `createErrorResponse()`: Generates standardized error responses
- **`performance.js`**: Performance monitoring
- `PerformanceMonitor`: Tracks request timing
- Adds `X-Performance-Metrics` header to responses
### Caching Strategy
- Uses Cloudflare Cache API for GET requests (200 OK only)
- Cache TTL controlled by `CACHE_DURATION` config
- Skips cache for: Git operations, Docker operations, AI inference requests
- Range requests: First checks for range-specific cache, falls back to full
content cache
### Special Platform Handling
#### npm
- Rewrites `https://registry.npmjs.org/` URLs in JSON responses to point to Xget
instance
#### PyPI
- Rewrites `https://files.pythonhosted.org` URLs in HTML responses to point to
Xget instance
- Uses separate `pypi-files` platform for file downloads
#### crates.io
- Adds `/api/v1/crates` prefix to all API requests
- Handles search endpoint (`/?q=`) specially
#### Jenkins
- Adds `/current/` prefix to update center paths
- Preserves `/experimental/` and `/download/` paths as-is
#### Docker Registries
- Handles authentication via token service
- Uses manual redirect mode to strip Authorization headers before S3 redirects
- Auto-retries with public token on 401 responses
## Code Structure Conventions
### File Organization
```
src/
├── index.js # Main Worker entry point
├── app/
│ ├── handle-request.js # Shared request pipeline
│ └── request-context.js # Protocol-aware request classification
├── config/
│ ├── index.js # Runtime configuration
│ ├── platform-catalog.js # Platform base URLs
│ └── platforms.js # Compatibility exports
├── protocols/
│ ├── git.js # Git protocol handler
│ ├── docker.js # Docker/OCI handler
│ └── ai.js # AI inference handler
├── response/
│ └── finalize-response.js # Response shaping and cache writes
├── routing/
│ ├── platform-index.js # Platform matching order
│ ├── platform-transformers.js
│ └── resolve-target.js # Upstream target resolution
├── upstream/
│ ├── cache.js # Cache read helpers
│ └── fetch-upstream.js # Upstream transport and retries
└── utils/
├── validation.js # Request validation
├── security.js # Security utilities
└── performance.js # Performance monitoring
test/
├── features/ # Feature tests
├── platforms/ # Platform-specific tests
├── unit/ # Unit tests
├── index.test.js # Core Worker tests
└── integration.test.js # Integration tests
```
### Important Patterns
#### Protocol Detection Order
1. Check if Docker request (via `isDockerRequest()`)
2. Check if Git request (via `isGitRequest()`)
3. Check if Git LFS request (via `isGitLFSRequest()`)
4. Check if AI request (via `isAIInferenceRequest()`)
5. Default to standard file download
#### Adding a New Platform
1. Add platform entry to `PLATFORM_CATALOG` in `src/config/platform-catalog.js`
2. If special path transformation needed, add a transformer in
`src/routing/platform-transformers.js`
3. Add platform tests in `test/platforms/`
4. Update README.md with platform documentation
#### Retry Logic
- Retries up to `MAX_RETRIES` times with linear backoff
- Delay: `RETRY_DELAY_MS * attempts` (default: 1000ms, 2000ms, 3000ms)
- Retries on: Network errors, timeouts, 5xx errors
- Does NOT retry: 4xx errors (except Docker 401 which has special handling)
#### Error Handling
- All errors caught at top level in `handleRequest()`
- Errors converted to JSON responses via `createErrorResponse()`
- Performance metrics still added even on error paths
## Testing Guidelines
### Test Structure
- **Unit tests** (`test/unit/`): Test individual functions in isolation
- **Feature tests** (`test/features/`): Test specific features (auth, caching,
Git, performance)
- **Platform tests** (`test/platforms/`): Test platform-specific transformations
- **Integration tests** (`test/integration.test.js`): End-to-end request flows
### Running Specific Tests
```bash
# Run specific test file
npm run test:run test/unit/platforms.test.js
# Run tests matching pattern
npm run test:run -- --testNamePattern "Docker"
# Run with coverage
npm run test:coverage
```
### Common Test Patterns
```javascript
// Mock request creation
const request = new Request('http://localhost/gh/microsoft/vscode', {
method: 'GET',
headers: { 'User-Agent': 'git/2.34.1' }
});
// Mock environment
const env = {};
const ctx = { waitUntil: () => {} };
// Test the worker
const response = await worker.fetch(request, env, ctx);
expect(response.status).toBe(200);
```
## Deployment
### Cloudflare Workers
- Primary deployment target
- Uses GitHub Actions for CI/CD (`.github/workflows/workers.yml`)
- Requires `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID` secrets
### Cloudflare Pages
- Alternative deployment via adapter in `adapters/pages/`
- Auto-synced from `main` branch to `pages` branch
- Uses separate workflow (`.github/workflows/pages-cf.yml`)
### Other Platforms
- **Vercel/Netlify**: Uses Functions adapter in `adapters/functions/`
- **Deno Deploy**: Uses Functions adapter (compatible format)
- **Docker**: Multi-stage build using `workerd` runtime
### Environment Variables
Configure in Cloudflare Workers dashboard or via `wrangler.toml`:
- `TIMEOUT_SECONDS`: Override default timeout
- `MAX_RETRIES`: Override retry count
- `CACHE_DURATION`: Override cache TTL
- `ALLOWED_METHODS`: Override allowed HTTP methods (comma-separated)
- `ALLOWED_ORIGINS`: Override CORS origins (comma-separated)
## Important Notes
### Security Considerations
- Never log or expose Authorization headers
- Docker authentication tokens are stripped before S3 redirects
- All responses include security headers (HSTS, CSP, X-Frame-Options, etc.)
- Path length limited to prevent URL-based attacks (default: 2048 chars)
### Performance Optimization
- Use `ctx.waitUntil()` for cache writes to avoid blocking response
- Range requests leverage cache when possible
- Cloudflare edge caching (`cf` fetch options) for non-protocol requests
- HTTP/3 enabled for supported clients
### Git/Docker/AI Requests
- Skip normal caching mechanisms
- Allow POST/PUT/PATCH methods
- Preserve all upstream headers
- No performance headers added (to maintain protocol compatibility)
### URL Rewriting
- Only enabled for npm and PyPI platforms
- Rewrites responses to point to Xget instance instead of upstream
- Required for package managers to download dependencies through Xget
## Common Tasks
### Adding a New Platform
1. Add to `PLATFORM_CATALOG` in `src/config/platform-catalog.js`
2. If special transformation needed, update
`src/routing/platform-transformers.js`
3. Add test in `test/platforms/`
4. Update README.md documentation
5. Test locally with `npm run dev`
### Debugging Requests
1. Use `npm run dev` to start local server
2. Add `console.log()` statements in `src/app/handle-request.js` or the relevant
extracted pipeline module
3. Check Wrangler dev server output
4. Inspect `X-Performance-Metrics` header in responses
### Fixing Test Failures
1. Run specific failing test: `npm run test:run test/path/to/test.js`
2. Check mock setup matches actual request pattern
3. Verify platform configuration in `src/config/platform-catalog.js` and
`src/routing/platform-transformers.js`
4. Run all tests before committing: `npm run test:run`
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# 贡献者行为准则
## 我们的承诺
作为成员、贡献者和领导者,我们承诺让每个人都能在我们的社区中获得无骚扰的体验,无论其年龄、体型、明显或不明显的残疾、种族、性别特征、性别认同和表达、经验水平、教育程度、社会经济地位、国籍、外貌、种族、宗教或性取向如何。
我们承诺以有助于建立开放、友好、多元、包容和健康社区的方式行事和互动。
## 我们的标准
有助于为我们社区创造积极环境的行为示例包括:
* 对他人表现出同理心和善意
* 尊重不同的观点、看法和经历
* 给予并优雅地接受建设性反馈
* 承担责任并向受我们错误影响的人道歉,并从经验中学习
* 专注于不仅对我们个人最好,而且对整个社区最好的事情
不可接受的行为示例包括:
* 使用性化的语言或图像,以及任何形式的性关注或性挑逗
* 恶意评论、侮辱性或贬损性评论,以及个人或政治攻击
* 公开或私下骚扰
* 未经明确许可发布他人的私人信息,如物理地址或电子邮件地址
* 在专业环境中可能被合理认为不当的其他行为
## 执行责任
社区领导者有责任澄清和执行我们的可接受行为标准,并将对他们认为不当、威胁、冒犯或有害的任何行为采取适当和公平的纠正措施。
社区领导者有权利和责任删除、编辑或拒绝与本行为准则不符的评论、提交、代码、wiki 编辑、问题和其他贡献,并在适当时传达审核决定的原因。
## 适用范围
本行为准则适用于所有社区空间,也适用于个人在公共空间正式代表社区的情况。代表我们社区的示例包括使用官方电子邮件地址、通过官方社交媒体账户发布信息,或在线上或线下活动中担任指定代表。
## 执行
可以向负责执行的社区领导者报告滥用、骚扰或其他不可接受的行为,联系邮箱:<i@xi-xu.me>。
所有投诉都将得到及时和公正的审查和调查。
所有社区领导者都有义务尊重任何事件报告者的隐私和安全。
## 执行指南
社区领导者将遵循这些社区影响指南来确定他们认为违反本行为准则的任何行为的后果:
### 1. 纠正
**社区影响**:使用不当语言或其他被认为在社区中不专业或不受欢迎的行为。
**后果**:社区领导者的私人书面警告,澄清违规的性质并解释为什么该行为不当。可能会要求公开道歉。
### 2. 警告
**社区影响**:通过单一事件或一系列行为的违规。
**后果**:对持续行为后果的警告。在指定时间内不得与相关人员互动,包括与执行行为准则的人员进行主动互动。这包括避免在社区空间以及社交媒体等外部渠道中的互动。违反这些条款可能导致临时或永久禁令。
### 3. 临时禁令
**社区影响**:严重违反社区标准,包括持续的不当行为。
**后果**:在指定时间内禁止与社区进行任何形式的互动或公开交流。在此期间不允许与相关人员进行公开或私人互动,包括与执行行为准则的人员进行主动互动。违反这些条款可能导致永久禁令。
### 4. 永久禁令
**社区影响**:表现出违反社区标准的模式,包括持续的不当行为、对个人的骚扰或对某类个人的攻击或贬低。
**后果**:永久禁止在社区内进行任何形式的公开互动。
## 归属
本行为准则改编自[贡献者公约][homepage] 2.0 版,可在 <https://www.contributor-covenant.org/version/2/0/code_of_conduct.html> 获取。
社区影响指南的灵感来自 [Mozilla 的行为准则执行阶梯](https://github.com/mozilla/diversity)。
有关本行为准则常见问题的答案,请参阅 <https://www.contributor-covenant.org/faq> 的常见问题解答。翻译版本可在 <https://www.contributor-covenant.org/translations> 获取。
[homepage]: https://www.contributor-covenant.org
================================================
FILE: CONTRIBUTING.md
================================================
# 贡献指南
感谢您对 Xget 的关注!我们欢迎各种形式的贡献,包括但不限于代码、文档、测试、反馈和建议。
## 🤝 贡献方式
### 报告问题
- 使用
[Issue 模板](https://github.com/xixu-me/Xget/issues/new/choose)报告 bug 或提出功能请求
- 搜索现有 issues 避免重复报告
- 提供详细的重现步骤和环境信息
### 提交代码
- fork 存储库到您的 GitHub 账户
- 创建功能分支 (`git checkout -b feature/amazing-feature`)
- 安装依赖以启用本地 Git hooks (`npm install`)
- 使用 Conventional
Commits 提交更改 (`git commit -m 'feat(platforms): add amazing feature'`)
- 推送到分支 (`git push origin feature/amazing-feature`)
- 创建 Pull Request
### 改进文档
- 修正文档中的错误或不准确信息
- 添加使用示例和最佳实践
- 翻译文档到其他语言
- 改进代码注释和 API 文档
## 🛠️ 开发环境设置
### 前置要求
- Node.js 18+
- npm 或 yarn
- Git
- Cloudflare 账户(用于测试部署)
### 本地开发
```bash
# 克隆存储库
git clone https://github.com/xixu-me/Xget.git
cd Xget
# 安装依赖
npm install
# 安装后会自动启用 commit-msg hook
# 启动开发服务器
npm run dev
# 单次运行测试
npm run test:run
# 代码格式化
npm run format
# 代码检查
npm run lint
```
## 📝 代码规范
### 代码风格
- 使用 2 个空格缩进
- 使用分号结尾
- 使用单引号字符串
- 遵循 ESLint 配置规则
### 命名约定
- 变量和函数使用 camelCase
- 常量使用 UPPER_SNAKE_CASE
- 类名使用 PascalCase
- 文件名使用 kebab-case
### 注释规范
```javascript
/**
* 函数描述
* @param {string} param1 - 参数1描述
* @param {Object} param2 - 参数2描述
* @returns {Promise<Response>} 返回值描述
*/
function exampleFunction(param1, param2) {
// 实现逻辑
}
```
## 🧪 测试
### 测试类型
- **单元测试**: 测试单个函数和模块
- **集成测试**: 测试组件间的交互
- **端到端测试**: 测试完整的用户场景
### 运行测试
```bash
# 单次运行所有测试
npm run test:run
# 运行特定测试文件
npm run test:run test/platforms/jenkins.test.js
# 按测试名称筛选
npm run test:run -- --testNamePattern "platform"
# 生成测试覆盖率报告
npm run test:coverage
```
### 编写测试
- 为新功能编写相应的测试
- 确保测试覆盖率不低于 80%
- 使用描述性的测试名称
- 测试边界情况和错误处理
## 🚀 提交规范
### Commit 消息格式
使用 [Conventional Commits](https://www.conventionalcommits.org/) 规范:
```
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
```
### 类型说明
- `feat`: 新功能
- `fix`: 修复 bug
- `docs`: 文档更新
- `style`: 代码格式化(不影响功能)
- `refactor`: 代码重构
- `perf`: 性能优化
- `test`: 测试相关
- `chore`: 构建过程或辅助工具的变动
### 示例
```bash
feat(platforms): add support for Bitbucket
fix(cache): resolve cache invalidation issue
docs(readme): update installation instructions
perf(proxy): optimize request handling performance
```
### 自动校验
- `npm install` 会自动安装 `commit-msg` hook,在本地阻止不符合规范的提交
- GitHub Actions 会在 `push` 和 `pull_request`
中再次校验提交消息,防止绕过本地 hook
## 🔍 Pull Request 流程
### 提交前检查
- [ ] 代码通过所有测试
- [ ] 代码符合存储库规范
- [ ] 添加了必要的测试
- [ ] 更新了相关文档
- [ ] Commit 消息符合规范
### PR 描述模板
请使用 [PR 模板](.github/pull_request_template.md)填写详细信息。
### 代码审查
- 所有 PR 需要至少一个维护者的审查
- 解决审查中提出的问题
- 保持 PR 的焦点明确,避免混合多个不相关的更改
## 🌟 贡献认可
### 贡献者列表
我们会在 README.md 中维护贡献者列表,感谢每一位贡献者的付出。
### 贡献统计
- 代码贡献会在 GitHub 贡献图中显示
- 重要贡献会在 Release Notes 中特别提及
- 长期贡献者可能被邀请成为存储库维护者
## 📋 开发任务
### 当前优先级
1. **性能优化**: 提升缓存效率和响应速度
2. **平台支持**: 添加新的代码托管和包管理平台
3. **安全增强**: 加强请求验证和安全防护
4. **监控改进**: 完善性能监控和错误追踪
### 适合新手的任务
查找标有 `good first issue` 标签的 issues,这些通常是:
- 文档改进
- 简单的 bug 修复
- 代码格式化
- 测试用例添加
## 🤔 获取帮助
### 沟通渠道
- **GitHub Issues**: 报告问题和功能请求
- **Email**: 敏感问题可发送至维护者邮箱
### 常见问题
**Q: 如何添加新平台支持?** A: 在 `src/config/platform-catalog.js`
中添加平台地址;如果需要特殊路径转换,再更新
`src/routing/platform-transformers.js`,然后补充相关文档和测试。
**Q: 如何测试 Cloudflare Workers 功能?** A: 使用 `npm run dev`
启动本地开发服务器,或部署到 Cloudflare Workers 测试环境。
**Q: 如何处理跨域问题?** A: 检查 CORS 配置,确保允许的源和方法设置正确。
## 📄 许可证
通过贡献代码,您同意您的贡献将在与存储库相同的 [AGPL-3.0 许可证](LICENSE)
下发布。
## 🙏 致谢
感谢所有为 Xget 做出贡献的开发者、测试者和用户。您的支持和反馈是存储库持续改进的动力!
---
如果您有任何问题或建议,请随时通过 GitHub Issues 与我们联系。我们期待您的参与!
================================================
FILE: Dockerfile
================================================
# --- Stage 1: build the Worker with Wrangler -----------------------
FROM node:25-alpine AS builder
WORKDIR /app
# Install dependencies & wrangler
COPY package*.json wrangler.toml ./
RUN npm ci
# Copy source and build
COPY src ./src
RUN npx wrangler deploy --dry-run --outdir=dist
# --- Stage 2: minimal runtime with workerd -------------------------
FROM node:25-slim AS runtime
ARG TARGETARCH
# Install ca-certificates for SSL, then install workerd via npm
RUN apt-get update && \
apt-get install -y ca-certificates && \
rm -rf /var/lib/apt/lists/* && \
case "${TARGETARCH}" in \
amd64) WORKERD_PKG="@cloudflare/workerd-linux-64" ;; \
arm64) WORKERD_PKG="@cloudflare/workerd-linux-arm64" ;; \
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \
esac && \
npm install -g "${WORKERD_PKG}" && \
ln -s "/usr/local/lib/node_modules/${WORKERD_PKG}/bin/workerd" /usr/local/bin/workerd && \
workerd --version
WORKDIR /worker
# Bring in the compiled Worker bundle and config
COPY --from=builder /app/dist ./dist
COPY config.capnp ./config.capnp
# Expose the port workerd listens on
EXPOSE 8080
CMD ["workerd", "serve", "config.capnp"]
================================================
FILE: LICENSE
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
================================================
FILE: README.md
================================================
<div align="center">
# Xget 🚀
<a href="https://trendshift.io/repositories/14768" target="_blank"><img src="https://trendshift.io/api/badge/repositories/14768" alt="xixu-me%2FXget | Trendshift" width="250" height="55"/></a>
[](https://zread.ai/xixu-me/Xget)
[](https://deepwiki.com/xixu-me/Xget)
[](https://codecov.io/github/xixu-me/xget)
[](#-ecosystem-integration)
[](#-ecosystem-integration)
[](#deploy-to-cloudflare-workers)
[](#deploy-to-edgeone-pages)
[](#deploy-to-vercel)
[](#deploy-to-netlify)
[](#deploy-to-deno-deploy)
[](#self-hosted-deployment)
[](#self-hosted-deployment)
**English** | [汉语(简体)](README.zh-Hans.md) |
[漢語(繁體)](README.zh-Hant.md)
</div>
[](#github)
[](#gitlab)
[](#gitea)
[](#codeberg)
[](#sourceforge)
[](#aosp-android-open-source-project)
[](#hugging-face-mirror)
[](#civitai-ai-model-platform)
[](#npm-package-acceleration)
[](#python-package-acceleration)
[](#conda-package-acceleration)
[](#maven-package-acceleration)
[](#apache-software-download-acceleration)
[](#gradle-package-acceleration)
[](#homebrew-package-acceleration)
[](#ruby-package-acceleration)
[](#r-package-acceleration)
[](#perl-package-acceleration)
[](#texlatex-package-acceleration)
[](#go-module-acceleration)
[](#nuget-package-acceleration)
[](#rust-package-acceleration)
[](#php-package-acceleration)
[](#flathub-repository-mirror)
[](#debianubuntu-apt-configuration)
[](#debianubuntu-apt-configuration)
[](#fedora-dnf-configuration)
[](#rocky-linux-dnf-configuration)
[](#opensuse-zypper-configuration)
[](#arch-linux-pacman-configuration)
[](#arxiv-paper-download)
[](#f-droid-repository-mirror)
[](#jenkins-plugin-download)
[](#container-registries)
[](#ai-inference-providers)
Ultra-high-performance, secure, all-in-one acceleration engine for developer
resources that significantly outperforms traditional solutions, delivering
unified, efficient acceleration across code repositories, model and dataset
hubs, package registries, container registries, AI inference providers, and
more.
In-depth technical analysis article published:
**_[Deep Dive into Xget: A High-Performance, Multi-Protocol, and Secure Acceleration Engine for Developer Resources](https://blog.xi-xu.me/en/2025/10/07/Deep-Dive-into-Xget.html)_**.
Xget was invited to join the
[GitCode platform](https://gitcode.com/xixu-me/xget) and recognized as a G-Star
graduation project. It has also received spontaneous recommendations from
several well-known tech creators, including
[Ruan Yifeng](https://www.ruanyifeng.com/blog/2025/12/weekly-issue-379.html#:~:text=Xget),
[GitHubDaily](https://x.com/i/status/1956204203937829256),
[FishC](https://www.bilibili.com/video/BV1EeeBzVEop/), and
[Xuanli 199](https://www.bilibili.com/video/BV197hqzsE8Y/?t=8). Sincere thanks
to GitCode and every creator, reader, and user who helped more people discover
Xget.
## 🎯 Quick Start
**Pre-deployed Instance (no reliability guarantee): `xget.xi-xu.me`**
**URL Converter:** [**`xuc.xi-xu.me`**](https://xuc.xi-xu.me) - Convert any
supported platform URL to Xget's acceleration format with one click
**Agent Skills:** [**`skills/xget/`**](skills/xget/) - Designed to work as a
standalone `/xget` directory in a skills installation
## 🌟 Core Advantages - Why Choose Xget?
### ⚡ Extreme Performance - Breaking Through Traditional Accelerator Bottlenecks
- **⚡ Millisecond Response**: Cloudflare's global 330+ edge nodes, average
response time < 50ms
- **🌐 HTTP/3 Ultra-Fast Protocol**: Latest HTTP/3 protocol enabled, 40%
reduction in connection latency, 30% increase in transmission speed
- **📦 Intelligent Multi-Compression**: Triple compression algorithms (gzip,
deflate, brotli), 60% improvement in transmission efficiency
- **🔗 Zero-Latency Pre-Connection**: Connection warm-up and keep-alive,
eliminating handshake overhead for second-level responses
- **⚡ Parallel Chunked Download**: Full support for HTTP Range requests,
multiplied multi-threaded download speeds
- **🎯 Smart Routing Optimization**: Automatically selects optimal transmission
paths, avoiding network congestion nodes
### 🌐 Deep Multi-Platform Integration
- **All-in-One Multi-Platform Support**: Unified support for mainstream
platforms in various development scenarios
- **Intelligent Recognition and Conversion**: Automatically recognizes platform
prefixes and converts to correct URL structures for target platforms
- **Consistent Acceleration Experience**: Enjoy unified and stable ultra-fast
download experience regardless of file type or source
### 🔒 Enterprise-Grade Security
- **Multi-Layer Security Headers**:
- `Strict-Transport-Security`: Enforces HTTPS transmission, prevents
man-in-the-middle attacks
- `X-Frame-Options: DENY`: Prevents clickjacking attacks
- `X-XSS-Protection`: Built-in XSS protection mechanism
- `Content-Security-Policy`: Strict content security policy
- `Referrer-Policy`: Controls referrer information leakage
- **Request Validation Mechanism**:
- HTTP method whitelist: Regular requests limited to GET/HEAD, while Git/LFS,
container registry, AI inference, and Hugging Face API traffic allow `POST`,
`PUT`, `PATCH`, and `DELETE` as needed
- Path length limit: Prevents excessively long URL attacks (max 2048
characters)
- Input sanitization: Prevents path traversal and injection attacks
- **Timeout Protection**: 30-second request timeout, prevents resource
exhaustion and malicious requests
### 🚀 Modern Architecture and Reliability
- **Intelligent Retry Mechanism**:
- Maximum 3 retries with linear delay strategy (1000ms × retry count)
- Automatic error recovery, improved download success rate
- Timeout detection and interruption handling
- **Efficient Caching Strategy**:
- 1800 seconds (30 minutes) default cache duration, significantly reduces
origin server pressure
- Git operations skip caching to ensure real-time data
- Edge caching based on Cloudflare Cache API
- **Performance Monitoring System**:
- Built-in `PerformanceMonitor` class for real-time tracking of request stage
durations
- Detailed performance data provided via `X-Performance-Metrics` response
header
- Cache hit rate statistics and optimization recommendations
### 🎯 Full Git Protocol Compatibility
- **Smart Protocol Detection**:
- Automatically recognizes Git-specific endpoints (`/info/refs`,
`/git-upload-pack`, `/git-receive-pack`)
- Detects Git client User-Agent patterns
- Supports query parameters like `service=git-upload-pack`
- **Complete Operation Support**:
- `git clone`: Full repository cloning, supports shallow clones and branch
specification
- `git push`: Code push and branch management
- `git pull/fetch`: Incremental updates and remote synchronization
- `git submodule`: Recursive submodule cloning
- **Protocol Optimization**:
- Preserves Git-specific request headers and authentication information
- Smart User-Agent handling (default `git/2.34.1`)
- Supports Git LFS large file transfer
### 📱 Ecosystem Integration
- **Dedicated Browser Extension**:
[Xget Now](https://github.com/xixu-me/Xget-Now) provides seamless experience
- Automatic URL redirection, no manual URL modification needed
- Support for custom Xget instance domains
- Multi-platform preference settings and blacklist/whitelist management
- Local processing ensures privacy and security
- **Download Tool Compatibility**: Perfect support for wget, cURL, aria2, IDM,
and other mainstream download tools
- **CI/CD Integration**: Can be used directly in GitHub Actions, GitLab CI, and
other environments
## 🏗️ System Architecture
### Request Processing Flow
```mermaid
graph TD
Request[User Request / User-Agent] --> Identify{Identify Platform}
Identify -->|Invalid| Error[Return Error]
Identify -->|Valid| Transform[Transform Path]
Transform --> CheckProtocol{Check Protocol}
CheckProtocol -->|Git| GitHandler[Git Protocol Adapter]
CheckProtocol -->|Docker| DockerHandler[Docker Protocol Adapter]
CheckProtocol -->|AI| AIHandler[AI Inference Adapter]
CheckProtocol -->|Standard| StdHandler[Standard Adapter]
GitHandler --> Upstream[Fetch Upstream]
DockerHandler --> Upstream
AIHandler --> Upstream
StdHandler --> CacheCheck{Check Cache}
CacheCheck -->|Hit| ReturnCache[Return Cached Response]
CacheCheck -->|Miss| Upstream
Upstream -->|Success| ProcessResponse[Process Response]
Upstream -->|Failure| Retry{Retry?}
Retry -->|Yes| Wait["Wait (Backoff)"] --> Upstream
Retry -->|No| Error
ProcessResponse --> Finalize[Add Headers & Return]
Finalize --> Response[Response]
```
### Component Architecture
```mermaid
classDiagram
class Worker {
+fetch(request)
}
class AppHandler {
+handleRequest(request, env, ctx)
}
class PlatformCatalog {
+PLATFORM_CATALOG
}
class PlatformRouting {
+transformPath()
+resolveTarget()
}
class Validation {
+validateRequest()
+isDockerRequest()
}
class GitProtocol {
+configureGitHeaders()
+isGitRequest()
}
class DockerProtocol {
+handleDockerAuth()
+fetchToken()
}
class AIProtocol {
+configureAIHeaders()
}
class UpstreamPipeline {
+tryReadCachedResponse()
+fetchUpstreamResponse()
}
class ResponsePipeline {
+finalizeResponse()
}
class Security {
+addSecurityHeaders()
}
class Performance {
+monitor()
}
Worker --> AppHandler
AppHandler --> PlatformCatalog
AppHandler --> PlatformRouting
AppHandler --> Validation
AppHandler --> GitProtocol
AppHandler --> DockerProtocol
AppHandler --> AIProtocol
AppHandler --> UpstreamPipeline
AppHandler --> ResponsePipeline
AppHandler --> Security
AppHandler --> Performance
PlatformRouting --> PlatformCatalog
```
## 📖 URL Conversion Rules
Using the pre-deployed instance **`xget.xi-xu.me`** or your own deployed
instance, simply replace the domain and add the platform prefix:
### Conversion Format
| Platform | Platform Prefix | Original URL Format | Accelerated URL Format |
| ---------------------- | --------------- | -------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| GitHub | `gh` | `https://github.com/...` | `https://xget.xi-xu.me/gh/...` |
| GitHub Gist | `gist` | `https://gist.github.com/...` | `https://xget.xi-xu.me/gist/...` |
| GitLab | `gl` | `https://gitlab.com/...` | `https://xget.xi-xu.me/gl/...` |
| Gitea | `gitea` | `https://gitea.com/...` | `https://xget.xi-xu.me/gitea/...` |
| Codeberg | `codeberg` | `https://codeberg.org/...` | `https://xget.xi-xu.me/codeberg/...` |
| SourceForge | `sf` | `https://sourceforge.net/...` | `https://xget.xi-xu.me/sf/...` |
| AOSP | `aosp` | `https://android.googlesource.com/...` | `https://xget.xi-xu.me/aosp/...` |
| Hugging Face | `hf` | `https://huggingface.co/...` | `https://xget.xi-xu.me/hf/...` |
| Civitai | `civitai` | `https://civitai.com/...` | `https://xget.xi-xu.me/civitai/...` |
| npm | `npm` | `https://registry.npmjs.org/...` | `https://xget.xi-xu.me/npm/...` |
| PyPI | `pypi` | `https://pypi.org/...` | `https://xget.xi-xu.me/pypi/...` |
| conda | `conda` | `https://repo.anaconda.com/...` and `https://conda.anaconda.org/...` | `https://xget.xi-xu.me/conda/...` and `https://xget.xi-xu.me/conda/community/...` |
| Maven | `maven` | `https://repo1.maven.org/...` | `https://xget.xi-xu.me/maven/...` |
| Apache | `apache` | `https://downloads.apache.org/...` | `https://xget.xi-xu.me/apache/...` |
| Gradle | `gradle` | `https://plugins.gradle.org/...` | `https://xget.xi-xu.me/gradle/...` |
| Homebrew | `homebrew` | `https://github.com/Homebrew/...` | `https://xget.xi-xu.me/homebrew/...` |
| RubyGems | `rubygems` | `https://rubygems.org/...` | `https://xget.xi-xu.me/rubygems/...` |
| CRAN | `cran` | `https://cran.r-project.org/...` | `https://xget.xi-xu.me/cran/...` |
| CPAN | `cpan` | `https://www.cpan.org/...` | `https://xget.xi-xu.me/cpan/...` |
| CTAN | `ctan` | `https://tug.ctan.org/...` | `https://xget.xi-xu.me/ctan/...` |
| Go Modules | `golang` | `https://proxy.golang.org/...` | `https://xget.xi-xu.me/golang/...` |
| NuGet | `nuget` | `https://api.nuget.org/...` | `https://xget.xi-xu.me/nuget/...` |
| Rust Crates | `crates` | `https://crates.io/...` | `https://xget.xi-xu.me/crates/...` |
| Packagist | `packagist` | `https://repo.packagist.org/...` | `https://xget.xi-xu.me/packagist/...` |
| Flathub | `flathub` | `https://dl.flathub.org/...` | `https://xget.xi-xu.me/flathub/...` |
| Debian | `debian` | `https://deb.debian.org/...` | `https://xget.xi-xu.me/debian/...` |
| Ubuntu | `ubuntu` | `https://archive.ubuntu.com/...` | `https://xget.xi-xu.me/ubuntu/...` |
| Fedora | `fedora` | `https://dl.fedoraproject.org/...` | `https://xget.xi-xu.me/fedora/...` |
| Rocky Linux | `rocky` | `https://download.rockylinux.org/...` | `https://xget.xi-xu.me/rocky/...` |
| openSUSE | `opensuse` | `https://download.opensuse.org/...` | `https://xget.xi-xu.me/opensuse/...` |
| Arch Linux | `arch` | `https://geo.mirror.pkgbuild.com/...` | `https://xget.xi-xu.me/arch/...` |
| arXiv | `arxiv` | `https://arxiv.org/...` | `https://xget.xi-xu.me/arxiv/...` |
| F-Droid | `fdroid` | `https://f-droid.org/...` | `https://xget.xi-xu.me/fdroid/...` |
| Jenkins Plugins | `jenkins` | `https://updates.jenkins.io/...` | `https://xget.xi-xu.me/jenkins/...` |
| Container Registries | `cr` | See [Container Registries](#container-registries) | See [Container Registries](#container-registries) |
| AI Inference Providers | `ip` | See [AI Inference Providers](#ai-inference-providers) | See [AI Inference Providers](#ai-inference-providers) |
### Platform Conversion Examples
#### GitHub
```url
# Original URL
https://github.com/microsoft/vscode/archive/refs/heads/main.zip
# Converted (add gh prefix)
https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip
```
#### GitHub Gist
```url
# Original URL
https://gist.github.com/xixu-me/e2ea9db6b1f143892495f796fef18631/raw/3b8807172ee492d0da3a7e370b0fb88fc97b53e6/Free-ChatGPT-Paid-Plan.md
# Converted (add gist prefix)
https://xget.xi-xu.me/gist/xixu-me/e2ea9db6b1f143892495f796fef18631/raw/3b8807172ee492d0da3a7e370b0fb88fc97b53e6/Free-ChatGPT-Paid-Plan.md
```
#### GitLab
```url
# Original URL
https://gitlab.com/gitlab-org/gitlab/-/archive/master/gitlab-master.zip
# Converted (add gl prefix)
https://xget.xi-xu.me/gl/gitlab-org/gitlab/-/archive/master/gitlab-master.zip
```
#### Gitea
```url
# Original URL
https://gitea.com/gitea/gitea/archive/master.zip
# Converted (add gitea prefix)
https://xget.xi-xu.me/gitea/gitea/gitea/archive/master.zip
```
#### Codeberg
```url
# Original URL
https://codeberg.org/forgejo/forgejo/archive/forgejo.zip
# Converted (add codeberg prefix)
https://xget.xi-xu.me/codeberg/forgejo/forgejo/archive/forgejo.zip
```
#### SourceForge
```url
# Original URL
https://sourceforge.net/projects/sevenzip/files/7-Zip/23.01/7z2301-x64.exe/download
# Converted (add sf prefix)
https://xget.xi-xu.me/sf/projects/sevenzip/files/7-Zip/23.01/7z2301-x64.exe/download
```
#### AOSP (Android Open Source Project)
```url
# AOSP project original URL
https://android.googlesource.com/platform/frameworks/base
# Converted (add aosp prefix)
https://xget.xi-xu.me/aosp/platform/frameworks/base
# AOSP device tree original URL
https://android.googlesource.com/device/google/pixel
# Converted (add aosp prefix)
https://xget.xi-xu.me/aosp/device/google/pixel
```
#### Hugging Face
```url
# Model file original URL
https://huggingface.co/microsoft/DialoGPT-medium/resolve/main/pytorch_model.bin
# Converted (add hf prefix)
https://xget.xi-xu.me/hf/microsoft/DialoGPT-medium/resolve/main/pytorch_model.bin
# Dataset file original URL
https://huggingface.co/datasets/rajpurkar/squad/resolve/main/plain_text/train-00000-of-00001.parquet
# Converted (add hf prefix)
https://xget.xi-xu.me/hf/datasets/rajpurkar/squad/resolve/main/plain_text/train-00000-of-00001.parquet
```
#### Civitai
```url
# AI model download original URL
https://civitai.com/api/download/models/128713
# Converted (add civitai prefix)
https://xget.xi-xu.me/civitai/api/download/models/128713
# Model API original URL
https://civitai.com/api/v1/models/7240
# Converted (add civitai prefix)
https://xget.xi-xu.me/civitai/api/v1/models/7240
# Model version API original URL
https://civitai.com/api/v1/model-versions/128713
# Converted (add civitai prefix)
https://xget.xi-xu.me/civitai/api/v1/model-versions/128713
```
#### npm
```url
# Package file original URL
https://registry.npmjs.org/react/-/react-18.2.0.tgz
# Converted (add npm prefix)
https://xget.xi-xu.me/npm/react/-/react-18.2.0.tgz
# Package metadata original URL
https://registry.npmjs.org/lodash
# Converted (add npm prefix)
https://xget.xi-xu.me/npm/lodash
```
#### PyPI
```url
# Python package file original URL
https://pypi.org/packages/source/r/requests/requests-2.31.0.tar.gz
# Converted (add pypi prefix)
https://xget.xi-xu.me/pypi/packages/source/r/requests/requests-2.31.0.tar.gz
# Wheel file original URL
https://pypi.org/packages/py3/r/requests/requests-2.31.0-py3-none-any.whl
# Converted (add pypi prefix)
https://xget.xi-xu.me/pypi/packages/py3/r/requests/requests-2.31.0-py3-none-any.whl
```
#### conda
```url
# Default channel package file original URL
https://repo.anaconda.com/pkgs/main/linux-64/numpy-1.24.3-py311h08b1b3b_1.conda
# Converted (add conda prefix)
https://xget.xi-xu.me/conda/pkgs/main/linux-64/numpy-1.24.3-py311h08b1b3b_1.conda
# Community channel metadata original URL
https://conda.anaconda.org/conda-forge/linux-64/repodata.json
# Converted (add conda/community prefix)
https://xget.xi-xu.me/conda/community/conda-forge/linux-64/repodata.json
```
#### Maven
```url
# Maven Central Repository JAR file original URL
https://repo1.maven.org/maven2/org/springframework/spring-core/5.3.21/spring-core-5.3.21.jar
# Converted (add maven prefix)
https://xget.xi-xu.me/maven/maven2/org/springframework/spring-core/5.3.21/spring-core-5.3.21.jar
# Maven metadata original URL
https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/maven-metadata.xml
# Converted (add maven prefix)
https://xget.xi-xu.me/maven/maven2/org/apache/commons/commons-lang3/maven-metadata.xml
```
#### Apache Software Download
```url
# Apache software download original URL
https://downloads.apache.org/kafka/3.6.1/kafka_2.13-3.6.1.tgz
# Converted (add apache prefix)
https://xget.xi-xu.me/apache/kafka/3.6.1/kafka_2.13-3.6.1.tgz
# Apache Maven download original URL
https://downloads.apache.org/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz
# Converted (add apache prefix)
https://xget.xi-xu.me/apache/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz
# Apache Spark download original URL
https://downloads.apache.org/spark/spark-3.5.0/spark-3.5.0-bin-hadoop3.tgz
# Converted (add apache prefix)
https://xget.xi-xu.me/apache/spark/spark-3.5.0/spark-3.5.0-bin-hadoop3.tgz
```
#### Gradle
```url
# Gradle plugin portal JAR file original URL
https://plugins.gradle.org/m2/org/gradle/gradle-hello-world-plugin/0.2/gradle-hello-world-plugin-0.2.jar
# Converted (add gradle prefix)
https://xget.xi-xu.me/gradle/m2/org/gradle/gradle-hello-world-plugin/0.2/gradle-hello-world-plugin-0.2.jar
# Gradle plugin metadata original URL
https://plugins.gradle.org/m2/com/github/ben-manes/gradle-versions-plugin/0.51.0/gradle-versions-plugin-0.51.0.module
# Converted (add gradle prefix)
https://xget.xi-xu.me/gradle/m2/com/github/ben-manes/gradle-versions-plugin/0.51.0/gradle-versions-plugin-0.51.0.module
```
#### Homebrew
```url
# Homebrew formula repository original URL
https://github.com/Homebrew/homebrew-core/raw/HEAD/Formula/g/git.rb
# Converted (add homebrew prefix)
https://xget.xi-xu.me/homebrew/homebrew-core/raw/HEAD/Formula/g/git.rb
# Homebrew API original URL
https://formulae.brew.sh/api/formula/git.json
# Converted (add homebrew/api prefix)
https://xget.xi-xu.me/homebrew/api/formula/git.json
# Homebrew Bottles original URL
https://ghcr.io/v2/homebrew/core/git/manifests/2.39.0
# Converted (add homebrew/bottles prefix)
https://xget.xi-xu.me/homebrew/bottles/v2/homebrew/core/git/manifests/2.39.0
```
#### RubyGems
```url
# RubyGems package file original URL
https://rubygems.org/gems/rails-7.0.4.gem
# Converted (add rubygems prefix)
https://xget.xi-xu.me/rubygems/gems/rails-7.0.4.gem
# RubyGems API original URL
https://rubygems.org/api/v1/gems/nokogiri.json
# Converted (add rubygems prefix)
https://xget.xi-xu.me/rubygems/api/v1/gems/nokogiri.json
```
#### CRAN
```url
# CRAN package file original URL
https://cran.r-project.org/src/contrib/ggplot2_3.5.2.tar.gz
# Converted (add cran prefix)
https://xget.xi-xu.me/cran/src/contrib/ggplot2_3.5.2.tar.gz
# CRAN package metadata original URL
https://cran.r-project.org/web/packages/dplyr/DESCRIPTION
# Converted (add cran prefix)
https://xget.xi-xu.me/cran/web/packages/dplyr/DESCRIPTION
```
#### CPAN (Perl Package Management)
```url
# CPAN module original URL
https://www.cpan.org/modules/by-module/DBI/DBI-1.643.tar.gz
# Converted (add cpan prefix)
https://xget.xi-xu.me/cpan/modules/by-module/DBI/DBI-1.643.tar.gz
# CPAN author package original URL
https://www.cpan.org/authors/id/T/TI/TIMB/DBI-1.643.tar.gz
# Converted (add cpan prefix)
https://xget.xi-xu.me/cpan/authors/id/T/TI/TIMB/DBI-1.643.tar.gz
```
#### CTAN (TeX/LaTeX Package Management)
```url
# CTAN package file original URL
https://tug.ctan.org/tex-archive/macros/latex/contrib/beamer.zip
# Converted (add ctan prefix)
https://xget.xi-xu.me/ctan/tex-archive/macros/latex/contrib/beamer.zip
# CTAN font file original URL
https://tug.ctan.org/tex-archive/fonts/cm/pk/ljfour/public/cm/dpi600/cmr10.pk
# Converted (add ctan prefix)
https://xget.xi-xu.me/ctan/tex-archive/fonts/cm/pk/ljfour/public/cm/dpi600/cmr10.pk
```
#### Go Modules
```url
# Go module proxy original URL
https://proxy.golang.org/github.com/gin-gonic/gin/@v/v1.9.1.zip
# Converted (add golang prefix)
https://xget.xi-xu.me/golang/github.com/gin-gonic/gin/@v/v1.9.1.zip
# Go module info original URL
https://proxy.golang.org/github.com/gorilla/mux/@v/list
# Converted (add golang prefix)
https://xget.xi-xu.me/golang/github.com/gorilla/mux/@v/list
```
#### NuGet
```url
# NuGet package download original URL
https://api.nuget.org/v3-flatcontainer/newtonsoft.json/13.0.3/newtonsoft.json.13.0.3.nupkg
# Converted (add nuget prefix)
https://xget.xi-xu.me/nuget/v3-flatcontainer/newtonsoft.json/13.0.3/newtonsoft.json.13.0.3.nupkg
# NuGet package metadata original URL
https://api.nuget.org/v3/registration5-semver1/microsoft.aspnetcore.app/index.json
# Converted (add nuget prefix)
https://xget.xi-xu.me/nuget/v3/registration5-semver1/microsoft.aspnetcore.app/index.json
```
#### Rust Crates
```url
# Crate download original URL
https://crates.io/api/v1/crates/serde/1.0.0/download
# Converted (add crates prefix)
https://xget.xi-xu.me/crates/serde/1.0.0/download
# Crate metadata original URL
https://crates.io/api/v1/crates/serde
# Converted (add crates prefix)
https://xget.xi-xu.me/crates/serde
# Crate search original URL
https://crates.io/api/v1/crates?q=serde
# Converted (add crates prefix)
https://xget.xi-xu.me/crates/?q=serde
```
#### Packagist
```url
# Packagist package metadata original URL
https://repo.packagist.org/p2/symfony/console.json
# Converted (add packagist prefix)
https://xget.xi-xu.me/packagist/p2/symfony/console.json
# Packagist package list original URL
https://repo.packagist.org/packages/list.json
# Converted (add packagist prefix)
https://xget.xi-xu.me/packagist/packages/list.json
```
#### Flathub
```url
# Flathub repository original URL
https://dl.flathub.org/repo/summary
# Converted (add flathub prefix)
https://xget.xi-xu.me/flathub/repo/summary
# Flathub app reference original URL
https://dl.flathub.org/repo/appstream/org.gnome.gedit.flatpakref
# Converted (add flathub prefix)
https://xget.xi-xu.me/flathub/repo/appstream/org.gnome.gedit.flatpakref
```
#### Linux Distributions
```url
# Debian package original URL
https://deb.debian.org/debian/pool/main/c/curl/curl_7.88.1-10+deb12u4_amd64.deb
# Converted (add debian prefix)
https://xget.xi-xu.me/debian/debian/pool/main/c/curl/curl_7.88.1-10+deb12u4_amd64.deb
# Ubuntu package original URL
https://archive.ubuntu.com/ubuntu/pool/main/g/git/git_2.34.1-1ubuntu1.9_amd64.deb
# Converted (add ubuntu prefix)
https://xget.xi-xu.me/ubuntu/ubuntu/pool/main/g/git/git_2.34.1-1ubuntu1.9_amd64.deb
# Fedora package original URL
https://dl.fedoraproject.org/pub/fedora/linux/releases/39/Everything/x86_64/os/Packages/n/nginx-1.24.0-1.fc39.x86_64.rpm
# Converted (add fedora prefix)
https://xget.xi-xu.me/fedora/pub/fedora/linux/releases/39/Everything/x86_64/os/Packages/n/nginx-1.24.0-1.fc39.x86_64.rpm
# Rocky Linux package original URL
https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/b/bash-5.1.8-6.el9.x86_64.rpm
# Converted (add rocky prefix)
https://xget.xi-xu.me/rocky/pub/rocky/9/BaseOS/x86_64/os/Packages/b/bash-5.1.8-6.el9.x86_64.rpm
# openSUSE package original URL
https://download.opensuse.org/distribution/leap/15.5/repo/oss/x86_64/vim-9.0.1572-150500.20.8.1.x86_64.rpm
# Converted (add opensuse prefix)
https://xget.xi-xu.me/opensuse/distribution/leap/15.5/repo/oss/x86_64/vim-9.0.1572-150500.20.8.1.x86_64.rpm
# Arch Linux package original URL
https://geo.mirror.pkgbuild.com/core/os/x86_64/linux-6.6.10.arch1-1-x86_64.pkg.tar.zst
# Converted (add arch prefix)
https://xget.xi-xu.me/arch/core/os/x86_64/linux-6.6.10.arch1-1-x86_64.pkg.tar.zst
```
#### arXiv
```url
# arXiv paper PDF original URL
https://arxiv.org/pdf/2301.07041.pdf
# Converted (add arxiv prefix)
https://xget.xi-xu.me/arxiv/pdf/2301.07041.pdf
# arXiv paper source original URL
https://arxiv.org/e-print/2301.07041
# Converted (add arxiv prefix)
https://xget.xi-xu.me/arxiv/e-print/2301.07041
```
#### F-Droid
```url
# F-Droid app APK original URL
https://f-droid.org/repo/org.fdroid.fdroid_1016050.apk
# Converted (add fdroid prefix)
https://xget.xi-xu.me/fdroid/repo/org.fdroid.fdroid_1016050.apk
# F-Droid app metadata original URL
https://f-droid.org/api/v1/packages/org.fdroid.fdroid
# Converted (add fdroid prefix)
https://xget.xi-xu.me/fdroid/api/v1/packages/org.fdroid.fdroid
```
#### Jenkins Plugins
```url
# Jenkins update center original URL
https://updates.jenkins.io/update-center.json
# Converted (add jenkins prefix)
https://xget.xi-xu.me/jenkins/update-center.json
# Jenkins plugin download original URL
https://updates.jenkins.io/download/plugins/maven-plugin/3.27/maven-plugin.hpi
# Converted (add jenkins prefix)
https://xget.xi-xu.me/jenkins/download/plugins/maven-plugin/3.27/maven-plugin.hpi
```
#### Container Registries
Xget supports multiple container registries, using the `cr/[Registry Prefix]`
format:
| Container Registry | Registry Prefix | Original URL Format | Accelerated URL Format |
| ---------------------------- | --------------- | ------------------------------------------- | ------------------------------------------- |
| Docker Hub | `docker` | `https://registry-1.docker.io/...` | `https://xget.xi-xu.me/cr/docker/...` |
| Quay.io | `quay` | `https://quay.io/...` | `https://xget.xi-xu.me/cr/quay/...` |
| Google Container Registry | `gcr` | `https://gcr.io/...` | `https://xget.xi-xu.me/cr/gcr/...` |
| Microsoft Container Registry | `mcr` | `https://mcr.microsoft.com/...` | `https://xget.xi-xu.me/cr/mcr/...` |
| Amazon Public ECR | `ecr` | `https://public.ecr.aws/...` | `https://xget.xi-xu.me/cr/ecr/...` |
| GitHub Container Registry | `ghcr` | `https://ghcr.io/...` | `https://xget.xi-xu.me/cr/ghcr/...` |
| GitLab Container Registry | `gitlab` | `https://registry.gitlab.com/...` | `https://xget.xi-xu.me/cr/gitlab/...` |
| Red Hat Registry | `redhat` | `https://registry.redhat.io/...` | `https://xget.xi-xu.me/cr/redhat/...` |
| Oracle Container Registry | `oracle` | `https://container-registry.oracle.com/...` | `https://xget.xi-xu.me/cr/oracle/...` |
| Cloudsmith | `cloudsmith` | `https://docker.cloudsmith.io/...` | `https://xget.xi-xu.me/cr/cloudsmith/...` |
| DigitalOcean Registry | `digitalocean` | `https://registry.digitalocean.com/...` | `https://xget.xi-xu.me/cr/digitalocean/...` |
| VMware Registry | `vmware` | `https://projects.registry.vmware.com/...` | `https://xget.xi-xu.me/cr/vmware/...` |
| Kubernetes Registry | `k8s` | `https://registry.k8s.io/...` | `https://xget.xi-xu.me/cr/k8s/...` |
| Heroku Registry | `heroku` | `https://registry.heroku.com/...` | `https://xget.xi-xu.me/cr/heroku/...` |
| SUSE Registry | `suse` | `https://registry.suse.com/...` | `https://xget.xi-xu.me/cr/suse/...` |
| openSUSE Registry | `opensuse` | `https://registry.opensuse.org/...` | `https://xget.xi-xu.me/cr/opensuse/...` |
| Gitpod Registry | `gitpod` | `https://registry.gitpod.io/...` | `https://xget.xi-xu.me/cr/gitpod/...` |
```url
# Docker Hub original URL (official images)
https://registry-1.docker.io/v2/library/nginx/manifests/latest
# Converted (add cr/docker prefix)
https://xget.xi-xu.me/cr/docker/v2/nginx/manifests/latest
# Docker Hub original URL (user images)
https://registry-1.docker.io/v2/nginxinc/nginx-unprivileged/manifests/latest
# Converted (add cr/docker prefix)
https://xget.xi-xu.me/cr/docker/v2/nginxinc/nginx-unprivileged/manifests/latest
# GitHub Container Registry original URL
https://ghcr.io/v2/nginxinc/nginx-unprivileged/manifests/latest
# Converted (add cr/ghcr prefix)
https://xget.xi-xu.me/cr/ghcr/v2/nginxinc/nginx-unprivileged/manifests/latest
# Google Container Registry original URL
https://gcr.io/v2/distroless/base/manifests/latest
# Converted (add cr/gcr prefix)
https://xget.xi-xu.me/cr/gcr/v2/distroless/base/manifests/latest
```
For use cases, see
[Container Image Acceleration](#container-image-acceleration).
#### AI Inference Providers
Xget supports API acceleration for many mainstream AI inference providers, using
the `ip/[AI Provider Prefix]` format:
| AI Inference Provider | Provider Prefix | Original URL Format | Accelerated URL Format |
| --------------------- | --------------- | ----------------------------------------------- | -------------------------------------------- |
| OpenAI | `openai` | `https://api.openai.com/...` | `https://xget.xi-xu.me/ip/openai/...` |
| Anthropic | `anthropic` | `https://api.anthropic.com/...` | `https://xget.xi-xu.me/ip/anthropic/...` |
| Gemini | `gemini` | `https://generativelanguage.googleapis.com/...` | `https://xget.xi-xu.me/ip/gemini/...` |
| Vertex AI | `vertexai` | `https://aiplatform.googleapis.com/...` | `https://xget.xi-xu.me/ip/vertexai/...` |
| Cohere | `cohere` | `https://api.cohere.ai/...` | `https://xget.xi-xu.me/ip/cohere/...` |
| Mistral AI | `mistralai` | `https://api.mistral.ai/...` | `https://xget.xi-xu.me/ip/mistralai/...` |
| xAI | `xai` | `https://api.x.ai/...` | `https://xget.xi-xu.me/ip/xai/...` |
| GitHub Models | `githubmodels` | `https://models.github.ai/...` | `https://xget.xi-xu.me/ip/githubmodels/...` |
| NVIDIA API | `nvidiaapi` | `https://integrate.api.nvidia.com/...` | `https://xget.xi-xu.me/ip/nvidiaapi/...` |
| Perplexity | `perplexity` | `https://api.perplexity.ai/...` | `https://xget.xi-xu.me/ip/perplexity/...` |
| Groq | `groq` | `https://api.groq.com/...` | `https://xget.xi-xu.me/ip/groq/...` |
| Cerebras | `cerebras` | `https://api.cerebras.ai/...` | `https://xget.xi-xu.me/ip/cerebras/...` |
| SambaNova | `sambanova` | `https://api.sambanova.ai/...` | `https://xget.xi-xu.me/ip/sambanova/...` |
| Siray | `siray` | `https://api.siray.ai/...` | `https://xget.xi-xu.me/ip/siray/...` |
| HF Inference | `huggingface` | `https://router.huggingface.co/...` | `https://xget.xi-xu.me/ip/huggingface/...` |
| Together | `together` | `https://api.together.xyz/...` | `https://xget.xi-xu.me/ip/together/...` |
| Replicate | `replicate` | `https://api.replicate.com/...` | `https://xget.xi-xu.me/ip/replicate/...` |
| Fireworks | `fireworks` | `https://api.fireworks.ai/...` | `https://xget.xi-xu.me/ip/fireworks/...` |
| Nebius | `nebius` | `https://api.studio.nebius.ai/...` | `https://xget.xi-xu.me/ip/nebius/...` |
| Jina | `jina` | `https://api.jina.ai/...` | `https://xget.xi-xu.me/ip/jina/...` |
| Voyage AI | `voyageai` | `https://api.voyageai.com/...` | `https://xget.xi-xu.me/ip/voyageai/...` |
| Fal AI | `falai` | `https://fal.run/...` | `https://xget.xi-xu.me/ip/falai/...` |
| Novita | `novita` | `https://api.novita.ai/...` | `https://xget.xi-xu.me/ip/novita/...` |
| Burncloud | `burncloud` | `https://ai.burncloud.com/...` | `https://xget.xi-xu.me/ip/burncloud/...` |
| OpenRouter | `openrouter` | `https://openrouter.ai/...` | `https://xget.xi-xu.me/ip/openrouter/...` |
| Poe | `poe` | `https://api.poe.com/...` | `https://xget.xi-xu.me/ip/poe/...` |
| Featherless AI | `featherlessai` | `https://api.featherless.ai/...` | `https://xget.xi-xu.me/ip/featherlessai/...` |
| Hyperbolic | `hyperbolic` | `https://api.hyperbolic.xyz/...` | `https://xget.xi-xu.me/ip/hyperbolic/...` |
```url
# OpenAI API original URL
https://api.openai.com/v1/chat/completions
# Converted (add ip/openai prefix)
https://xget.xi-xu.me/ip/openai/v1/chat/completions
# Claude API original URL
https://api.anthropic.com/v1/messages
# Converted (add ip/anthropic prefix)
https://xget.xi-xu.me/ip/anthropic/v1/messages
# Gemini API original URL
https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent
# Converted (add ip/gemini prefix)
https://xget.xi-xu.me/ip/gemini/v1beta/models/gemini-2.5-flash:generateContent
# HF Inference API original URL
https://router.huggingface.co/hf-inference/models/openai/whisper-large-v3
# Converted (add ip/huggingface prefix)
https://xget.xi-xu.me/ip/huggingface/hf-inference/models/openai/whisper-large-v3
```
For use cases, see
[AI Inference API Acceleration](#ai-inference-api-acceleration).
## 🎯 Use Cases
### Git Operations and Configuration
#### Git Operations
```bash
# Clone repository
git clone https://xget.xi-xu.me/gh/microsoft/vscode.git
# Clone specific branch
git clone -b main https://xget.xi-xu.me/gh/facebook/react.git
# Shallow clone (latest commit only)
git clone --depth 1 https://xget.xi-xu.me/gh/torvalds/linux.git
# Clone GitLab repository
git clone https://xget.xi-xu.me/gl/gitlab-org/gitlab.git
# Clone Gitea repository
git clone https://xget.xi-xu.me/gitea/gitea/gitea.git
# Clone Codeberg repository
git clone https://xget.xi-xu.me/codeberg/forgejo/forgejo.git
# Clone SourceForge repository
git clone https://xget.xi-xu.me/sf/projects/mingw-w64/code.git
# Clone AOSP repository
git clone https://xget.xi-xu.me/aosp/platform/frameworks/base.git
# Add remote repository
git remote add upstream https://xget.xi-xu.me/gh/[owner]/[repository].git
# Pull updates
git pull https://xget.xi-xu.me/gh/microsoft/vscode.git main
# Recursive submodule clone
git clone --recursive https://xget.xi-xu.me/gh/[username]/[repository-with-submodules].git
```
#### Git Global Acceleration Configuration
```bash
# Configure Git to use Xget for specific domains
git config --global url."https://xget.xi-xu.me/gh/".insteadOf "https://github.com/"
git config --global url."https://xget.xi-xu.me/gl/".insteadOf "https://gitlab.com/"
git config --global url."https://xget.xi-xu.me/gitea/".insteadOf "https://gitea.com/"
git config --global url."https://xget.xi-xu.me/codeberg/".insteadOf "https://codeberg.org/"
git config --global url."https://xget.xi-xu.me/sf/".insteadOf "https://sourceforge.net/"
git config --global url."https://xget.xi-xu.me/aosp/".insteadOf "https://android.googlesource.com/"
# Verify configuration
git config --global --get-regexp url
# Now all git clone operations for relevant platforms will automatically use Xget
git clone https://github.com/microsoft/vscode.git # Automatically converted to Xget URL
git clone https://gitlab.com/gitlab-org/gitlab.git # Automatically converted to Xget URL
git clone https://codeberg.org/forgejo/forgejo.git # Automatically converted to Xget URL
git clone https://android.googlesource.com/platform/frameworks/base.git # Automatically converted to Xget URL
```
### Mainstream Download Tool Integration
#### wget Download
```bash
# Download single file
wget https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip
# Resume download
wget -c https://xget.xi-xu.me/hf/microsoft/DialoGPT-large/resolve/main/pytorch_model.bin
# Batch download
wget -i urls.txt # urls.txt contains multiple Xget URLs
```
#### cURL Download
```bash
# Basic download
curl -L -O https://xget.xi-xu.me/gh/golang/go/archive/refs/tags/go1.22.0.tar.gz
# Show progress bar
curl -L --progress-bar -o model.bin https://xget.xi-xu.me/hf/openai/whisper-large-v3/resolve/main/pytorch_model.bin
# Set user agent
curl -L -H "User-Agent: MyApp/1.0" https://xget.xi-xu.me/gl/gitlab-org/gitlab-runner/-/archive/main/gitlab-runner-main.zip
```
#### aria2 Multi-threaded Download
```bash
# Multi-threaded download of large files
aria2c -x 16 -s 16 https://xget.xi-xu.me/hf/microsoft/DialoGPT-large/resolve/main/pytorch_model.bin
# Resume download
aria2c -c https://xget.xi-xu.me/gh/microsoft/vscode/archive/refs/heads/main.zip
# Batch download configuration file
aria2c -i download-list.txt # File containing multiple Xget URLs
```
### Hugging Face Mirror
```python
import os
from transformers import AutoTokenizer, AutoModelForCausalLM
# Set environment variable to make transformers library automatically use Xget mirror
os.environ['HF_ENDPOINT'] = 'https://xget.xi-xu.me/hf'
# Define model name
model_name = 'microsoft/DialoGPT-medium'
print(f"Downloading model from mirror: {model_name}")
# Use AutoModelForCausalLM to load dialogue generation model
# Since we set the environment variable above, no additional parameters are needed here
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
print("Model and tokenizer loaded successfully!")
# You can now use the tokenizer and model
# For example:
# new_user_input_ids = tokenizer.encode("Hello, how are you?", return_tensors='pt')
# chat_history_ids = model.generate(new_user_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id)
# print(tokenizer.decode(chat_history_ids[:, new_user_input_ids.shape[-1]:][0], skip_special_tokens=True))
```
### Civitai AI Model Platform
```python
import requests
# Set API base URL to use Xget
base_url = "https://xget.xi-xu.me/civitai"
# Get model information
def get_model_info(model_id):
"""Get Civitai model information"""
url = f"{base_url}/api/v1/models/{model_id}"
response = requests.get(url)
return response.json()
# Download model
def download_model(model_version_id, output_path):
"""Download Civitai model file"""
download_url = f"{base_url}/api/download/models/{model_version_id}"
print(f"Downloading model version {model_version_id}...")
response = requests.get(download_url, stream=True)
response.raise_for_status()
with open(output_path, 'wb') as f:
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)
print(f"Model downloaded to: {output_path}")
# Usage example
model_id = 7240 # Example model ID
model_info = get_model_info(model_id)
print(f"Model name: {model_info['name']}")
# Download first model version
if model_info['modelVersions']:
version_id = model_info['modelVersions'][0]['id']
download_model(version_id, f"model_{version_id}.safetensors")
```
### npm Package Acceleration
#### Configure npm to Use Xget Mirror
```bash
# Temporarily use Xget mirror
npm install --registry https://xget.xi-xu.me/npm/
# Globally configure npm mirror
npm config set registry https://xget.xi-xu.me/npm/
# Verify configuration
npm config get registry
```
#### Configure Bun to Use Xget Mirror
```toml
# bunfig.toml (project-level) or ~/.bunfig.toml (global)
[install]
registry = "https://xget.xi-xu.me/npm/"
```
```bash
# Install dependencies with Bun
bun install
# Bun also supports .npmrc, so you can reuse existing npm registry settings
echo "registry=https://xget.xi-xu.me/npm/" > .npmrc
bun install
```
#### Use in Project (npm / Bun)
```bash
# Configure project-level mirror in .npmrc (.npmrc can be reused by npm / Bun)
echo "registry=https://xget.xi-xu.me/npm/" > .npmrc
# Install dependencies with npm
npm install
# Install dependencies with Bun
bun install
```
### Python Package Acceleration
#### Configure pip to Use Xget Mirror
```bash
# Temporarily use Xget mirror
pip install requests -i https://xget.xi-xu.me/pypi/simple/
# Globally configure pip mirror
pip config set global.index-url https://xget.xi-xu.me/pypi/simple/
pip config set global.trusted-host xget.xi-xu.me
# Verify configuration
pip config list
```
#### Use in Project
```bash
# Create pip.conf file (Linux/macOS)
mkdir -p ~/.pip
cat > ~/.pip/pip.conf << EOF
[global]
index-url = https://xget.xi-xu.me/pypi/simple/
trusted-host = xget.xi-xu.me
EOF
# Or create pip.conf in project root directory
cat > pip.conf << EOF
[global]
index-url = https://xget.xi-xu.me/pypi/simple/
trusted-host = xget.xi-xu.me
EOF
# Install using configuration file
pip install -r requirements.txt --config-file pip.conf
```
#### Specify Mirror in requirements.txt
```txt
# requirements.txt
--index-url https://xget.xi-xu.me/pypi/simple/
--trusted-host xget.xi-xu.me
requests>=2.25.0
numpy>=1.21.0
pandas>=1.3.0
matplotlib>=3.4.0
```
### conda Package Acceleration
#### Configure conda to Use Xget Mirror
```bash
# Configure default channel mirrors
conda config --add default_channels https://xget.xi-xu.me/conda/pkgs/msys2
conda config --add default_channels https://xget.xi-xu.me/conda/pkgs/r
conda config --add default_channels https://xget.xi-xu.me/conda/pkgs/main
# Configure all community channel mirrors (recommended)
conda config --set channel_alias https://xget.xi-xu.me/conda/community
# Or configure specific community channels
conda config --add channels https://xget.xi-xu.me/conda/community/conda-forge
conda config --add channels https://xget.xi-xu.me/conda/community/bioconda
# Set channel priority
conda config --set channel_priority strict
# Verify configuration
conda config --show
```
#### Configure in .condarc
The .condarc file can be placed in the user home directory (`~/.condarc`) or
project root directory:
```yaml
default_channels:
- https://xget.xi-xu.me/conda/pkgs/main
- https://xget.xi-xu.me/conda/pkgs/r
- https://xget.xi-xu.me/conda/pkgs/msys2
channel_alias: https://xget.xi-xu.me/conda/community
channel_priority: strict
show_channel_urls: true
```
#### Use Environment File
The environment file can directly specify complete mirror URLs:
```yaml
# environment.yml
name: myproject
channels:
- https://xget.xi-xu.me/conda/pkgs/main
- https://xget.xi-xu.me/conda/pkgs/r
- https://xget.xi-xu.me/conda/community/bioconda
- https://xget.xi-xu.me/conda/community/conda-forge
dependencies:
- python=3.11
- numpy>=1.24.0
- pandas>=2.0.0
- matplotlib>=3.7.0
- scipy>=1.10.0
- pip
- pip:
- requests>=2.28.0
```
```bash
# Create environment using environment file
conda env create -f environment.yml
# Update environment
conda env update -f environment.yml
```
### Maven Package Acceleration
#### Configure Maven to Use Xget Mirror
```xml
<!-- Configure Maven mirror in ~/.m2/settings.xml -->
<settings>
<mirrors>
<mirror>
<id>xget-maven-central</id>
<mirrorOf>central</mirrorOf>
<name>Xget Maven Central Mirror</name>
<url>https://xget.xi-xu.me/maven/maven2</url>
</mirror>
</mirrors>
</settings>
```
#### Use in Project
```xml
<!-- Configure project-level mirror in pom.xml -->
<project>
<repositories>
<repository>
<id>xget-maven-central</id>
<name>Xget Maven Central</name>
<url>https://xget.xi-xu.me/maven/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>xget-maven-central</id>
<name>Xget Maven Central</name>
<url>https://xget.xi-xu.me/maven/maven2</url>
</pluginRepository>
</pluginRepositories>
</project>
```
```bash
# Specify mirror using command line
mvn clean install -Dmaven.repo.remote=https://xget.xi-xu.me/maven/maven2
# Download specific dependency
mvn dependency:get -Dartifact=org.springframework:spring-core:5.3.21 \
-DremoteRepositories=https://xget.xi-xu.me/maven/maven2
```
### Apache Software Download Acceleration
#### Download Apache Software Using Xget
```bash
# Download Apache Kafka
wget https://xget.xi-xu.me/apache/kafka/3.6.1/kafka_2.13-3.6.1.tgz
# Download Apache Maven
curl -L -O https://xget.xi-xu.me/apache/maven/maven-3/3.9.5/binaries/apache-maven-3.9.5-bin.tar.gz
# Download Apache Spark
aria2c https://xget.xi-xu.me/apache/spark/spark-3.5.0/spark-3.5.0-bin-hadoop3.tgz
# Download Apache Hadoop
wget https://xget.xi-xu.me/apache/hadoop/common/hadoop-3.3.6/hadoop-3.3.6.tar.gz
# Download Apache Flink
curl -L -O https://xget.xi-xu.me/apache/flink/flink-1.18.1/flink-1.18.1-bin-scala_2.12.tgz
```
#### Common Apache Software Downloads
```bash
# Big data related
wget https://xget.xi-xu.me/apache/hive/hive-3.1.3/apache-hive-3.1.3-bin.tar.gz
wget https://xget.xi-xu.me/apache/hbase/2.5.7/hbase-2.5.7-bin.tar.gz
wget https://xget.xi-xu.me/apache/zookeeper/zookeeper-3.8.4/apache-zookeeper-3.8.4-bin.tar.gz
# Web servers
wget https://xget.xi-xu.me/apache/httpd/httpd-2.4.59.tar.gz
wget https://xget.xi-xu.me/apache/tomcat/tomcat-10/v10.1.19/bin/apache-tomcat-10.1.19.tar.gz
# Development tools
wget https://xget.xi-xu.me/apache/ant/1.10.14/apache-ant-1.10.14-bin.tar.gz
wget https://xget.xi-xu.me/apache/netbeans/netbeans/20/netbeans-20-bin.zip
```
### Gradle Package Acceleration
#### Configure Gradle to Use Xget Mirror
```gradle
// Configure Gradle mirror in build.gradle
repositories {
maven {
url 'https://xget.xi-xu.me/maven/maven2'
}
gradlePluginPortal {
url 'https://xget.xi-xu.me/gradle/m2'
}
}
// Configure plugin repositories
pluginManagement {
repositories {
maven {
url 'https://xget.xi-xu.me/gradle/m2'
}
gradlePluginPortal()
}
}
```
#### Global Configuration
```gradle
// Configure global mirror in ~/.gradle/init.gradle
allprojects {
repositories {
maven {
url 'https://xget.xi-xu.me/maven/maven2'
}
}
}
settingsEvaluated { settings ->
settings.pluginManagement {
repositories {
maven {
url 'https://xget.xi-xu.me/gradle/m2'
}
gradlePluginPortal()
}
}
}
```
```bash
# Specify mirror using command line
gradle build -Dmaven.repo.remote=https://xget.xi-xu.me/maven/maven2
# Refresh dependencies
gradle build --refresh-dependencies
```
### Homebrew Package Acceleration
#### Configure Homebrew to Use Xget Mirror
```bash
# Set Homebrew environment variables to use Xget mirror
export HOMEBREW_BREW_GIT_REMOTE="https://xget.xi-xu.me/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://xget.xi-xu.me/homebrew/homebrew-core.git"
export HOMEBREW_API_DOMAIN="https://xget.xi-xu.me/homebrew/api"
export HOMEBREW_BOTTLE_DOMAIN="https://xget.xi-xu.me/homebrew/bottles"
# Update Homebrew
brew update
```
#### Long-term Configuration
```bash
# For bash users, add to ~/.bash_profile
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://xget.xi-xu.me/homebrew/brew.git"' >> ~/.bash_profile
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://xget.xi-xu.me/homebrew/homebrew-core.git"' >> ~/.bash_profile
echo 'export HOMEBREW_API_DOMAIN="https://xget.xi-xu.me/homebrew/api"' >> ~/.bash_profile
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://xget.xi-xu.me/homebrew/bottles"' >> ~/.bash_profile
# For zsh users, add to ~/.zprofile
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://xget.xi-xu.me/homebrew/brew.git"' >> ~/.zprofile
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://xget.xi-xu.me/homebrew/homebrew-core.git"' >> ~/.zprofile
echo 'export HOMEBREW_API_DOMAIN="https://xget.xi-xu.me/homebrew/api"' >> ~/.zprofile
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://xget.xi-xu.me/homebrew/bottles"' >> ~/.zprofile
```
#### Use in Project
```bash
# Install packages
brew install git
# Search packages
brew search python
# Update packages
brew upgrade
# View installed packages
brew list
```
#### Verify Mirror Configuration
```bash
# Check Homebrew configuration
brew config
# View environment variables
echo $HOMEBREW_API_DOMAIN
echo $HOMEBREW_BOTTLE_DOMAIN
```
### Ruby Package Acceleration
#### Configure RubyGems to Use Xget Mirror
```bash
# Temporarily use Xget mirror
gem install rails --source https://xget.xi-xu.me/rubygems/
# Globally configure RubyGems mirror
gem sources --add https://xget.xi-xu.me/rubygems/
gem sources --remove https://rubygems.org/
# Verify configuration
gem sources -l
```
#### Use in Project
```ruby
# Configure project-level mirror in Gemfile
source 'https://xget.xi-xu.me/rubygems/'
gem 'rails', '~> 7.0.0'
gem 'pg', '~> 1.1'
gem 'puma', '~> 5.0'
```
```bash
# Install using bundle
bundle config mirror.https://rubygems.org https://xget.xi-xu.me/rubygems/
bundle install
```
### R Package Acceleration
#### Configure R to Use Xget CRAN Mirror
```r
# Temporarily use Xget CRAN mirror in R
install.packages("ggplot2", repos = "https://xget.xi-xu.me/cran/")
# Globally configure CRAN mirror
options(repos = c(CRAN = "https://xget.xi-xu.me/cran/"))
# Verify configuration
getOption("repos")
```
#### Configure in .Rprofile
```r
# Configure global mirror in .Rprofile file in user home directory
options(repos = c(
CRAN = "https://xget.xi-xu.me/cran/",
BioCsoft = "https://bioconductor.org/packages/release/bioc",
BioCann = "https://bioconductor.org/packages/release/data/annotation",
BioCexp = "https://bioconductor.org/packages/release/data/experiment"
))
# Set download method
options(download.file.method = "libcurl")
```
#### Use in Project
```r
# Specify mirror in project's renv.lock or script
renv::init()
renv::settings$repos.override(c(CRAN = "https://xget.xi-xu.me/cran/"))
# Install packages
install.packages(c("dplyr", "ggplot2", "tidyr"))
# Or use pak package manager
pak::pkg_install("tidyverse", repos = "https://xget.xi-xu.me/cran/")
```
```bash
# Install packages using R script in command line
Rscript -e "options(repos = c(CRAN = 'https://xget.xi-xu.me/cran/')); install.packages('ggplot2')"
# Batch install packages
Rscript -e "
options(repos = c(CRAN = 'https://xget.xi-xu.me/cran/'))
packages <- c('dplyr', 'ggplot2', 'tidyr', 'readr')
install.packages(packages)
"
```
### Perl Package Acceleration
#### Configure CPAN to Use Xget Mirror
```bash
# Configure CPAN to use Xget mirror
cpan o conf urllist push https://xget.xi-xu.me/cpan/
cpan o conf commit
# Or directly edit configuration file ~/.cpan/CPAN/MyConfig.pm
# Add:
# 'urllist' => [q[https://xget.xi-xu.me/cpan/]],
```
#### Use cpanm to Install Modules
```bash
# Install cpanm (if not available)
curl -L https://cpanmin.us | perl - --sudo App::cpanminus
# Install modules using Xget mirror
cpanm --mirror https://xget.xi-xu.me/cpan/ DBI
cpanm --mirror https://xget.xi-xu.me/cpan/ Mojolicious
# Install dependencies from Makefile.PL
cpanm --mirror https://xget.xi-xu.me/cpan/ --installdeps .
```
#### Use in Project
```perl
# List dependencies in cpanfile
requires 'DBI';
requires 'Mojolicious';
requires 'JSON';
# Then install using Xget mirror
cpanm --mirror https://xget.xi-xu.me/cpan/ --installdeps .
```
### TeX/LaTeX Package Acceleration
#### Configure TeX Live to Use Xget CTAN Mirror
```bash
# Configure tlmgr to use Xget CTAN mirror
tlmgr option repository https://xget.xi-xu.me/ctan/systems/texlive/tlnet
# Update package database
tlmgr update --self --all
# Install packages
tlmgr install beamer
tlmgr install tikz
```
#### Configure MiKTeX to Use Xget Mirror
```bash
# Windows MiKTeX configuration
mpm --set-repository=https://xget.xi-xu.me/ctan/systems/win32/miktex
# Update package database
mpm --update-db
# Install packages
mpm --install=beamer
mpm --install=pgf
```
#### Use in Project
```bash
# Automatically install missing packages during LaTeX document compilation
pdflatex --shell-escape document.tex
# Or manually install specific packages
tlmgr install caption
tlmgr install subcaption
tlmgr install algorithm2e
```
### Go Module Acceleration
#### Configure Go to Use Xget Proxy
```bash
# Configure Go module proxy
export GOPROXY=https://xget.xi-xu.me/golang,direct
export GOSUMDB=off
# Or permanently configure
go env -w GOPROXY=https://xget.xi-xu.me/golang,direct
go env -w GOSUMDB=off
# Verify configuration
go env GOPROXY
```
#### Use in Project
```bash
# Download dependencies
go mod download
# Update dependencies
go get -u ./...
# Clean module cache
go clean -modcache
```
### NuGet Package Acceleration
#### Configure NuGet to Use Xget Mirror
```bash
# Add Xget package source
dotnet nuget add source https://xget.xi-xu.me/nuget/v3/index.json -n xget
# List package sources
dotnet nuget list source
# Use in project
dotnet restore --source https://xget.xi-xu.me/nuget/v3/index.json
```
#### Configure in NuGet.Config
```xml
<!-- NuGet.Config -->
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="xget" value="https://xget.xi-xu.me/nuget/v3/index.json" />
</packageSources>
</configuration>
```
### Rust Package Acceleration
#### Configure Cargo to Use Xget Mirror
```bash
# Configure Cargo to use Xget mirror (in ~/.cargo/config.toml)
mkdir -p ~/.cargo
cat >> ~/.cargo/config.toml << EOF
[source.crates-io]
replace-with = "xget"
[source.xget]
registry = "https://xget.xi-xu.me/crates/"
EOF
# Verify configuration
cargo search serde
```
#### Use in Project
```toml
# Can use dependencies normally in Cargo.toml
[dependencies]
serde = "1.0"
tokio = "1.0"
reqwest = "0.11"
```
```bash
# Xget will be automatically used when building the project
cargo build
# Update dependencies
cargo update
# Add new dependency
cargo add clap
```
### PHP Package Acceleration
#### Configure Composer to Use Xget Mirror
```bash
# Globally configure Composer mirror
composer config -g repo.packagist composer https://xget.xi-xu.me/packagist/
# Project-level configuration
composer config repo.packagist composer https://xget.xi-xu.me/packagist/
# Verify configuration
composer config -l
```
#### Configure in composer.json
```json
{
"repositories": [
{
"type": "composer",
"url": "https://xget.xi-xu.me/packagist/"
}
],
"require": {
"symfony/console": "^6.0",
"guzzlehttp/guzzle": "^7.0"
}
}
```
### Flathub Repository Mirror
#### Configure Flatpak / Flathub to Use Xget Mirror
```bash
# If Flathub has not been added before, import the official descriptor
# first so Flatpak trusts the Flathub signing key.
flatpak remote-add --if-not-exists flathub \
https://dl.flathub.org/repo/flathub.flatpakrepo
# Then repoint the existing Flathub remote to the Xget mirror
flatpak remote-modify flathub \
--url=https://xget.xi-xu.me/flathub/repo/
# Restore the default upstream when needed
flatpak remote-modify flathub \
--url=https://dl.flathub.org/repo/
```
Xget mirrors the Flathub OSTree repository endpoint. On current Flatpak clients,
importing a mirrored `.flatpakrepo` descriptor or adding the mirrored repository
directly may still fall back to the upstream Flathub URL or fail to import the
signing key, so `flatpak remote-modify ... --url=...` is the reliable setup. For
system-wide remotes, run the same commands with `sudo`.
#### Supported Flathub Services
```url
# OSTree repository metadata
https://xget.xi-xu.me/flathub/repo/config
https://xget.xi-xu.me/flathub/repo/summary
https://xget.xi-xu.me/flathub/repo/summary.sig
https://xget.xi-xu.me/flathub/repo/summary.idx
https://xget.xi-xu.me/flathub/repo/summaries/...
# Flatpak remote descriptor
https://xget.xi-xu.me/flathub/repo/flathub.flatpakrepo
# App reference descriptor
https://xget.xi-xu.me/flathub/repo/appstream/[app-id].flatpakref
# Repository objects and static deltas
https://xget.xi-xu.me/flathub/repo/objects/...
https://xget.xi-xu.me/flathub/repo/deltas/...
https://xget.xi-xu.me/flathub/repo/delta-indexes/...
```
#### Usage Examples
```bash
# Verify that the saved remote URL now points to Xget
flatpak remotes --show-details
# Inspect remote contents
flatpak remote-ls flathub
# Install an app after repointing the Flathub remote
flatpak install flathub org.gnome.gedit
# Install directly from a rewritten .flatpakref
flatpak install --from \
https://xget.xi-xu.me/flathub/repo/appstream/org.gnome.gedit.flatpakref
# Print libcurl HTTP traces when troubleshooting
OSTREE_DEBUG_HTTP=1 flatpak remote-ls flathub
# Update installed apps and runtimes
flatpak update
```
### Linux Distribution Acceleration
#### Debian/Ubuntu APT Configuration
```bash
# Backup original source list
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
# Configure Debian mirror
echo "deb https://xget.xi-xu.me/debian/debian bookworm main" | sudo tee /etc/apt/sources.list
echo "deb https://xget.xi-xu.me/debian/debian-security bookworm-security main" | sudo tee -a /etc/apt/sources.list
# Configure Ubuntu mirror
echo "deb https://xget.xi-xu.me/ubuntu/ubuntu jammy main restricted universe multiverse" | sudo tee /etc/apt/sources.list
echo "deb https://xget.xi-xu.me/ubuntu/ubuntu jammy-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
# Update package list
sudo apt update
```
#### Fedora DNF Configuration
```bash
# Configure Fedora mirror
sudo sed -i 's|^metalink=|#metalink=|g' /etc/yum.repos.d/fedora*.repo
sudo sed -i 's|^#baseurl=http://download.example/pub/fedora/linux|baseurl=https://xget.xi-xu.me/fedora/pub/fedora/linux|g' /etc/yum.repos.d/fedora*.repo
# Update package cache
sudo dnf makecache
```
#### Rocky Linux DNF Configuration
```bash
# Configure Rocky Linux mirror
sudo sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/rocky*.repo
sudo sed -i 's|^#baseurl=http://dl.rockylinux.org|baseurl=https://xget.xi-xu.me/rocky|g' /etc/yum.repos.d/rocky*.repo
# Update package cache
sudo dnf makecache
```
#### openSUSE Zypper Configuration
```bash
# Configure openSUSE Leap mirror
sudo zypper mr -d repo-oss
sudo zypper ar -f https://xget.xi-xu.me/opensuse/distribution/leap/15.5/repo/oss/ repo-oss-xget
# Configure openSUSE Tumbleweed mirror
sudo zypper mr -d repo-oss
sudo zypper ar -f https://xget.xi-xu.me/opensuse/tumbleweed/repo/oss/ repo-oss-xget
# Refresh software sources
sudo zypper refresh
# Verify configuration
sudo zypper lr -u
```
#### Arch Linux Pacman Configuration
```bash
# Backup original mirror list
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
# Configure Arch Linux mirror
echo 'Server = https://xget.xi-xu.me/arch/$repo/os/$arch' | sudo tee /etc/pacman.d/mirrorlist
# Update package database
sudo pacman -Sy
```
### Academic Resource Acceleration
#### arXiv Paper Download
```bash
# Download arXiv paper PDF
wget https://xget.xi-xu.me/arxiv/pdf/2301.07041.pdf
# Download paper source
curl -L -O https://xget.xi-xu.me/arxiv/e-print/2301.07041
# Batch download multiple papers
for id in 2301.07041 2302.13971 2303.08774; do
wget https://xget.xi-xu.me/arxiv/pdf/${id}.pdf
done
```
#### Use in Academic Tools
```python
# Use arXiv accelerated download in Python
import requests
def download_arxiv_paper(arxiv_id, output_path):
url = f"https://xget.xi-xu.me/arxiv/pdf/{arxiv_id}.pdf"
response = requests.get(url)
if response.status_code == 200:
with open(output_path, 'wb') as f:
f.write(response.content)
print(f"Downloaded {arxiv_id} to {output_path}")
else:
print(f"Failed to download {arxiv_id}")
# Download paper
download_arxiv_paper("2301.07041", "attention_is_all_you_need.pdf")
```
### F-Droid Repository Mirror
#### Configure F-Droid Client to Use Xget Mirror
1. In F-Droid app, go to **Settings** → **Repositories**
2. Click **+** and enter repository URL: `https://xget.xi-xu.me/fdroid/repo`
3. Click **Add** then click **Add Mirror**
#### Supported F-Droid Services
```url
# F-Droid app APK download
https://xget.xi-xu.me/fdroid/repo/[package-name]_[version-code].apk
# F-Droid repository index
https://xget.xi-xu.me/fdroid/repo/index-v1.jar
# F-Droid app icons
https://xget.xi-xu.me/fdroid/repo/icons-640/[package-name].[version-code].png
# F-Droid API endpoints
https://xget.xi-xu.me/fdroid/api/v1/packages/[package-name]
```
#### Usage Examples
```bash
# Directly download F-Droid client APK
wget https://xget.xi-xu.me/fdroid/repo/org.fdroid.fdroid_1016050.apk
# Download other open source apps
curl -L -O https://xget.xi-xu.me/fdroid/repo/org.mozilla.fennec_fdroid_1014000.apk
# Get app information
curl https://xget.xi-xu.me/fdroid/api/v1/packages/org.fdroid.fdroid
```
#### Batch App Management
```bash
# Create app download script
cat > download_fdroid_apps.sh << 'EOF'
#!/bin/bash
# Define list of apps to download
apps=(
"org.fdroid.fdroid_1016050.apk"
"org.mozilla.fennec_fdroid_1014000.apk"
"com.termux_1180.apk"
"org.videolan.vlc_13050399.apk"
)
# Create download directory
mkdir -p fdroid_apps
# Batch download apps
for app in "${apps[@]}"; do
echo "Downloading: $app"
wget -P fdroid_apps "https://xget.xi-xu.me/fdroid/repo/$app"
done
echo "All apps downloaded!"
EOF
chmod +x download_fdroid_apps.sh
./download_fdroid_apps.sh
```
#### Developer Integration
For Android developers, F-Droid mirror can be integrated into build scripts:
```gradle
// Configure F-Droid dependency check in build.gradle
task checkFDroidAvailability {
doLast {
def fdroidUrl = "https://xget.xi-xu.me/fdroid/api/v1/packages/${project.name}"
try {
def connection = new URL(fdroidUrl).openConnection()
connection.requestMethod = 'GET'
def responseCode = connection.responseCode
if (responseCode == 200) {
println "App available on F-Droid: $fdroidUrl"
}
} catch (Exception e) {
println "Error checking F-Droid availability: ${e.message}"
}
}
}
```
### Jenkins Plugin Download
#### Use Xget to Accelerate Jenkins Plugin Download and Update
Supports Jenkins update center and plugin downloads, compatible with
configuration methods of domestic mirrors like Tsinghua mirror.
#### Jenkins Update Center Configuration
##### Method 1: Configure in Jenkins Web Interface
1. Log in to Jenkins management interface
2. Go to **Manage Jenkins** → **Plugins** → **Advanced**
3. In the **Update Site** section, change the URL to
`https://xget.xi-xu.me/jenkins/update-center.json`
4. Click **Submit** to save configuration
##### Method 2: Modify Configuration File
```bash
# Modify update center configuration file on Jenkins server
# Default location: $JENKINS_HOME/hudson.model.UpdateCenter.xml
sudo nano /var/lib/jenkins/hudson.model.UpdateCenter.xml
# Change URL to:
# <url>https://xget.xi-xu.me/jenkins/update-center.json</url>
# Restart Jenkins service
sudo systemctl restart jenkins
```
#### Supported Jenkins Services
```url
# Jenkins update center JSON
https://xget.xi-xu.me/jenkins/update-center.json
# Jenkins update center (actual JSON format)
https://xget.xi-xu.me/jenkins/update-center.actual.json
# Jenkins plugin download
https://xget.xi-xu.me/jenkins/download/plugins/[plugin-name]/[version]/[plugin-name].hpi
# Experimental plugin update center
https://xget.xi-xu.me/jenkins/experimental/update-center.json
```
#### Usage Examples
```bash
# Download Maven plugin
wget https://xget.xi-xu.me/jenkins/download/plugins/maven-plugin/3.27/maven-plugin.hpi
# Download Git plugin
curl -L -O https://xget.xi-xu.me/jenkins/download/plugins/git/5.2.1/git.hpi
# Get update center information
curl https://xget.xi-xu.me/jenkins/update-center.json
# Batch download common plugins
cat > download_jenkins_plugins.sh << 'EOF'
#!/bin/bash
# Define list of plugins to download
plugins=(
"git:5.2.1"
"maven-plugin:3.27"
"workflow-aggregator:596.v8c21c963d92d"
"blueocean:1.27.8"
"docker-workflow:563.vd5d2e5c4007f"
)
# Create plugin download directory
mkdir -p jenkins_plugins
# Batch download plugins
for plugin in "${plugins[@]}"; do
name=$(echo $plugin | cut -d: -f1)
version=$(echo $plugin | cut -d: -f2)
echo "Downloading plugin: $name v$version"
wget -P jenkins_plugins "https://xget.xi-xu.me/jenkins/download/plugins/$name/$version/$name.hpi"
done
echo "All plugins downloaded!"
EOF
chmod +x download_jenkins_plugins.sh
./download_jenkins_plugins.sh
```
#### Offline Jenkins Deployment
For Jenkins deployment in offline environments:
```bash
# 1. Download Jenkins core file
wget https://xget.xi-xu.me/jenkins/war/jenkins.war
# 2. Create plugin packaging script
cat > prepare_jenkins_offline.sh << 'EOF'
#!/bin/bash
# Create offline deployment directory structure
mkdir -p jenkins_offline/{plugins,update_center}
# Download update center configuration
curl -o jenkins_offline/update_center/update-center.json \
https://xget.xi-xu.me/jenkins/update-center.json
# Essential plugins list
essential_plugins=(
"ant:475.vf34069fef73c"
"build-timeout:1.31"
"credentials:1319.v7eb_51b_3a_c97b_"
"git:5.2.1"
"github:1.38.0"
"gradle:2.8.2"
"ldap:682.v7b_544c9d1512"
"mailer:463.vedf8358e006b_"
"matrix-auth:3.2.2"
"maven-plugin:3.27"
"pam-auth:1.10"
"pipeline-stage-view:2.34"
"ssh-slaves:2.973.v0fa_8c0dea_f9f"
"timestamper:1.26"
"workflow-aggregator:596.v8c21c963d92d"
"ws-cleanup:0.45"
)
# Download all essential plugins
for plugin in "${essential_plugins[@]}"; do
name=$(echo $plugin | cut -d: -f1)
version=$(echo $plugin | cut -d: -f2)
echo "Downloading $name:$version"
wget -P jenkins_offline/plugins \
"https://xget.xi-xu.me/jenkins/download/plugins/$name/$version/$name.hpi"
done
# Create deployment instructions
cat > jenkins_offline/deploy_instructions.md << 'DEPLOY'
# Jenkins Offline Deployment Instructions
1. Copy jenkins.war to target server
2. Start Jenkins: java -jar jenkins.war
3. Copy .hpi files from plugins/ directory to $JENKINS_HOME/plugins/
4. Restart Jenkins
DEPLOY
echo "Offline deployment package prepared!"
EOF
chmod +x prepare_jenkins_offline.sh
./prepare_jenkins_offline.sh
```
#### Use in Project
##### Plugin Check in Jenkinsfile
```groovy
pipeline {
agent any
stages {
stage('Check Plugin Availability') {
steps {
script {
// Check Maven plugin availability
def pluginUrl = "https://xget.xi-xu.me/jenkins/download/plugins/maven-plugin/3.27/maven-plugin.hpi"
try {
def response = httpRequest url: pluginUrl, httpMode: 'HEAD'
if (response.status == 200) {
echo "Maven plugin available: ${pluginUrl}"
}
} catch (Exception e) {
error "Maven plugin not available: ${e.message}"
}
}
}
}
stage('Build') {
steps {
// Your build steps
echo "Building with accelerated plugins..."
}
}
}
}
```
### Container Image Acceleration
#### Pull Images Directly
```bash
# Pull GitHub Container Registry images
docker pull xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest
# Pull Google Container Registry images
docker pull xget.xi-xu.me/cr/gcr/distroless/base:latest
# Pull Microsoft Container Registry images
docker pull xget.xi-xu.me/cr/mcr/dotnet/runtime:8.0
```
#### Kubernetes Deployment Configuration
```yaml
# deployment.yaml - Use Xget's images
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest
ports:
- containerPort: 80
- name: redis
image: xget.xi-xu.me/cr/ghcr/bitnami/redis:alpine
ports:
- containerPort: 6379
```
#### Docker Compose Configuration
```yaml
# docker-compose.yml - Use Xget accelerated images
version: '3.8'
services:
web:
image: xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest
ports:
- '80:80'
volumes:
- ./html:/usr/share/nginx/html
database:
image: xget.xi-xu.me/cr/mcr/mssql/server:2022-latest
environment:
ACCEPT_EULA: Y
SA_PASSWORD: 'MyStrongPassword123!'
volumes:
- mssql_data:/var/opt/mssql
cache:
image: xget.xi-xu.me/cr/ghcr/bitnami/redis:alpine
ports:
- '6379:6379'
volumes:
mssql_data:
```
#### Dockerfile Optimization
```dockerfile
# Use Xget accelerated base images in Dockerfile
FROM xget.xi-xu.me/cr/ghcr/nodejs/node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# Production stage
FROM xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest
COPY --from=builder /app/dist /usr/share/nginx/html
# Use Microsoft Container Registry's .NET image
FROM xget.xi-xu.me/cr/mcr/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
COPY --from=builder /app/publish .
ENTRYPOINT ["dotnet", "MyApp.dll"]
```
#### CI/CD Integration
```yaml
# GitHub Actions - Use Xget to accelerate container builds
name: Build and Deploy
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build with accelerated base images
run: |
# Build using Xget's base images
docker build -t myapp:latest \
--build-arg BASE_IMAGE=xget.xi-xu.me/cr/ghcr/nodejs/node:18-alpine .
- name: Test with accelerated images
run: |
# Test using accelerated images
docker run --rm \
xget.xi-xu.me/cr/mcr/dotnet/runtime:8.0 \
dotnet --version
```
#### Podman Configuration
```bash
# Configure Podman to use Xget image acceleration
# Edit /etc/containers/registries.conf
[[registry]]
prefix = "ghcr.io"
location = "xget.xi-xu.me/cr/ghcr"
# Or pull directly
podman pull xget.xi-xu.me/cr/ghcr/alpine/alpine:latest
podman pull xget.xi-xu.me/cr/ghcr/nginxinc/nginx-unprivileged:latest
```
#### containerd Configuration
```toml
# Configure containerd to use Xget
# Edit /etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."ghcr.io"]
endpoint = ["https://xget.xi-xu.me/cr/ghcr"]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."gcr.io"]
endpoint = ["https://xget.xi-xu.me/cr/gcr"]
```
```bash
# Restart containerd
sudo systemctl restart containerd
```
### AI Inference API Acceleration
#### OpenAI API
```python
from openai import OpenAI
client = OpenAI(
api_key="your-api-key",
base_url="https://xget.xi-xu.me/ip/openai/v1", # Use Xget
)
response = client.responses.create(
model="gpt-5.1",
input="Hello, GPT!",
)
print(response.output_text)
```
#### Claude API
```python
from anthropic import Anthropic
client = Anthropic(
api_key="your-api-key",
base_url="https://xget.xi-xu.me/ip/anthropic", # Use Xget
)
message = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=256,
messages=[
{
"role": "user",
"content": "Hello, Claude!",
}
],
)
print(message.content[0].text)
```
#### Gemini API
```python
from google import genai
from google.genai import types
client = genai.Client(
api_key="your-api-key",
http_options=types.HttpOptions(base_url="https://xget.xi-xu.me/ip/gemini"), # Use Xget
)
response = client.models.generate_content(
model="gemini-3-pro-preview",
contents="Hello, Gemini!",
)
print(response.text)
```
#### Multi-Provider Unified Interface
```python
from openai import OpenAI
providers = [
("Cohere", "your-cohere-api-key", "/cohere/compatibility/v1", "command-a-03-2025"),
("Mistral", "your-mistral-api-key", "/mistralai/v1", "mistral-medium-latest"),
("xAI", "your-xai-api-key", "/xai/v1", "grok-4"),
]
for name, key, path, model in providers:
client = OpenAI(api_key=key, base_url="https://xget.xi-xu.me/ip" + path) # Use Xget
response = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": f"Hello, who are you?"}],
)
print(name, "=>", response.choices[0].message.content)
```
#### Use in JavaScript/Node.js
```javascript
// OpenAI API acceleration
import OpenAI from 'openai';
const openaiClient = new OpenAI({
apiKey: 'your-openai-api-key',
baseURL: 'https://xget.xi-xu.me/ip/openai/v1' // Use Xget
});
async function chatWithGPT() {
const response = await openaiClient.responses.create({
model: 'gpt-5.1',
input: 'Hello, GPT!'
});
console.log(response.output_text);
}
// Claude API acceleration
import Anthropic from '@anthropic-ai/sdk';
const anthropicClient = new Anthropic({
apiKey: 'your-claude-api-key',
baseURL: 'https://xget.xi-xu.me/ip/anthropic' // Use Xget
});
async function chatWithClaude() {
const message = await anthropicClient.messages.create({
model: 'claude-sonnet-4-5',
max_tokens: 256,
messages: [
{
role: 'user',
content: 'Hello, Claude!'
}
]
});
console.log(message.content[0].text);
}
// Gemini API acceleration
import { GoogleGenAI } from '@google/genai';
const geminiClient = new GoogleGenAI({
apiKey: 'your-gemini-api-key'
});
async function chatWithGemini() {
const response = await geminiClient.models.generateContent({
model: 'gemini-3-pro-preview',
contents: 'Hello, Gemini!',
config: {
httpOptions: {
baseUrl: 'https://xget.xi-xu.me/ip/gemini' // Use Xget
}
}
});
console.log(response.text);
}
```
#### Environment Variable Configuration
```bash
# Configure in .env file
OPENAI_BASE_URL=https://xget.xi-xu.me/ip/openai
ANTHROPIC_BASE_URL=https://xget.xi-xu.me/ip/anthropic
GEMINI_BASE_URL=https://xget.xi-xu.me/ip/gemini
COHERE_BASE_URL=https://xget.xi-xu.me/ip/cohere
MISTRAL_AI_BASE_URL=https://xget.xi-xu.me/ip/mistralai
GROQ_BASE_URL=https://xget.xi-xu.me/ip/groq
```
Then use in code:
```python
import os
from openai import OpenAI
# Read configuration from environment variables
client = OpenAI(
api_key=os.getenv("OPENAI_API_KEY"),
base_url=os.getenv("OPENAI_BASE_URL") # Automatically uses Xget
)
```
## 🚀 Deployment
### Deploy to Cloudflare Workers
1. **Fork this repository**:
[Fork xixu-me/Xget](https://github.com/xixu-me/Xget/fork)
2. **Get Cloudflare credentials**:
- Visit
[Account API tokens](https://dash.cloudflare.com/?to=/:account/api-tokens)
to create and note an API token, using the "Edit Cloudflare Workers"
template.
- Visit
[Workers and Pages](https://dash.cloudflare.com/?to=/:account/workers-and-pages)
to note the Account ID.
3. **Configure GitHub Secrets**:
- Go to your GitHub repository → Settings → Secrets and variables → Actions
- Add the following secrets:
- `CLOUDFLARE_API_TOKEN`: Your API token
- `CLOUDFLARE_ACCOUNT_ID`: Your Account ID
4. **Trigger deployment**:
- Pushing code to the `main` branch will automatically trigger deployment
- Modifying only documentation files (`.md`), `LICENSE`, `.gitignore`, etc.
will not trigger deployment
- You can also manually trigger deployment in the GitHub Actions page
5. **Bind custom domain** (optional): Bind your custom domain in the Cloudflare
Workers console
### Deploy to Cloudflare Pages
1. **Fork this repository**:
[Fork xixu-me/Xget](https://github.com/xixu-me/Xget/fork)
2. **Get Cloudflare credentials**:
- Visit
[Account API tokens](https://dash.cloudflare.com/?to=/:account/api-tokens)
to create and note an API token, using the "Edit Cloudflare Workers"
template.
- Visit
[Workers and Pages](https://dash.cloudflare.com/?to=/:account/workers-and-pages)
to note the Account ID.
3. **Configure GitHub Secrets**:
- Go to your GitHub repository → Settings → Secrets and variables → Actions
- Add the following secrets:
- `CLOUDFLARE_API_TOKEN`: Your API token
- `CLOUDFLARE_ACCOUNT_ID`: Your Account ID
4. **Trigger deployment**:
- The repository will automatically convert Workers code to Pages-compatible
format and sync to the `pages` branch
- Pushing code to the `main` branch will automatically trigger sync and
deployment workflows
- Modifying only documentation files (`.md`), `LICENSE`, `.gitignore`, etc.
will not trigger deployment
- You can also manually trigger deployment in the GitHub Actions page
5. **Bind custom domain** (optional): Bind your custom domain in the Cloudflare
Pages console
**Note**: The `pages` branch is automatically generated from the `main` branch.
Do not manually edit the `pages` branch as it will be overwritten by the sync
workflow.
### Deploy to EdgeOne Pages
1. **Fork this repository**:
[Fork xixu-me/Xget](https://github.com/xixu-me/Xget/fork)
2. **Get EdgeOne Pages API Token**:
- Visit
[China EdgeOne Console](https://console.cloud.tencent.com/edgeone/pages?tab=api)
or
[International EdgeOne Console](https://console.tencentcloud.com/edgeone/pages?tab=api)
to create and note an API Token
3. **Configure GitHub Secrets**:
- Go to your GitHub repository → Settings → Secrets and variables → Actions
- Add the following secret:
- `EDGEONE_API_TOKEN`: Your API Token
4. **Trigger deployment**:
- The repository will automatically convert Workers code to Pages-compatible
format and sync to the `pages` branch
- Pushing code to the `main` branch will automatically trigger sync and
deployment workflows
- Modifying only documentation files (`.md`), `LICENSE`, `.gitignore`, etc.
will not trigger deployment
- You can also manually trigger deployment in the GitHub Actions page
5. **Bind custom domain** (option
gitextract_0eq81jzj/ ├── .dockerignore ├── .editorconfig ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.yml │ │ ├── config.yml │ │ ├── documentation.yml │ │ ├── feature_request.yml │ │ ├── performance_issue.yml │ │ └── platform_request.yml │ ├── dependabot.yml │ ├── pull_request_template.md │ └── workflows/ │ ├── ci.yml │ ├── commitlint.yml │ ├── dependabot-auto-merge.yml │ ├── functions-ntl.yml │ ├── functions-vc.yml │ ├── image.yml │ ├── pages-cf.yml │ ├── pages-eo.yml │ ├── sync.yml │ └── workers.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.json ├── AGENTS.md ├── CLAUDE.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── README.md ├── README.zh-Hans.md ├── README.zh-Hant.md ├── SECURITY.md ├── adapters/ │ ├── functions/ │ │ ├── api/ │ │ │ └── index.js │ │ ├── deno.js │ │ ├── netlify/ │ │ │ └── edge-functions/ │ │ │ └── edge-handler.js │ │ ├── netlify.toml │ │ ├── package.json │ │ └── vercel.json │ └── pages/ │ ├── functions/ │ │ └── [[path]].js │ └── wrangler.toml ├── codecov.yml ├── commitlint.config.mjs ├── config.capnp ├── docs/ │ └── deploy-on-digitalocean.md ├── eslint.config.js ├── package.json ├── scripts/ │ └── fix-badge-colors.js ├── skills/ │ └── xget/ │ ├── SKILL.md │ ├── references/ │ │ └── REFERENCE.md │ └── scripts/ │ └── xget.mjs ├── src/ │ ├── app/ │ │ ├── handle-request.js │ │ └── request-context.js │ ├── config/ │ │ ├── index.js │ │ ├── platform-catalog.js │ │ └── platforms.js │ ├── index.js │ ├── protocols/ │ │ ├── ai.js │ │ ├── docker.js │ │ ├── git.js │ │ └── huggingface.js │ ├── response/ │ │ └── finalize-response.js │ ├── routing/ │ │ ├── platform-index.js │ │ ├── platform-transformers.js │ │ └── resolve-target.js │ ├── types.d.ts │ ├── upstream/ │ │ ├── cache.js │ │ └── fetch-upstream.js │ └── utils/ │ ├── performance.js │ ├── rewrite.js │ ├── security.js │ └── validation.js ├── test/ │ ├── benchmark/ │ │ └── performance.bench.js │ ├── features/ │ │ ├── auth.test.js │ │ ├── git-lfs.test.js │ │ ├── git.test.js │ │ ├── performance.test.js │ │ ├── range-cache.test.js │ │ └── security.test.js │ ├── fixtures/ │ │ └── responses.js │ ├── helpers/ │ │ ├── assertions.js │ │ ├── generators.js │ │ ├── index.js │ │ ├── mocks.js │ │ └── test-utils.js │ ├── index.test.js │ ├── integration.test.js │ ├── platforms/ │ │ ├── container-registry.test.js │ │ ├── cran.test.js │ │ ├── crates.test.js │ │ ├── flathub.test.js │ │ ├── homebrew.test.js │ │ ├── jenkins.test.js │ │ ├── npm-fix.test.js │ │ └── opensuse.test.js │ ├── setup.js │ ├── types.d.ts │ └── unit/ │ ├── app-structure.test.js │ ├── cache-privacy.test.js │ ├── cors-and-proxy-options.test.js │ ├── docker-helpers.test.js │ ├── flathub-rewrite.test.js │ ├── package-manifest.test.js │ ├── pipeline-modules.test.js │ ├── platform-boundaries.test.js │ ├── platforms.test.js │ ├── protocol-helpers.test.js │ ├── protocols.test.js │ ├── runtime-helpers.test.js │ ├── utils.test.js │ ├── worker-regressions.test.js │ └── xget-skill-script.test.js ├── tsconfig.json ├── vitest.config.js ├── vitest.coverage.config.js └── wrangler.toml
SYMBOL INDEX (176 symbols across 37 files)
FILE: adapters/functions/api/index.js
function handler (line 54) | async function handler(request, context) {
FILE: adapters/functions/deno.js
function handler (line 34) | async function handler(request) {
FILE: adapters/pages/functions/[[path]].js
function onRequest (line 55) | async function onRequest(context) {
FILE: scripts/fix-badge-colors.js
function extractBadgeInfo (line 16) | function extractBadgeInfo(filePath) {
function fixBadgeColors (line 50) | function fixBadgeColors(filePath, colorChanges) {
function fetchSimpleIcons (line 84) | async function fetchSimpleIcons() {
function checkReadme (line 106) | function checkReadme(filePath, simpleIcons) {
function main (line 186) | async function main() {
FILE: skills/xget/scripts/xget.mjs
constant DEFAULT_SOURCE_URL (line 8) | const DEFAULT_SOURCE_URL =
constant DEFAULT_README_URL (line 10) | const DEFAULT_README_URL = 'https://raw.githubusercontent.com/xixu-me/xg...
constant DEFAULT_BASE_PLACEHOLDER (line 12) | const DEFAULT_BASE_PLACEHOLDER = 'https://xget.example.com';
constant DEFAULT_PUBLIC_BASE_URL (line 13) | const DEFAULT_PUBLIC_BASE_URL = 'https://xget.xi-xu.me';
constant DEFAULT_PUBLIC_HOST (line 14) | const DEFAULT_PUBLIC_HOST = 'xget.xi-xu.me';
constant README_USE_CASES_HEADING (line 15) | const README_USE_CASES_HEADING = '## 🎯 Use Cases';
constant MISSING_BASE_URL_HINT (line 16) | const MISSING_BASE_URL_HINT =
constant CRATES_API_PREFIX (line 20) | const CRATES_API_PREFIX = '/api/v1/crates';
function getInvocationCommand (line 67) | function getInvocationCommand() {
function printHelp (line 80) | function printHelp() {
function parseArgs (line 130) | function parseArgs(argv) {
function getErrorMessage (line 167) | function getErrorMessage(error) {
function fail (line 176) | function fail(message, code = 1) {
function parsePlatformMapObject (line 187) | function parsePlatformMapObject(objectSource) {
function httpGet (line 218) | function httpGet(url) {
function extractPlatformsModule (line 251) | function extractPlatformsModule(jsSource) {
function createPlatformEntries (line 283) | function createPlatformEntries(platforms) {
function loadPlatformsFromSource (line 302) | function loadPlatformsFromSource(jsSource) {
function loadPlatforms (line 311) | async function loadPlatforms(sourceUrl) {
function normalizeBaseUrl (line 320) | function normalizeBaseUrl(value) {
function resolveBaseUrl (line 342) | function resolveBaseUrl(optionValue, envValue) {
function normalizeAbsoluteUrl (line 351) | function normalizeAbsoluteUrl(value, flagName) {
function normalizePathname (line 363) | function normalizePathname(pathname) {
function matchesPathPrefix (line 377) | function matchesPathPrefix(pathname, prefix, caseInsensitive = false) {
function stripPathPrefix (line 404) | function stripPathPrefix(pathname, prefix, caseInsensitive = false) {
function findPlatformByKey (line 420) | function findPlatformByKey(platforms, key) {
function findSpecialPlatformForUrl (line 429) | function findSpecialPlatformForUrl(platforms, originUrl) {
function findPlatformForUrl (line 446) | function findPlatformForUrl(platforms, originUrl) {
function getConvertedSuffix (line 476) | function getConvertedSuffix(platform, originUrl) {
function buildConvertedUrl (line 507) | function buildConvertedUrl(baseUrl, platform, originUrl) {
function parseMarkdownHeading (line 516) | function parseMarkdownHeading(line) {
function normalizeHeadingQuery (line 536) | function normalizeHeadingQuery(heading) {
function isCodeFenceDelimiter (line 548) | function isCodeFenceDelimiter(line) {
function collectMarkdownHeadings (line 556) | function collectMarkdownHeadings(lines) {
function formatHeadingLabel (line 601) | function formatHeadingLabel(heading) {
function sliceMarkdownSection (line 610) | function sliceMarkdownSection(lines, heading) {
function findUniqueHeading (line 639) | function findUniqueHeading(lines, heading) {
function filterHeadingsByMatch (line 662) | function filterHeadingsByMatch(headings, match) {
function listMarkdownHeadings (line 681) | function listMarkdownHeadings(markdown, minLevel = 2, maxLevel = 6) {
function resolveMarkdownHeading (line 697) | function resolveMarkdownHeading(markdown, heading) {
function extractMarkdownSection (line 706) | function extractMarkdownSection(markdown, heading) {
function rewriteUseCasesBaseUrl (line 717) | function rewriteUseCasesBaseUrl(baseUrl, markdownSection) {
function selectUseCaseSection (line 731) | function selectUseCaseSection(useCasesMarkdown, heading, match) {
function createUseCasesSnippet (line 782) | function createUseCasesSnippet(baseUrl, readmeMarkdown, options = {}) {
function renderJson (line 798) | function renderJson(value) {
function renderTable (line 806) | function renderTable(rows) {
function renderTextContent (line 829) | function renderTextContent(content) {
function renderTextHeadings (line 837) | function renderTextHeadings(headings) {
function getStringOption (line 853) | function getStringOption(options, key) {
function main (line 858) | async function main() {
FILE: src/app/handle-request.js
function handleRequest (line 32) | async function handleRequest(request, env, ctx) {
FILE: src/app/request-context.js
function createRequestContext (line 21) | function createRequestContext(request, env) {
FILE: src/config/index.js
function createConfig (line 134) | function createConfig(env = {}) {
constant CONFIG (line 179) | const CONFIG = createConfig();
FILE: src/config/platform-catalog.js
constant PLATFORM_CATALOG (line 23) | const PLATFORM_CATALOG = {
constant PLATFORMS (line 121) | const PLATFORMS = PLATFORM_CATALOG;
FILE: src/index.js
method fetch (line 22) | fetch(request, env, ctx) {
FILE: src/protocols/ai.js
function isAIInferenceRequest (line 34) | function isAIInferenceRequest(request, url) {
function configureAIHeaders (line 46) | function configureAIHeaders(headers, request) {
FILE: src/protocols/docker.js
function parseAuthenticate (line 35) | function parseAuthenticate(authenticateStr) {
function fetchToken (line 60) | async function fetchToken(wwwAuthenticate, scope, authorization) {
function readRegistryTokenResponse (line 85) | async function readRegistryTokenResponse(response) {
function getScopeFromUrl (line 124) | function getScopeFromUrl(url, effectivePath, platform) {
function normalizeRepoPath (line 154) | function normalizeRepoPath(platformKey, repoPath) {
function extractRepositoryPath (line 167) | function extractRepositoryPath(apiPath) {
function normalizeRegistryApiPath (line 194) | function normalizeRegistryApiPath(platformKey, apiPath) {
function resolveDockerAuthTarget (line 215) | function resolveDockerAuthTarget(url, platforms) {
function responseUnauthorized (line 264) | function responseUnauthorized(url, platform) {
function handleDockerAuth (line 295) | async function handleDockerAuth(request, url, config) {
FILE: src/protocols/git.js
function isGitRequest (line 35) | function isGitRequest(request, url) {
function isGitLFSRequest (line 78) | function isGitLFSRequest(request, url) {
function configureGitHeaders (line 122) | function configureGitHeaders(headers, request, url, isLFS) {
FILE: src/protocols/huggingface.js
function isHuggingFaceAPIRequest (line 33) | function isHuggingFaceAPIRequest(request, url) {
function configureHuggingFaceHeaders (line 52) | function configureHuggingFaceHeaders(headers, request) {
FILE: src/response/finalize-response.js
function finalizeErrorResponse (line 27) | async function finalizeErrorResponse({ requestContext, response, respons...
function finalizeSuccessfulResponse (line 84) | async function finalizeSuccessfulResponse({
function finalizeResponse (line 239) | async function finalizeResponse({
FILE: src/routing/platform-index.js
function getPlatformPathPrefix (line 8) | function getPlatformPathPrefix(platformKey) {
constant SORTED_PLATFORMS (line 15) | const SORTED_PLATFORMS = Object.keys(PLATFORM_CATALOG).sort((a, b) => {
FILE: src/routing/platform-transformers.js
function escapeRegex (line 9) | function escapeRegex(value) {
function stripPlatformPrefix (line 19) | function stripPlatformPrefix(path, platformKey) {
function transformCratesPath (line 29) | function transformCratesPath(transformedPath) {
function transformJenkinsPath (line 46) | function transformJenkinsPath(transformedPath) {
constant PLATFORM_PATH_TRANSFORMERS (line 71) | const PLATFORM_PATH_TRANSFORMERS = {
function transformPath (line 82) | function transformPath(path, platformKey) {
FILE: src/routing/resolve-target.js
constant HOME_PAGE_URL (line 7) | const HOME_PAGE_URL = 'https://github.com/xixu-me/Xget';
function createHomepageRedirect (line 13) | function createHomepageRedirect() {
function normalizeEffectivePath (line 23) | function normalizeEffectivePath(url, isDocker) {
function resolveTarget (line 62) | function resolveTarget(url, effectivePath, platforms) {
FILE: src/types.d.ts
type ExecutionContext (line 9) | interface ExecutionContext {
type DenoEnv (line 22) | interface DenoEnv {
type DenoGlobal (line 30) | interface DenoGlobal {
FILE: src/upstream/cache.js
function getDefaultCache (line 9) | function getDefaultCache() {
function tryReadCachedResponse (line 36) | async function tryReadCachedResponse({
FILE: src/upstream/fetch-upstream.js
constant MEDIA_FILE_PATTERN (line 13) | const MEDIA_FILE_PATTERN =
function createFetchOptions (line 36) | function createFetchOptions({
function followDockerRedirectIfNeeded (line 123) | async function followDockerRedirectIfNeeded(response, targetUrl, finalFe...
function executeFetch (line 164) | async function executeFetch({ fetchOptions, request, requestContext, req...
function retryDockerWithAnonymousToken (line 239) | async function retryDockerWithAnonymousToken({
function fetchUpstreamResponse (line 311) | async function fetchUpstreamResponse({
FILE: src/utils/performance.js
class PerformanceMonitor (line 31) | class PerformanceMonitor {
method constructor (line 38) | constructor() {
method mark (line 50) | mark(name) {
method getMetrics (line 64) | getMetrics() {
function addPerformanceHeaders (line 81) | function addPerformanceHeaders(response, monitor) {
FILE: src/utils/rewrite.js
constant FLATHUB_REPO_BASE_URL_PATTERN (line 5) | const FLATHUB_REPO_BASE_URL_PATTERN = /https:\/\/(?:dl\.)?flathub\.org\/...
constant FLATPAK_REFERENCE_FILE_PATTERN (line 6) | const FLATPAK_REFERENCE_FILE_PATTERN = /\.(flatpakrepo|flatpakref)$/i;
function shouldRewriteTextResponse (line 15) | function shouldRewriteTextResponse(platform, requestPath, contentType = ...
function isFlatpakReferenceFilePath (line 36) | function isFlatpakReferenceFilePath(requestPath) {
function rewriteTextResponse (line 48) | function rewriteTextResponse(platform, requestPath, originalText, origin) {
FILE: src/utils/security.js
function resolveAllowedOrigin (line 29) | function resolveAllowedOrigin(request, config) {
function addCorsHeaders (line 50) | function addCorsHeaders(headers, request, config) {
function addSecurityHeaders (line 89) | function addSecurityHeaders(headers) {
function createErrorResponse (line 109) | function createErrorResponse(message, status, includeDetails = false) {
FILE: src/utils/validation.js
function getRequestTraits (line 42) | function getRequestTraits(request, url) {
function isProtocolRequest (line 63) | function isProtocolRequest(traits) {
function decodePathnameForValidation (line 75) | function decodePathnameForValidation(pathname) {
function hasPathTraversal (line 95) | function hasPathTraversal(pathname) {
function hasAsciiControlChars (line 110) | function hasAsciiControlChars(value) {
function isDockerRequest (line 131) | function isDockerRequest(request, url) {
function getAllowedMethods (line 180) | function getAllowedMethods(request, url, config = CONFIG) {
function validateRequest (line 210) | function validateRequest(
FILE: test/features/auth.test.js
method waitUntil (line 7) | waitUntil() {}
method passThroughOnException (line 8) | passThroughOnException() {}
FILE: test/features/performance.test.js
class MockPerformanceMonitor (line 4) | class MockPerformanceMonitor {
method constructor (line 5) | constructor() {
method mark (line 14) | mark(name) {
method getMetrics (line 21) | getMetrics() {
FILE: test/fixtures/responses.js
constant MOCK_RESPONSES (line 6) | const MOCK_RESPONSES = {
function createMockResponse (line 70) | function createMockResponse(mockData) {
FILE: test/helpers/assertions.js
function validateSecurityHeaders (line 10) | function validateSecurityHeaders(response) {
function isValidUrl (line 44) | function isValidUrl(url) {
function hasSecurityHeaders (line 58) | function hasSecurityHeaders(response) {
FILE: test/helpers/generators.js
function generateTestUrl (line 11) | function generateTestUrl(platform, path) {
constant TEST_URLS (line 19) | const TEST_URLS = {
constant SECURITY_PAYLOADS (line 60) | const SECURITY_PAYLOADS = {
method randomString (line 90) | randomString(length = 10) {
method githubRepo (line 103) | githubRepo() {
method filePath (line 115) | filePath() {
FILE: test/helpers/index.js
class PerformanceTestHelper (line 13) | class PerformanceTestHelper {
method constructor (line 14) | constructor() {
method measure (line 25) | async measure(fn, name = 'operation') {
method getMeasurements (line 43) | getMeasurements() {
method getAverageDuration (line 52) | getAverageDuration(name) {
method clear (line 65) | clear() {
function timeout (line 75) | function timeout(ms) {
function wait (line 86) | function wait(ms) {
FILE: test/helpers/mocks.js
function createMockRequest (line 11) | function createMockRequest(url, options = {}) {
function createMockResponse (line 29) | function createMockResponse(body = 'OK', options = {}) {
function createGitRequest (line 47) | function createGitRequest(url, service = 'git-upload-pack') {
function createDockerRequest (line 68) | function createDockerRequest(url, options = {}) {
function mockFetch (line 86) | function mockFetch(url, _options = {}) {
function createMockNpmRegistryResponse (line 106) | function createMockNpmRegistryResponse(packageName, version = '1.0.0') {
FILE: test/unit/cors-and-proxy-options.test.js
method waitUntil (line 7) | waitUntil() {}
method passThroughOnException (line 8) | passThroughOnException() {}
FILE: test/unit/flathub-rewrite.test.js
method waitUntil (line 7) | waitUntil() {}
method passThroughOnException (line 8) | passThroughOnException() {}
function readUtf8Text (line 16) | async function readUtf8Text(response) {
FILE: test/unit/pipeline-modules.test.js
method waitUntil (line 92) | waitUntil() {}
method passThroughOnException (line 92) | passThroughOnException() {}
FILE: test/unit/protocols.test.js
method waitUntil (line 14) | waitUntil() {}
method passThroughOnException (line 15) | passThroughOnException() {}
FILE: test/unit/worker-regressions.test.js
method waitUntil (line 7) | waitUntil() {}
method passThroughOnException (line 8) | passThroughOnException() {}
method get (line 643) | get(name) {
method [Symbol.iterator] (line 653) | *[Symbol.iterator]() {
method get (line 686) | get(name) {
method [Symbol.iterator] (line 693) | *[Symbol.iterator]() {
Condensed preview — 117 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (780K chars).
[
{
"path": ".dockerignore",
"chars": 427,
"preview": "# Dependencies\nnode_modules/\nnpm-debug.log\n\n# Build outputs\ndist/\n.wrangler/\nwrangler-dist/\n\n# Tests\ntest/\ncoverage/\n*.t"
},
{
"path": ".editorconfig",
"chars": 203,
"preview": "# http://editorconfig.org\nroot = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_tr"
},
{
"path": ".github/FUNDING.yml",
"chars": 61,
"preview": "custom: https://xi-xu.me/#sponsorships\nbuy_me_a_coffee: xixu\n"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.yml",
"chars": 3435,
"preview": "name: 🐛 bug 报告\ndescription: 报告一个问题或错误\ntitle: \"[Bug]: \"\nlabels: [\"bug\", \"需要分类\"]\nassignees: []\n\nbody:\n - type: markdown\n "
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 380,
"preview": "blank_issues_enabled: false\ncontact_links:\n - name: 📚 文档\n url: https://github.com/xixu-me/Xget/blob/main/README.zh-H"
},
{
"path": ".github/ISSUE_TEMPLATE/documentation.yml",
"chars": 3241,
"preview": "name: 📝 文档改进\ndescription: 报告文档问题或建议文档改进\ntitle: \"[Docs]: \"\nlabels: [\"documentation\", \"需要分类\"]\nassignees: []\n\nbody:\n - typ"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.yml",
"chars": 3248,
"preview": "name: ✨ 功能请求\ndescription: 建议一个新功能或改进\ntitle: \"[Feature]: \"\nlabels: [\"enhancement\", \"需要分类\"]\nassignees: []\n\nbody:\n - type:"
},
{
"path": ".github/ISSUE_TEMPLATE/performance_issue.yml",
"chars": 4880,
"preview": "name: ⚡ 性能问题\ndescription: 报告性能相关的问题或建议性能优化\ntitle: \"[Performance]: \"\nlabels: [\"performance\", \"需要分类\"]\nassignees: []\n\nbody:"
},
{
"path": ".github/ISSUE_TEMPLATE/platform_request.yml",
"chars": 4960,
"preview": "name: 🌐 新平台支持请求\ndescription: 请求添加对新平台的支持\ntitle: \"[Platform]: \"\nlabels: [\"platform\", \"enhancement\", \"需要分类\"]\nassignees: []"
},
{
"path": ".github/dependabot.yml",
"chars": 1746,
"preview": "version: 2\nupdates:\n # GitHub Actions dependencies\n - package-ecosystem: \"github-actions\"\n directory: \"/\"\n sched"
},
{
"path": ".github/pull_request_template.md",
"chars": 1164,
"preview": "## 概述\n\n<!-- 请简要描述此 PR 的目的和改动内容 -->\n\n## 改动类型\n\n<!-- 请勾选适用的改动类型 -->\n\n- [ ] 🐛 bug 修复\n- [ ] ✨ 新功能\n- [ ] 📝 文档更新\n- [ ] 🎨 代码风格/格"
},
{
"path": ".github/workflows/ci.yml",
"chars": 3137,
"preview": "name: CI\n\non:\n push:\n branches:\n - main\n paths-ignore:\n - \"**.md\"\n - \"LICENSE\"\n - \".gitignore"
},
{
"path": ".github/workflows/commitlint.yml",
"chars": 1258,
"preview": "name: Commit Lint\n\non:\n push:\n branches:\n - main\n pull_request:\n branches:\n - main\n\nconcurrency:\n gro"
},
{
"path": ".github/workflows/dependabot-auto-merge.yml",
"chars": 3798,
"preview": "name: Dependabot Auto Merge\n\non:\n workflow_run:\n workflows:\n - CI\n - Commit Lint\n types:\n - comple"
},
{
"path": ".github/workflows/functions-ntl.yml",
"chars": 1000,
"preview": "name: Deploy to Netlify\n\non:\n workflow_run:\n workflows: [\"Sync to Pages and Functions\"]\n types:\n - completed"
},
{
"path": ".github/workflows/functions-vc.yml",
"chars": 1337,
"preview": "name: Deploy to Vercel\n\non:\n workflow_run:\n workflows: [\"Sync to Pages and Functions\"]\n types:\n - completed\n"
},
{
"path": ".github/workflows/image.yml",
"chars": 2604,
"preview": "name: Build and Push Image\n\non:\n workflow_run:\n workflows: [\"CI\"]\n types:\n - completed\n branches:\n -"
},
{
"path": ".github/workflows/pages-cf.yml",
"chars": 2258,
"preview": "name: Deploy to Cloudflare Pages\n\non:\n workflow_run:\n workflows: [\"Sync to Pages and Functions\"]\n types:\n - "
},
{
"path": ".github/workflows/pages-eo.yml",
"chars": 1187,
"preview": "name: Deploy to EdgeOne Pages\n\non:\n workflow_run:\n workflows: [\"Sync to Pages and Functions\"]\n types:\n - com"
},
{
"path": ".github/workflows/sync.yml",
"chars": 6430,
"preview": "name: Sync to Pages and Functions\n\non:\n workflow_run:\n workflows: [\"CI\"]\n types:\n - completed\n branches:\n"
},
{
"path": ".github/workflows/workers.yml",
"chars": 1254,
"preview": "name: Deploy to Cloudflare Workers\n\non:\n workflow_run:\n workflows: [\"CI\"]\n types:\n - completed\n branches:"
},
{
"path": ".gitignore",
"chars": 2131,
"preview": "# Logs\n\nlogs\n_.log\nnpm-debug.log_\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n.pnpm-debug.log*\n\n# Diagnostic report"
},
{
"path": ".prettierignore",
"chars": 1042,
"preview": "# Dependencies\nnode_modules/\n.pnp\n.pnp.js\n\n# Production builds\ndist/\nbuild/\n\n# Environment files\n.env\n.env.local\n.env.de"
},
{
"path": ".prettierrc.json",
"chars": 748,
"preview": "{\n \"arrowParens\": \"avoid\",\n \"bracketSameLine\": false,\n \"bracketSpacing\": true,\n \"embeddedLanguageFormatting\": \"auto\""
},
{
"path": "AGENTS.md",
"chars": 10,
"preview": "CLAUDE.md\n"
},
{
"path": "CLAUDE.md",
"chars": 12605,
"preview": "# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with\ncode in this repository.\n\n## "
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 1682,
"preview": "# 贡献者行为准则\n\n## 我们的承诺\n\n作为成员、贡献者和领导者,我们承诺让每个人都能在我们的社区中获得无骚扰的体验,无论其年龄、体型、明显或不明显的残疾、种族、性别特征、性别认同和表达、经验水平、教育程度、社会经济地位、国籍、外貌、种族"
},
{
"path": "CONTRIBUTING.md",
"chars": 3430,
"preview": "# 贡献指南\n\n感谢您对 Xget 的关注!我们欢迎各种形式的贡献,包括但不限于代码、文档、测试、反馈和建议。\n\n## 🤝 贡献方式\n\n### 报告问题\n\n- 使用\n [Issue 模板](https://github.com/xixu-"
},
{
"path": "Dockerfile",
"chars": 1195,
"preview": "# --- Stage 1: build the Worker with Wrangler -----------------------\nFROM node:25-alpine AS builder\n\nWORKDIR /app\n\n# In"
},
{
"path": "LICENSE",
"chars": 34503,
"preview": "GNU AFFERO GENERAL PUBLIC LICENSE\n Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software "
},
{
"path": "README.md",
"chars": 104977,
"preview": "<div align=\"center\">\n\n# Xget 🚀\n\n<a href=\"https://trendshift.io/repositories/14768\" target=\"_blank\"><img src=\"https://tre"
},
{
"path": "README.zh-Hans.md",
"chars": 83523,
"preview": "<div align=\"center\">\n\n# Xget 🚀\n\n<a href=\"https://trendshift.io/repositories/14768\" target=\"_blank\"><img src=\"https://tre"
},
{
"path": "README.zh-Hant.md",
"chars": 83889,
"preview": "<div align=\"center\">\n\n# Xget 🚀\n\n<a href=\"https://trendshift.io/repositories/14768\" target=\"_blank\"><img src=\"https://tre"
},
{
"path": "SECURITY.md",
"chars": 1883,
"preview": "# 安全政策\n\n## 🔒 支持的版本\n\n我们为以下版本提供安全更新:\n\n| 版本 | 支持状态 |\n| --- | --- |\n| 最新版本 | ✅ |\n| 开发版本 | ⚠️ 仅限测试 |\n\n## 🚨 报告安全漏洞\n\n如果您发现了安全漏洞"
},
{
"path": "adapters/functions/api/index.js",
"chars": 3758,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "adapters/functions/deno.js",
"chars": 2483,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "adapters/functions/netlify/edge-functions/edge-handler.js",
"chars": 854,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "adapters/functions/netlify.toml",
"chars": 80,
"preview": "[[edge_functions]]\nfunction = \"edge-handler\"\npath = \"/*\"\n\n[build]\npublish = \".\"\n"
},
{
"path": "adapters/functions/package.json",
"chars": 318,
"preview": "{\n \"name\": \"xget\",\n \"version\": \"1.0.0\",\n \"type\": \"module\",\n \"private\": false,\n \"scripts\": {\n \"dev\": \"vercel dev\""
},
{
"path": "adapters/functions/vercel.json",
"chars": 356,
"preview": "{\n \"$schema\": \"https://openapi.vercel.sh/vercel.json\",\n \"name\": \"xget\",\n \"version\": 2,\n \"rewrites\": [\n {\n \"s"
},
{
"path": "adapters/pages/functions/[[path]].js",
"chars": 2633,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "adapters/pages/wrangler.toml",
"chars": 167,
"preview": "#:schema node_modules/wrangler/config-schema.json\nname = \"xget\"\npages_build_output_dir = \".\"\ncompatibility_date = \"2024-"
},
{
"path": "codecov.yml",
"chars": 564,
"preview": "codecov:\n require_ci_to_pass: true\n strict_yaml_branch: main\n\ncoverage:\n precision: 2\n round: down\n range: 0..100\n "
},
{
"path": "commitlint.config.mjs",
"chars": 68,
"preview": "export default {\n extends: [\"@commitlint/config-conventional\"],\n};\n"
},
{
"path": "config.capnp",
"chars": 531,
"preview": "using Workerd = import \"/workerd/workerd.capnp\";\n\nconst config :Workerd.Config = (\n services = [\n (name = \"main\", wo"
},
{
"path": "docs/deploy-on-digitalocean.md",
"chars": 12589,
"preview": "# Deploying and Optimizing Xget on DigitalOcean\n\nXget itself is shipped as a container image, so it fits very naturally "
},
{
"path": "eslint.config.js",
"chars": 6955,
"preview": "import js from '@eslint/js';\nimport prettierConfig from 'eslint-config-prettier';\nimport jsdoc from 'eslint-plugin-jsdoc"
},
{
"path": "package.json",
"chars": 1556,
"preview": "{\n \"dependencies\": {\n \"express\": \"^5.2.1\"\n },\n \"devDependencies\": {\n \"@cloudflare/vitest-pool-workers\": \"^0.13."
},
{
"path": "scripts/fix-badge-colors.js",
"chars": 5839,
"preview": "import { readFileSync, writeFileSync } from 'fs';\nimport { dirname, join } from 'path';\nimport { fileURLToPath } from 'u"
},
{
"path": "skills/xget/SKILL.md",
"chars": 4852,
"preview": "---\nname: xget\ndescription:\n Execute Xget work in real developer workflows. Use this skill when a task\n involves Xget "
},
{
"path": "skills/xget/references/REFERENCE.md",
"chars": 4118,
"preview": "# Xget Reference\n\nUse this file only when the user needs shell setup, deployment, or\ntroubleshooting details. Reuse the "
},
{
"path": "skills/xget/scripts/xget.mjs",
"chars": 25583,
"preview": "#!/usr/bin/env node\n\nimport { get } from 'node:https';\nimport { relative } from 'node:path';\nimport process from 'node:p"
},
{
"path": "src/app/handle-request.js",
"chars": 7182,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "src/app/request-context.js",
"chars": 1138,
"preview": "import { CONFIG, createConfig } from '../config/index.js';\nimport { getRequestTraits } from '../utils/validation.js';\n\n/"
},
{
"path": "src/config/index.js",
"chars": 6981,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "src/config/platform-catalog.js",
"chars": 4602,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "src/config/platforms.js",
"chars": 493,
"preview": "/**\n * Compatibility exports for platform configuration and routing helpers.\n *\n * New code should prefer:\n * - `src/con"
},
{
"path": "src/index.js",
"chars": 733,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "src/protocols/ai.js",
"chars": 1911,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "src/protocols/docker.js",
"chars": 11136,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "src/protocols/git.js",
"chars": 5144,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "src/protocols/huggingface.js",
"chars": 1987,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "src/response/finalize-response.js",
"chars": 7718,
"preview": "import {\n isFlatpakReferenceFilePath,\n rewriteTextResponse,\n shouldRewriteTextResponse\n} from '../utils/rewrite.js';\n"
},
{
"path": "src/routing/platform-index.js",
"chars": 565,
"preview": "import { PLATFORM_CATALOG } from '../config/platform-catalog.js';\n\n/**\n * Converts a platform key into its matching URL "
},
{
"path": "src/routing/platform-transformers.js",
"chars": 2577,
"preview": "import { PLATFORM_CATALOG } from '../config/platform-catalog.js';\nimport { getPlatformPathPrefix } from './platform-inde"
},
{
"path": "src/routing/resolve-target.js",
"chars": 3044,
"preview": "import { SORTED_PLATFORMS } from './platform-index.js';\nimport { transformPath } from './platform-transformers.js';\nimpo"
},
{
"path": "src/types.d.ts",
"chars": 884,
"preview": "/**\n * Global type declarations for Cloudflare Workers\n */\n\n/**\n * Cloudflare Workers execution context\n * Provides meth"
},
{
"path": "src/upstream/cache.js",
"chars": 2368,
"preview": "/**\n * Cache helpers for upstream request handling.\n */\n\n/**\n * Reads the default Cloudflare cache when available.\n * @r"
},
{
"path": "src/upstream/fetch-upstream.js",
"chars": 11312,
"preview": "import { configureAIHeaders } from '../protocols/ai.js';\nimport {\n fetchToken,\n getScopeFromUrl,\n parseAuthenticate,\n"
},
{
"path": "src/utils/performance.js",
"chars": 3213,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "src/utils/rewrite.js",
"chars": 1984,
"preview": "/**\n * Xget - Platform-specific upstream response rewriting helpers.\n */\n\nconst FLATHUB_REPO_BASE_URL_PATTERN = /https:\\"
},
{
"path": "src/utils/security.js",
"chars": 4384,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "src/utils/validation.js",
"chars": 7921,
"preview": "/**\n * Xget - High-performance acceleration engine for developer resources\n * Copyright (C) 2025 Xi Xu\n *\n * This progra"
},
{
"path": "test/benchmark/performance.bench.js",
"chars": 6393,
"preview": "import { SELF } from 'cloudflare:test';\nimport { bench, describe } from 'vitest';\nimport { TEST_URLS } from '../helpers/"
},
{
"path": "test/features/auth.test.js",
"chars": 4230,
"preview": "import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\n\nimport worker from '../../src/index.js';\n\n/**"
},
{
"path": "test/features/git-lfs.test.js",
"chars": 2966,
"preview": "import { SELF } from 'cloudflare:test';\nimport { describe, expect, it } from 'vitest';\n\ndescribe('Git LFS Protocol Integ"
},
{
"path": "test/features/git.test.js",
"chars": 1333,
"preview": "import { SELF } from 'cloudflare:test';\nimport { describe, expect, it } from 'vitest';\n\ndescribe('Git Protocol Integrati"
},
{
"path": "test/features/performance.test.js",
"chars": 7089,
"preview": "import { beforeEach, describe, expect, it, vi } from 'vitest';\n\n// Mock PerformanceMonitor class for testing\nclass MockP"
},
{
"path": "test/features/range-cache.test.js",
"chars": 8494,
"preview": "import { SELF } from 'cloudflare:test';\nimport { describe, expect, it } from 'vitest';\n\n/**\n * Tests for Range Request C"
},
{
"path": "test/features/security.test.js",
"chars": 10188,
"preview": "import { SELF } from 'cloudflare:test';\nimport { describe, expect, it } from 'vitest';\n\ndescribe('Security Features', ()"
},
{
"path": "test/fixtures/responses.js",
"chars": 2082,
"preview": "/**\n * Mock HTTP response fixtures for testing\n * Organized by platform with realistic response data\n */\n\nexport const M"
},
{
"path": "test/helpers/assertions.js",
"chars": 1344,
"preview": "/**\n * Custom assertions and validation helpers\n */\n\n/**\n * Validate response headers for security\n * @param {Response} "
},
{
"path": "test/helpers/generators.js",
"chars": 4154,
"preview": "/**\n * Test data generators\n */\n\n/**\n * Generate test URLs for different platforms\n * @param {string} platform - Platfor"
},
{
"path": "test/helpers/index.js",
"chars": 2150,
"preview": "/**\n * Test helpers - centralized exports\n */\n\n// Re-export all utilities\nexport * from './assertions.js';\nexport * from"
},
{
"path": "test/helpers/mocks.js",
"chars": 3320,
"preview": "/**\n * Mock creation utilities for tests\n */\n\n/**\n * Create a mock request with default options\n * @param {string} url -"
},
{
"path": "test/helpers/test-utils.js",
"chars": 257,
"preview": "/**\n * Test utilities - backward compatibility wrapper\n * This file maintains backward compatibility with existing tests"
},
{
"path": "test/index.test.js",
"chars": 10462,
"preview": "import { SELF } from 'cloudflare:test';\nimport { describe, expect, it } from 'vitest';\n\ndescribe('Xget Core Functionalit"
},
{
"path": "test/integration.test.js",
"chars": 11614,
"preview": "import { SELF } from 'cloudflare:test';\nimport { describe, expect, it } from 'vitest';\n\ndescribe('Integration Tests', ()"
},
{
"path": "test/platforms/container-registry.test.js",
"chars": 10328,
"preview": "import { SELF } from 'cloudflare:test';\nimport { describe, expect, it } from 'vitest';\n\ndescribe('Container Registry Sup"
},
{
"path": "test/platforms/cran.test.js",
"chars": 1932,
"preview": "import { describe, expect, it } from 'vitest';\nimport { PLATFORM_CATALOG as PLATFORMS } from '../../src/config/platform-"
},
{
"path": "test/platforms/crates.test.js",
"chars": 1215,
"preview": "import { describe, expect, it } from 'vitest';\nimport { transformPath } from '../../src/routing/platform-transformers.js"
},
{
"path": "test/platforms/flathub.test.js",
"chars": 1958,
"preview": "import { describe, expect, it } from 'vitest';\nimport { PLATFORM_CATALOG as PLATFORMS } from '../../src/config/platform-"
},
{
"path": "test/platforms/homebrew.test.js",
"chars": 3062,
"preview": "import { describe, expect, it } from 'vitest';\nimport { transformPath } from '../../src/routing/platform-transformers.js"
},
{
"path": "test/platforms/jenkins.test.js",
"chars": 6051,
"preview": "import { describe, expect, it } from 'vitest';\nimport { transformPath } from '../../src/routing/platform-transformers.js"
},
{
"path": "test/platforms/npm-fix.test.js",
"chars": 2318,
"preview": "import { describe, expect, it } from 'vitest';\n\ndescribe('npm URL Rewriting Fix', () => {\n it('should correctly rewrite"
},
{
"path": "test/platforms/opensuse.test.js",
"chars": 2429,
"preview": "import { describe, expect, it } from 'vitest';\nimport { PLATFORM_CATALOG as PLATFORMS } from '../../src/config/platform-"
},
{
"path": "test/setup.js",
"chars": 1239,
"preview": "/**\n * Test setup and global configuration\n * Simplified version - only essential setup\n */\n\nimport { beforeAll } from '"
},
{
"path": "test/types.d.ts",
"chars": 682,
"preview": "/**\n * Type declarations for cloudflare:test module\n * Based on @cloudflare/vitest-pool-workers\n */\n\ndeclare module 'clo"
},
{
"path": "test/unit/app-structure.test.js",
"chars": 2160,
"preview": "import { describe, expect, it } from 'vitest';\n\nimport apiHandler, { config as vercelConfig } from '../../adapters/funct"
},
{
"path": "test/unit/cache-privacy.test.js",
"chars": 1966,
"preview": "import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\n\nimport worker from '../../src/index.js';\n\ndes"
},
{
"path": "test/unit/cors-and-proxy-options.test.js",
"chars": 3991,
"preview": "import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\n\nimport worker from '../../src/index.js';\n\n/**"
},
{
"path": "test/unit/docker-helpers.test.js",
"chars": 4909,
"preview": "import { afterEach, describe, expect, it, vi } from 'vitest';\n\nimport { CONFIG } from '../../src/config/index.js';\nimpor"
},
{
"path": "test/unit/flathub-rewrite.test.js",
"chars": 4570,
"preview": "import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\n\nimport worker from '../../src/index.js';\n\n/**"
},
{
"path": "test/unit/package-manifest.test.js",
"chars": 525,
"preview": "import { createRequire } from 'node:module';\n\nimport { describe, expect, it } from 'vitest';\n\ndescribe('Package manifest"
},
{
"path": "test/unit/pipeline-modules.test.js",
"chars": 4025,
"preview": "import { afterEach, describe, expect, it, vi } from 'vitest';\n\nimport { createRequestContext } from '../../src/app/reque"
},
{
"path": "test/unit/platform-boundaries.test.js",
"chars": 1263,
"preview": "import { describe, expect, it } from 'vitest';\n\nimport { PLATFORM_CATALOG } from '../../src/config/platform-catalog.js';"
},
{
"path": "test/unit/platforms.test.js",
"chars": 16490,
"preview": "import { describe, expect, it } from 'vitest';\nimport { PLATFORM_CATALOG as PLATFORMS } from '../../src/config/platform-"
},
{
"path": "test/unit/protocol-helpers.test.js",
"chars": 6042,
"preview": "import { describe, expect, it } from 'vitest';\n\nimport { configureAIHeaders } from '../../src/protocols/ai.js';\nimport {"
},
{
"path": "test/unit/protocols.test.js",
"chars": 12096,
"preview": "import { afterEach, describe, expect, it, vi } from 'vitest';\nimport worker from '../../src/index.js';\nimport { CONFIG }"
},
{
"path": "test/unit/runtime-helpers.test.js",
"chars": 2250,
"preview": "import { afterEach, describe, expect, it, vi } from 'vitest';\n\nimport { PerformanceMonitor, addPerformanceHeaders } from"
},
{
"path": "test/unit/utils.test.js",
"chars": 11734,
"preview": "import { describe, expect, it } from 'vitest';\n\nimport { createConfig } from '../../src/config/index.js';\nimport { isGit"
},
{
"path": "test/unit/worker-regressions.test.js",
"chars": 22951,
"preview": "import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\n\nimport worker from '../../src/index.js';\n\n/**"
},
{
"path": "test/unit/xget-skill-script.test.js",
"chars": 1323,
"preview": "import { describe, expect, it } from 'vitest';\n\nimport {\n createPlatformEntries,\n extractPlatformsModule,\n loadPlatfo"
},
{
"path": "tsconfig.json",
"chars": 446,
"preview": "{\n \"compilerOptions\": {\n \"allowJs\": true,\n \"checkJs\": true,\n \"esModuleInterop\": true,\n \"forceConsistentCasi"
},
{
"path": "vitest.config.js",
"chars": 304,
"preview": "import { cloudflareTest } from '@cloudflare/vitest-pool-workers';\nimport { defineConfig } from 'vitest/config';\n\nexport "
},
{
"path": "vitest.coverage.config.js",
"chars": 1165,
"preview": "import { defineConfig } from 'vitest/config';\n\nexport default defineConfig({\n test: {\n testTimeout: 60000,\n hookT"
},
{
"path": "wrangler.toml",
"chars": 439,
"preview": "#:schema node_modules/wrangler/config-schema.json\nname = \"xget\"\nmain = \"src/index.js\"\ncompatibility_date = \"2024-10-22\"\n"
}
]
About this extraction
This page contains the full source code of the xixu-me/xget GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 117 files (728.7 KB), approximately 214.9k tokens, and a symbol index with 176 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.