Commit Graph

63 Commits

Author SHA1 Message Date
shanshanzhong147 f6911965dc chore: snapshot current aws standby and backup tooling work 2026-05-13 10:59:03 -07:00
shanshanzhong147 f946504cb8 x 2026-05-08 06:19:59 -07:00
shanshanzhong147 b52e01eaa2 fix(auth): grant trial only on email bind
Build docker and publish / build (20.15.1) (push) Successful in 5m17s
Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-29 22:36:17 -07:00
shanshanzhong147 32e3dc3c73 fix(order): cover invite gifts and inactive renewals
Build docker and publish / build (20.15.1) (push) Successful in 5m36s
2026-04-29 21:52:28 -07:00
shanshanzhong147 47696b9e68 fix(order): reconcile subscriptions and grant device trials
Build docker and publish / build (20.15.1) (push) Has been cancelled
2026-04-29 21:00:46 -07:00
shanshanzhong147 5b49aa8242 fix(auth): disable trial grants on public email flows
Build docker and publish / build (20.15.1) (push) Successful in 5m29s
2026-04-25 01:11:27 -07:00
shanshanzhong147 9db4762904 fix(order): prevent duplicate subscriptions and repair invite gifts
Build docker and publish / build (20.15.1) (push) Successful in 5m6s
2026-04-24 21:16:21 -07:00
shanshanzhong147 4b73cd4d3c fix: 泛域名邮箱(+别名/Gmail点号)拦截提前,不受白名单开关影响
Build docker and publish / build (20.15.1) (push) Successful in 5m38s
2026-04-21 09:44:00 -07:00
shanshanzhong147 23a7a292ef fix: Gmail 泛域名邮箱(含点号/+别名)直接拒绝赠送试用
Build docker and publish / build (20.15.1) (push) Successful in 5m23s
Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-21 01:09:34 -07:00
shanshanzhong147 c8258dc93b feat: 设备登录新增 base_payload 字段,前端传入后存储到 user_device 表
Build docker and publish / build (20.15.1) (push) Successful in 4m48s
2026-04-20 20:08:20 -07:00
shanshanzhong147 954b19c332 feat: 邮箱规范化(NormalizeEmail)与域名白名单检查(IsEmailDomainWhitelisted)
Build docker and publish / build (20.15.1) (push) Has been cancelled
2026-04-12 18:43:47 -07:00
shanshanzhong147 e818ac8764 x
Build docker and publish / build (20.15.1) (push) Successful in 7m38s
2026-04-04 09:41:41 -07:00
shanshanzhong147 98d8525fa9 refactor: 简化 trial 赠送配置,删除多余的白名单启用开关
Build docker and publish / build (20.15.1) (push) Successful in 7m42s
**简化方案**:
- 删除 `EnableTrialEmailWhitelist` 配置字段(多余)
- 保留 `TrialEmailDomainWhitelist`(逗号分隔的白名单域名)
- 赠送规则:白名单**非空** 且 **邮箱在列表** 才赠送

**新的赠送逻辑**:
```yaml
TrialEmailDomainWhitelist: "qq.com,163.com,gmail.com"
```
- 为空 →  不赠送(关闭)
- 非空 →  赠送给白名单域名的邮箱

**更新的地方**:
1. internal/config/config.go - 删除 EnableTrialEmailWhitelist 字段
2. userRegisterLogic.go - 简化赠送逻辑
3. emailLoginLogic.go - 简化赠送逻辑
4. bindEmailWithVerificationLogic.go - 简化赠送逻辑
5. oAuthLoginGetTokenLogic.go - 简化赠送逻辑

**配置升级说明**:
旧配置:
```yaml
EnableTrial: true
EnableTrialEmailWhitelist: true
TrialEmailDomainWhitelist: "qq.com,163.com"
```

新配置(只保留两项):
```yaml
EnableTrial: true
TrialEmailDomainWhitelist: "qq.com,163.com"
```

关闭赠送:
```yaml
EnableTrial: true
TrialEmailDomainWhitelist: ""
```

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-03 07:20:10 -07:00
shanshanzhong147 d586bbeabb fix: OAuth registration missing email domain whitelist check for trial gifting
**Problem**: OAuth registration path (Google, Apple, Telegram) was missing the
email domain whitelist validation, causing trial subscriptions to be granted to
all users regardless of the whitelist configuration.

**Root Cause**: The previous commit (3417da2a) that implemented trial domain
whitelist only updated device/phone/email direct registration paths, but
missed the OAuth registration path in oAuthLoginGetTokenLogic.go.

