diff --git a/README.md b/README.md
index dc30f32..6de9918 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,13 @@
#
-i0c.cc is a personal edge redirect playground with a PostgreSQL control plane and an archived Git fallback. It runs the same core through optional edge-platform adapters and provides a WebUI with optional analytics for my own use.
+i0c.cc is a personal edge redirect playground with a database-backed control plane, PostgreSQL enabled by default, and an archived Git fallback. It runs the same core through optional edge-platform adapters and provides a WebUI with optional analytics for my own use.
## Positioning
This repository is maintained for personal use and engineering experimentation. It is not intended to be a hosted URL-shortening service or an enterprise redirect platform.
- Deploy whichever Runtime adapter fits the environment; Cloudflare, Vercel, and Netlify are supported alternatives rather than required replicas.
-- Use PostgreSQL for immediate database-backed saves, immutable history, and rollback; Git remains an archived build-time fallback.
+- Use PostgreSQL by default, or bind Cloudflare D1 on a compatible WebUI host, for immediate saves, immutable history, and rollback; Git remains an archived build-time fallback.
- Use the WebUI and analytics when they help the personal workflow; the roadmap prioritizes clarity and reliability over feature parity with commercial products.
## Projects
@@ -22,7 +22,7 @@ This repository is maintained for personal use and engineering experimentation.
| Plugin Catalog | [packages/plugin-catalog](packages/plugin-catalog) | Optional official presets and host-specific plugin configuration validation. |
| Runtime Host | [packages/runtime-host](packages/runtime-host) | Platform-neutral Runtime deployment and executable-plugin installation contracts. |
| Runtime Build | [packages/runtime-build](packages/runtime-build) | Build-time installation validation, root-config binding, and selected-adapter bundling. |
-| Official plugins | [plugins](plugins) | Git and PostgreSQL data backends, an HTTP Runtime snapshot source, three Runtime adapters, analytics delivery and storage, and bot classification. |
+| Official plugins | [plugins](plugins) | Git, PostgreSQL, and D1 data backends, an HTTP Runtime snapshot source, three Runtime adapters, analytics delivery and storage, and bot classification. |
Executable plugins are selected at build time: Runtime installations live in [i0c.runtime.config.ts](i0c.runtime.config.ts), WebUI server installations in [i0c.webui.config.ts](i0c.webui.config.ts), and client-safe WebUI renderers in [apps/webui/webui.extensions.ts](apps/webui/webui.extensions.ts). The remote `config.json` document configures installed code but never downloads or executes new packages.
@@ -81,13 +81,13 @@ The selected WebUI Repository contains two independently editable documents:
- `config.json` stores non-sensitive instance settings such as the canonical Runtime origin, cache TTLs, robots policy, analytics namespace and collector endpoint, WebUI access policy, and namespaced plugin configuration.
- `redirects.json` stores redirect rules.
-The checked-in PostgreSQL Repository uses optimistic document revisions and exposes an atomic two-document snapshot. An empty database enters a one-time WebUI setup flow that creates both documents atomically. Every save, import, migration, and rollback produces an immutable revision; restoring an older document creates a new head instead of rewriting history. Managers can import and export both JSON documents for backup and migration.
+The PostgreSQL and D1 Repositories implement the same optimistic-revision, atomic-snapshot, immutable-history, import/export, and rollback contract. The checked-in deployment selects PostgreSQL. A D1-capable WebUI host may select D1 and inject its database binding before the Repository is initialized.
GitHub Contents remains available as an archived build-time fallback that preserves commits on a configured branch, but it is not enabled by the checked-in deployment. The WebUI can edit both documents; invalid `config.json` content remains visible to managers so it can be repaired.
-The checked-in HTTP Snapshot Source reads one validated WebUI snapshot so config and rules always come from the same Repository revision. It uses ETags, bounded retries and timeouts, and the last valid memory or platform cache. GitHub Raw remains available when Git-backed data is selected. Runtime deployments never receive PostgreSQL credentials.
+The checked-in HTTP Snapshot Source reads one validated WebUI snapshot so config and rules always come from the same Repository revision. It uses ETags, bounded retries and timeouts, and the last valid memory or platform cache. GitHub Raw remains available when Git-backed data is selected. Runtime deployments never receive database credentials or bindings.
-[packages/config](packages/config) owns schemas, validation, safe defaults, and the build-time Repository and Source selection. Bootstrap changes such as GitHub paths, PostgreSQL connection policy, HTTP snapshot URL, or GitHub OAuth scope require rebuilding. PostgreSQL Repository migrations are deliberate external writes and never run during a build or application startup.
+[packages/config](packages/config) owns schemas, validation, safe defaults, and the build-time Repository and Source selection. Bootstrap changes such as GitHub paths, database provider or connection policy, HTTP snapshot URL, or GitHub OAuth scope require rebuilding. Repository migrations are deliberate external writes and never run during a build or application startup.
The former non-sensitive environment variables are not read as overrides or fallbacks. Existing values left in a provider dashboard are ignored and can be removed after the new deployment is verified. Secrets and deployment-specific bindings remain in each application's environment example.
@@ -143,7 +143,7 @@ pnpm check
## Data documents
-The two Repository implementations use the same document schemas:
+All Repository implementations use the same document schemas:
```text
packages/config/config.schema.json
diff --git a/README.zh-CN.md b/README.zh-CN.md
index a0898d8..af2a1be 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,13 +1,13 @@
# i0c.cc
-i0c.cc 是一个以 PostgreSQL 为控制面、保留归档 Git 回退方案的个人边缘重定向实验项目。同一套核心可以通过不同边缘平台适配器运行,并提供自用的 WebUI 与可选统计功能。
+i0c.cc 是一个以数据库为控制面、默认启用 PostgreSQL、并保留归档 Git 回退方案的个人边缘重定向实验项目。同一套核心可以通过不同边缘平台适配器运行,并提供自用的 WebUI 与可选统计功能。
## 项目定位
这个仓库面向个人使用和工程实验,不准备成为托管短链接服务或企业级重定向平台。
- 按部署环境选择所需的 Runtime 适配器;Cloudflare、Vercel 与 Netlify 是可选方案,不要求同时运行。
-- 使用 PostgreSQL 实现数据库即时保存、不可变历史与回滚;Git 只作为归档的构建期回退方案保留。
+- 默认使用 PostgreSQL;兼容的 WebUI 宿主也可绑定 Cloudflare D1,实现即时保存、不可变历史与回滚;Git 只作为归档的构建期回退方案保留。
- WebUI 与统计功能服务于个人工作流;后续路线优先保证清晰和可靠,不追求与商业产品功能对齐。
## 项目
@@ -22,7 +22,7 @@ i0c.cc 是一个以 PostgreSQL 为控制面、保留归档 Git 回退方案的
| 插件目录 | [packages/plugin-catalog](packages/plugin-catalog) | 可选的官方预设与按宿主执行的插件配置校验。 |
| Runtime 宿主 | [packages/runtime-host](packages/runtime-host) | 平台无关的 Runtime 部署与可执行插件安装契约。 |
| Runtime 构建 | [packages/runtime-build](packages/runtime-build) | 构建期安装校验、根配置绑定与所选适配器 Bundle 生成。 |
-| 官方插件 | [plugins](plugins) | Git 与 PostgreSQL 数据后端、HTTP Runtime 快照源、三个 Runtime 适配器、统计投递与存储,以及机器人分类。 |
+| 官方插件 | [plugins](plugins) | Git、PostgreSQL 与 D1 数据后端、HTTP Runtime 快照源、三个 Runtime 适配器、统计投递与存储,以及机器人分类。 |
可执行插件在构建期选择:Runtime 安装位于 [i0c.runtime.config.ts](i0c.runtime.config.ts),WebUI 服务端安装位于 [i0c.webui.config.ts](i0c.webui.config.ts),客户端安全的 WebUI Renderer 位于 [apps/webui/webui.extensions.ts](apps/webui/webui.extensions.ts)。远程 `config.json` 文档只能配置已安装代码,不会下载或执行新包。
@@ -81,13 +81,13 @@ Vercel 需要保持开启 **Include source files outside of the Root Directory i
- `config.json` 存放非敏感实例配置,包括 Runtime 规范域名、缓存时间、robots 策略、统计命名空间与收集端地址、WebUI 访问策略,以及按命名空间隔离的插件配置。
- `redirects.json` 存放重定向规则。
-仓库当前启用的 PostgreSQL Repository 使用乐观文档版本,并提供两份文档的原子快照。数据库为空时,WebUI 会进入一次性初始化流程,并原子创建两份文档。每次保存、导入、迁移和回滚都会产生不可变版本;恢复旧文档会创建新的活动版本,而不是改写历史。管理者可以导入和导出两份 JSON,用于备份和迁移。
+PostgreSQL 与 D1 Repository 实现同一套乐观版本、原子快照、不可变历史、导入导出和回滚契约。仓库当前部署选择 PostgreSQL;支持 D1 的 WebUI 宿主可选择 D1,并在 Repository 初始化前注入数据库 binding。
GitHub Contents 仍保留为归档的构建期回退方案,并可在指定分支保留 commit,但仓库当前部署不会启用它。WebUI 可以编辑两份文档;即使 `config.json` 写坏,管理员仍能看到原文并修复。
-仓库当前启用的 HTTP Snapshot Source 从 WebUI 读取一份经过校验的快照,确保配置和规则来自同一个 Repository revision;它使用 ETag、有限重试与超时,并保留最后一次有效的内存或平台缓存。选择 Git 数据后端时仍可使用 GitHub Raw。Runtime 部署不会获得 PostgreSQL 凭据。
+仓库当前启用的 HTTP Snapshot Source 从 WebUI 读取一份经过校验的快照,确保配置和规则来自同一个 Repository revision;它使用 ETag、有限重试与超时,并保留最后一次有效的内存或平台缓存。选择 Git 数据后端时仍可使用 GitHub Raw。Runtime 部署不会获得数据库凭据或 binding。
-[packages/config](packages/config) 负责 schema、校验、安全默认值,以及构建期 Repository 与 Source 选择。修改 GitHub 路径、PostgreSQL 连接策略、HTTP 快照地址或 GitHub OAuth scope 等启动配置后仍需重新构建。PostgreSQL Repository 迁移属于明确的外部写入,构建与应用启动都不会自动执行。
+[packages/config](packages/config) 负责 schema、校验、安全默认值,以及构建期 Repository 与 Source 选择。修改 GitHub 路径、数据库类型或连接策略、HTTP 快照地址或 GitHub OAuth scope 等启动配置后仍需重新构建。Repository 迁移属于明确的外部写入,构建与应用启动都不会自动执行。
原有非敏感环境变量不再作为覆盖值或回退值读取。平台后台遗留的旧值会被忽略,确认新部署正常后即可删除。密钥和与部署绑定的值继续保留在各应用的环境变量示例中。
@@ -143,7 +143,7 @@ pnpm check
## 数据文档
-两种 Repository 实现共用下面的文档 schema:
+所有 Repository 实现共用下面的文档 schema:
```text
packages/config/config.schema.json
diff --git a/apps/webui/README.md b/apps/webui/README.md
index dbd9141..d4148ac 100644
--- a/apps/webui/README.md
+++ b/apps/webui/README.md
@@ -62,9 +62,11 @@ This project provides two rule-editing modes and a separate settings surface:
## Data repository
-The checked-in deployment selects PostgreSQL through [../../packages/config/src/defaults.ts](../../packages/config/src/defaults.ts) and uses `DATABASE_URL`.
+The checked-in deployment selects PostgreSQL through [../../packages/config/src/defaults.ts](../../packages/config/src/defaults.ts) and uses `DATABASE_URL`. A D1-capable WebUI host may select `provider: "d1"` and inject a `D1Database` binding through `configureAppDataRepositoryBinding` before the Repository is first used.
-First-run setup creates both documents in one transaction and refuses partially initialized databases. Every save creates an immutable revision. Import validates both JSON files and replaces them atomically, while restore copies an old document into a new head revision instead of rewriting history. Managers can export, import, inspect, and restore revisions from **Settings → Data and history**.
+PostgreSQL and D1 are held to the same shared behavior contract. First-run setup creates both documents atomically and refuses partially initialized databases. Every save creates an immutable revision. Import validates both JSON files and replaces them atomically, while restore copies an old document into a new head revision instead of rewriting history. Managers can export, import, inspect, and restore revisions from **Settings → Data and history**.
+
+D1 owns independent migrations in [../../plugins/repository/d1/migrations](../../plugins/repository/d1/migrations). Apply them deliberately to the bound database before opening setup. The current Vercel deployment remains on PostgreSQL because Vercel does not provide a native D1 binding.
The `seed` command remains available for controlled non-interactive migrations, but it is not part of the normal deployment flow:
@@ -72,7 +74,7 @@ The `seed` command remains available for controlled non-interactive migrations,
pnpm --filter @i0c/plugin-data-repository-postgres seed -- --config --redirects
```
-For database-backed documents, also select the HTTP Runtime Source in the same bootstrap configuration and point it at `https:///api/runtime/snapshot`. The public endpoint returns one validated config-and-rules revision with an ETag; it contains no Secret values. Edge Runtime deployments fetch this endpoint and never receive the PostgreSQL connection string.
+For database-backed documents, also select the HTTP Runtime Source in the same bootstrap configuration and point it at `https:///api/runtime/snapshot`. The public endpoint returns one validated config-and-rules revision with an ETag; it contains no Secret values. Edge Runtime deployments fetch this endpoint and never receive the database connection or binding.
GitHub Contents and GitHub Raw remain in the workspace as archived build-time alternatives. Re-enabling them requires deliberately changing the bootstrap Repository and Runtime Source selections, restoring the required OAuth Repository scope, and rebuilding both applications. They are not part of the default first-run flow.
@@ -140,10 +142,10 @@ The WebUI does not read former non-sensitive environment variables as overrides
- Versioned authenticated, numeric-ID allowlist, or GitHub-wide read-only access with configured managers and optional blocked users.
- Visual editing of `redirects.json`: group tree management + rule form editing.
-- Rules JSON editor: line numbers, current line highlighting, JSON syntax validation (error prompts for formatting issues).
+- GitHub Repository-only rules source override and JSON editor with line highlighting and syntax validation.
- Visual, validated `config.json` settings with a raw recovery editor only when the current document cannot be represented safely.
- First-run database initialization without hand-written JSON or a seed command.
-- Immutable document history, non-destructive rollback, and atomic JSON backup import/export.
+- Immutable document history with Git-style line diffs, non-destructive rollback, and atomic JSON backup import/export.
- Authenticated plugin status reporting for installed manifests, configuration state, capabilities, missing bindings, and selected-Store health.
- Form behavior aligned with the schema (specification source: [https://raw.githubusercontent.com/Revaea/i0c.cc/main/packages/config/redirects.schema.json](https://raw.githubusercontent.com/Revaea/i0c.cc/main/packages/config/redirects.schema.json)).
- Supports undo/redo for quick editing rollback.
diff --git a/apps/webui/README.zh-CN.md b/apps/webui/README.zh-CN.md
index 7b9491f..f62455e 100644
--- a/apps/webui/README.zh-CN.md
+++ b/apps/webui/README.zh-CN.md
@@ -6,10 +6,10 @@ i0c.cc WebUI 是一个基于 Next.js 16 的管理面板,用于通过 GitHub OA
服务端 Data Repository 与 Analytics Store 工厂通过 [../../i0c.webui.config.ts](../../i0c.webui.config.ts) 在构建期安装。客户端安全的 UI Renderer 使用 [webui.extensions.ts](webui.extensions.ts),确保它们留在客户端 Bundle。workspace fixture 会覆盖两条安装链,无需在 WebUI 宿主源码中增加工厂映射;生产 Renderer 清单目前有意保持为空。
-该项目提供两种规则编辑方式和独立的设置界面:
+该项目默认提供可视化规则编辑和独立的设置界面:
- 可视化规则编辑(分组树 + 表单)
-- 规则 JSON 编辑(右侧面板,可直接编辑 `redirects.json`)
+- 重新启用 GitHub Repository 时提供 Git 专属的规则来源切换与 JSON 编辑
- 位于侧边栏底部的可视化实例设置(`config.json`,使用共享契约校验)
- 数据库备份导入导出与不可变版本历史
@@ -60,9 +60,11 @@ i0c.cc WebUI 是一个基于 Next.js 16 的管理面板,用于通过 GitHub OA
## Data Repository
-仓库当前通过 [../../packages/config/src/defaults.ts](../../packages/config/src/defaults.ts) 选择 PostgreSQL,并使用 `DATABASE_URL`。
+仓库当前通过 [../../packages/config/src/defaults.ts](../../packages/config/src/defaults.ts) 选择 PostgreSQL,并使用 `DATABASE_URL`。支持 D1 的 WebUI 宿主可以选择 `provider: "d1"`,并在首次使用 Repository 前通过 `configureAppDataRepositoryBinding` 注入 `D1Database` binding。
-首次初始化会在一个事务中创建两份文档,并拒绝只存在其中一份文档的半初始化数据库。每次保存都会创建不可变版本;导入会先校验两份 JSON,再原子替换;恢复则把旧内容复制为新的活动版本,不会改写历史。管理者可以在 **设置 → 数据与历史** 中导出、导入、查看和恢复版本。
+PostgreSQL 与 D1 由同一套共享行为契约约束。首次初始化会原子创建两份文档,并拒绝只存在其中一份文档的半初始化数据库。每次保存都会创建不可变版本;导入会先校验两份 JSON,再原子替换;恢复则把旧内容复制为新的活动版本,不会改写历史。管理者可以在 **设置 → 数据与历史** 中导出、导入、查看和恢复版本。
+
+D1 使用 [../../plugins/repository/d1/migrations](../../plugins/repository/d1/migrations) 中的独立迁移。打开初始化页面前,需要明确将这些迁移应用到绑定的数据库。当前 Vercel 部署仍使用 PostgreSQL,因为 Vercel 不提供原生 D1 binding。
`seed` 命令继续用于受控的非交互迁移,但不再属于正常部署流程:
@@ -70,7 +72,7 @@ i0c.cc WebUI 是一个基于 Next.js 16 的管理面板,用于通过 GitHub OA
pnpm --filter @i0c/plugin-data-repository-postgres seed -- --config --redirects
```
-使用数据库文档时,还要在同一份启动配置中选择 HTTP Runtime Source,并指向 `https:///api/runtime/snapshot`。这个公开端点会返回一份带 ETag、经过校验的配置与规则 revision,且不包含 Secret 值。边缘 Runtime 只读取该端点,不会获得 PostgreSQL 连接串。
+使用数据库文档时,还要在同一份启动配置中选择 HTTP Runtime Source,并指向 `https:///api/runtime/snapshot`。这个公开端点会返回一份带 ETag、经过校验的配置与规则 revision,且不包含 Secret 值。边缘 Runtime 只读取该端点,不会获得数据库连接信息或 binding。
GitHub Contents 与 GitHub Raw 继续保留在 workspace 中,作为归档的构建期替代方案。重新启用时,需要主动修改启动 Repository 与 Runtime Source 选择、恢复对应的 OAuth Repository scope,并重新构建两个应用;它们不属于默认首次初始化流程。
@@ -134,10 +136,10 @@ WebUI 不会把原有非敏感环境变量作为覆盖值或回退值读取。Ve
- 通过版本化配置选择任意已登录用户、数字用户 ID 白名单或带指定管理员与可选黑名单的 GitHub 全员只读模式。
- 可视化编辑 `redirects.json`:分组树管理 + 规则表单编辑。
-- 规则 JSON 编辑器:行号、当前行高亮、JSON 语法校验(格式错误提示)。
+- GitHub Repository 专属的规则来源切换和 JSON 编辑器,支持当前行高亮与语法校验。
- 可视化并校验 `config.json`;只有当前文档无法安全转换为表单时,才显示原始内容恢复编辑器。
- 数据库首次初始化,无需手写 JSON 或执行 seed。
-- 不可变文档历史、非破坏性回滚,以及原子 JSON 备份导入导出。
+- 带 Git 风格行差异的不可变文档历史、非破坏性回滚,以及原子 JSON 备份导入导出。
- 通过认证后查看已安装 Manifest、配置状态、能力、缺失绑定和所选 Store 健康状态。
- 表单行为对齐 Schema(规范来源:[https://raw.githubusercontent.com/Revaea/i0c.cc/main/packages/config/redirects.schema.json](https://raw.githubusercontent.com/Revaea/i0c.cc/main/packages/config/redirects.schema.json))。
- 支持撤销/重做,便于快速回退编辑。
diff --git a/apps/webui/messages/en/redirects.json b/apps/webui/messages/en/redirects.json
index f2dc0d4..25f6aa1 100644
--- a/apps/webui/messages/en/redirects.json
+++ b/apps/webui/messages/en/redirects.json
@@ -6,7 +6,7 @@
"rootTitle": "Root (rules written directly under slots)",
"empty": "No groups yet",
"readOnlyTitle": "Public read-only view",
- "readOnlyDescription": "Rules and settings can be inspected, but editing and custom rules JSON sources are disabled.",
+ "readOnlyDescription": "Rules and settings can be inspected, but only managers can save changes.",
"cannotLoad": "Failed to load groups",
"group": "Group",
"selectHint": "Select a group on the right",
@@ -189,7 +189,7 @@
},
"dataManagement": {
"title": "Data management",
- "description": "Back up, import, inspect, and restore the instance configuration and redirect rules stored in PostgreSQL.",
+ "description": "Back up, import, inspect, and restore the instance configuration and redirect rules stored in the selected data repository.",
"managerOnly": "Only managers can export, import, or inspect stored revisions.",
"unsavedWarning": "Save or discard the current rule and settings changes before importing or restoring data.",
"cancel": "Cancel",
@@ -218,7 +218,7 @@
"redirects": "redirects.json",
"chooseFile": "Choose file",
"noFile": "No file selected",
- "action": "Import both files",
+ "action": "Confirm import",
"confirmTitle": "Import this backup?",
"confirmDescription": "The current configuration and rules will be preserved in history, then both uploaded files will become the new active revision.",
"confirmAction": "Import backup"
@@ -231,12 +231,23 @@
"current": "Current",
"actor": "GitHub user {actor}",
"checksum": "Checksum {checksum}",
- "view": "View JSON",
+ "view": "View changes",
"restore": "Restore",
"confirmTitle": "Restore this revision?",
"confirmDescription": "Revision {revision} will be copied into a new active revision. Existing history will not be changed.",
"confirmAction": "Restore revision",
- "previewTitle": "Revision {revision}"
+ "previewTitle": "Revision {revision}",
+ "previewLoading": "Loading revision changes",
+ "previewError": "Could not load this revision.",
+ "views": {
+ "changes": "Changes",
+ "json": "Full JSON"
+ },
+ "comparedWith": "Compared with revision {revision}",
+ "initialRevision": "Initial revision",
+ "noChanges": "No line changes were found.",
+ "diffLabel": "Revision line changes",
+ "omittedLines": "{count, plural, one {# unchanged line hidden} other {# unchanged lines hidden}}"
},
"errors": {
"fileTooLarge": "Each JSON file must be no larger than 1 MB.",
diff --git a/apps/webui/messages/en/shared.json b/apps/webui/messages/en/shared.json
index a70baba..ce81125 100644
--- a/apps/webui/messages/en/shared.json
+++ b/apps/webui/messages/en/shared.json
@@ -13,7 +13,7 @@
},
"setup": {
"title": "Initialize this deployment",
- "description": "Create the first instance configuration and an empty rule set in PostgreSQL. Your signed-in GitHub account becomes the first manager.",
+ "description": "Create the first instance configuration and an empty rule set in the selected data repository. Your signed-in GitHub account becomes the first manager.",
"secret": "Instance secret",
"secretHelp": "Enter the shared I0C_SECRET configured in this WebUI and every Runtime deployment.",
"webUiOrigin": "WebUI origin",
@@ -32,7 +32,8 @@
"initializing": "Initializing...",
"unknownError": "Initialization failed. Check the values and try again.",
"migrationRequired": "Database migration required",
- "migrationRequiredHelp": "Apply the PostgreSQL data repository migrations before opening setup again.",
+ "migrationRequiredHelp": "Apply the selected data repository migrations before opening setup again.",
+ "migrationRequiredD1Detail": "Apply plugins/repository/d1/migrations/*.sql to the bound D1 database.",
"partial": "Partial initialization detected",
"partialHelp": "Only one required data document exists. Setup will not overwrite it; repair or clear the partial state explicitly.",
"unsupported": "Setup is unavailable",
diff --git a/apps/webui/messages/zh-CN/redirects.json b/apps/webui/messages/zh-CN/redirects.json
index 17c6232..35b4771 100644
--- a/apps/webui/messages/zh-CN/redirects.json
+++ b/apps/webui/messages/zh-CN/redirects.json
@@ -6,7 +6,7 @@
"rootTitle": "根目录(直接写在 slots 下的规则)",
"empty": "暂无分组",
"readOnlyTitle": "公开只读视图",
- "readOnlyDescription": "可以查看规则和设置,但不能编辑或加载自定义规则 JSON 地址。",
+ "readOnlyDescription": "可以查看规则和设置,但只有管理员可以保存更改。",
"cannotLoad": "无法加载分组",
"group": "分组",
"selectHint": "从右侧选择分组",
@@ -189,7 +189,7 @@
},
"dataManagement": {
"title": "数据管理",
- "description": "备份、导入、查看和恢复存储在 PostgreSQL 中的实例配置与重定向规则。",
+ "description": "备份、导入、查看和恢复存储在当前数据 Repository 中的实例配置与重定向规则。",
"managerOnly": "只有管理者可以导出、导入或查看存储的历史版本。",
"unsavedWarning": "导入或恢复数据前,请先保存或放弃当前的规则和设置改动。",
"cancel": "取消",
@@ -218,7 +218,7 @@
"redirects": "redirects.json",
"chooseFile": "选择文件",
"noFile": "尚未选择文件",
- "action": "导入两份文件",
+ "action": "确认导入",
"confirmTitle": "导入此备份?",
"confirmDescription": "当前配置和规则会保留在历史记录中,随后两份上传文件将成为新的活动版本。",
"confirmAction": "导入备份"
@@ -231,12 +231,23 @@
"current": "当前",
"actor": "GitHub 用户 {actor}",
"checksum": "校验和 {checksum}",
- "view": "查看 JSON",
+ "view": "查看改动",
"restore": "恢复",
"confirmTitle": "恢复此版本?",
"confirmDescription": "版本 {revision} 会被复制为新的活动版本,现有历史记录不会被修改。",
"confirmAction": "恢复版本",
- "previewTitle": "版本 {revision}"
+ "previewTitle": "版本 {revision}",
+ "previewLoading": "正在加载版本改动",
+ "previewError": "无法加载此版本。",
+ "views": {
+ "changes": "改动",
+ "json": "完整 JSON"
+ },
+ "comparedWith": "与版本 {revision} 对比",
+ "initialRevision": "初始版本",
+ "noChanges": "未发现行内容变化。",
+ "diffLabel": "版本行内容变化",
+ "omittedLines": "已隐藏 {count} 行未改动内容"
},
"errors": {
"fileTooLarge": "每份 JSON 文件不能超过 1 MB。",
diff --git a/apps/webui/messages/zh-CN/shared.json b/apps/webui/messages/zh-CN/shared.json
index 26b037c..6272ae4 100644
--- a/apps/webui/messages/zh-CN/shared.json
+++ b/apps/webui/messages/zh-CN/shared.json
@@ -13,7 +13,7 @@
},
"setup": {
"title": "初始化此部署",
- "description": "在 PostgreSQL 中创建第一份实例配置和空规则集。当前登录的 GitHub 账号将成为首位管理员。",
+ "description": "在当前选择的数据 Repository 中创建第一份实例配置和空规则集。当前登录的 GitHub 账号将成为首位管理员。",
"secret": "实例密钥",
"secretHelp": "输入 WebUI 与所有 Runtime 部署共用的 I0C_SECRET。",
"webUiOrigin": "WebUI 地址",
@@ -32,7 +32,8 @@
"initializing": "正在初始化……",
"unknownError": "初始化失败,请检查填写内容后重试。",
"migrationRequired": "需要执行数据库迁移",
- "migrationRequiredHelp": "请先应用 PostgreSQL 数据 Repository 迁移,然后重新打开初始化页面。",
+ "migrationRequiredHelp": "请先应用当前数据 Repository 的迁移,然后重新打开初始化页面。",
+ "migrationRequiredD1Detail": "请将 plugins/repository/d1/migrations/*.sql 应用到绑定的 D1 数据库。",
"partial": "检测到不完整初始化",
"partialHelp": "当前只存在一份必要数据文档。初始化不会覆盖它,请明确修复或清理不完整状态。",
"unsupported": "无法进行初始化",
diff --git a/apps/webui/package.json b/apps/webui/package.json
index 8d00b21..3c2c0ea 100644
--- a/apps/webui/package.json
+++ b/apps/webui/package.json
@@ -23,6 +23,7 @@
"@i0c/analytics-domain": "workspace:*",
"@i0c/config": "workspace:*",
"@i0c/plugin-catalog": "workspace:*",
+ "@i0c/plugin-data-repository-d1": "workspace:*",
"@i0c/plugin-data-repository-postgres": "workspace:*",
"@i0c/plugin-github-data": "workspace:*",
"@i0c/plugin-api": "workspace:*",
diff --git a/apps/webui/src/app/[locale]/setup/page.tsx b/apps/webui/src/app/[locale]/setup/page.tsx
index ec8b7d6..9a2bf8d 100644
--- a/apps/webui/src/app/[locale]/setup/page.tsx
+++ b/apps/webui/src/app/[locale]/setup/page.tsx
@@ -3,6 +3,8 @@ import { getTranslations } from "next-intl/server";
import { headers } from "next/headers";
import { redirect } from "next/navigation";
+import { bootstrapConfig } from "@i0c/config";
+
import { authOptions } from "@/auth/config";
import { SetupForm } from "@/components/setup/setup-form";
import { LanguageSwitcher } from "@/components/ui/controls/language-switcher";
@@ -30,7 +32,11 @@ export default async function SetupPage({ params }: SetupPageProps) {
);
}
diff --git a/apps/webui/src/components/editor/right-panel.tsx b/apps/webui/src/components/editor/right-panel.tsx
index c721c89..b115d79 100644
--- a/apps/webui/src/components/editor/right-panel.tsx
+++ b/apps/webui/src/components/editor/right-panel.tsx
@@ -22,6 +22,9 @@ export type RightPanelProps = {
onJsonDraftChange: (value: string) => void;
jsonError: string | null;
isReadOnly: boolean;
+ showSaveAction: boolean;
+ supportsJsonEditor: boolean;
+ supportsSourceOverride: boolean;
onLoadSourceUrl: (url: string) => Promise;
onUndo: () => void;
rulesContent: ReactNode;
@@ -42,6 +45,9 @@ export function RightPanel({
onJsonDraftChange,
jsonError,
isReadOnly,
+ showSaveAction,
+ supportsJsonEditor,
+ supportsSourceOverride,
onLoadSourceUrl,
onUndo,
rulesContent,
@@ -58,7 +64,7 @@ export function RightPanel({