diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml
index 0a42089..e0db23f 100644
--- a/.github/workflows/sync.yml
+++ b/.github/workflows/sync.yml
@@ -83,7 +83,7 @@ jobs:
*
* This catch-all route handler processes all incoming requests to the Xget
* acceleration engine. It delegates request processing to the main handleRequest
- * function from the Worker code, maintaining full compatibility with the
+ * function from the Workers code, maintaining full compatibility with the
* existing implementation.
*
* The [[path]] syntax in the filename creates a catch-all route that matches
@@ -101,7 +101,6 @@ jobs:
*
* @example
* // This is called automatically by Pages
- * // User requests: https://xget.pages.dev/npm/lodash
* // Runtime invokes: onRequest(context)
* // Returns: Response with package data
*
@@ -165,7 +164,7 @@ jobs:
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b pages
git add .
- git commit -m "Convert Worker to Pages
+ git commit -m "Convert Workers to Pages
Auto-converted from main branch commit ${{ github.sha }}
diff --git a/README.md b/README.md
index e76e59e..b9c3854 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,8 @@
-[](#部署到-cloudflare-workers)
+[](#部署到-cloudflare-workers)
+[](#部署到-edgeone-pages)
[](#自托管部署)
[](#自托管部署)
[](#-生态系统集成)
@@ -2364,8 +2365,6 @@ client = OpenAI(
### 部署到 Cloudflare Workers
-#### 部署步骤
-
1. **fork 本存储库**:[Fork xixu-me/Xget](https://github.com/xixu-me/Xget/fork)
2. **获取 Cloudflare 凭证**:
@@ -2374,7 +2373,7 @@ client = OpenAI(
3. **配置 GitHub Secrets**:
- 进入你的 GitHub 存储库 → Settings → Secrets and variables → Actions
- - 添加以下 Secrets:
+ - 添加以下 secrets:
- `CLOUDFLARE_API_TOKEN`:你的 API 令牌
- `CLOUDFLARE_ACCOUNT_ID`:你的 Account ID
@@ -2385,22 +2384,51 @@ client = OpenAI(
5. **绑定自定义域名**(可选):在 Cloudflare Workers 控制台中绑定你的自定义域名
-部署完成后,你的 Xget 服务将在以下地址可用:
+### 部署到 Cloudflare Pages
-- Worker 域名:`your-worker-name.your-subdomain.workers.dev`
-- 自定义域名:`your-domain.com`(如果已绑定)
+1. **fork 本存储库**:[Fork xixu-me/Xget](https://github.com/xixu-me/Xget/fork)
-#### 环境变量配置
+2. **获取 Cloudflare 凭证**:
+ - 访问[帐户 API 令牌](https://dash.cloudflare.com/?to=/:account/api-tokens)创建并记录 API 令牌,使用“编辑 Cloudflare Workers”模板
+ - 访问 [Workers 和 Pages](https://dash.cloudflare.com/?to=/:account/workers-and-pages) 记录 Account ID
-你可以在 Cloudflare Workers 控制台中设置以下环境变量来自定义配置:
+3. **配置 GitHub Secrets**:
+ - 进入你的 GitHub 存储库 → Settings → Secrets and variables → Actions
+ - 添加以下 secrets:
+ - `CLOUDFLARE_API_TOKEN`:你的 API 令牌
+ - `CLOUDFLARE_ACCOUNT_ID`:你的 Account ID
-- `TIMEOUT_SECONDS`:请求超时时间(默认:30)
-- `MAX_RETRIES`:最大重试次数(默认:3)
-- `RETRY_DELAY_MS`:重试延迟时间(默认:1000)
-- `CACHE_DURATION`:缓存持续时间(默认:1800)
-- `ALLOWED_METHODS`:允许的 HTTP 方法(默认:GET,HEAD)
-- `ALLOWED_ORIGINS`:允许的 CORS 源(默认:*)
-- `MAX_PATH_LENGTH`:最大路径长度(默认:2048)
+4. **触发部署**:
+ - 存储库会自动将 Workers 代码转换为 Pages 兼容格式并同步到 `pages` 分支
+ - 推送代码到 `main` 分支会自动触发同步和部署工作流
+ - 仅修改文档文件(`.md`)、`LICENSE`、`.gitignore` 等不会触发部署
+ - 也可以在 GitHub Actions 页面手动触发部署
+
+5. **绑定自定义域名**(可选):在 Cloudflare Pages 控制台中绑定你的自定义域名
+
+**注意**:`pages` 分支是从 `main` 分支自动生成的。请勿手动编辑 `pages` 分支,因为它会被同步工作流覆盖。
+
+### 部署到 EdgeOne Pages
+
+1. **fork 本存储库**:[Fork xixu-me/Xget](https://github.com/xixu-me/Xget/fork)
+
+2. **获取 EdgeOne Pages API Token**:
+ - 访问[中国站 EdgeOne 控制台](https://console.cloud.tencent.com/edgeone/pages?tab=api)或[国际站 EdgeOne 控制台](https://console.tencentcloud.com/edgeone/pages?tab=api)创建并记录 API Token
+
+3. **配置 GitHub Secrets**:
+ - 进入你的 GitHub 存储库 → Settings → Secrets and variables → Actions
+ - 添加以下 secret:
+ - `EDGEONE_API_TOKEN`:你的 EdgeOne Pages API Token
+
+4. **触发部署**:
+ - 存储库会自动将 Workers 代码转换为 Pages 兼容格式并同步到 `pages` 分支
+ - 推送代码到 `main` 分支会自动触发同步和部署工作流
+ - 仅修改文档文件(`.md`)、`LICENSE`、`.gitignore` 等不会触发部署
+ - 也可以在 GitHub Actions 页面手动触发部署
+
+5. **绑定自定义域名**(可选):在 EdgeOne Pages 控制台中绑定你的自定义域名
+
+**注意**:`pages` 分支是从 `main` 分支自动生成的。请勿手动编辑 `pages` 分支,因为它会被同步工作流覆盖。
### 自托管部署
@@ -2504,9 +2532,9 @@ podman-compose up -d
podman compose up -d
```
-部署完成后,Xget 将在 `http://:8080` 可用。
+部署完成后,Xget 将在 8080 端口运行。
-**注意**:自托管部署不包括 Cloudflare Workers 的全球边缘网络加速,性能取决于你的服务器配置和网络环境。
+**注意**:自托管部署不包括全球边缘网络加速,性能取决于你的服务器配置和网络环境。
## 🔧 配置
diff --git a/src/index.js b/src/index.js
index 2dca358..0d1560c 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1213,7 +1213,7 @@ async function handleRequest(request, env, ctx) {
// Handle PyPI simple index URL rewriting
if (platform === 'pypi' && response.headers.get('content-type')?.includes('text/html')) {
const originalText = await response.text();
- // Rewrite URLs in the response body to go through the Cloudflare Worker
+ // Rewrite URLs in the response body to go through the Cloudflare Workers
// files.pythonhosted.org URLs should be rewritten to go through our pypi/files endpoint
const rewrittenText = originalText.replace(
/https:\/\/files\.pythonhosted\.org/g,
@@ -1396,7 +1396,7 @@ function addPerformanceHeaders(response, monitor) {
* Cloudflare Workers. The fetch handler receives all incoming HTTP requests
* and delegates processing to the handleRequest function.
*
- * **Deployment:** This module is deployed as a Cloudflare Worker and handles
+ * **Deployment:** This module is deployed as a Cloudflare Workers and handles
* requests at the edge for optimal performance and global distribution.
*
* @example
@@ -1410,7 +1410,7 @@ function addPerformanceHeaders(response, monitor) {
*/
export default {
/**
- * Main entry point for the Cloudflare Worker fetch event.
+ * Main entry point for the Cloudflare Workers fetch event.
*
* This method is automatically invoked by the Cloudflare Workers runtime
* for every incoming HTTP request. It delegates all request processing