Commit Graph
43 Commits
Author SHA1 Message Date
bhwa233 eb62c37e02 feat(i18n): enhance locale handling and routing (#996)
* feat(i18n): enhance locale handling and routing

- Implemented dynamic locale aliases in router configuration.
- Added support for preferred locale storage in global state.
- Improved locale resolution logic in router beforeEach guard.
- Created utility functions for locale management and path manipulation.
- Added tests for locale matching and message extraction.
- Updated Header component to allow language selection.
- Refactored getRouterPathWithLang to utilize new locale utilities.
- Updated Vite configuration to support aliasing for vue-i18n.
- Bumped version numbers across various packages to 1.9.0.

* feat(i18n): update version to 1.8.0 and enhance locale handling

- Updated version numbers across all package.json files to 1.8.0.
- Enhanced locale handling in App.vue by centralizing locale configurations.
- Improved Turnstile component to support dynamic language rendering.
- Refactored i18n utilities to include initial locale setup and empty locale messages.
- Updated i18n.ts to utilize the new locale management structure.
- Added naive-locale.ts for better integration with Naive UI's locale handling.
- Adjusted Header.vue to streamline language selection and locale changes.
- Fixed translations in multiple locale files for consistency and accuracy.

* fix(i18n): address review feedback

* feat(i18n): update default locale to English and enhance language handling in components

* fix(i18n): switch locale selector to dropdown

* docs: add topbar language and github order design spec

* fix(i18n): 修复 Header 语言切换器相关问题,恢复为独立控件并调整样式

* Refactor locale handling in router and add locale-guard utility functions

- Improved locale resolution logic in router by introducing utility functions for better readability and maintainability.
- Added `locale-guard.js` to encapsulate locale-related functions such as getting route locale, resolving locale for navigation, and applying locale navigation state.
- Updated JWT synchronization logic to streamline the handling of JWT from query parameters.
- Modified i18n messages test to check for coverage of registered locale message keys instead of extracting English source messages.

* 删除顶部栏语言和GitHub顺序设计文档

* fix: 修复前端设置初始化时未返回 domains 数组导致的 undefined 错误

* refactor(i18n): consolidate locale infrastructure

* fix(i18n): stabilize locale route switching

* fix(i18n): persist default locale selection

* fix(i18n): 修复前端设置初始化时未返回 domains 数组导致的 undefined 错误,统一按空数组兜底处理
feat(i18n): 添加 locale 别名处理,支持默认语言的重定向
test(i18n): 增加对默认语言别名重定向的测试用例

* refactor: replace useAppI18n with useScopedI18n in multiple components for improved localization management

* fix(tests): 移除不必要的 URL 断言以简化 Passkey 测试

* fix(i18n): 更新语言切换逻辑,确保使用当前语言设置进行路由导航

* fix(i18n): 强制路由切换以确保语言切换后正确导航

* refactor(i18n): 优化消息注册和路由本地化逻辑,移除冗余代码

* refactor(i18n): 拆分 API 文件以优化路由管理,更新语言处理逻辑

* fix: align i18n release notes and frontend test script
2026-04-25 13:46:26 +08:00
Dream HunterandClaude Opus 4.6 e6cc8e2ffd feat: add Turnstile CAPTCHA for login forms (#767) (#885)
* feat: add Turnstile CAPTCHA for login forms (#767)

Add optional Turnstile verification for admin login, user login, and
address password login via ENABLE_LOGIN_TURNSTILE_CHECK env var.
Does not affect existing Turnstile on address creation / registration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add ENABLE_LOGIN_TURNSTILE_CHECK to wrangler.toml.template

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: ensure openSettings loaded before admin login modal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: add Turnstile to site access password and fix settings field name

- Add Turnstile to site access password modal in Header.vue
- Add /open_api/site_login endpoint for password + Turnstile verification
- Fix settings field name from enableTurnstileLogin to enableLoginTurnstileCheck

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: move login endpoints to open_api/auth.ts

Move /open_api/site_login and /open_api/admin_login from commom_api.ts
to a dedicated open_api/auth.ts file for better code organization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: change Turnstile check failure status from 500 to 400

Turnstile validation failure is a client error, not a server error.
Change all Turnstile check error responses from 500 to 400.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: use unique IDs for multiple Turnstile instances

When multiple modals with Turnstile appear simultaneously (e.g., site
access + admin login), the hardcoded id="cf-turnstile" causes conflicts.
Generate a unique container ID per Turnstile instance to fix this.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: review fixes - cfToken separation, register Turnstile, error codes

- Separate cfToken refs in Login.vue to avoid token sharing between
  login and new address creation Turnstile instances
- Add Turnstile check to user registration endpoint (not just verify_code)
- Show Turnstile on register tab regardless of enableMailVerify
- Pass cf_token in register request body
- Fix site_login error message to use CustomAuthPasswordMsg
- Fix verifyCode Turnstile error status from 500 to 400
- Restore empty line in commom_api.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: separate register Turnstile logic for with/without mail verify

- With mail verify: verify_code already checks Turnstile, register
  skips Turnstile (token is one-time use)
- Without mail verify: register checks Turnstile directly
- Separate loginCfToken for login tab to avoid token sharing with
  register tab Turnstile

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add enableLoginTurnstileCheck to store defaults, simplify changelog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add /open_api/credential_login for credential login verification

Add credential_login endpoint that verifies both Turnstile token and
JWT credential server-side, replacing the generic verify_turnstile
endpoint. Credential login now validates the JWT before accepting it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: improve login endpoints - hash passwords, expose Turnstile refresh, fix status codes

- site_login/admin_login: always called, verify hashed password + optional Turnstile
- credential_login: always called, verify JWT + optional Turnstile
- Frontend sends hashed passwords instead of plaintext
- Turnstile component exposes refresh method via defineExpose
- Fix Turnstile error status 500→400 in mails_api and telegram_api

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: rename to ENABLE_GLOBAL_TURNSTILE_CHECK and add isGlobalTurnstileEnabled helper

- Rename ENABLE_LOGIN_TURNSTILE_CHECK -> ENABLE_GLOBAL_TURNSTILE_CHECK
- Add isGlobalTurnstileEnabled() in utils.ts: checks env var + Turnstile keys all present
- Backend settings returns enableGlobalTurnstileCheck computed from the helper
- All backend endpoints use isGlobalTurnstileEnabled(c) instead of raw env check
- Update all frontend refs, docs, changelog, and wrangler template

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: use utils.isGlobalTurnstileEnabled instead of named import

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: add E2E tests for turnstile login endpoints

- Test all 3 new /open_api/* endpoints when ENABLE_GLOBAL_TURNSTILE_CHECK is disabled
- Verify settings returns enableGlobalTurnstileCheck: false
- Test admin_login with correct/wrong/empty hashed password
- Test site_login returns 401 when no PASSWORDS configured
- Test credential_login with valid JWT, invalid JWT, empty credential
- Test address_login with empty cf_token works when turnstile disabled
- Add ADMIN_PASSWORDS to E2E wrangler config for admin_login tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: rename test file to login-endpoints.spec.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: validate JWT payload has address field in credential_login

Prevents user tokens or challenge tokens from being accepted as
address credentials since they share the same JWT_SECRET.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: refresh Turnstile token on login failure to allow retry

After a failed login attempt, the consumed Turnstile token is now
refreshed so users can retry without manually refreshing.
Also adds ref to signup Turnstile in UserLogin.vue to refresh after
verification code is sent (single-use token consumed).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: separate Turnstile tokens for signup and reset password flows

Split shared cfToken into signupCfToken and resetCfToken to prevent
single-use Turnstile token conflicts between signup tab and reset
password modal. Each flow now has its own token ref and refreshes
the correct Turnstile widget after use.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: update comments from "login turnstile" to "global turnstile"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 00:47:26 +08:00
Dream Hunter f55e8c9818 feat: add configurable Status menu button (#851) 2026-03-03 12:58:49 +08:00
Dream Hunter 983300acf4 feat: |UI| add loading for lazy load component (#597) 2025-02-27 00:36:13 +08:00
Dream Hunter 3f81fbee6d feat: announcement support html (#566)
* feat: announcement support html

* feat: update dependencies
2025-01-20 13:53:40 +08:00
Dream Hunter 6d4783e1cd fix: UI admin page show modal when no need password (#419) 2024-08-17 23:54:03 +08:00
Dream Hunter c733d3bf4d fix: get user role before all requests (#393) 2024-08-11 19:29:49 +08:00
Dream Hunter 10da337a9c feat: add SHOW_GITHUB config (#371) 2024-08-04 14:34:35 +08:00
Dream Hunter 5faae8796d feat: add ADMIN_USER_ROLE for user access admin panel (#363) 2024-07-27 22:04:18 +08:00
Dream Hunter 00c671cf14 feat: logo click 5 time to admin page && fix: 401 cannot show auth modal (#335) 2024-07-06 20:21:21 +08:00
Dream Hunter b792c196c1 feat: UI i18n depends on router (#289) 2024-06-01 12:12:13 +08:00
Dream Hunter 1f8edbc295 feat: add TITLE in worker for custom website title (#276) 2024-05-26 16:21:27 +08:00
Dream Hunter 870b7b9198 feat: add telegram mini app (#250) 2024-05-19 00:35:10 +08:00
Dream Hunter 9de2d23be1 feat: add version for frontend && backend (#230) 2024-05-12 18:31:43 +08:00
Dream Hunter 4b9d40d04b feat: UI show version (#226) 2024-05-12 11:52:55 +08:00
Dream Hunter 1fa56dfe98 feat: add UserLogin (#209) 2024-05-08 23:14:44 +08:00
Dream Hunter 854e4665b9 fix: showPassword (#193) 2024-05-04 00:09:46 +08:00
Dream Hunter 91a01784db fix: showPassword (#192) 2024-05-04 00:01:55 +08:00
Dream Hunter e81142f5ef feat: UI: add user page: useIframeShowMail && mailboxSplitSize (#184) 2024-05-01 18:09:21 +08:00
Dream Hunter 23d1709ca1 feat: support admin create address && add ENABLE_USER_CREATE_EMAIL config (#175) 2024-04-29 00:09:53 +08:00
Dream Hunter 08a3d4ce0e feat: add ENABLE_USER_DELETE_EMAIL && ENABLE_AUTO_REPLY && modify fetchAddressError i18n && UI: show autoRefreshInterval (#169) 2024-04-27 23:16:18 +08:00
Dream Hunter f624fe5b58 feat: add adminContact && DEFAULT_SEND_BALANCE (#162) 2024-04-26 00:21:43 +08:00
Dream Hunter b058a1bd12 feat: update packages (#161) 2024-04-25 14:30:39 +08:00
Dream Hunter a3edb09305 feat: UI authTip to accessTip && worker / path return OK (#158) 2024-04-23 12:50:20 +08:00
Dream Hunter aea8b964bb feat: admin cleanup tab && admin sendbox tab (#126) 2024-04-14 22:41:16 +08:00
Dream Hunter b8f0fa49cf feat: init send mail (#113)
* feat: init send mail

* feat: init send mail
2024-04-12 13:26:42 +08:00
Dream Hunter fbd2e0e844 fix: UI overflow (#111)
* feat: UI overflow

* feat: add domain
2024-04-10 13:25:26 +08:00
Dream Hunter 37a9b0557a feat: UI use fakerjs cdn && overflow: auto (#108) 2024-04-09 21:58:07 +08:00
Dream Hunter 42a828e98b feat: add faker-js (#107) 2024-04-09 19:30:35 +08:00
Dream Hunter def400eb09 feat: use rust mail-parser (#104)
* feat: imp worker v2

* feat: add rust mail-parser

* feat: imp frontend v2

* feat: imp frontend v2

* feat: update doc

* feat: add mailV1Alert

* feat: remove unused
2024-04-09 14:58:19 +08:00
Dream Hunter 9ce706fad1 feat: add admin account search && delete account for user (#96)
* feat: add admin account search && delete account for user

* feat: add admin account search && delete account for user
2024-04-04 14:30:07 +08:00
Dream Hunter 761cda0154 fix: menu not show in mobile (#90) 2024-04-01 13:20:04 +08:00
Dream Hunter 8fba01eb4b feat: UI: add menu icon (#85) 2024-03-31 17:29:37 +08:00
Dream Hunter a8e961caf4 feat: UI: move account releated code to header.vue (#84) 2024-03-31 16:16:15 +08:00
Dream Hunter 0d81d05aa3 feat: add menu label for mobile (#82)
* feat: add menu label for mobile

* feat: pc select 1 email
2024-03-30 12:07:06 +08:00
Dream Hunter ef2acb2e64 fix: header style (#59) 2024-01-14 00:17:05 +08:00
Dream Hunter 95ae65dc03 feat: add auto reply (#49)
* feat: add auto reply

* feat: add auto reply

* feat: update readme

* feat: add auto reply
2023-12-18 21:41:15 +08:00
Dream Hunter fa998514f7 fix: menu (#46) 2023-12-15 13:40:52 +08:00
Dream Hunter c9466edf43 fix: menu (#44) 2023-12-15 13:27:55 +08:00
Dream Hunter c5ea19bc07 feat: add vhooks (#43) 2023-12-15 12:28:42 +08:00
Dream Hunter bf6374af52 feat: add admin query emails (#39)
* feat: add NPagination

* feat: admin query emails
2023-12-12 16:33:54 +08:00
Dream Hunter 0bca2b8dce feat: make auth modal cannot be close by user (#24) 2023-09-10 00:18:09 +08:00
Dream Hunter a395b951e8 feat: add auth mode and refactor frontend (#21) 2023-09-09 16:00:10 +08:00