mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 13:00:39 +00:00
feat: update sync workflow and README for KV storage support
This commit is contained in:
@@ -4,6 +4,9 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "0 3 * * *"
|
- cron: "0 3 * * *"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -17,12 +20,45 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- run: |
|
- name: Configure git
|
||||||
git remote add upstream https://github.com/shuaiplus/nodewarden.git || true
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
- name: Sync main from upstream
|
||||||
|
run: |
|
||||||
|
git remote add upstream https://github.com/shuaiplus/NodeWarden.git || true
|
||||||
git fetch upstream
|
git fetch upstream
|
||||||
|
|
||||||
# 强制让当前分支完全等于 upstream
|
git checkout main
|
||||||
git reset --hard upstream/main
|
git reset --hard upstream/main
|
||||||
|
|
||||||
# 强制推送
|
|
||||||
git push origin main --force
|
git push origin main --force
|
||||||
|
|
||||||
|
- name: Rebuild kv from main
|
||||||
|
run: |
|
||||||
|
git fetch origin main kv || true
|
||||||
|
git checkout -B kv origin/main
|
||||||
|
|
||||||
|
python - <<'PY'
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
path = Path("wrangler.toml")
|
||||||
|
text = path.read_text(encoding="utf-8")
|
||||||
|
old = """[[r2_buckets]]
|
||||||
|
binding = "ATTACHMENTS"
|
||||||
|
bucket_name = "nodewarden-attachments"
|
||||||
|
"""
|
||||||
|
new = """[[kv_namespaces]]
|
||||||
|
binding = "ATTACHMENTS_KV"
|
||||||
|
id = "REPLACE_WITH_KV_NAMESPACE_ID"
|
||||||
|
"""
|
||||||
|
|
||||||
|
if old not in text:
|
||||||
|
raise SystemExit("Expected R2 block not found in wrangler.toml")
|
||||||
|
|
||||||
|
path.write_text(text.replace(old, new, 1), encoding="utf-8")
|
||||||
|
PY
|
||||||
|
|
||||||
|
git add wrangler.toml
|
||||||
|
git commit -m "chore(kv): sync from main" || echo "No changes"
|
||||||
|
git push origin kv --force
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
|
|
||||||
[](https://workers.cloudflare.com/)
|
[](https://workers.cloudflare.com/)
|
||||||
[](./LICENSE)
|
[](./LICENSE)
|
||||||
[-Cloudflare%20Workers-F38020?logo=cloudflare&logoColor=white)](https://deploy.workers.cloudflare.com/?url=https://github.com/shuaiplus/NodeWarden)
|
|
||||||
[-Cloudflare%20Workers-2ea44f?logo=cloudflare&logoColor=white)](./README_EN.md#kv-mode-no-credit-card)
|
|
||||||
[](https://github.com/shuaiplus/NodeWarden/releases/latest)
|
[](https://github.com/shuaiplus/NodeWarden/releases/latest)
|
||||||
[](https://github.com/shuaiplus/NodeWarden/actions/workflows/sync-upstream.yml)
|
[](https://github.com/shuaiplus/NodeWarden/actions/workflows/sync-upstream.yml)
|
||||||
|
|
||||||
@@ -30,11 +28,11 @@ English:[`README_EN.md`](./README_EN.md)
|
|||||||
| Web Vault(登录/笔记/卡片/身份) | ✅ | ✅ | 网页端密码库管理页面 |
|
| Web Vault(登录/笔记/卡片/身份) | ✅ | ✅ | 网页端密码库管理页面 |
|
||||||
| 文件夹 / 收藏 | ✅ | ✅ | 常用管理能力可用 |
|
| 文件夹 / 收藏 | ✅ | ✅ | 常用管理能力可用 |
|
||||||
| 全量同步 `/api/sync` | ✅ | ✅ | 已做兼容与性能优化 |
|
| 全量同步 `/api/sync` | ✅ | ✅ | 已做兼容与性能优化 |
|
||||||
| 附件上传/下载 | ✅ | ✅ | 基于 Cloudflare R2(或可选 KV 模式) |
|
| 附件上传/下载 | ✅ | ✅ | Cloudflare R2 和 KV 二选一 |
|
||||||
| 导入导出功能 | ✅ | ✅ | 完整实现,含 Bitwarden 密码库+附件 ZIP 导入 |
|
| 导入导出功能 | ✅ | ✅ | 完整实现,含 Bitwarden 密码库+附件 ZIP 导入 |
|
||||||
| 网站图标代理 | ✅ | ✅ | 通过 `/icons/{hostname}/icon.png` |
|
| 网站图标代理 | ✅ | ✅ | 通过 `/icons/{hostname}/icon.png` |
|
||||||
| passkey、TOTP字段 | ❌ | ✅ |官方需要会员,我们的不需要 |
|
| passkey、TOTP字段 | ✅ | ✅ |完全支持,无需高级版 |
|
||||||
| Send | ✅ | ✅ | 已支持文本 Send 与文件 Send |
|
| Send | ✅ | ✅ | Cloudflare R2 和 KV 二选一 |
|
||||||
| 多用户 | ✅ | ✅ | 完整的用户管理,邀请机制 |
|
| 多用户 | ✅ | ✅ | 完整的用户管理,邀请机制 |
|
||||||
| 组织/集合/成员权限 | ✅ | ❌ | 没必要实现 |
|
| 组织/集合/成员权限 | ✅ | ❌ | 没必要实现 |
|
||||||
| 登录 2FA(TOTP/WebAuthn/Duo/Email) | ✅ | ⚠️ 部分支持 | 仅支持用户级 TOTP |
|
| 登录 2FA(TOTP/WebAuthn/Duo/Email) | ✅ | ⚠️ 部分支持 | 仅支持用户级 TOTP |
|
||||||
@@ -59,18 +57,18 @@ English:[`README_EN.md`](./README_EN.md)
|
|||||||
**部署步骤:**
|
**部署步骤:**
|
||||||
|
|
||||||
1. 首先Fork本仓库,命名为**NodeWarden**
|
1. 首先Fork本仓库,命名为**NodeWarden**
|
||||||
2. 点击下面的一键部署按钮,修改项目名称为**NodeWarden2**,修改**JWT_SECRET**成32为随机字符串;
|
2. 根据对储存库的需求,**二选一**点击下面的按钮,修改项目名称为**NodeWarden2**,修改**JWT_SECRET**成32为随机字符串;
|
||||||
**若无信用卡,储存库可选KV模式**,一键部署页面里部署命令改成:npm run deploy:kv
|
- **R2**:需绑定银行卡;**单个附件/Send上限 100MB**(代码限制,可自行修改);**总量 10GB 免费**
|
||||||
|
|
||||||
[](https://deploy.workers.cloudflare.com/?url=https://github.com/shuaiplus/nodewarden)
|
[-Cloudflare%20Workers-F38020?logo=cloudflare&logoColor=white)](https://deploy.workers.cloudflare.com/?url=https://github.com/shuaiplus/NodeWarden)
|
||||||
|
|
||||||
|
- **KV**:无需绑卡;**单个附件/Send 文件上限 25 MiB**(cloudflare限制,不可修改);**总量 1GB 免费**
|
||||||
|
|
||||||
|
[-Cloudflare%20Workers-2ea44f?logo=cloudflare&logoColor=white)](https://deploy.workers.cloudflare.com/?url=https://github.com/shuaiplus/NodeWarden/tree/kv)
|
||||||
3. 部署完成后,同一页面打开workers设置,将**Git存储库**断开连接
|
3. 部署完成后,同一页面打开workers设置,将**Git存储库**断开连接
|
||||||
4. 同一位置,**Git存储库**链接至第一步Fork的仓库
|
4. 同一位置,**Git存储库**链接至第一步Fork的仓库(仓库名NodeWarden),**R2选择main分支,KV选择kv分支**(必须选对!!!)
|
||||||
|
5. 仓库**NodeWarden2**可以删除
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> R2 vs KV
|
|
||||||
>- R2:需绑定银行卡;**单个附件/Send上限 100MB**(代码限制,可自行修改);**总量 10GB 免费**
|
|
||||||
>- KV:无需绑卡;**单个附件/Send 文件上限 25 MiB**(cloudflare限制,不可修改);**总量 1GB 免费**
|
|
||||||
|
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
@@ -78,6 +76,7 @@ English:[`README_EN.md`](./README_EN.md)
|
|||||||
>- 手动:Github打开你Fork的私人仓库,看到顶部同步提示时,点击 “Sync fork”。
|
>- 手动:Github打开你Fork的私人仓库,看到顶部同步提示时,点击 “Sync fork”。
|
||||||
>- 自动:进入你的 Fork 仓库 → Actions,点击 “I understand my workflows, go ahead and enable them”,每天凌晨三点自动同步至上游
|
>- 自动:进入你的 Fork 仓库 → Actions,点击 “I understand my workflows, go ahead and enable them”,每天凌晨三点自动同步至上游
|
||||||
|
|
||||||
|
|
||||||
### CLI 部署
|
### CLI 部署
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
|
|||||||
@@ -6,12 +6,10 @@ assets = { directory = "./dist", not_found_handling = "single-page-application",
|
|||||||
[build]
|
[build]
|
||||||
command = "npm run build"
|
command = "npm run build"
|
||||||
|
|
||||||
# D1 Database for storing vault data
|
|
||||||
[[d1_databases]]
|
[[d1_databases]]
|
||||||
binding = "DB"
|
binding = "DB"
|
||||||
database_name = "nodewarden-db"
|
database_name = "nodewarden-db"
|
||||||
|
|
||||||
# R2 Bucket for storing attachments
|
|
||||||
[[r2_buckets]]
|
[[r2_buckets]]
|
||||||
binding = "ATTACHMENTS"
|
binding = "ATTACHMENTS"
|
||||||
bucket_name = "nodewarden-attachments"
|
bucket_name = "nodewarden-attachments"
|
||||||
|
|||||||
Reference in New Issue
Block a user