12 Commits

Author SHA1 Message Date
wuzf
e3c229b2fe fix(deploy): inject SW_VERSION into all env blocks 2026-08-09 20:40:19 +08:00
wuzf
9e46357a4d docs: streamline deployment guide and fix outdated instructions (#13)
DEPLOYMENT.md 从 1445 行精简至 318 行:
- 删除「非开发者部署指南」整章,该路径本身不合理(无命令行经验的
  用户应走一键部署),且内容细至教用户按 Win+R、用记事本存盘
- 合并重复内容:设置密码流程原有 4 处、密码强度要求 3 处、
  创建 KV 命令 3 处、生成加密密钥 4 处、升级指南 2 处
- 移除 87 行「 页面正常加载」式验证清单,改为 4 行关键验证要点
- 一键部署章节删除手动创建/绑定 KV 的过时步骤(wrangler.toml 已
  声明 SECRETS_KV,首次部署自动创建)

修正过时或错误的内容:
- KV 命令改为 wrangler 4.x 语法(kv:namespace 在 4.78 下报
  Unknown arguments,正确写法是 kv namespace),同步修正
  DEVELOPMENT.md 与 build-release.js 内嵌的部署说明
- CORS 章节改写:实现是基于请求 Host 的动态同源判断,
  原文档描述的 ALLOWED_ORIGINS 常量并不存在
- 自定义域名示例补 custom_domain = true 并去掉路由通配符,
  补充「修改后需重新部署」
- 开发环境部署命令改用 npm run deploy:dev,保留版本注入流程
- 修正浏览器控制台生成加密密钥的示例(原代码产出无效 Base64)
- DEVELOPMENT.md 修正 Token 有效期为 30 天(实际值,原写 1 天)

修复失效锚点:
- DEVELOPMENT.md 目录 10 处及 docs/README.md 3 处引用,emoji
  标题在 GitHub 生成的锚点形如 #-测试指南 / #️-开发环境
2026-08-01 17:37:52 +08:00
wuzf
5cc1513a58 chore(release): centralize version source and add release automation
- Replace hardcoded 1.5.0 in logger/monitoring with APP_VERSION import
- Update README version badges to 1.6.0 with test-enforced consistency
- Add scripts/release.js: npm run release:patch/minor/major runs tests,
  bumps package.json, syncs version.js and README badges, commits and tags
2026-07-26 22:10:20 +08:00
wuzf
ca0e495ab4 fix(deploy): make KV detection env-aware to prevent misreporting
Step 2.5 in deploy.js was env-blind, so 'npm run deploy:dev' falsely
reported reusing the production KV while wrangler silently fell back to
the env binding. Combined with [env.development] inheriting top-level
routes, dev deploys could also hijack the production custom domain.
Make extractWorkerName / injectKvNamespaceId / findExistingKvId accept
an envName parameter, and preserve [env.development].routes across
Sync Upstream merges so 'routes = []' overrides survive upgrades.
2026-05-10 11:02:12 +08:00
wuzf
efe5f3b43a chore(release): v1.4.0
Bump package manifests, logger/monitoring defaults, and README badges
to 1.4.0 covering the backup/export refactor and offline fallback.
Single-file release bundles now inject a timestamped
serviceWorkerVersion via esbuild define (previously fell back to
SW_VERSION='v1' and left PWA clients on stale caches), and the
generated DEPLOY.md lists the cache version plus the cloud-drive
OAuth secrets (ONEDRIVE_*, GOOGLE_DRIVE_*, OAUTH_REDIRECT_BASE_URL).
2026-04-19 01:28:21 +08:00
wuzf
88b9cd8878 refactor(backup): unify backup formats and indexing
Centralize backup serialization in utils/backup-format.js with a
single createBackupEntry() path shared by scheduled backups, manual
backups and exports. Introduce utils/backup-index.js for KV key
listing/pruning and utils/data-hash.js for change detection,
replacing ad-hoc helpers scattered across api/secrets/backup.js,
restore.js and worker.js. UI backup/export modules consume the shared
format so HTML/JSON/CSV exports round-trip through the same schema.
2026-04-11 23:35:46 +08:00
wuzf
7fe83d489a chore(release): v1.3.0
- unify version metadata for v1.3.0\n- prefer production KV namespace in deploy script
2026-03-30 00:10:35 +08:00
wuzf
c89ca68ecd feat(sync): auto-merge wrangler config during upstream sync 2026-03-21 20:31:30 +08:00
wuzf
2ca7e7747d feat(deploy): auto-detect and reuse existing KV namespace in deploy scripts 2026-03-21 19:52:02 +08:00
wuzf
06a20123e2 fix: prevent deploy platform from creating unused KV namespace
Comment out all [[kv_namespaces]] in wrangler.toml (both production and
development) so deploy.workers.cloudflare.com no longer creates an empty
"2fa" KV. Updated deploy.js to handle fully commented KV config: search
for existing "SECRETS_KV" namespace first (exact match only), create one
if not found, then inject the binding block into wrangler.toml before
deploying.
2026-02-27 02:07:50 +08:00
wuzf
e024051171 fix: remove hardcoded KV namespace IDs for one-click deploy 2026-02-27 00:36:42 +08:00
wuzf
83e9042759 feat: restructure into modular architecture with full open-source setup
- Refactor monolithic worker into layered modules (api, otp, ui, utils)
- Add Vitest test suite with 598 tests across 17 files
- Set up GitHub Actions CI/CD, Dependabot
- Add community files (CONTRIBUTING, CODE_OF_CONDUCT, SECURITY, templates)
- Add comprehensive documentation (API reference, architecture, deployment)
- Configure ESLint, Prettier, and Husky pre-commit hooks
- Implement PWA frontend with modular scripts, styles, and service worker
2025-06-07 23:31:55 +08:00