Skip to content

About

FluxDown 去中心化插件索引(内容寻址 + 多源分发 + 防回滚)

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

83 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FluxDown Plugin Index

The plugin index for FluxDown — a content-addressed, Git-versioned catalog of plugins.

Not a website — a verifiable data format. FluxDown discovers, downloads, and verifies plugins directly from this Git repository.

English · 简体中文


English

What this is

This repository is the marketplace: a Git-versioned, content-addressed index that any FluxDown client fetches, verifies, and installs from. There is no backend and no account. Authors keep their plugin in their own GitHub repository; registering it here once is enough — every later GitHub Release is picked up automatically. You can fork this repo to host your own index.

Design principles

Principle How it is realized
Authors own their repos registry.json binds one plugin identity to one GitHub repository. The author's Latest Release asset is the download source.
Register once, update automatically The hourly Stage job ingests each new Latest Release: hash, unpack, validate, append a shard, republish index.json. No PR per version.
Content-addressed contentHash = sha256(entire .fxplug zip) is the single source of truth. A client accepts a download from any mirror as long as the hash matches.
Immutable versions Shards are append-only. A version's bytes never change; a swapped release asset is detected and reported, and clients reject it by hash.
Rollback protection A global monotonic sequence. Clients persist a per-indexId high-water mark and reject any index whose sequence regresses.
Consent matches the package Shard permissions[] are copied from the package manifest by Stage; the client also refuses packages whose manifest identity, version, or permissions differ from the index entry.

Signing (v1 note). Author-level signatures (sigstore / ed25519) are a planned enhancement; the schema reserves sigScheme / sigstoreBundleRef. The integrity base is content addressing (sha256) + transport TLS + Git history.

Repository layout

registry.json                        Author registry: plugin identity ↔ GitHub repo (the only file authors edit)
STATE                                Index identity (indexId UUID) + sequence high-water mark
index.json                           Flattened full catalog — the client fetch entry point (generated)
plugins/<pluginId>/<version>.json    One shard per plugin per version (append-only, generated by Stage)
dist/<name>-<version>.fxplug         Legacy packages published before the registry (append-only)
scripts/package-lib.mjs              Safe .fxplug unpacking; admission is the SDK's validatePackage
scripts/publication-lib.mjs          Market-only localization policy; historical packages are exempt by identity/version/hash
vendor/fluxdown-plugin-manifest.mjs   Admission rules: dist/manifest.mjs of the published fluxdown-plugin-sdk, verbatim (first line names the release; never edit)
scripts/sync-validator.mjs / validator-lib.mjs  Vendor an SDK release (npm integrity verified) / verify vendor equals its npm release
scripts/readmit.mjs                  Re-admit the newest listing of every plugin with the vendored rules
scripts/stage-lib.mjs / stage.mjs    Stage: Latest Release → shard → index.json; stage-fail issues
scripts/check-registry.mjs           Registry PR check (dry-run Stage, PR comment)
scripts/index-lib.mjs                Shared content/history admission rules
scripts/validate.mjs / generate.mjs  Offline admission / deterministic flatten
scripts/check-mirrors.mjs            Online full-GET/hash validation of every mirror
.github/workflows/                   stage.yml (hourly + on registry change), registry-check.yml, validate.yml, sync-validator.yml

Publishing a plugin

Your repository

  1. Develop the plugin in your own public GitHub repository (manifest.json + scripts; see the plugin docs).
  2. Publish a GitHub Release (not draft, not pre-release) with exactly one .fxplug asset. The manifest version must be strict MAJOR.MINOR.PATCH and higher than every version already in the index. Enabling GitHub immutable releases is recommended.

Register once

  1. Open a PR that only adds your entry to registry.json:

    { "id": "author@name", "repo": "owner/repo", "tags": ["resolver", "video"] }

    id must equal the manifest identity; one repository hosts one plugin; tags (optional, ≤10 lowercase) are shown in the market. Renamed your repository? Point repo at the new name and keep the old one in "formerRepos": ["owner/old-name"] so already-published versions (whose mirrors use the old Release URL) stay valid; new releases are only staged from repo.

  2. The registry-check bot downloads your Latest Release, runs the full admission and comments with the result, the declared permissions, and the URL patterns the plugin intercepts. Fix your release and push to the PR to re-run.

  3. A maintainer reviews and merges. Stage publishes your plugin within minutes.

Updates

  1. Just publish a new Release. Stage runs hourly; on success the new version appears in the market. On failure an issue labeled stage-fail is opened (and closed automatically once fixed) — no new PR needed.

