Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ jobs:
fi
echo "repo 核验演练通过:不存在的仓库被拦下"

- name: 演练 4|第三方外链失败只警告,官方/演示站失败硬拦(§7)
- name: 演练 4|第三方外链失败只警告,自研项目外链失败硬拦(§7)
run: |
HUB_PROJECTS_DIR=tests/fixtures/submission/links/third-party pnpm check:links
echo "第三方外链失败仅警告:CI 未失败,符合 §7"
if HUB_PROJECTS_DIR=tests/fixtures/submission/links/official pnpm check:links; then
echo "::error::官方/演示站外链失败竟然放行了,§7 硬拦失效"
echo "::error::自研项目外链失败竟然放行了,§7 硬拦失效"
exit 1
fi
echo "官方/演示站外链失败硬拦:符合 §7"
echo "自研项目外链失败硬拦:符合 §7"

- name: 演练 5|不合规截图必须让 CI 失败并逐条点名(§7)
run: |
Expand Down
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ WorkerHub(hub)是 Cloudflare Workers 生态的中文精选应用目录:自
| `features` | string[] | ✓ | 特性 3–5 条(详情页列表);卡片只显示 tagline |
| `category` | enum | ✓ | 主分类,取值见 4.4 |
| `tags` | string[] | ✓ | 自由标签 ≤5 个,不得重复 |
| `homepage` | string(url) | ? | 项目官网 / 在线演示站(自研项目填各自 `oneboy.app` 域名);**演示站不可达会被 CI 硬拦** |
| `docs_url` | string(url) | ? | 部署/使用文档链接;缺省时页面取仓库 README |
| `deploy` | object | ✓ | 部署信息,见 4.3 |
| `resources` | enum[] | ✓ | 部署所需 Cloudflare 资源,≥1 个且不重复,见 4.5 |
Expand Down Expand Up @@ -177,7 +176,6 @@ tags:
- 标签一
- 标签二
category: productivity
homepage: https://example.com
docs_url: https://github.com/your-org/your-project/blob/main/docs/deploy.md
deploy:
method: git-integration
Expand Down Expand Up @@ -209,7 +207,7 @@ pricing_note: 免费层每日 10 万次请求,超过需 Workers Paid($5/月
pnpm install
pnpm validate:data # schema、枚举、slug 与文件名一致、slug/repo 查重
pnpm check:repos # repo 存在且为 public(调 GitHub API)
pnpm check:links # 外链可达性(自研与演示站链接失败会硬拦)
pnpm check:links # 外链可达性(自研项目外链失败会硬拦)
pnpm check:screenshots # 截图规格
```

Expand Down Expand Up @@ -259,7 +257,7 @@ pnpm check:screenshots # 截图规格
| `tier: verified` 的 `verified_at` + `verified_note_url` | 见第 3 节 | **失败** |
| `free_tier != yes` 时 `pricing_note` | 见 4.2 | **失败** |
| 外链可达性(`docs_url`、`deploy.url`、`deploy.guide_url`) | HTTP 探测 | **警告**(不硬拦,评审人人工确认) |
| 自研项目的全部外链、任何项目的 `homepage`(演示站) | HTTP 探测 | **失败** |
| 自研项目的全部外链 | HTTP 探测 | **失败** |
| 截图规格(webp、宽 ≥1200px、≤300KB) | 见第 6 节 | **失败** |
| 投稿 PR 变更范围 | 见第 7 节第 2 步 | **失败** |

Expand Down
269 changes: 28 additions & 241 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/link-health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* 用法:`pnpm health:links`
*
* 输入:`src/data/projects/*.yaml` 里的全部外链(仓库入口 + homepage / docs_url / deploy url / guide)。
* 输入:`src/data/projects/*.yaml` 里的全部外链(仓库入口 + docs_url / deploy url / guide)。
* 输出:
* - `link-health-report.json`(默认,已在 .gitignore)—— 摘要报告,工作流写进 GitHub Actions summary
* - `link-health-state.json`(默认,已在 .gitignore)—— 连续失败计数,CI 侧用 actions/cache 持久化
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate-submission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* 退出码:
* 0 没有硬拦问题(允许存在 warning)
* 1 有硬拦问题(§7:repo 不存在/私有、官方与演示站外链失败、截图不合规…)
* 1 有硬拦问题(§7:repo 不存在/私有、自研项目外链失败、截图不合规…)
* 传入 --fail-on-warnings 时,warning 也会导致退出码 1
*/
import { resolve } from 'node:path';
Expand Down
3 changes: 1 addition & 2 deletions src/data/projects/cloud-mail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tagline_zh: 一个域名搭起自己的邮箱服务:多用户、附件收发
description_zh: >-
基于 Cloudflare 的一站式邮箱服务平台:只要一个自有域名,就能像常规邮箱平台那样创建多个邮箱账号、收发并管理邮件,
用 Workers 替掉常驻服务器。集成 Cloudflare Email 与 Resend 发信,附件存 R2、数据存 D1、缓存走 KV,
还能用 Workers AI 自动识别邮件验证码,并带管理员后台与开放 API。演示站 skymail.ink,部署步骤见 docs.skymail.ink。
还能用 Workers AI 自动识别邮件验证码,并带管理员后台与开放 API。部署步骤见 docs.skymail.ink。
features:
- 一个域名开多个邮箱账号,附件收发走 R2,邮件可转发到 Telegram 机器人或其他邮箱
- 发信支持 Cloudflare Email 与 Resend 两种方式,可群发
Expand All @@ -19,7 +19,6 @@ tags:
- 自托管
- 邮件收发
- Email Workers
homepage: https://skymail.ink
docs_url: https://docs.skymail.ink
deploy:
method: github-actions
Expand Down
2 changes: 0 additions & 2 deletions src/data/projects/edgechat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ description_zh: >-
完全运行在 Cloudflare Workers 上的自部署团队聊天系统:实时消息、公开/私有频道与私信、文件与语音消息,
并支持 Telegram 双向桥接和两个独立部署站点共享同一群的跨实例互联。新消息正文与附件使用 AES-256-GCM
服务端静态加密,应用与数据资源都落在自己的 Cloudflare 账号下,由 GitHub Actions 自动部署与更新。
上游的在线演示站是纯前端界面模拟(API、WebSocket、文件上传均在浏览器内存中模拟,无真实后端)。
features:
- 实时消息、公开/私有频道与私信,附件存 R2、会话状态存 KV
- Telegram 双向桥接:文字、图片、视频、语音、文件双向同步,TG 成员无需注册
Expand All @@ -20,7 +19,6 @@ tags:
- 即时通讯
- Telegram
- 加密
homepage: https://echat.azora.top
docs_url: https://echat.azora.top/guide/getting-started.html
deploy:
method: github-actions
Expand Down
1 change: 0 additions & 1 deletion src/data/projects/edgeever.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ tags:
- 知识库
- 多端同步
- AI
homepage: https://demo.edgeever.org
docs_url: https://github.com/tianma-if/edgeever/blob/main/docs/deploy-cloudflare-button.zh-CN.md
deploy:
method: git-integration
Expand Down
1 change: 0 additions & 1 deletion src/data/projects/enotify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ tags:
- 通知
- 订阅管理
- 多渠道
homepage: https://enotify.oneboy.app
docs_url: https://github.com/WorkerHub/eNotify#部署指南
deploy:
method: github-actions
Expand Down
1 change: 0 additions & 1 deletion src/data/projects/someday.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ tags:
- 写信
- 定时投递
- 邮件
homepage: https://someday.oneboy.app
docs_url: https://github.com/WorkerHub/someday#部署
deploy:
method: github-actions
Expand Down
1 change: 0 additions & 1 deletion src/data/projects/uptimeflare.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ tags:
- 状态页
- 告警
- 免费
homepage: https://uptimeflare.pages.dev/
docs_url: https://github.com/lyc8503/UptimeFlare/wiki/Setup
deploy:
method: github-actions
Expand Down
10 changes: 1 addition & 9 deletions src/lib/link-health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ import { existsSync, readFileSync } from 'node:fs';
import { z } from 'zod';

/** 巡检的外链字段(§9.3「全部外链」:仓库入口 + 数据文件里的全部人工外链) */
export const LINK_FIELDS = [
'repo',
'homepage',
'docs_url',
'deploy.url',
'deploy.guide_url',
] as const;
export const LINK_FIELDS = ['repo', 'docs_url', 'deploy.url', 'deploy.guide_url'] as const;
export type LinkField = (typeof LINK_FIELDS)[number];

export const LINK_HEALTH_STATE_VERSION = 1;
Expand All @@ -38,7 +32,6 @@ export interface LinkSourceProject {
slug: string;
data: {
repo: string;
homepage?: string | undefined;
docs_url?: string | undefined;
deploy: { url?: string | undefined; guide_url?: string | undefined };
};
Expand All @@ -56,7 +49,6 @@ export function collectProjectLinks(projects: readonly LinkSourceProject[]): Pro
for (const project of projects) {
const { data } = project;
refs.push({ slug: project.slug, field: 'repo', url: `https://github.com/${data.repo}` });
if (data.homepage) refs.push({ slug: project.slug, field: 'homepage', url: data.homepage });
if (data.docs_url) refs.push({ slug: project.slug, field: 'docs_url', url: data.docs_url });
if (data.deploy.url)
refs.push({ slug: project.slug, field: 'deploy.url', url: data.deploy.url });
Expand Down
12 changes: 4 additions & 8 deletions src/lib/project-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* 入口按钮的唯一真源(SPEC §4.3 卡片主入口 + §5 详情页按钮呈现)。
*
* 卡片与详情页都从这里取链接与文案,避免「同一项目在两个页面按钮不一致」。
* 判定依据只有数据字段:第三方 = 仓库;官方 = 在线演示(有 homepage)或仓库;
* 判定依据只有数据字段:自研与第三方的主入口一律是仓库;
* coming-soon(waker 预告位)= 不给部署入口,只给仓库。
*/
import { DEPLOY_METHOD_META, type ProjectView } from './project-types';

export interface EntryLink {
href: string;
label: string;
kind: 'repo' | 'demo' | 'deploy' | 'docs';
kind: 'repo' | 'deploy' | 'docs';
/** 外部链接(新标签打开) */
external: boolean;
}
Expand All @@ -24,11 +24,8 @@ const link = (href: string, label: string, kind: EntryLink['kind']): EntryLink =
external: isExternal(href),
});

/** 卡片主入口(§4.3):官方=在线演示或仓库;第三方=仓库 */
/** 卡片主入口(§4.3):一律「查看仓库」 */
export function primaryEntry(project: ProjectView): EntryLink {
if (project.source === 'official' && project.homepage) {
return link(project.homepage, '在线演示', 'demo');
}
return link(project.repoUrl, '查看仓库', 'repo');
}

Expand All @@ -52,10 +49,9 @@ export function deployAction(project: ProjectView): EntryLink {
}
}

