Commit Graph

14 Commits

Author SHA1 Message Date
Haitao Pan
16a4d430a4 feat: add billing source sync state schema 2026-04-12 13:14:41 +08:00
4970b0d3be
feat(accounting): expose pricing-backed billing profile state (#11)
Co-authored-by: Haitao Pan <manbuzhe2009@qq.com>
2026-04-09 14:04:59 +08:00
Haitao Pan
e9fb4af72b feat(accounts): add accounting control plane 2026-04-01 16:15:16 +08:00
Haitao Pan
e75b2d45e3 feat: Implement persistent session management by moving session logic to the store interface and adding a sessions table. 2026-02-05 11:27:11 +08:00
Haitao Pan
dc348238f1 fix: correct sessions table column names from user_id to user_uuid
- Fixed CreateSession and GetSession SQL queries to use user_uuid instead of user_id
- Added unique constraint on sessions.token column for proper upsert support
- Created migration file to add the unique index to existing databases

This fixes the 500 error on /api/auth/login caused by session creation failure
2026-02-05 11:00:57 +08:00
Haitao Pan
8b8a2aa3fa feat(agent-persistence): implement PostgreSQL persistence for agent registry
Core Changes:
- Add Agent struct and management methods to Store interface
- Implement PostgreSQL store methods (UpsertAgent, ListAgents, DeleteAgent, DeleteStaleAgents)
- Integrate persistence into Registry with async database writes
- Add Load() method to restore agents from database on startup
- Implement runAgentCleanup background task (5min interval, 10min stale threshold)

Database:
- Update agents table schema to use JSONB for groups field
- Add indexes on last_heartbeat and healthy columns
- Support health tracking and automatic cleanup of stale agents

Documentation:
- Add comprehensive DB access and upgrade guide
- Include agent persistence implementation plan
- Document diagnostic procedures and troubleshooting steps
- Add walkthrough of multi-agent support implementation

This enables:
- Persistent agent state across service restarts
- Automatic cleanup of offline agents
- Multi-agent support with shared token authentication
2026-02-05 08:34:25 +08:00
Haitao Pan
81177114f5 feat(agent): support multiple agents with shared token and self-reported IDs
- Add AgentID field to StatusReport for agent self-identification
- Implement RegisterAgent() method for dynamic agent registration
- Modify agentReportStatusHandler to extract and use agent-reported IDs
- Use wildcard credential to support multiple agents with INTERNAL_SERVICE_TOKEN
- Add agents table schema for future persistence

This enables scalable multi-node deployment without pre-configuring each agent ID.
2026-02-05 08:05:23 +08:00
Haitao Pan
40bb141322 feat: enforce root account and introduce RBAC policy scaffolding 2026-02-04 13:36:24 +08:00
Haitao Pan
693889f366 feat: implement user management features (pause, delete, blacklist, renew uuid) 2026-02-02 20:19:06 +08:00
Haitao Pan
e1e22bca62 feat: Introduce nodes table and refactor Xray config syncer to generate multiple protocol-specific configurations using new XHTTP and TCP templates. 2026-01-27 21:56:39 +08:00
Haitao Pan
fb06e97d6c Add superadmin integration tests and env-based config 2026-01-25 09:04:08 +08:00
Haitao Pan
29ee491acf reset accounts.svc.plus repo 2026-01-23 23:16:37 +08:00
Haitao Pan
ee6e1a6363 feat: move account service to repo root
# Conflicts:
#	account/Makefile
#	account/go.mod
#	docs/account-admin-settings.md
#	docs/account-svc-plus.md
2026-01-16 16:15:23 +08:00
Haitao Pan
dce981a529 chore: move account sql assets and update migrate docs 2026-01-16 11:47:10 +08:00