**Solution**:
- Added email domain whitelist check to OAuth register() method
- Added isEmailDomainWhitelisted() helper function matching the pattern
  used in other auth logic files
- Only activate trial if EnableTrial=true AND
  (whitelist disabled OR email domain matches whitelist)
- Added email logging to trial subscription activation log

Affected flows:
- OAuth Google login with new user
- OAuth Apple login with new user
- OAuth Telegram login with new user

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-03 06:44:33 -07:00
shanshanzhong147 3417da2a9e feat: trial 赠送改为白名单邮箱域名控制
Build docker and publish / build (20.15.1) (push) Failing after 7m14s
- 新增 EnableTrialEmailWhitelist + TrialEmailDomainWhitelist 配置
- 邮箱注册/登录:加白名单域名判断,域名匹配才赠送 trial
- 设备登录/手机注册:移除 activeTrial,不再自动赠送
- 绑定邮箱(bindEmailWithVerification):绑定成功后检查白名单+防重复赠送
- 新增 IsEmailDomainWhitelisted 导出函数供跨包调用
- 清理 deviceLoginLogic/telephoneUserRegisterLogic 中的 activeTrial 死代码

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-04-02 05:46:04 -07:00
shanshanzhong147 b43dcd8dab merge: 同步 origin/master 新功能到定制版本
Build docker and publish / build (20.15.1) (push) Successful in 8m8s
2026-03-24 01:03:56 -07:00
EUForest 7fe7243c24 feat: Add slider verification code 2026-03-23 02:42:12 +08:00
shanshanzhong147 e5e9f93f68 Merge remote-tracking branch 'origin/master' into internal 2026-03-19 01:55:01 -07:00
shanshanzhong147 fdfadca57f 赠送逻辑
Build docker and publish / build (20.15.1) (push) Successful in 6m57s
2026-03-18 02:04:34 -07:00
shanshanzhong147 772c12f821 fix: 注销后 device login 补回被删除的 device auth_method,修复前端按钮显示异常
Build docker and publish / build (20.15.1) (push) Successful in 7m18s
Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-11 10:07:14 -07:00
EUForest fae77a8954 feat(auth): add captcha verification to phone authentication
- Add verifyCaptcha method to phone login logic
- Add verifyCaptcha method to phone registration logic
- Support both local and Turnstile captcha verification
- Check EnableUserLoginCaptcha for phone login
- Check EnableUserRegisterCaptcha for phone registration
- Validate captcha before processing phone authentication
2026-03-09 22:55:23 +08:00
EUForest cea3e31f3a feat(auth): add captcha verification to user email authentication
- Add verifyCaptcha method to user login logic
- Add verifyCaptcha method to user registration logic
- Add verifyCaptcha method to password reset logic
- Support both local and Turnstile captcha verification
- Check respective configuration flags before verification
- Validate captcha code and ID for local captcha
- Validate Turnstile token for Turnstile mode
2026-03-09 22:55:08 +08:00
EUForest 9aaffec61d feat(auth): add admin authentication with permission checks
- Add admin login handler and logic with IsAdmin verification
- Add admin password reset handler and logic
- Add admin captcha generation handler and logic
- Implement device binding for admin login
- Add login logging for admin authentication
- Check EnableAdminLoginCaptcha configuration
- Separate admin authentication from user authentication
- Verify admin permission before allowing access
2026-03-09 22:54:59 +08:00
EUForest 2afb86f973 feat(auth): add user captcha generation endpoint
- Add handler for /v1/auth/captcha/generate endpoint
- Implement captcha generation logic based on configuration
- Support local image captcha generation with Redis storage
- Return Turnstile site key for Turnstile mode
- Check EnableUserLoginCaptcha configuration
2026-03-09 22:54:47 +08:00
EUForest 39310d5b9a Features:
- Node group CRUD operations with traffic-based filtering
  - Three grouping modes: average distribution, subscription-based, and traffic-based
  - Automatic and manual group recalculation with history tracking
  - Group assignment preview before applying changes
  - User subscription group locking to prevent automatic reassignment
  - Subscribe-to-group mapping configuration
  - Group calculation history and detailed reports
  - System configuration for group management (enabled/mode/auto_create)

  Database:
  - Add node_group table for group definitions
  - Add group_history and group_history_detail tables for tracking
  - Add node_group_ids (JSON) to nodes and subscribe tables
  - Add node_group_id and group_locked fields to user_subscribe table
  - Add migration files for schema changes