/** 详情页的补充入口:在线演示 / 部署文档 / 仓库(去重、去空) */
/** 详情页的补充入口:部署文档 / 仓库(去重、去空) */
export function secondaryEntries(project: ProjectView): EntryLink[] {
const candidates: EntryLink[] = [];
if (project.homepage) candidates.push(link(project.homepage, '在线演示', 'demo'));
if (project.docsUrl) candidates.push(link(project.docsUrl, '部署文档', 'docs'));
candidates.push(link(project.repoUrl, 'GitHub 仓库', 'repo'));

Expand Down
1 change: 0 additions & 1 deletion src/lib/project-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ export const projectSchema = z
.array(z.string().min(1))
.max(5)
.refine((v) => new Set(v).size === v.length, { message: 'tags 不得重复' }),
homepage: z.url().optional(),
docs_url: z.url().optional(),
deploy: deploySchema,
resources: z
Expand Down
1 change: 0 additions & 1 deletion src/lib/project-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ export interface ProjectView {

repo: string;
repoUrl: string;
homepage: string | null;
docsUrl: string | null;
deploy: { method: DeployMethod; url: string | null; guideUrl: string | null };

Expand Down
1 change: 0 additions & 1 deletion src/lib/project-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export function toProjectView({ data, meta }: ProjectWithMeta): ProjectView {

repo: data.repo,
repoUrl: `https://github.com/${data.repo}`,
homepage: data.homepage ?? null,
docsUrl: data.docs_url ?? null,
deploy: {
method: data.deploy.method,
Expand Down
17 changes: 8 additions & 9 deletions src/lib/submission-checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* 投稿数据的三类必检项(SPEC §7「CI 自动校验」,投稿 PR 与官方数据 PR 同等适用):
*
* 1. `repo` 真实存在且为 public(GitHub REST API 核验)
* 2. 外链可达性(homepage / docs_url / deploy.url / deploy.guide_url)
* 2. 外链可达性(docs_url / deploy.url / deploy.guide_url)
* 3. 截图规格(webp、宽 ≥1200px、体积 ≤300KB)
*
* 严重级别严格照抄 §7 原文:
* - `repo` 不存在 / 私有 / 无法核验 → **硬拦**(error)
* - 外链失败 → **默认只警告**,由评审人人工确认;
* 但「官方项目的全部外链」与「任何项目的演示站(homepage)」失败 → **硬拦**(error)
* 但「官方项目的全部外链」失败 → **硬拦**(error)
* - 例外(返工口径,见 ONE-449):外链返回 **HTTP 403** 时一律降级为 warning。
* CDN(Cloudflare Pages 等)的 bot 防护会拒绝 CI runner 出口 IP,403 说明站点在线、
* 只是不许探针访问,不构成「不可达」结论;输出保留站点名与状态码供人眼复核。
Expand Down Expand Up @@ -228,17 +228,16 @@ export async function checkRepos(
// 2. 外链可达性(§7)
// ---------------------------------------------------------------------------

export type LinkField = 'homepage' | 'docs_url' | 'deploy.url' | 'deploy.guide_url';
export type LinkField = 'docs_url' | 'deploy.url' | 'deploy.guide_url';

export interface ProjectLink {
field: LinkField;
url: string;
}

/** 该项目的全部外链(§7 列举:homepage / docs / deploy url) */
/** 该项目的全部外链(§7 列举:docs / deploy url) */
export function collectLinks(data: ProjectInput): ProjectLink[] {
const links: ProjectLink[] = [];
if (data.homepage) links.push({ field: 'homepage', url: data.homepage });
if (data.docs_url) links.push({ field: 'docs_url', url: data.docs_url });
if (data.deploy.url) links.push({ field: 'deploy.url', url: data.deploy.url });
if (data.deploy.guide_url) links.push({ field: 'deploy.guide_url', url: data.deploy.guide_url });
Expand All @@ -247,13 +246,13 @@ export function collectLinks(data: ProjectInput): ProjectLink[] {

/**
* 外链失败时的严重级别(§7 原文):
* 「失败给 warning 不硬拦(评审人人工确认);官方项目与演示站链接失败则硬拦」。
* 即:`source=official` 的任何外链、以及任何项目的 `homepage`(官网/演示站)→ error。
* 「失败给 warning 不硬拦(评审人人工确认);官方项目链接失败则硬拦」。
* 即:`source=official` 的任何外链 → error,第三方 → warning。
*
* 注意:这只是基础分级;HTTP 403(bot 防护)的例外由 `resolveLinkFailureSeverity` 叠加。
*/
export const linkFailureSeverity = (data: ProjectInput, field: LinkField): Severity =>
data.source === 'official' || field === 'homepage' ? 'error' : 'warning';
export const linkFailureSeverity = (data: ProjectInput, _field: LinkField): Severity =>
data.source === 'official' ? 'error' : 'warning';

export interface LinkProbeResult {
url: string;
Expand Down
2 changes: 1 addition & 1 deletion tests/build-summary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const links: LinkHealthReport = {
rows: [
{
url: 'https://zeta.oneboy.app',
field: 'homepage',
field: 'docs_url',
slugs: ['zeta'],
outcome: 'failed',
status: 502,
Expand Down
1 change: 0 additions & 1 deletion tests/contributing-docs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const MANUAL_FIELDS = [
'features',
'category',
'tags',
'homepage',
'docs_url',
'deploy',
'resources',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# 演练夹具:官方项目的 homepage(演示站)不可达 → §7 要求 CI 硬拦
slug: drill-official-broken-home
name: Drill Official Broken Home
# 演练夹具:自研条目的 docs_url 不可达 → §7 要求 CI 硬拦
slug: drill-official-broken-docs
name: Drill Official Broken Docs
repo: WorkerHub/hub-drill-official
source: official
tagline_zh: 演练用官方条目,演示站地址不可达。
tagline_zh: 演练用自研条目,文档地址不可达。
description_zh: 第一条说明句。第二条说明句。
features:
- 特性一
Expand All @@ -12,7 +12,7 @@ features:
tags:
- drill
category: notification
homepage: http://127.0.0.1:9/demo
docs_url: http://127.0.0.1:9/docs
deploy:
method: docs-only
resources:
Expand Down
17 changes: 8 additions & 9 deletions tests/link-health.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const project = (slug: string, overrides: Partial<LinkSourceProject['data']> = {
slug,
data: {
repo: `WorkerHub/${slug}`,
homepage: `https://${slug}.oneboy.app`,
docs_url: `https://github.com/WorkerHub/${slug}#deploy`,
deploy: {
url: `https://deploy.workers.cloudflare.com/?url=https://github.com/WorkerHub/${slug}`,
Expand All @@ -46,12 +45,12 @@ const fetchStub = (statuses: Record<string, number>, fallback = 200): typeof fet
test('collectProjectLinks 收集仓库入口与数据文件里的全部外链', () => {
const refs = collectProjectLinks([
project('enotify'),
project('waker', { homepage: undefined, docs_url: undefined, deploy: {} }),
project('waker', { docs_url: undefined, deploy: {} }),
]);

assert.deepEqual(
refs.map((ref) => `${ref.slug}:${ref.field}`),
['enotify:repo', 'enotify:homepage', 'enotify:docs_url', 'enotify:deploy.url', 'waker:repo'],
['enotify:repo', 'enotify:docs_url', 'enotify:deploy.url', 'waker:repo'],
);
assert.equal(refs[0]!.url, 'https://github.com/WorkerHub/enotify');
});
Expand All @@ -66,8 +65,8 @@ test('同一 URL 只检查一次,并合并引用它的项目', async () => {

const { report } = await runLinkHealth(
[
{ slug: 'alpha', field: 'homepage', url: shared },
{ slug: 'beta', field: 'homepage', url: shared },
{ slug: 'alpha', field: 'docs_url', url: shared },
{ slug: 'beta', field: 'docs_url', url: shared },
],
{ fetchImpl },
);
Expand All @@ -81,8 +80,8 @@ test('连续失败累计到阈值后点名,恢复可达后计数清零', async
const bad = 'https://broken.example.org';
const good = 'https://ok.example.org';
const refs = [
{ slug: 'alpha', field: 'homepage' as const, url: bad },
{ slug: 'beta', field: 'homepage' as const, url: good },
{ slug: 'alpha', field: 'docs_url' as const, url: bad },
{ slug: 'beta', field: 'docs_url' as const, url: good },
];

const first = await runLinkHealth(refs, {
Expand Down Expand Up @@ -115,7 +114,7 @@ test('连续失败累计到阈值后点名,恢复可达后计数清零', async
test('反爬/限流类状态码归入「需人工确认」,不计入连续失败', async () => {
const limited = 'https://protected.example.org';
const { report, state } = await runLinkHealth(
[{ slug: 'alpha', field: 'homepage', url: limited }],
[{ slug: 'alpha', field: 'docs_url', url: limited }],
{
fetchImpl: fetchStub({ [limited]: 403 }),
previous: emptyLinkHealthState(),
Expand All @@ -138,7 +137,7 @@ test('网络异常不会让巡检抛错,而是记为失败', async () => {
throw new Error('ECONNREFUSED');
}) as typeof fetch;

const { report } = await runLinkHealth([{ slug: 'alpha', field: 'homepage', url: down }], {
const { report } = await runLinkHealth([{ slug: 'alpha', field: 'docs_url', url: down }], {
fetchImpl,
retries: 0,
});
Expand Down
Loading
Loading