Admission rules (PR check and Stage)

Check Rule
Release Latest Release of the registered repo, exactly one .fxplug asset on that repo's releases/download URL
Bytes ≤ 10 MiB; sha256 equals GitHub's asset digest when present
Zip ≤ 200 entries, ≤ 50 MiB unpacked, no ../absolute/backslash paths, no symlinks or encrypted entries, CRC verified; manifest.json at root or in one wrapper folder
Manifest + files validatePackage of the vendored fluxdown-plugin-sdk release, the same rules the client enforces at install (schema, permissions, contributes, contents of sniffRules / view icons / page scripts), listing-strict: three-part versions and every referenced file present
Setting localization New publications and updates require non-blank localizations.en and localizations.zh for every setting title, every option label, and any custom description/helper label
Identity Manifest identity equals the registered id
Version Strictly greater than every published version; identical bytes only add the release as a mirror of the existing version
Immutability A staged release asset whose digest changes is reported; the published version keeps its bytes

Updates are fully automatic: first registration is reviewed by a maintainer, later releases are not. The PR comment lists what a reviewer approves — permissions, risk level, desktop network hosts, the download URLs the plugin handles, the sites its page scripts run on — and the rules version used. Permissions are always shown to users before installing.

Localization is a market publication rule, not a client install rule. First publications and new versions are checked by Stage and registry PR checks; mirror CI applies the same policy to new shards against the exact pre-change publication baseline, including newly yanked shards. Already-published identity/version/hash tuples, byte-identical mirror additions, and historical re-admission are not retroactively required to add translations. Plugins without manifest settings have no setting text to translate. This checks declarative setting text, not whether a custom script view actually renders translated text.

The SDK validator remains the sole source of package/schema rules; publication-lib.mjs adds only the market's translation-completeness policy. The published validator must support settings[].localizations before translated packages can be admitted; update it through the normal SDK release/sync workflow, never by editing vendor/.

Where the rules come from

