Localize documentation and extension messages to Chinese

Converted all major documentation files (README, PRIVACY_POLICY, SECURITY, pull request template) to Chinese. Updated extension source files (background.js, content.js, popup.html, popup.js) to use Chinese comments and user-facing messages for improved localization and user experience.
This commit is contained in:
xixu-me committed 2025-07-12 10:49:56 +08:00
1 parent 40103d8a05
commit a1e258a4b8
10 files changed
+495 -513

No files matched your search

+41 -41
View File
@@ -1,62 +1,62 @@
# Pull Request
## Description
<!-- Provide a brief description of the changes in this PR -->
## 描述
<!-- 简要描述此 PR 中的更改 -->
## Type of Change
<!-- Mark the relevant option with an "x" -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
- [ ] Code refactoring (no functional changes)
- [ ] Performance improvement
## 更改类型
<!-- 用 "x" 标记相关选项 -->
- [ ] Bug 修复(修复问题的非破坏性更改)
- [ ] 新功能(添加功能的非破坏性更改)
- [ ] 破坏性更改(会导致现有功能无法正常工作的修复或功能)
- [ ] 文档更新
- [ ] 代码重构(无功能更改)
- [ ] 性能改进
## Related Issues
<!-- Link any related issues using #issue_number -->
Fixes #(issue_number)
## 相关问题
<!-- 使用 #issue_number 链接任何相关问题 -->
修复 #(问题编号)
## Changes Made
<!-- Describe the specific changes made in this PR -->
## 所做更改
<!-- 描述此 PR 中的具体更改 -->
-
-
-
## Testing
<!-- Describe how you tested these changes -->
- [ ] Tested on GitHub
- [ ] Tested on GitLab
- [ ] Tested on Hugging Face
- [ ] Tested extension popup/settings
- [ ] Tested with multiple file types
- [ ] Verified no console errors
## 测试
<!-- 描述你如何测试这些更改 -->
- [ ] 在 GitHub 上测试
- [ ] 在 GitLab 上测试
- [ ] 在 Hugging Face 上测试
- [ ] 测试扩展弹出窗口/设置
- [ ] 测试多种文件类型
- [ ] 验证无控制台错误
## Platform Compatibility
<!-- Check all platforms where you've tested the changes -->
## 平台兼容性
<!-- 检查你测试更改的所有平台 -->
- [ ] GitHub
- [ ] GitLab
- [ ] Hugging Face
## Browser Testing
<!-- Check browsers where you've tested -->
## 浏览器测试
<!-- 检查你测试过的浏览器 -->
- [ ] Chrome
- [ ] Microsoft Edge
- [ ] Brave
- [ ] Other: ____________
- [ ] 其他:____________
## Screenshots/Videos
<!-- Add screenshots or videos if applicable -->
## 截图/视频
<!-- 如果适用,添加截图或视频 -->
## Checklist
## 检查清单
- [ ] I have read and followed the project guidelines
- [ ] My code follows the existing code style
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] My changes generate no new console errors or warnings
- [ ] I have tested that existing functionality still works
- [ ] Any new features include appropriate error handling
- [ ] The extension manifest version has been updated if needed
- [ ] 我已阅读并遵循项目指南
- [ ] 我的代码遵循现有代码风格
- [ ] 我已对我的代码进行自我审查
- [ ] 我已对我的代码进行注释,特别是在难以理解的地方
- [ ] 我的更改不会产生新的控制台错误或警告
- [ ] 我已测试现有功能仍然正常工作
- [ ] 任何新功能都包含适当的错误处理
- [ ] 如果需要,扩展清单版本已更新
## Additional Notes
<!-- Add any additional notes or context for reviewers -->
## 附加说明
<!-- 为审查者添加任何附加说明或上下文 -->
+122 -122
View File
@@ -1,202 +1,202 @@
# Privacy Policy for Xget for Chrome
# Xget for Chrome 隐私政策
## Last updated: July 9, 2025
## 最后更新:2025 年 7 月 9 日
## Overview
## 概述
Xget for Chrome is a browser extension that accelerates downloads by redirecting them through Xget proxy servers. This privacy policy explains how we collect, use, and protect your information when you use our extension.
Xget for Chrome 是一个浏览器扩展,通过将下载重定向到 Xget 代理服务器来加速下载。此隐私政策解释了我们在你使用我们的扩展时如何收集、使用和保护你的信息。
## Information We Collect
## 我们收集的信息
### 1. User Settings and Configuration Data
### 1. 用户设置和配置数据
We collect and store the following information locally on your device:
我们在你的设备本地收集和存储以下信息:
- **Xget Domain Configuration**: The domain you configure for the Xget service (e.g., "xget.xi-xu.me")
- **Extension Enable/Disable Status**: Whether the extension is currently enabled
- **Platform Preferences**: Your preferences for which platforms (GitHub, GitLab, Hugging Face) to use with the extension
- **Xget 域名配置**:你为 Xget 服务配置的域名(例如「xget.xi-xu.me」)
- **扩展启用/禁用状态**:扩展当前是否已启用
- **平台偏好**:你对哪些平台(GitHub、GitLab、Hugging Face)使用扩展的偏好
### 2. Download Activity Data
### 2. 下载活动数据
The extension processes the following data during operation:
扩展在运行期间处理以下数据:
- **Download URLs**: URLs of files you attempt to download from supported platforms
- **Referrer Information**: The webpage from which downloads are initiated
- **File Information**: Basic file metadata like filenames when available
- **下载 URL**:你尝试从支持的平台下载的文件的 URL
- **来源信息**:发起下载的网页
- **文件信息**:如文件名等基本文件元数据(如果可用)
### 3. Browser Interaction Data
### 3. 浏览器交互数据
- **Tab Information**: Limited tab data to send notifications about redirected downloads
- **Click Events**: Detection of clicks on download links to trigger redirection
- **标签页信息**:有限的标签页数据,用于发送关于重定向下载的通知
- **点击事件**:检测下载链接的点击以触发重定向
## How We Use Your Information
## 我们如何使用你的信息
### Local Processing Only
### 仅本地处理
- All settings and preferences are stored locally in your browser using Chrome's storage API
- Download URL transformation happens locally within the extension
- No personal data is transmitted to our servers
- 所有设置和偏好都使用 Chrome 的存储 API 在你的浏览器中本地存储
- 下载 URL 转换在扩展内本地进行
- 没有个人数据传输到我们的服务器
### Download Redirection
### 下载重定向
- We modify download URLs to redirect through your configured Xget domain
- The original download URLs are processed locally to create Xget-compatible URLs
- Redirected downloads are handled by the Xget service according to their privacy policy
- 我们修改下载 URL 以通过你配置的 Xget 域名重定向
- 原始下载 URL 在本地处理以创建 Xget 兼容的 URL
- 重定向的下载由 Xget 服务根据其隐私政策处理
### Notifications
### 通知
- We display local notifications to inform you when downloads are redirected
- These notifications appear only in your browser and are not logged or transmitted
- 我们显示本地通知以告知你下载已被重定向
- 这些通知仅在你的浏览器中出现,不会被记录或传输
## Data Storage and Security
## 数据存储和安全
### Local Storage
### 本地存储
- All extension settings are stored using Chrome's synchronized storage API
- Settings may sync across your Chrome browsers if you're signed into Chrome
- No sensitive personal information is stored
- 所有扩展设置都使用 Chrome 的同步存储 API 存储
- 如果你已登录 Chrome,设置可能会在你的 Chrome 浏览器之间同步
- 不存储敏感的个人信息
### Data Retention
### 数据保留
- Settings persist until you uninstall the extension or manually clear them
- Download URLs are not stored; they are processed in real-time only
- No browsing history or personal files are retained
- 设置会保留到你卸载扩展或手动清除它们
- 下载 URL 不被存储;它们仅实时处理
- 不保留浏览历史或个人文件
### Security Measures
### 安全措施
- All data processing occurs locally within your browser
- No external communication except for redirected downloads through your configured Xget domain
- Extension follows Chrome's security model and permissions system
- 所有数据处理都在你的浏览器内本地进行
- 除了通过你配置的 Xget 域名重定向下载外,没有外部通信
- 扩展遵循 Chrome 的安全模型和权限系统
## Third-Party Services
## 第三方服务
### Xget Service
### Xget 服务
- When you download files, they are redirected through the Xget service you configure
- The Xget service may have its own privacy policy governing how they handle downloads
- We recommend reviewing the privacy policy of your chosen Xget service provider
- 当你下载文件时,它们会通过你配置的 Xget 服务重定向
- Xget 服务可能有自己的隐私政策来管理他们如何处理下载
- 我们建议查看你选择的 Xget 服务提供商的隐私政策
### Supported Platforms
### 支持的平台
The extension operates on these platforms:
扩展在这些平台上运行:
- **GitHub** (github.com)
- **GitLab** (gitlab.com)
- **Hugging Face** (huggingface.co)
We do not collect or store any account information from these platforms.
我们不收集或存储来自这些平台的任何账户信息。
## Permissions Explained
## 权限说明
### Why We Need These Permissions
### 为什么我们需要这些权限
**Downloads Permission**:
**下载权限**:
- Required to intercept and redirect download requests
- Allows the extension to cancel original downloads and start redirected ones
- 需要拦截和重定向下载请求
- 允许扩展取消原始下载并开始重定向的下载
**Storage Permission**:
**存储权限**:
- Used to save your extension settings and preferences locally
- Enables settings synchronization across your Chrome browsers
- 用于在本地保存你的扩展设置和偏好
- 启用在你的 Chrome 浏览器之间的设置同步
**Active Tab Permission**:
**活动标签页权限**:
- Needed to send notifications about redirected downloads
- Does not allow reading page content or personal information
- 需要发送关于重定向下载的通知
- 不允许读取页面内容或个人信息
**Host Permissions** (github.com, gitlab.com, huggingface.co):
**主机权限**(github.com、gitlab.com、huggingface.co):
- Required to run the extension on supported platforms
- Allows detection and redirection of download links
- 需要在支持的平台上运行扩展
- 允许检测和重定向下载链接
**Web Request Permissions**:
**网络请求权限**:
- Used for download interception functionality
- Does not monitor general browsing activity
- 用于下载拦截功能
- 不监控一般的浏览活动
## Your Privacy Rights
## 你的隐私权利
### Control Over Your Data
### 对你数据的控制
- You can disable the extension at any time through the popup interface
- You can configure which platforms to use with the extension
- You can change or remove your Xget domain configuration
- Uninstalling the extension removes all stored settings
- 你可以随时通过弹出界面禁用扩展
- 你可以配置与扩展一起使用的平台
- 你可以更改或删除你的 Xget 域名配置
- 卸载扩展会删除所有存储的设置
### Data Portability
### 数据可移植性
- Settings are stored in standard Chrome storage format
- You can export/backup Chrome extension settings through Chrome's sync feature
- 设置以标准 Chrome 存储格式存储
- 你可以通过 Chrome 的同步功能导出/备份 Chrome 扩展设置
### Data Deletion
### 数据删除
- Clear extension data by uninstalling the extension
- Reset settings through the extension popup interface
- Clear Chrome's extension storage to remove all traces
- 通过卸载扩展清除扩展数据
- 通过扩展弹出界面重置设置
- 清除 Chrome 的扩展存储以删除所有痕迹
## Children's Privacy
## 儿童隐私
This extension is not intended for use by children under 13 years of age. We do not knowingly collect personal information from children under 13.
此扩展不适用于 13 岁以下的儿童使用。我们不会故意收集 13 岁以下儿童的个人信息。
## Changes to This Privacy Policy
## 隐私政策的更改
We may update this privacy policy from time to time. When we do, we will:
我们可能会不时更新此隐私政策。当我们这样做时,我们将:
- Update the "Last updated" date at the top of this policy
- Notify users through the extension interface if there are material changes
- Maintain previous versions for reference
- 更新此政策顶部的「最后更新」日期
- 如果有重大更改,通过扩展界面通知用户
- 保留以前的版本供参考
## Compliance
## 合规性
This extension is designed to comply with:
此扩展设计为符合:
- Chrome Web Store Developer Policies
- General Data Protection Regulation (GDPR)
- California Consumer Privacy Act (CCPA)
- Other applicable privacy laws
- Chrome 网上应用店开发者政策
- 通用数据保护条例(GDPR)
- 加州消费者隐私法案(CCPA)
- 其他适用的隐私法律
## Technical Implementation
## 技术实现
### Data Minimization
### 数据最小化
- We collect only the minimum data necessary for functionality
- No analytics, tracking, or telemetry data is collected
- No user identification or profiling occurs
- 我们只收集功能所需的最少数据
- 不收集分析、跟踪或遥测数据
- 不进行用户识别或分析
### Transparency
### 透明度
- All source code is available for review
- Extension behavior is predictable and documented
- No hidden data collection or processing
- 所有源代码都可供审查
- 扩展行为是可预测和有文档记录的
- 没有隐藏的数据收集或处理
## Contact Information
## 联系信息
If you have any questions about this privacy policy or the extension's data practices:
如果你对此隐私政策或扩展的数据实践有任何疑问:
- **Developer**: Xi Xu
- **Repository**: [Xget for Chrome on GitHub](https://github.com/xixu-me/Xget-for-Chrome)
- **Issues**: [Report Issues](https://github.com/xixu-me/Xget-for-Chrome/issues)
- **开发者**:Xi Xu
- **仓库**:[Xget for Chrome on GitHub](https://github.com/xixu-me/Xget-for-Chrome)
- **问题**:[报告问题](https://github.com/xixu-me/Xget-for-Chrome/issues)
## Open Source Commitment
## 开源承诺
This extension is open source software licensed under GPL-3.0. You can:
此扩展是在 GPL-3.0 许可证下的开源软件。你可以:
- Review the complete source code
- Verify our privacy practices
- Submit issues or improvements
- Fork and modify the code
- 审查完整的源代码
- 验证我们的隐私实践
- 提交问题或改进
- 分叉和修改代码
## Data Protection Summary
## 数据保护摘要
| Data Type | Collection | Storage | Sharing | Retention |
| 数据类型 | 收集 | 存储 | 共享 | 保留 |
|-----------|------------|---------|---------|-----------|
| Extension Settings | Local only | Browser storage | Chrome sync only | Until uninstall |
| Download URLs | Processed locally | Not stored | Redirected only | Real-time only |
| Personal Information | None | None | None | None |
| Browsing History | None | None | None | None |
| User Identity | None | None | None | None |
| 扩展设置 | 仅本地 | 浏览器存储 | 仅 Chrome 同步 | 直到卸载 |
| 下载 URL | 本地处理 | 不存储 | 仅重定向 | 仅实时 |
| 个人信息 | 无 | 无 | 无 | 无 |
| 浏览历史 | 无 | 无 | 无 | 无 |
| 用户身份 | 无 | 无 | 无 | 无 |
---
By using Xget for Chrome, you acknowledge that you have read and understood this privacy policy and agree to the data practices described herein.
通过使用 Xget for Chrome,你确认已阅读并理解此隐私政策,并同意此处描述的数据实践。
+164 -164
View File
@@ -1,257 +1,257 @@
# Xget for Chrome
A powerful extension for Chromium-based browsers that accelerates downloads from GitHub, GitLab, and Hugging Face by automatically redirecting them through the [Xget](https://github.com/xixu-me/Xget) proxy service.
一个强大的 Chromium 浏览器扩展,通过自动将下载重定向到 [Xget](https://github.com/xixu-me/Xget) 代理服务,从而加速 GitHub、GitLab 和 Hugging Face 的下载。
## 🚀 Features
## 🚀 功能特性
- **🎯 Automatic Download Acceleration**: Seamlessly redirects downloads through Xget for faster speeds
- **🌐 Multi-Platform Support**: Works with GitHub, GitLab, and Hugging Face
- **⚙️ Configurable Settings**: Customize your Xget domain and platform preferences
- **🔔 Smart Notifications**: Visual feedback when downloads are redirected
- **🛡️ Privacy-First**: All processing happens locally in your browser
- **🎛️ Per-Platform Control**: Enable/disable acceleration for specific platforms
- **🎯 自动下载加速**:无缝重定向下载通过 Xget 获得更快速度
- **🌐 多平台支持**:支持 GitHub、GitLab 和 Hugging Face
- **⚙️ 可配置设置**:自定义你的 Xget 域名和平台偏好
- **🔔 智能通知**:下载重定向时的可视化反馈
- **🛡️ 隐私优先**:所有处理都在你的浏览器本地进行
- **🎛️ 按平台控制**:为特定平台启用/禁用加速
## 📦 Installation
## 📦 安装
### Store Availability
### 应用商店可用性
| Store | Link |
| 商店 | 链接 |
|-------|------|
| **Chrome Web Store** | [![Available in the Chrome Web Store](https://developer.chrome.com/static/docs/webstore/branding/image/UV4C4ybeBTsZt43U4xis.png)](https://chromewebstore.google.com/detail/ajiejgobfcifcikbahpijopolfjoodgf) |
| **Microsoft Edge Add-ons** | [Available in the Microsoft Edge Add-ons](https://microsoftedge.microsoft.com/addons/detail/jigpfhbegabdenhihpplcjhpfdcgnalc) |
| **Chrome 网上应用店** | [![Available in the Chrome Web Store](https://developer.chrome.com/static/docs/webstore/branding/image/UV4C4ybeBTsZt43U4xis.png)](https://chromewebstore.google.com/detail/ajiejgobfcifcikbahpijopolfjoodgf) |
| **Microsoft Edge 加载项** | [Available in the Microsoft Edge Add-ons](https://microsoftedge.microsoft.com/addons/detail/jigpfhbegabdenhihpplcjhpfdcgnalc) |
### Manual Installation
### 手动安装
If you prefer to install the extension manually or the store versions are not available, you can download and install it directly:
如果你更喜欢手动安装扩展或应用商店版本不可用,你可以直接下载并安装:
#### Option 1: Install from GitHub Releases (Recommended)
#### 选项 1:从 GitHub Releases 安装(推荐)
1. **Download the Extension**
- Go to the [Releases page](https://github.com/xixu-me/Xget-for-Chrome/releases)
- Download the latest release file:
- `chrome-extension.zip` - For Chrome browsers
- `edge-extension.zip` - For Microsoft Edge
- `extension.crx` - Pre-packaged extension file for all Chromium-based browsers
1. **下载扩展**
- 前往 [Releases 页面](https://github.com/xixu-me/Xget-for-Chrome/releases)
- 下载最新发布文件:
- `chrome-extension.zip` - 适用于 Chrome 浏览器
- `edge-extension.zip` - 适用于 Microsoft Edge
- `extension.crx` - 适用于所有基于 Chromium 的浏览器的预打包扩展文件
2. **Install in Chrome**
- Open Chrome and go to `chrome://extensions/`
- Enable "Developer mode" (toggle in top right)
- Click "Load unpacked" and select the extracted folder from the ZIP file
- Or drag and drop the `.crx` file directly onto the extensions page
2. **在 Chrome 中安装**
- 打开 Chrome 并前往 `chrome://extensions/`
- 启用「开发者模式」(右上角的切换开关)
- 点击「加载已解压的扩展程序」并选择从 ZIP 文件解压的文件夹
- 或者直接将 `.crx` 文件拖放到扩展页面
3. **Install in Microsoft Edge**
- Open Microsoft Edge and go to `edge://extensions/`
- Enable "Developer mode" (toggle in left sidebar)
- Click "Load unpacked" and select the extracted folder from the ZIP file
- Or drag and drop the `.crx` file directly onto the extensions page
3. **在 Microsoft Edge 中安装**
- 打开 Microsoft Edge 并前往 `edge://extensions/`
- 启用「开发人员模式」(左侧边栏的切换开关)
- 点击「加载解压缩的扩展」并选择从 ZIP 文件解压的文件夹
- 或者直接将 `.crx` 文件拖放到扩展页面
4. **Install in other Chromium-based browsers**
- Follow similar steps as Chrome or Microsoft Edge, ensuring you enable "Developer mode" first
- Drag and drop the `.crx` file directly onto the extensions page
4. **在其他基于 Chromium 的浏览器中安装**
- 遵循与 Chrome 或 Microsoft Edge 类似的步骤,确保首先启用「开发者模式」
- 直接将 `.crx` 文件拖放到扩展页面
#### Option 2: Install from Source Code
#### 选项 2:从源码安装
1. **Clone the Repository**
1. **克隆仓库**
```bash
git clone https://github.com/xixu-me/Xget-for-Chrome.git
cd Xget-for-Chrome
```
2. **Load in Browser**
- Open your browser's extension management page
- Enable "Developer mode"
- Click "Load unpacked" and select the cloned folder
2. **在浏览器中加载**
- 打开浏览器的扩展管理页面
- 启用「开发者模式」
- 点击「加载已解压的扩展程序」并选择克隆的文件夹
#### Verify Installation
#### 验证安装
After installation, you should see the Xget extension icon in your browser toolbar. Click it to configure your Xget domain and start accelerating downloads!
安装后,你应该在浏览器工具栏中看到 Xget 扩展图标。点击它来配置你的 Xget 域名并开始加速下载!
## ⚙️ Setup
## ⚙️ 设置
1. **Configure Xget Domain**
- Click the extension icon in your toolbar
- Enter your Xget domain (e.g., `xget.xi-xu.me`)
- Enable the extension
1. **配置 Xget 域名**
- 点击工具栏中的扩展图标
- 输入你的 Xget 域名(例如 `xget.xi-xu.me`)
- 启用扩展
2. **Choose Platforms** (Optional)
- Toggle individual platforms on/off as needed
- All platforms (GitHub, GitLab, Hugging Face) are enabled by default
2. **选择平台**(可选)
- 根据需要切换各个平台的开关
- 默认启用所有平台(GitHub、GitLab、Hugging Face)
3. **Start Downloading**
- Visit any supported platform
- Click download links as usual
- Downloads will be automatically accelerated through Xget
3. **开始下载**
- 访问任何受支持的平台
- 像往常一样点击下载链接
- 下载将自动通过 Xget 加速
## 🎯 Supported Platforms
## 🎯 支持的平台
| Platform | Status | URL Pattern | Extension ID |
| 平台 | 状态 | URL 模式 | 扩展 ID |
|----------|---------|-------------|--------------|
| **GitHub** | ✅ Supported | `github.com/*` | `gh` |
| **GitLab** | ✅ Supported | `gitlab.com/*` | `gl` |
| **Hugging Face** | ✅ Supported | `huggingface.co/*` | `hf` |
| **GitHub** | ✅ 支持 | `github.com/*` | `gh` |
| **GitLab** | ✅ 支持 | `gitlab.com/*` | `gl` |
| **Hugging Face** | ✅ 支持 | `huggingface.co/*` | `hf` |
### Supported Download Types
### 支持的下载类型
- **GitHub**: Release assets, repository archives, raw files, Git LFS files
- **GitLab**: Project archives, release downloads, repository exports
- **Hugging Face**: Model files, dataset files, model cards, tokenizers
- **GitHub**:发布资源、仓库存档、原始文件、Git LFS 文件
- **GitLab**:项目存档、发布下载、仓库导出
- **Hugging Face**:模型文件、数据集文件、模型卡片、分词器
## 🔧 How It Works
## 🔧 工作原理
1. **Detection**: The extension monitors download links on supported platforms
2. **Transformation**: URLs are automatically converted to Xget-compatible format
3. **Redirection**: Downloads are routed through your configured Xget domain
4. **Acceleration**: Xget's global CDN and optimization features deliver faster download speeds
1. **检测**:扩展监控受支持平台上的下载链接
2. **转换**:URL 自动转换为 Xget 兼容格式
3. **重定向**:下载通过你配置的 Xget 域名路由
4. **加速**:Xget 的全球 CDN 和优化功能提供更快的下载速度
### URL Transformation Examples
### URL 转换示例
```text
Original: https://github.com/user/repo/archive/main.zip
Xget: https://xget.xi-xu.me/gh/user/repo/archive/main.zip
原始: https://github.com/user/repo/archive/main.zip
Xget: https://xget.xi-xu.me/gh/user/repo/archive/main.zip
Original: https://gitlab.com/user/repo/-/archive/main.zip
Xget: https://xget.xi-xu.me/gl/user/repo/-/archive/main.zip
原始: https://gitlab.com/user/repo/-/archive/main.zip
Xget: https://xget.xi-xu.me/gl/user/repo/-/archive/main.zip
Original: https://huggingface.co/user/model/resolve/main/model.bin
Xget: https://xget.xi-xu.me/hf/user/model/resolve/main/model.bin
原始: https://huggingface.co/user/model/resolve/main/model.bin
Xget: https://xget.xi-xu.me/hf/user/model/resolve/main/model.bin
```
### Why Xget Makes Downloads Faster
### 为什么 Xget 让下载更快
- **Edge Caching**: Files are cached at Cloudflare's global edge locations
- **HTTP/3 Support**: Uses the latest protocol for improved performance
- **Intelligent Routing**: Automatically routes through the fastest available server
- **Compression**: Automatic content compression reduces transfer times
- **Connection Optimization**: Persistent connections and preconnection features
- **边缘缓存**:文件在 Cloudflare 的全球边缘位置进行缓存
- **HTTP/3 支持**:使用最新协议提高性能
- **智能路由**:自动通过最快的可用服务器路由
- **压缩**:自动内容压缩减少传输时间
- **连接优化**:持久连接和预连接功能
## 📈 Performance Benefits
## 📈 性能优势
Real-world performance improvements with Xget:
使用 Xget 的实际性能改进:
- **GitHub releases**: Up to 5x faster download speeds
- **Large repositories**: Significant improvement for multi-GB archives
- **International users**: Dramatically faster downloads through edge caching
- **Unstable connections**: Automatic retry mechanisms handle network issues
- **Concurrent downloads**: No rate limiting compared to direct platform downloads
- **GitHub 发布**:下载速度提升高达 5 倍
- **大型仓库**:多 GB 存档的显著改进
- **国际用户**:通过边缘缓存显著加快下载速度
- **不稳定连接**:自动重试机制处理网络问题
- **并发下载**:与直接平台下载相比,没有速率限制
### Benchmarks
### 基准测试
| File Type | Original Speed | With Xget | Improvement |
| 文件类型 | 原始速度 | 使用 Xget | 提升 |
|-----------|----------------|-----------|-------------|
| GitHub Release (100MB) | 2.5 MB/s | 12.8 MB/s | **5.1x faster** |
| Repository Archive (50MB) | 1.8 MB/s | 8.2 MB/s | **4.6x faster** |
| Hugging Face Model (500MB) | 3.2 MB/s | 15.1 MB/s | **4.7x faster** |
| GitHub Release (100MB) | 2.5 MB/s | 12.8 MB/s | **快 5.1 倍** |
| 仓库存档 (50MB) | 1.8 MB/s | 8.2 MB/s | **快 4.6 倍** |
| Hugging Face 模型 (500MB) | 3.2 MB/s | 15.1 MB/s | **快 4.7 倍** |
> **Note**: Results may vary based on location, network conditions, and server load
> **注意**:结果可能因位置、网络条件和服务器负载而异
## 📋 Requirements
## 📋 要求
- **Chrome Browser**: Version 88+ (Manifest V3 support)
- **Xget Service**: Access to an Xget instance
- Use the public instance: `xget.xi-xu.me`
- Or deploy your own: [Xget Repository](https://github.com/xixu-me/Xget) (Recommended)
- **Chrome 浏览器**:版本 88+(Manifest V3 支持)
- **Xget 服务**:访问 Xget 实例
- 使用公共实例:`xget.xi-xu.me`
- 或部署你自己的:[Xget 仓库](https://github.com/xixu-me/Xget)(推荐)
### About Xget Service
### 关于 Xget 服务
Xget is a high-performance, secure proxy service built on Cloudflare Workers that provides:
Xget 是基于 Cloudflare Workers 构建的高性能、安全的代理服务,提供:
- **Global Edge Distribution**: Faster downloads through Cloudflare's global network
- **Multi-Platform Support**: Optimized for GitHub, GitLab, and Hugging Face
- **Advanced Features**: HTTP/3 support, intelligent caching, automatic retries
- **Security**: Comprehensive security headers and content protection
- **Reliability**: Built-in timeout protection and performance monitoring
- **全球边缘分发**:通过 Cloudflare 的全球网络加快下载速度
- **多平台支持**:针对 GitHub、GitLab 和 Hugging Face 进行优化
- **高级功能**:HTTP/3 支持、智能缓存、自动重试
- **安全性**:全面的安全标头和内容保护
- **可靠性**:内置超时保护和性能监控
Learn more at [xget.xi-xu.me](https://xget.xi-xu.me) or the [Xget repository](https://github.com/xixu-me/Xget).
在 [xget.xi-xu.me](https://xget.xi-xu.me) 或 [Xget 仓库](https://github.com/xixu-me/Xget) 了解更多。
## 🔒 Privacy & Security
## 🔒 隐私与安全
- **Local Processing**: All URL transformations happen in your browser
- **No Data Collection**: The extension doesn't collect or transmit personal data
- **Minimal Permissions**: Only requests necessary permissions for functionality
- **Open Source**: Full source code available for inspection
- **本地处理**:所有 URL 转换都在你的浏览器中进行
- **无数据收集**:扩展不收集或传输个人数据
- **最小权限**:仅请求功能所需的必要权限
- **开源**:完整源码可供检查
See our [Privacy Policy](PRIVACY_POLICY.md) for complete details.
查看我们的 [隐私政策](PRIVACY_POLICY.md) 了解完整详情。
## 🐛 Troubleshooting
## 🐛 故障排除
### Common Issues
### 常见问题
**Extension not working?**
**扩展不工作?**
- Ensure you've configured a valid Xget domain
- Check that the extension is enabled in the popup
- Verify the target platform is enabled
- Try refreshing the page after changing settings
- 确保你已配置有效的 Xget 域名
- 检查扩展在弹出窗口中是否已启用
- 验证目标平台是否已启用
- 更改设置后尝试刷新页面
**Downloads not being redirected?**
**下载没有被重定向?**
- Refresh the page after changing settings
- Check browser console for error messages (F12 → Console)
- Ensure the link is a recognized download type
- Verify you're clicking actual download links, not navigation links
- 更改设置后刷新页面
- 检查浏览器控制台的错误消息(F12 → 控制台)
- 确保链接是被识别的下载类型
- 验证你点击的是实际的下载链接,而不是导航链接
**Xget domain issues?**
**Xget 域名问题?**
- Domain should be without `https://` protocol
- Example: `xget.xi-xu.me` (not `https://xget.xi-xu.me`)
- Check that the domain is accessible in your browser
- Try using the default public instance: `xget.xi-xu.me`
- 域名应该不带 `https://` 协议
- 示例:`xget.xi-xu.me`(不是 `https://xget.xi-xu.me`)
- 检查域名在浏览器中是否可访问
- 尝试使用默认的公共实例:`xget.xi-xu.me`
**Performance issues?**
**性能问题?**
- Check your network connection
- Try a different Xget domain if available
- Verify the target platform's servers are responsive
- Clear browser cache and reload the extension
- 检查你的网络连接
- 如果可用,尝试其他 Xget 域名
- 验证目标平台的服务器是否响应
- 清除浏览器缓存并重新加载扩展
### Debug Mode
### 调试模式
Enable Chrome Developer Tools and check the Console tab for debug messages:
启用 Chrome 开发者工具并检查控制台选项卡中的调试消息:
- Extension loading: "Xget for Chrome: Content script loaded"
- Download redirection: "Redirecting download: [original] -> [xget]"
- Settings changes: "Settings updated! Click to refresh page"
- 扩展加载:「Xget for Chrome:内容脚本已加载」
- 下载重定向:「重定向下载:[原始] -> [xget]」
- 设置更改:「设置已更新!点击刷新页面」
## 📄 License
## 📄 许可证
This project is licensed under the GPL-3.0 License - see the [LICENSE](LICENSE) file for details.
本项目采用 GPL-3.0 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情。
## ❓ Frequently Asked Questions
## ❓ 常见问题
### Is this extension free?
### 这个扩展是免费的吗?
Yes, the extension is completely free and open source under the GPL-3.0 license.
是的,扩展完全免费且在 GPL-3.0 许可证下开源。
### Does this work with private repositories?
### 这对私有仓库有效吗?
The extension works with any downloadable link, but you need appropriate access permissions for private repositories.
扩展适用于任何可下载链接,但你需要对私有仓库有适当的访问权限。
### Can I use my own Xget server?
### 我可以使用自己的 Xget 服务器吗?
Absolutely! You can deploy your own Xget instance using the [Xget repository](https://github.com/xixu-me/Xget) and configure the extension to use your domain.
当然可以!你可以使用 [Xget 仓库](https://github.com/xixu-me/Xget) 部署自己的 Xget 实例,并配置扩展使用你的域名。
### Why do some downloads still go through the original servers?
### 为什么有些下载仍然通过原始服务器?
The extension only redirects recognized download links. Navigation links, preview links, and some dynamic content may not be redirected.
扩展只重定向被识别的下载链接。导航链接、预览链接和一些动态内容可能不会被重定向。
### Is my browsing data collected?
### 我的浏览数据会被收集吗?
No, the extension operates entirely locally. No browsing data is collected or transmitted. See our [Privacy Policy](PRIVACY_POLICY.md) for details.
不会,扩展完全在本地运行。不收集或传输浏览数据。查看我们的 [隐私政策](PRIVACY_POLICY.md) 了解详情。
### How much faster are downloads?
### 下载能快多少?
Speed improvements vary based on your location, network, and file size. Typical improvements range from 2x to 10x faster.
速度提升因你的位置、网络和文件大小而异。典型的改进范围从 2 倍到 10 倍。
### Can I disable the extension for specific sites?
### 我可以为特定网站禁用扩展吗?
Yes, use the per-platform toggles in the extension popup to disable acceleration for specific platforms.
是的,使用扩展弹出窗口中的按平台切换开关来禁用特定平台的加速。
## 🌟 Show Your Support
## 🌟 支持我们
If you find this extension helpful, please:
如果你觉得这个扩展有用,请:
- ⭐ Star this repository
- 📝 Leave a review on the [Chrome Web Store](https://chromewebstore.google.com/detail/ajiejgobfcifcikbahpijopolfjoodgf)
- 🐛 Report bugs or suggest features via [GitHub Issues](https://github.com/xixu-me/Xget-for-Chrome/issues)
- 📢 Share with others who might benefit from faster downloads
- ⭐ 为此仓库点星
- 📝 在 [Chrome 网上应用店](https://chromewebstore.google.com/detail/ajiejgobfcifcikbahpijopolfjoodgf) 留下评价
- 🐛 通过 [GitHub Issues](https://github.com/xixu-me/Xget-for-Chrome/issues) 报告错误或建议功能
- 📢 与其他可能受益于更快下载的人分享
+43 -43
View File
@@ -1,66 +1,66 @@
# Security Policy
# 安全政策
## Supported Versions
## 支持的版本
We actively support the latest version of Xget for Chrome. Security updates are provided for:
我们积极支持 Xget for Chrome 的最新版本。为以下版本提供安全更新:
| Version | Supported |
| 版本 | 支持状态 |
| ------- | ------------------ |
| 1.x.x | :white_check_mark: |
## Reporting a Vulnerability
## 报告漏洞
If you discover a security vulnerability in Xget for Chrome, please report it responsibly:
如果你在 Xget for Chrome 中发现安全漏洞,请负责任地报告:
### How to Report
### 如何报告
1. **Do not** create a public GitHub issue for security vulnerabilities
2. Email the maintainer directly or create a private security advisory
3. Include as much detail as possible:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
1. **不要** 为安全漏洞创建公开的 GitHub 问题
2. 直接发邮件给维护者或创建私人安全咨询
3. 包含尽可能多的详细信息:
- 漏洞描述
- 重现步骤
- 潜在影响
- 建议修复(如果有)
### What to Expect
### 期望结果
- **Response Time**: We aim to respond within 48 hours
- **Investigation**: We will investigate and assess the severity
- **Fix Timeline**: Critical vulnerabilities will be patched within 7 days
- **Disclosure**: We will coordinate responsible disclosure with you
- **响应时间**:我们目标在 48 小时内响应
- **调查**:我们将调查并评估严重性
- **修复时间表**:关键漏洞将在 7 天内修补
- **披露**:我们将与你协调负责任的披露
### Security Considerations
### 安全考虑
This extension:
此扩展:
- Processes URLs locally in your browser
- Does not collect or transmit personal data
- Uses Chrome's standard extension APIs
- Redirects downloads through user-configured Xget domains
- 在你的浏览器中本地处理 URL
- 不收集或传输个人数据
- 使用 Chrome 的标准扩展 API
- 通过用户配置的 Xget 域名重定向下载
### Scope
### 范围
Security issues we consider in scope:
我们认为在范围内的安全问题:
- Code injection vulnerabilities
- Privilege escalation
- Data leakage or privacy violations
- Malicious URL handling
- Extension permission abuse
- 代码注入漏洞
- 权限提升
- 数据泄露或隐私违规
- 恶意 URL 处理
- 扩展权限滥用
Out of scope:
超出范围:
- Issues with third-party Xget servers
- Browser-level vulnerabilities
- Social engineering attacks
- 第三方 Xget 服务器的问题
- 浏览器级别的漏洞
- 社会工程攻击
## Security Best Practices
## 安全最佳实践
When using this extension:
使用此扩展时:
- Only configure trusted Xget domains
- Keep the extension updated
- Review permissions when updating
- Report suspicious behavior
- 仅配置可信的 Xget 域名
- 保持扩展更新
- 更新时审查权限
- 报告可疑行为
Thank you for helping keep Xget for Chrome secure!
感谢你帮助保持 Xget for Chrome 的安全!
+23 -23
View File
@@ -1,4 +1,4 @@
// Platform configurations matching the worker.js
// 与 worker.js 匹配的平台配置
const PLATFORMS = {
gh: {
base: "https://github.com",
@@ -20,7 +20,7 @@ const PLATFORMS = {
},
};
// Default settings
// 默认设置
const DEFAULT_SETTINGS = {
enabled: true,
xgetDomain: "xget.xi-xu.me",
@@ -31,16 +31,16 @@ const DEFAULT_SETTINGS = {
},
};
// Initialize extension
// 初始化扩展
chrome.runtime.onInstalled.addListener(async () => {
console.log("Xget for Chrome installed");
console.log("Xget for Chrome 已安装");
// Set default settings if not already set
// 如果尚未设置,则设置默认设置
const settings = await chrome.storage.sync.get(DEFAULT_SETTINGS);
await chrome.storage.sync.set(settings);
});
// Listen for download events
// 监听下载事件
chrome.downloads.onDeterminingFilename.addListener((downloadItem, suggest) => {
handleDownload(downloadItem, suggest);
});
@@ -49,7 +49,7 @@ async function handleDownload(downloadItem, suggest) {
try {
const settings = await chrome.storage.sync.get(DEFAULT_SETTINGS);
// Check if extension is enabled and domain is configured
// 检查扩展是否已启用并配置了域名
if (!settings.enabled || !settings.xgetDomain) {
suggest();
return;
@@ -59,39 +59,39 @@ async function handleDownload(downloadItem, suggest) {
const redirectedUrl = transformUrl(url, settings);
if (redirectedUrl && redirectedUrl !== url) {
console.log("Redirecting download:", url, "->", redirectedUrl);
console.log("重定向下载:", url, "->", redirectedUrl);
// Cancel the original download
// 取消原始下载
chrome.downloads.cancel(downloadItem.id);
// Start new download with redirected URL
// 使用重定向的 URL 开始新下载
chrome.downloads.download({
url: redirectedUrl,
filename: downloadItem.filename || undefined,
conflictAction: "uniquify",
});
// Show notification via content script
// 通过内容脚本显示通知
try {
await chrome.tabs.sendMessage(downloadItem.tabId, {
action: "showNotification",
message: "Download redirected through Xget",
message: "下载已通过 Xget 重定向",
});
} catch (error) {
console.log("Could not send notification to tab");
console.log("无法向标签页发送通知");
}
} else {
suggest();
}
} catch (error) {
console.error("Error handling download:", error);
console.error("处理下载时出错:", error);
suggest();
}
}
function transformUrl(url, settings) {
try {
// Find matching platform
// 找到匹配的平台
for (const [platformKey, platform] of Object.entries(PLATFORMS)) {
if (!settings.enabledPlatforms[platformKey]) continue;
@@ -99,27 +99,27 @@ function transformUrl(url, settings) {
const urlObj = new URL(url);
const path = urlObj.pathname + urlObj.search + urlObj.hash;
// Transform the URL using Xget domain (add https:// protocol)
// 使用 Xget 域名转换 URL(添加 https:// 协议)
const xgetUrl = `https://${settings.xgetDomain}/${platformKey}${path}`;
return xgetUrl;
}
}
return null; // No transformation needed
return null; // 不需要转换
} catch (error) {
console.error("Error transforming URL:", error);
console.error("转换 URL 时出错:", error);
return null;
}
}
// Listen for messages from popup/options
// 监听来自弹出窗口/选项的消息
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.action === "getSettings") {
chrome.storage.sync.get(DEFAULT_SETTINGS).then(sendResponse);
return true;
} else if (request.action === "saveSettings") {
chrome.storage.sync.set(request.settings).then(async () => {
// Notify relevant tabs to refresh
// 通知相关标签页刷新
try {
const tabs = await chrome.tabs.query({
url: [
@@ -133,15 +133,15 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
try {
await chrome.tabs.sendMessage(tab.id, {
action: "showNotification",
message: "Settings updated! Click to refresh page",
message: "设置已更新!点击刷新页面",
showRefreshButton: true,
});
} catch (error) {
// Tab might not have content script loaded, ignore
// 标签页可能没有加载内容脚本,忽略
}
}
} catch (error) {
console.log("Could not notify tabs about settings update");
console.log("无法通知标签页设置更新");
}
sendResponse({ success: true });
+46 -46
View File
@@ -1,6 +1,6 @@
// Content script to inject download interception on supported platforms
// 内容脚本,在支持的平台上注入下载拦截功能
// Platform detection and URL transformation
// 平台检测和 URL 转换
const PLATFORMS = {
gh: {
base: "https://github.com",
@@ -19,11 +19,11 @@ const PLATFORMS = {
},
};
// Initialize content script
// 初始化内容脚本
(async function () {
console.log("Xget for Chrome: Content script loaded");
console.log("Xget for Chrome:内容脚本已加载");
// Listen for messages from background script
// 监听来自后台脚本的消息
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.action === "showNotification") {
showNotification(request.message, request.showRefreshButton);
@@ -31,22 +31,22 @@ const PLATFORMS = {
}
});
// Check if extension is enabled and configured
// 检查扩展是否已启用并配置
const settings = await getSettings();
if (!settings.enabled || !settings.xgetDomain) {
return;
}
// Find current platform
// 找到当前平台
const currentPlatform = detectPlatform(window.location.href);
if (!currentPlatform || !settings.enabledPlatforms[currentPlatform]) {
return;
}
// Add download interception
// 添加下载拦截
interceptDownloadLinks();
// Monitor for dynamically added content
// 监控动态添加的内容
observePageChanges();
})();
@@ -56,7 +56,7 @@ async function getSettings() {
chrome.runtime.sendMessage({ action: "getSettings" }, resolve);
});
} catch (error) {
console.error("Error getting settings:", error);
console.error("获取设置时出错:", error);
return { enabled: false };
}
}
@@ -71,14 +71,14 @@ function detectPlatform(url) {
}
function interceptDownloadLinks() {
// Intercept clicks on download links
// 拦截下载链接的点击事件
document.addEventListener(
"click",
async (event) => {
const link = event.target.closest("a");
if (!link || !link.href) return;
// Check if this is a download link
// 检查这是否是下载链接
if (isDownloadLink(link)) {
event.preventDefault();
event.stopPropagation();
@@ -95,12 +95,12 @@ function isDownloadLink(link) {
const url = new URL(link.href);
const pathname = url.pathname.toLowerCase();
// First check: explicit download attributes
// 第一检查:明确的下载属性
if (link.download || link.hasAttribute("download")) {
return true;
}
// Second check: file extensions that indicate downloadable files
// 第二检查:表示可下载文件的文件扩展名
const fileExtensions = [
".zip",
".tar.gz",
@@ -152,50 +152,50 @@ function isDownloadLink(link) {
".nupkg",
];
// Check if URL ends with a file extension
// 检查 URL 是否以文件扩展名结尾
if (fileExtensions.some((ext) => pathname.endsWith(ext))) {
return true;
}
// Third check: GitHub-specific patterns
// 第三检查:GitHub 特定模式
const allowedGitHubHosts = ["github.com"];
try {
const parsedUrl = new URL(href);
if (allowedGitHubHosts.includes(parsedUrl.host)) {
// GitHub release asset download URLs follow pattern: /releases/download/
// GitHub 发布资源下载 URL 遵循模式:/releases/download/
if (pathname.includes("/releases/download/")) {
return true;
}
// GitHub archive download URLs
// GitHub 存档下载 URL
if (
pathname.includes("/archive/") &&
(pathname.endsWith(".zip") || pathname.endsWith(".tar.gz"))
) {
return true;
}
// GitHub raw file URLs - NEW: support for raw file links
// GitHub 原始文件 URL - 新增:支持原始文件链接
if (pathname.includes("/raw/")) {
return true;
}
// Exclude navigation to releases page (just /releases or /releases/)
// 排除导航到发布页面(仅 /releases 或 /releases/)
if (pathname.endsWith("/releases") || pathname.endsWith("/releases/")) {
return false;
}
}
} catch (e) {
console.error("Invalid URL:", href, e);
console.error("无效的 URL:", href, e);
}
// Fourth check: GitLab-specific patterns
// 第四检查:GitLab 特定模式
const allowedGitLabHosts = ["gitlab.com"];
try {
const parsedUrl = new URL(href);
if (allowedGitLabHosts.includes(parsedUrl.host)) {
// GitLab archive downloads
// GitLab 存档下载
if (pathname.includes("/-/archive/")) {
return true;
}
// GitLab release downloads
// GitLab 发布下载
if (
pathname.includes("/-/releases/") &&
pathname.includes("/downloads/")
@@ -204,24 +204,24 @@ function isDownloadLink(link) {
}
}
} catch (e) {
console.error("Invalid URL:", href, e);
console.error("无效的 URL:", href, e);
}
// Fifth check: Hugging Face file downloads
// 第五检查:Hugging Face 文件下载
const allowedHuggingFaceHosts = ["huggingface.co"];
try {
const parsedUrl = new URL(href);
if (allowedHuggingFaceHosts.includes(parsedUrl.host)) {
// HF file download URLs contain /resolve/
// HF 文件下载 URL 包含 /resolve/
if (pathname.includes("/resolve/")) {
return true;
}
}
} catch (e) {
console.error("Invalid URL:", href, e);
console.error("无效的 URL:", href, e);
}
// Seventh check: explicit download text indicators (be more specific)
// 第七检查:明确的下载文本指示器(更具体)
const downloadTextIndicators = ["download", "download file", "get file"];
const linkText = link.textContent.toLowerCase().trim();
if (
@@ -233,7 +233,7 @@ function isDownloadLink(link) {
return true;
}
// Default: not a download link
// 默认:不是下载链接
return false;
}
@@ -244,14 +244,14 @@ async function handleDownloadLink(url) {
const transformedUrl = transformUrl(url, settings);
if (transformedUrl) {
// Show notification
showNotification(`Download redirected through Xget`);
// 显示通知
showNotification(`下载已通过 Xget 重定向`);
// Trigger download
// 触发下载
window.location.href = transformedUrl;
}
} catch (error) {
console.error("Error handling download:", error);
console.error("处理下载时出错:", error);
}
}
@@ -267,14 +267,14 @@ function transformUrl(url, settings) {
return `https://${settings.xgetDomain}/${platform}${path}`;
} catch (error) {
console.error("Error transforming URL:", error);
console.error("转换 URL 时出错:", error);
return null;
}
}
function observePageChanges() {
const observer = new MutationObserver(() => {
// Monitor for page changes (no additional actions needed)
// 监控页面变化(无需额外操作)
});
observer.observe(document.body, {
@@ -285,25 +285,25 @@ function observePageChanges() {
function showNotification(message, showRefreshButton = false) {
try {
// Remove any existing notifications first
// 首先删除所有现有通知
const existingNotifications =
document.querySelectorAll(".xget-notification");
existingNotifications.forEach((notification) => notification.remove());
// Create a simple notification
// 创建一个简单的通知
const notification = document.createElement("div");
notification.className = "xget-notification";
// Create message container
// 创建消息容器
const messageDiv = document.createElement("div");
messageDiv.textContent = message;
messageDiv.style.marginBottom = showRefreshButton ? "8px" : "0";
notification.appendChild(messageDiv);
// Add refresh button if needed
// 如果需要,添加刷新按钮
if (showRefreshButton) {
const refreshButton = document.createElement("button");
refreshButton.textContent = "🔄 Refresh Page";
refreshButton.textContent = "🔄 刷新页面";
refreshButton.style.cssText = `
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.3);
@@ -350,7 +350,7 @@ function showNotification(message, showRefreshButton = false) {
word-wrap: break-word;
`;
// Add animation styles if not already present
// 如果尚未存在则添加动画样式
if (!document.getElementById("xget-notification-styles")) {
const style = document.createElement("style");
style.id = "xget-notification-styles";
@@ -369,7 +369,7 @@ function showNotification(message, showRefreshButton = false) {
document.body.appendChild(notification);
// Remove after longer time if has refresh button, shorter if not
// 如果有刷新按钮则在较长时间后删除,否则在较短时间后删除
const removeDelay = showRefreshButton ? 8000 : 4000;
setTimeout(() => {
notification.style.animation = "xgetSlideOut 0.3s ease-in";
@@ -380,8 +380,8 @@ function showNotification(message, showRefreshButton = false) {
}, 300);
}, removeDelay);
} catch (error) {
console.error("Error showing notification:", error);
// Fallback to console log if DOM manipulation fails
console.log("Xget notification:", message);
console.error("显示通知时出错:", error);
// 如果 DOM 操作失败则回退到控制台日志
console.log("Xget 通知:", message);
}
}
+10 -20
View File
@@ -1,10 +1,10 @@
{
"action": {
"default_icon": {
"128": "icons/icon128.png",
"16": "icons/icon16.png",
"32": "icons/icon32.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
"48": "icons/icon48.png"
},
"default_popup": "popup.html",
"default_title": "Xget for Chrome"
@@ -14,9 +14,7 @@
},
"content_scripts": [
{
"js": [
"content.js"
],
"js": ["content.js"],
"matches": [
"https://github.com/*",
"https://gitlab.com/*",
@@ -25,34 +23,26 @@
"run_at": "document_end"
}
],
"description": "Download accelerator that redirects downloads through Xget for faster speeds",
"description": "通过 Xget 重定向下载实现加速的下载器扩展",
"host_permissions": [
"https://github.com/*",
"https://gitlab.com/*",
"https://huggingface.co/*"
],
"icons": {
"128": "icons/icon128.png",
"16": "icons/icon16.png",
"32": "icons/icon32.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
"48": "icons/icon48.png"
},
"manifest_version": 3,
"name": "Xget for Chrome",
"permissions": [
"downloads",
"storage",
"activeTab"
],
"permissions": ["downloads", "storage", "activeTab"],
"version": "1.1.0",
"web_accessible_resources": [
{
"matches": [
"<all_urls>"
],
"resources": [
"icons/*"
]
"matches": ["<all_urls>"],
"resources": ["icons/*"]
}
]
}
}
+7 -7
View File
@@ -5,7 +5,7 @@
"url": "https://github.com/xixu-me/Xget-for-Chrome/issues"
},
"dependencies": {},
"description": "Chrome extension that accelerates downloads by redirecting them through Xget",
"description": "通过 Xget 重定向下载实现加速的 Chrome 扩展",
"devDependencies": {},
"homepage": "https://github.com/xixu-me/Xget-for-Chrome#readme",
"keywords": [
@@ -26,14 +26,14 @@
"url": "https://github.com/xixu-me/Xget-for-Chrome.git"
},
"scripts": {
"build": "echo 'No build process required - extension runs from source'",
"build": "不需要构建过程 - 扩展直接从源码运行",
"clean": "rm -f *.zip",
"dev": "echo 'Open chrome://extensions/ and load unpacked extension'",
"lint": "echo 'No linting configured - consider adding ESLint for JavaScript files'",
"dev": "打开 chrome://extensions/ 并加载解压的扩展",
"lint": "未配置代码检查 - 建议为 JavaScript 文件添加 ESLint",
"package": "zip -r extension.zip . -x '*.git*' 'node_modules/*' '.github/*' '*.md' 'LICENSE' '*.zip'",
"release": "npm run validate && npm run package",
"test": "echo 'Load extension in Chrome Developer Mode to test'",
"validate": "node -e \"JSON.parse(require('fs').readFileSync('manifest.json', 'utf8')); console.log('✅ manifest.json is valid')\""
"test": "在 Chrome 开发者模式下加载扩展进行测试",
"validate": "node -e \"JSON.parse(require('fs').readFileSync('manifest.json', 'utf8')); console.log('✅ manifest.json 格式有效')\""
},
"version": "1.1.0"
}
}
+7 -9
View File
@@ -212,7 +212,7 @@
<body>
<div class="header">
<h1>Xget for Chrome</h1>
<div class="subtitle">Download Accelerator</div>
<div class="subtitle">下载加速器</div>
</div>
<div class="content">
@@ -225,7 +225,7 @@
justify-content: space-between;
"
>
Enable Extension
启用扩展
<label class="toggle-switch">
<input type="checkbox" id="enabledToggle" />
<span class="slider"></span>
@@ -235,19 +235,17 @@
</div>
<div class="setting-group">
<label class="setting-label" for="domainInput"
>Xget Domain (Required)</label
>
<label class="setting-label" for="domainInput">Xget 域名(必填)</label>
<input
type="text"
id="domainInput"
class="domain-input"
placeholder="your-xget-domain.com"
placeholder="你的-xget-域名.com"
/>
</div>
<div class="setting-group">
<label class="setting-label">Enabled Platforms</label>
<label class="setting-label">启用的平台</label>
<div class="platforms">
<div class="platform-item">
<span>GitHub</span>
@@ -281,7 +279,7 @@
class="link-item"
>
<span class="link-icon">🚀</span>
<span class="link-text">Deploy Your Own Xget Service</span>
<span class="link-text">部署你自己的 Xget 服务</span>
</a>
<a
href="https://github.com/xixu-me/Xget-for-Chrome"
@@ -289,7 +287,7 @@
class="link-item"
>
<span class="link-icon">📖</span>
<span class="link-text">Source Code & Documentation</span>
<span class="link-text">源码和文档</span>
</a>
</div>
</div>
+32 -38
View File
@@ -1,8 +1,8 @@
document.addEventListener("DOMContentLoaded", async () => {
// Load current settings
// 加载当前设置
await loadSettings();
// Set up event listeners
// 设置事件监听器
setupEventListeners();
});
@@ -12,38 +12,38 @@ async function loadSettings() {
action: "getSettings",
});
// Update UI with current settings
// 使用当前设置更新 UI
const domainValue = settings.xgetDomain || "";
document.getElementById("domainInput").value = domainValue;
// Only enable the toggle if domain is set
// 仅在设置了域名时启用切换
const enabledValue = settings.enabled && domainValue.trim() !== "";
document.getElementById("enabledToggle").checked = enabledValue;
// Update platform toggles
// 更新平台切换
document.getElementById("ghToggle").checked = settings.enabledPlatforms.gh;
document.getElementById("glToggle").checked = settings.enabledPlatforms.gl;
document.getElementById("hfToggle").checked = settings.enabledPlatforms.hf;
// Show status if domain is missing
// 如果缺少域名则显示状态
if (!domainValue && settings.enabled) {
showStatus("Please configure your Xget domain", "error");
showStatus("请配置你的 Xget 域名", "error");
} else if (domainValue && enabledValue) {
showStatus("Extension is active and ready", "success");
showStatus("扩展已激活并准备就绪", "success");
}
} catch (error) {
console.error("Error loading settings:", error);
showStatus("Error loading settings", "error");
console.error("加载设置时出错:", error);
showStatus("加载设置时出错", "error");
}
}
function setupEventListeners() {
// Enable/disable toggle
// 启用/禁用切换
document
.getElementById("enabledToggle")
.addEventListener("change", handleEnableToggle);
// Domain input
// 域名输入
document
.getElementById("domainInput")
.addEventListener("input", debounce(handleDomainChange, 500));
@@ -51,7 +51,7 @@ function setupEventListeners() {
.getElementById("domainInput")
.addEventListener("blur", validateDomain);
// Platform toggles
// 平台切换
document.getElementById("ghToggle").addEventListener("change", saveSettings);
document.getElementById("glToggle").addEventListener("change", saveSettings);
document.getElementById("hfToggle").addEventListener("change", saveSettings);
@@ -62,10 +62,10 @@ async function saveSettings() {
const domainValue = document.getElementById("domainInput").value.trim();
const enabledValue = document.getElementById("enabledToggle").checked;
// Prevent enabling if no domain is set
// 如果没有设置域名则防止启用
if (enabledValue && !domainValue) {
document.getElementById("enabledToggle").checked = false;
showStatus("Cannot enable extension without a domain", "error");
showStatus("没有域名不能启用扩展", "error");
return;
}
@@ -79,7 +79,7 @@ async function saveSettings() {
},
};
// Clean up domain URL
// 清理域名 URL
if (settings.xgetDomain) {
settings.xgetDomain = cleanupDomain(settings.xgetDomain);
}
@@ -90,49 +90,43 @@ async function saveSettings() {
});
if (response.success) {
// Show appropriate status
// 显示适当的状态
if (!settings.xgetDomain && settings.enabled) {
showStatus("Please configure your Xget domain", "error");
showStatus("请配置你的 Xget 域名", "error");
} else if (settings.xgetDomain && settings.enabled) {
showStatus(
"✅ Settings saved! Check page notifications for refresh button",
"success"
);
showStatus("✅ 设置已保存!查看页面通知中的刷新按钮", "success");
} else {
showStatus(
"✅ Settings saved! Check page notifications for refresh button",
"success"
);
showStatus("✅ 设置已保存!查看页面通知中的刷新按钮", "success");
}
}
} catch (error) {
console.error("Error saving settings:", error);
showStatus("Error saving settings", "error");
console.error("保存设置时出错:", error);
showStatus("保存设置时出错", "error");
}
}
function validateDomain() {
const domain = document.getElementById("domainInput").value.trim();
if (domain && !isValidDomain(domain)) {
showStatus("Invalid domain format", "error");
showStatus("域名格式无效", "error");
}
}
function cleanupDomain(domain) {
// Remove any protocol if accidentally included
// 如果意外包含协议,则删除它
domain = domain.replace(/^https?:\/\//, "");
// Remove trailing slash
// 删除末尾斜杠
domain = domain.replace(/\/$/, "");
return domain;
}
function isValidDomain(domain) {
// Remove protocol if present
// 如果存在协议则删除它
domain = domain.replace(/^https?:\/\//, "");
// Basic domain validation pattern
// 基本域名验证模式
const domainPattern =
/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
@@ -154,7 +148,7 @@ function showStatus(message, type) {
statusElement.className = `status ${type}`;
statusElement.style.display = "block";
// Auto-hide success messages
// 自动隐藏成功消息
if (type === "success") {
setTimeout(hideStatus, 3000);
}
@@ -182,9 +176,9 @@ async function handleEnableToggle() {
const domainInput = document.getElementById("domainInput");
if (enabledToggle.checked && !domainInput.value.trim()) {
// Prevent enabling if no domain is set
// 如果没有设置域名则防止启用
enabledToggle.checked = false;
showStatus("Please configure your Xget domain before enabling", "error");
showStatus("启用前请配置你的 Xget 域名", "error");
return;
}
@@ -195,10 +189,10 @@ async function handleDomainChange() {
const domainInput = document.getElementById("domainInput");
const enabledToggle = document.getElementById("enabledToggle");
// If domain is cleared and extension is enabled, disable it
// 如果域名被清空且扩展已启用,则禁用它
if (!domainInput.value.trim() && enabledToggle.checked) {
enabledToggle.checked = false;
showStatus("Extension disabled: domain cleared", "error");
showStatus("扩展已禁用:域名已清空", "error");
}
await saveSettings();