Skip to content

Commit f4e7c5b

Browse files
committed
fix(website): 下载量改为纯 GitHub 全量统计并缓存 12 小时
R2 分窗查询任一窗口失败即静默返回 0 并写入缓存,导致 total_downloads 在 GitHub+R2 与仅 GitHub 之间反复跳变。移除全部 R2 Analytics 逻辑,仅累加分页拉取的全部 release 的 asset download_count,缓存 TTL 与 CDN s-maxage 统一为 12 小时。同步删除 README 中 R2 下载统计相关的环境变量说明。
1 parent 14b4f75 commit f4e7c5b

2 files changed

Lines changed: 60 additions & 311 deletions

File tree

website/README.md

Lines changed: 51 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,51 @@
1-
# FluxDown 官网
2-
3-
基于 Astro + React + Tailwind CSS 构建,部署到 Vercel。
4-
5-
## 环境变量配置
6-
7-
复制 `.env.example``.env`,填写以下必要变量:
8-
9-
| 变量 | 说明 | 必填 |
10-
|------|------|------|
11-
| `GITHUB_REPO` | 仓库地址(owner/repo) ||
12-
| `GITHUB_TOKEN` | GitHub PAT,需要 `repo` 权限 ||
13-
| `GITHUB_WEBHOOK_SECRET` | Webhook 签名密钥 ||
14-
| `SMTP_HOST/PORT/USER/PASS` | SMTP 邮件配置 ||
15-
| `AFDIAN_USER_ID/TOKEN` | 爱发电 API ||
16-
| `CF_R2_ACCESS_KEY_ID` | R2 API 令牌访问密钥 ID ||
17-
| `CF_R2_SECRET_ACCESS_KEY` | R2 API 令牌机密访问密钥 ||
18-
| `CF_R2_ENDPOINT` | R2 S3 终结点 URL ||
19-
| `CF_R2_BUCKET` | R2 存储桶名称 ||
20-
| `CF_R2_PUBLIC_URL` | R2 公开访问域名(如 `https://dl.fluxdown.app`||
21-
22-
### Cloudflare R2 配置说明
23-
24-
R2 用于将 Release 文件镜像到 Cloudflare 网络,改善中国大陆用户的下载速度。
25-
26-
1.[Cloudflare Dashboard](https://dash.cloudflare.com/) → R2 → 创建存储桶
27-
2. 进入存储桶 → 设置 → 公开访问,绑定自定义域(如 `dl.fluxdown.app`
28-
3. R2 → 管理 R2 API 令牌 → 创建 Account API 令牌
29-
- 权限:**对象读和写**
30-
- 指定存储桶:仅限 fluxdown 存储桶
31-
4. 将凭据填入 `.env`,并同步到 Vercel 环境变量和 GitHub Actions Secrets
32-
33-
GitHub Actions Secrets 需要配置(用于发版时自动同步文件到 R2):
34-
35-
| Secret 名称 | 对应值 |
36-
|-------------|--------|
37-
| `CF_R2_ACCESS_KEY_ID` | 访问密钥 ID |
38-
| `CF_R2_SECRET_ACCESS_KEY` | 机密访问密钥 |
39-
| `CF_R2_ENDPOINT` | S3 终结点 URL |
40-
| `CF_R2_BUCKET` | 存储桶名称 |
41-
42-
## 🚀 Project Structure
43-
44-
Inside of your Astro project, you'll see the following folders and files:
45-
46-
```text
47-
/
48-
├── public/
49-
├── src/
50-
│ └── pages/
51-
│ └── index.astro
52-
└── package.json
53-
```
54-
55-
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
56-
57-
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
58-
59-
Any static assets, like images, can be placed in the `public/` directory.
60-
61-
## 🧞 Commands
62-
63-
All commands are run from the root of the project, from a terminal:
64-
65-
| Command | Action |
66-
| :------------------------ | :----------------------------------------------- |
67-
| `npm install` | Installs dependencies |
68-
| `npm run dev` | Starts local dev server at `localhost:4321` |
69-
| `npm run build` | Build your production site to `./dist/` |
70-
| `npm run preview` | Preview your build locally, before deploying |
71-
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
72-
| `npm run astro -- --help` | Get help using the Astro CLI |
73-
74-
## 👀 Want to learn more?
75-
76-
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
1+
# FluxDown 官网
2+
3+
基于 Astro + React + Tailwind CSS 构建,部署到 Vercel。
4+
5+
## 环境变量配置
6+
7+
复制 `.env.example``.env`,填写以下必要变量:
8+
9+
| 变量 | 说明 | 必填 |
10+
|------|------|------|
11+
| `GITHUB_REPO` | 仓库地址(owner/repo) ||
12+
| `GITHUB_TOKEN` | GitHub PAT,需要 `repo` 权限 ||
13+
| `GITHUB_WEBHOOK_SECRET` | Webhook 签名密钥 ||
14+
| `SMTP_HOST/PORT/USER/PASS` | SMTP 邮件配置 ||
15+
| `AFDIAN_USER_ID/TOKEN` | 爱发电 API ||
16+
17+
## 🚀 Project Structure
18+
19+
Inside of your Astro project, you'll see the following folders and files:
20+
21+
```text
22+
/
23+
├── public/
24+
├── src/
25+
│ └── pages/
26+
│ └── index.astro
27+
└── package.json
28+
```
29+
30+
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
31+
32+
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
33+
34+
Any static assets, like images, can be placed in the `public/` directory.
35+
36+
## 🧞 Commands
37+
38+
All commands are run from the root of the project, from a terminal:
39+
40+
| Command | Action |
41+
| :------------------------ | :----------------------------------------------- |
42+
| `npm install` | Installs dependencies |
43+
| `npm run dev` | Starts local dev server at `localhost:4321` |
44+
| `npm run build` | Build your production site to `./dist/` |
45+
| `npm run preview` | Preview your build locally, before deploying |
46+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
47+
| `npm run astro -- --help` | Get help using the Astro CLI |
48+
49+
## 👀 Want to learn more?
50+
51+
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).

0 commit comments

Comments
 (0)