2026-03-08 23:22:38 +08:00
shanshanzhong147 4d913c1728 修复缓存
Build docker and publish / build (20.15.1) (push) Successful in 7m26s
2026-03-06 21:58:29 -08:00
shanshanzhong147 6c370485d1 fix gitea workflow path and runner label
Build docker and publish / build (20.15.1) (push) Failing after 8m1s
2026-03-04 03:07:41 -08:00
shanshanzhong147 82626dd749 fix device decrypt flow and delete_account response stability
Build docker and publish / build (20.15.1) (push) Failing after 8m0s
2026-03-04 01:37:11 -08:00
shanshanzhong147 4d8516b2e1 同步历史版本代码 2026-03-03 09:32:22 -08:00
EUForest 37200698ab update: redis config 2026-01-31 12:08:12 +08:00
greatsage 5f1a546bbe fix: resolve trial subscription cache issue on new user registration
When new users register with trial subscription enabled, the subscription
link fails to connect in Clash clients. This is caused by missing cache
invalidation after transaction commit.

Changes:
- Add cache clearing after successful trial subscription creation
- Clear user subscription cache, subscription details cache, and server cache
- Modify activeTrial functions to return subscription object for cache clearing
- Apply fix to all registration methods: email, phone, device, and OAuth

This ensures subscription links work immediately after registration without
requiring manual subscription reset.
2026-01-22 23:57:15 +07:00
EUForest 3359704a45 feat: add short_code field to device login API
- Add optional short_code parameter to DeviceLoginRequest
- Add ShortCode field to Device model
- Save short_code to database during device registration
- Add database migration for user_device.short_code column
- Fix duplicate variable declaration in routes.go
2026-01-10 18:11:24 +08:00
EUForest 23ef9dbff1 feat: bind device limit 2026-01-06 16:15:47 +08:00
EUForest 80ee9a6acf Merge upstream/master into develop
Sync upstream changes from perfect-panel/server

  Includes updates from v1.0.1 to v1.2.5:
  - Currency configuration support
  - Subscribe improvements (short token, inventory check, etc.)
  - Node management enhancements
  - Database migrations
  - Bug fixes and optimizations
2026-01-02 12:51:55 +08:00
EUForest 47c41d1d14 fix bug: telephone login 2025-12-19 22:46:48 +08:00
EUForest 128791f43e update: bind device 2025-11-24 15:59:45 +08:00
EUForest ff2d3f85f3 new features: Based on IP user registration restrictions 2025-11-13 14:52:02 +08:00
EUForest 0fb92f380f update: Remove accounts without verification methods 2025-11-13 14:50:55 +08:00
EUForest de6661cc16 Update: Successful authentication records the identifier. 2025-11-06 15:32:29 +08:00
EUForest 2605d22f8e Add: ClearServerAllCache Func 2025-11-01 16:05:37 +08:00
EUForest 7b8e71ade2 fix bug: SMS recharge password 2025-11-01 15:52:05 +08:00
EUForest 2edc0ef1c8 fix bug: device login fail 2025-10-28 14:18:20 +08:00
EUForest cd3b9d4fc8 Merge remote-tracking branch 'upstream'
# Conflicts:
#	apis/public/subscribe.api
#	initialize/migrate/database/02115_ads.up.sql
#	internal/logic/auth/deviceLoginLogic.go
#	internal/logic/public/subscribe/queryUserSubscribeNodeListLogic.go
#	internal/logic/public/user/unbindDeviceLogic.go
#	internal/types/types.go
#	pkg/tool/encryption_test.go
2025-10-22 20:16:03 +08:00
EUForest d78d79fa2d add: Automatically delete token when device is removed 2025-10-22 19:52:52 +08:00
EUForest 96808d531a Application device interface encryption and other bug fixes (#87)
* add: device login

* update: global config

* add: User transmission interface encryption

* update: get global config

* update: User transmission interface encryption

* add: get device list

* add: SecretIsEmpty Message

* update: device middleware

* add: query user subscribe node list

* fix bug: query device list

* fix bug: unbind device

* update: device login

* fix bug: The ad table is missing the description field

* fix bug:page size is zero

* update: Device Middleware

* fix bug: Site custom data update failed
2025-10-15 10:09:19 -04:00
EUForest f0e2633ef6 update: device login 2025-10-14 11:37:25 +08:00
EUForest 8c776cdbac update: User transmission interface encryption 2025-10-12 19:10:52 +08:00
EUForest 46e6a9784d add: User transmission interface encryption 2025-10-12 16:23:29 +08:00
EUForest 71018eb2f4 add: device login 2025-10-11 15:55:45 +08:00
Chang lue Tsen 8562734fde feat(user): add encryption algorithm and salt fields to User model for migrate 2025-10-09 13:33:03 -04:00