The index never re-implements the client's rules. They live in FluxDown's packages/plugin-sdk/src/manifest.ts (tested against the engine's shared fixtures) and reach this repository only as a published npm release:

  1. FluxDown releases the SDK (plugin-sdk-v* tag) and dispatches sync-validator.yml here; a daily run catches anything missed.
  2. sync-validator.mjs downloads fluxdown-plugin-sdk@<version> from registry.npmjs.org, checks the npm integrity and the version stamped on the file, and replaces vendor/fluxdown-plugin-manifest.mjs (latest never moves backwards; dispatch an explicit older version to roll back).
  3. The job runs the offline tests and admission, re-admits the newest listing of every plugin (rejections open an issue — published bytes stay, the author must release), then pushes to main.
  4. validate.yml fails if the vendored file differs from its npm release, so it cannot be edited by hand.

Generated shard fields

Field Source
pluginId, version, name, description, minAppVersion, permissions[], networkHosts[] Package manifest
contentHash sha256 of the release asset
sequence Next global sequence above STATE, index.json and every shard
author / homepage Registered repository owner / URL
mirrors[] The release asset URL
publishTime Release published_at (also drives index.json.updated)
tags[] registry.json
yanked none; maintainers may set deprecated / vulnerable / malicious
sigScheme / sigstoreBundleRef Reserved (none)

Maintainer operations

  • Yank: edit the shard's yanked (vulnerable / malicious also disable installed copies on clients); regenerate with node scripts/generate.mjs.
  • Delist: remove the entry from registry.json (Stage stops ingesting and closes its stage-fail issue); yank versions that must disappear from installs.
  • Maintainer change: a PR re-pointing repo for an existing id; the bot flags it and the previous maintainer must confirm in the PR. The new version must still be higher.
  • Identity rename: a PR replacing an entry's id and listing the old one in "formerIds": ["author@old"]. The old identity stays reserved and its published shards keep validating against this entry's repo / formerRepos; new releases are staged only under the new id, starting a fresh version line. Installed copies do not migrate (clients match by identity), so yank the old versions deprecated in the same PR — that hides the old identity from the market without disabling installed copies.
  • Re-check a PR: run the registry-check workflow manually with the PR number.

The .fxplug package

A .fxplug is a plain zip of the plugin directory with manifest.json at the root (or inside a single wrapper folder). Manifest keys, permissions and limits: https://fluxdown.com/docs/en/plugins/manifest/. Check a package locally with npx fluxdown-plugin validate before releasing.

Validation commands

Node 20 or later, no dependencies:

node --test scripts/index.test.mjs scripts/stage.test.mjs scripts/validator.test.mjs
node scripts/validate.mjs
node scripts/validate.mjs --base /path/to/exact-base-checkout
node scripts/check-mirrors.mjs
node scripts/check-mirrors.mjs --base /path/to/exact-base-checkout  # also enforce policy on new packages
node scripts/sync-validator.mjs --verify                           # vendored rules = their npm release
node scripts/readmit.mjs                                           # newest listings vs. vendored rules
node scripts/sync-validator.mjs --from <sdk>/dist/manifest.mjs     # try an unreleased SDK build locally (do not commit)
GITHUB_TOKEN=… node scripts/stage.mjs --root /tmp/index-copy        # dry-run Stage on a copy
GITHUB_TOKEN=… node scripts/check-registry.mjs --head registry.json # PR check locally

The first three are offline. --base takes a complete checkout of the exact published base commit (CI uses pull_request.base.sha / push.before; Stage pins the pre-stage HEAD). Missing baselines and shallow history fail admission. Published shards, legacy dist/ packages, identities, versions, hashes and sequences cannot be deleted or rewritten; mirror and display metadata repairs are allowed. check-mirrors.mjs GETs every mirror of every non-yanked version in full (45 s, 10 MiB, ≤5 HTTPS/public-host redirects); yanked versions are skipped because clients never install them by default.

How the client consumes it

FluxDown's plugin::market::MarketClient: fetch index.json (multi-source failover) → verify the sequence has not regressed → download the .fxplug from the first working mirror → pin-compare against contentHash → verify the manifest identity / version / permissions match the entry → install through the shared pipeline (zip-slip / zip-bomb protection + manifest validation).


简体中文

这是什么

本仓库本身就是市场:一份 Git 版本化、内容寻址的索引,FluxDown 客户端从这里发现、校验并安装插件。无后端、无账号。作者把插件放在自己的 GitHub 仓库里维护,在这里登记一次即可——之后每次 GitHub Release 都会被自动收录。你也可以 fork 本仓库自建索引。

设计要点

原则 实现方式
作者维护自己的仓库 registry.json 把一个插件 identity 绑定到一个 GitHub 仓库;作者 Latest Release 的附件就是下载源。
登记一次,自动更新 每小时运行的 Stage 收录每个新的 Latest Release:算哈希、解包、校验、追加分片、重新发布 index.json。不必每个版本提 PR。
内容寻址 contentHash = sha256(整个 .fxplug zip) 是唯一真相源;从任一镜像取回,哈希吻合即接受。
版本不可变 分片只增不删;同一版本字节永不改变。Release 附件被替换会被发现并上报,客户端按哈希拒绝。
防回滚 全局 sequence 单调递增;客户端持久化 per-indexId 高水位,索引回退即拒绝。
授权与包一致 分片 permissions[] 由 Stage 从包内 manifest 抄录;客户端还会拒绝 manifest 的 identity / 版本 / 权限与索引条目不一致的包。

v1 签名说明。 作者级签名(sigstore / ed25519)为后续增强,schema 已预留 sigScheme / sigstoreBundleRef。当前完整性基座 = 内容寻址(sha256)+ 传输层 TLS + Git 历史。

目录结构

registry.json                        作者登记表:插件 identity ↔ GitHub 仓库(作者唯一需要编辑的文件)
STATE                                索引身份(indexId UUID)+ sequence 高水位
index.json                           flatten 后的全量目录 —— 客户端拉取入口(生成)
plugins/<pluginId>/<version>.json    每插件每版本一份分片(只增不删,由 Stage 生成)
dist/<name>-<version>.fxplug         登记表出现前发布的历史包(只增不删)
scripts/package-lib.mjs              .fxplug 安全解包;准入即 SDK 的 validatePackage
scripts/publication-lib.mjs          仅市场执行的国际化准入;以 identity/version/hash 豁免历史包
vendor/fluxdown-plugin-manifest.mjs   准入规则:已发布 fluxdown-plugin-sdk 的 dist/manifest.mjs 原样(首行标明版本;禁止手改)
scripts/sync-validator.mjs / validator-lib.mjs  同步某个 SDK 发布版(校验 npm integrity)/ 校验 vendor 与 npm 发布物一致
scripts/readmit.mjs                  用当前规则复核每个插件的最新上架版本
scripts/stage-lib.mjs / stage.mjs    Stage:Latest Release → 分片 → index.json;stage-fail issue
scripts/check-registry.mjs           登记 PR 检查(Stage 演练 + PR 评论)
scripts/index-lib.mjs                共享内容 / 历史准入规则
scripts/validate.mjs / generate.mjs  离线准入 / 确定性 flatten
scripts/check-mirrors.mjs            对每个镜像完整 GET 并核验哈希
.github/workflows/                   stage.yml(每小时 + 登记变更)、registry-check.yml、validate.yml、sync-validator.yml

发布一个插件

你的仓库

  1. 在自己的公开 GitHub 仓库开发插件(manifest.json + 脚本,见插件文档)。
  2. 发布 GitHub Release(非草稿、非预发布),附件中恰好一个 .fxplug。manifest version 须为严格的 MAJOR.MINOR.PATCH,且高于索引中已有的所有版本。建议开启 GitHub 不可变 Release。

登记一次

  1. 提一个只修改 registry.json 的 PR,追加:

    { "id": "author@name", "repo": "owner/repo", "tags": ["resolver", "video"] }

    id 必须等于 manifest identity;一个仓库只发布一个插件;tags 可选(≤10 个小写标签),用于市场展示。仓库改名时把 repo 改成新名,并把旧名记入 "formerRepos": ["owner/old-name"],已发布版本(镜像仍是旧 Release 地址)才能继续通过校验;新版本只从 repo 收录。

  2. registry-check 机器人会下载你的 Latest Release,跑完整准入,并在 PR 里评论结果、声明的权限和插件拦截的 URL 规则。修好 Release 后向 PR 推送任意提交即可重跑。

  3. 维护者审核合并,Stage 在几分钟内收录。

更新

  1. 直接发布新 Release。Stage 每小时运行一次,成功后新版本出现在市场;失败时开一个 stage-fail 标签的 issue(修复后自动关闭),无需再提 PR。

准入规则(PR 检查与 Stage 共用)

检查 规则
Release 登记仓库的 Latest Release,恰好一个 .fxplug 附件,地址属于该仓库的 releases/download
字节 ≤ 10 MiB;GitHub 提供附件 digest 时 sha256 必须一致
Zip ≤ 200 个条目、解压 ≤ 50 MiB;禁 .. / 绝对路径 / 反斜杠、符号链接、加密条目;校验 CRC;manifest.json 在根目录或唯一包裹目录内
Manifest 与文件 同步来的 fluxdown-plugin-sdk 版本的 validatePackage,即客户端安装时的同一套规则(schema、权限、contributes、sniffRules / 视图图标 / 页面脚本的内容),并按上架标准从严:三段版本号、所有引用文件必须在包内
设置国际化 新上架及更新:每项设置的标题、全部选项标签,以及自定义说明/辅助按钮文案,均须提供非空的 localizations.en 与 localizations.zh
身份 manifest identity 等于登记的 id
版本 严格高于全部已发布版本;字节完全相同则只把 Release 追加为该版本的镜像
不可变 已收录的 Release 附件 digest 变化会被上报,已发布版本字节不变

更新全自动:首次登记由维护者人工审核,之后的版本不再人工审核。PR 评论列出审核者要批准的内容——权限、风险等级、桌面网络主机、插件处理的下载地址、页面脚本运行的站点——以及所用规则版本。安装前客户端始终向用户展示权限。

国际化是市场发布准入,不是客户端安装限制。首次发布和新版本由 Stage/登记 PR 检查执行;镜像 CI 对照变更前的精确发布基线,同样检查新增分片(包括新加入即撤回的分片,防止先撤回再恢复绕过)。已发布的 identity/version/hash、相同字节追加镜像及历史复核不追溯要求翻译。没有 manifest 设置项的插件无需提供设置文案。此处检查声明式设置,不把脚本声明或源码片段当作自定义视图实际支持多语言的证明。

包结构/schema 仍以 SDK 校验器为唯一事实源,publication-lib.mjs 只额外检查市场要求的译文完整性。市场接纳翻译包前,须经正常 SDK 发布/同步流程更新到支持 settings[].localizations 的校验器,不能手改 vendor/。

规则从哪里来

索引仓不重写客户端规则。规则只在 FluxDown 的 packages/plugin-sdk/src/manifest.ts(与引擎共用夹具测试),并且只以 npm 发布版的形式进入本仓库:

  1. FluxDown 发布 SDK(plugin-sdk-v* tag)后触发本仓库 sync-validator.yml;另有每日定时兜底。
  2. sync-validator.mjs 从 registry.npmjs.org 下载 fluxdown-plugin-sdk@<版本>,校验 npm integrity 与文件首行版本标记,替换 vendor/fluxdown-plugin-manifest.mjs(latest 不会回退;回滚需手动触发并指定旧版本)。
  3. 工作流跑离线测试与准入,再用新规则复核每个插件的最新上架版本(被拒则开 issue——已发布字节不变,需作者发新版),然后推送到 main。
  4. validate.yml 校验 vendor 文件与其 npm 发布物逐字节一致,手改会失败。

生成的分片字段

字段 来源
pluginId、version、name、description、minAppVersion、permissions[]、networkHosts[] 包内 manifest
contentHash Release 附件 sha256
sequence 高于 STATE、index.json 与所有分片的下一个全局序号
author / homepage 登记仓库的 owner / 地址
mirrors[] Release 附件地址
publishTime Release published_at(同时决定 index.json.updated)
tags[] registry.json
yanked none;维护者可改为 deprecated / vulnerable / malicious
sigScheme / sigstoreBundleRef 预留(none)

维护者操作

  • 撤回:修改分片 yanked(vulnerable / malicious 会让客户端停用已安装副本),再跑 node scripts/generate.mjs。
  • 下架:从 registry.json 删除条目(Stage 停止收录并关闭其 stage-fail issue);需要从用户端消失的版本另行撤回。
  • 更换维护者:PR 把已有 id 的 repo 指向新仓库;机器人会标注,须原维护者在 PR 中确认,新版本号仍须更高。
  • 更换 identity:PR 把条目的 id 换成新值,并把旧值记入 "formerIds": ["author@old"]。旧 identity 继续被占用,其已发布分片仍按本条目的 repo / formerRepos 校验镜像;新版本只以新 id 收录,版本线从头开始。客户端按 identity 匹配,已安装用户不会自动迁移,因此应在同一 PR 把旧版本撤回为 deprecated——旧 identity 从市场消失,已安装副本不会被停用。
  • 重跑 PR 检查:手动运行 registry-check workflow 并填 PR 号。

.fxplug 插件包

.fxplug 是插件目录的普通 zip,manifest.json 位于根目录(或唯一一层包裹目录内)。manifest 字段、权限与限制见 https://fluxdown.com/docs/zh/plugins/manifest/。发布前可用 npx fluxdown-plugin validate 本地检查。

校验命令

要求 Node 20+,无依赖:

node --test scripts/index.test.mjs scripts/stage.test.mjs scripts/validator.test.mjs
node scripts/validate.mjs
node scripts/validate.mjs --base /path/to/exact-base-checkout
node scripts/check-mirrors.mjs
node scripts/check-mirrors.mjs --base /path/to/exact-base-checkout  # 同时检查新包的市场准入策略
node scripts/sync-validator.mjs --verify                           # vendor 规则 = 其 npm 发布物
node scripts/readmit.mjs                                           # 用当前规则复核最新上架版本
node scripts/sync-validator.mjs --from <sdk>/dist/manifest.mjs     # 本地试用未发布的 SDK 构建(不要提交)
GITHUB_TOKEN=… node scripts/stage.mjs --root /tmp/index-copy        # 在副本上演练 Stage
GITHUB_TOKEN=… node scripts/check-registry.mjs --head registry.json # 本地跑 PR 检查

前三条离线执行。--base 为已发布精确 commit 的完整 checkout(CI 用 pull_request.base.sha / push.before;Stage 固定为收录前的 HEAD)。缺失基线或 shallow 历史直接失败。已发布分片、历史 dist/ 包、identity、版本、哈希与 sequence 不得删除或改写;允许修复镜像与展示元数据。check-mirrors.mjs 对每个未撤回版本的每个镜像完整 GET(45 秒、10 MiB、≤5 次 HTTPS / 公网重定向);已撤回版本跳过,因为客户端默认不会安装它们。

客户端如何使用

FluxDown 引擎的 plugin::market::MarketClient:拉 index.json(多源 failover)→ 校验 sequence 不回退 → 从首个可用镜像下载 .fxplug → 用 contentHash 钉住比对 → 核对 manifest 的 identity / 版本 / 权限与条目一致 → 复用安装管线(zip-slip / 压缩炸弹防护 + manifest 校验)安装。

About

FluxDown 去中心化插件索引(内容寻址 + 多源分发 + 防回滚)

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages