From 1dfa96611a8c38928a963c2e7c76675aedf451dc Mon Sep 17 00:00:00 2001 From: shuaiplus <2327005759@qq.com> Date: Mon, 23 Feb 2026 20:01:55 +0800 Subject: [PATCH] feat: add CLI deployment instructions --- README.md | 30 +++++++++++++++++++++--------- README_EN.md | 29 +++++++++++++++++++++-------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 5354c61..9b03f1e 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,27 @@ English:[`README_EN.md`](./README_EN.md) 2. [![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/shuaiplus/nodewarden) 3. 打开部署后生成的链接,并根据网页提示完成后续操作。 +### CLI 部署 + +```powershell +# 先把仓库拉到本地 +git clone https://github.com/shuaiplus/NodeWarden.git +cd NodeWarden + +# 安装依赖 +npm install + +# Cloudflare CLI 登录 +npx wrangler login + +# 创建云资源(D1 + R2) +npx wrangler d1 create nodewarden-db +npx wrangler r2 bucket create nodewarden-attachments + +# 部署 +npx wrangler deploy +``` + --- ## 本地开发 @@ -64,16 +85,7 @@ English:[`README_EN.md`](./README_EN.md) npm install npm run dev ``` - -## 可选:登录 TOTP(2FA) - -- 在 Workers 的 Variables and Secrets 里新增 Secret:`TOTP_SECRET`(Base32)。 -- 配置了 `TOTP_SECRET` 就启用登录 TOTP;删除该变量即关闭。 -- 客户端流程:密码 -> TOTP 验证码。 -- 支持“记住此设备”30 天。 - --- - ## 常见问题 **Q: 如何备份数据?** diff --git a/README_EN.md b/README_EN.md index 63dbdb8..203a092 100644 --- a/README_EN.md +++ b/README_EN.md @@ -57,6 +57,27 @@ 2. [![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/shuaiplus/nodewarden) 3. Open the generated service URL and follow the on-page instructions. +### CLI deploy + +```powershell +# Clone repository +git clone https://github.com/shuaiplus/NodeWarden.git +cd NodeWarden + +# Install dependencies +npm install + +# Cloudflare CLI login +npx wrangler login + +# Create cloud resources (D1 + R2) +npx wrangler d1 create nodewarden-db +npx wrangler r2 bucket create nodewarden-attachments + +# Deploy +npx wrangler deploy +``` + ## Local development @@ -66,14 +87,6 @@ This repo is a Cloudflare Workers TypeScript project (Wrangler). npm install npm run dev ``` - -## Optional Login TOTP (2FA) - -- Add Workers Secret `TOTP_SECRET` (Base32) to enable login TOTP. -- Remove `TOTP_SECRET` to disable login TOTP. -- Client flow: password -> TOTP code. -- "Remember this device" is supported for 30 days. - --- ## FAQ