Go to file
Haitao Pan 0942c5d031 fix(login): ensure redirect and UI update after successful login
Fixed critical issues preventing proper login flow:

1. ENSURE REDIRECT AFTER LOGIN
   - Added onSuccess callback in routes/login.tsx
   - Modified LoginForm to ALWAYS redirect after successful login
   - Even if onSuccess exists, backup redirect mechanism still triggers
   - Reduced redirect delay from 1000ms to 500ms for faster response

2. NOTIFY OTHER COMPONENTS OF LOGIN SUCCESS
   - Added global 'login-success' event dispatch in LoginForm
   - Window emits custom event when login completes successfully
   - Allows other components to react to authentication state change

3. UPDATE NAVBAR USER STATE IN REAL-TIME
   - Navbar now listens for 'login-success' event
   - Triggers session fetch when login success event is received
   - currentUser signal updates immediately after login
   - UserMenu shows logged-in state without page refresh

4. CLEANUP EVENT LISTENERS
   - Properly remove event listeners on component unmount
   - Prevents memory leaks and duplicate listeners

CHANGES:
- routes/login.tsx: Added onSuccess callback for redirect
- islands/LoginForm.tsx: Added global event dispatch + backup redirect
- islands/Navbar.tsx: Added event listener for login success

The user will now see:
 Immediate redirect to /panel after login
 Navbar updates UserMenu to show avatar/dropdown
 No page refresh needed
 Session persists across navigation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 16:46:37 +08:00
.github Add dashboard UI tests and CI coverage (#556) 2025-10-17 16:52:28 +08:00
account update: account/config/sync.yaml 2025-11-05 16:36:08 +08:00
config Add CMS configuration schema, docs, and validation (#551) 2025-10-17 16:41:22 +08:00
dashboard feat: enable mail demo preview and fix extension import (#643) 2025-11-03 07:56:18 +08:00
dashboard-fresh fix(login): ensure redirect and UI update after successful login 2025-11-05 16:46:37 +08:00
deploy feat: point account service to dedicated domain (#598) 2025-10-28 17:07:02 +08:00
docs feat(dashboard-fresh): migrate and integrate dashboard source 2025-11-04 18:06:21 +08:00
example Simplify runtime config loading (#635) 2025-11-02 11:51:46 +08:00
light-idp/idp-server Merge pull request #199 from svc-design/codex/implement-oauth2-authorization-flow 2025-08-21 15:36:16 +08:00
rag-server Update default API domains (#604) 2025-10-30 18:24:08 +08:00
ragbench Add ragbench evaluation tool and workflow 2025-08-13 11:10:04 +08:00
scripts add scripts/install_stalwart_mailserver.sh 2025-11-01 20:27:32 +08:00
types docs: refine routing plan and dl components (#221) 2025-09-15 17:33:40 +08:00
wasm/askai_limiter feat: add flexible askai rate limiter 2025-08-04 00:00:49 +08:00
workflows chore: update proxy host variable 2025-07-23 17:11:10 +08:00
.gitignore update prod runtime config and cleanup: adjust .gitignore, remove account-export.yaml 2025-11-02 12:07:13 +08:00
AGENTS.md docs: add repository agent guidelines (#613) 2025-10-31 21:27:40 +08:00
go.mod Add SSH-based account sync utility (#602) 2025-10-30 14:07:53 +08:00
go.sum Add SSH-based account sync utility (#602) 2025-10-30 14:07:53 +08:00
LICENSE Initial commit 2025-05-30 10:49:17 +08:00
Makefile Added new account export and config files, updated nginx configuration 2025-10-31 07:59:09 +08:00
README.md feat: point account service to dedicated domain (#598) 2025-10-28 17:07:02 +08:00

XControl

XControl is a modular multi-tenant management platform written in Go. The project integrates several optional components to provide a visual control plane for traffic statistics, configuration export and multi-node management.

This repository contains the API server, agent code and a Next.js-based UI.

Components

  • dashboard
  • ui-panel
  • xcontrol-cli
  • xcontrol-server

All UI components provide both Chinese and English interfaces.

Tech Stack

Category Technology Version
Gateway OpenResty 1.27.1.2
BackendFramework Go 1.24
FrontFramework Next.js/Node.js/Yarn 14.1.0/v22.20.0/4.10.3
Cache Redis 8.2.0
Database PostgreSQL + pgvector 14.18
Model (Local) HuggingFace Hub + Ollama baai/bge-m3, llama2:13b
Model (Online) Chutes.AI baai/bge-m3, moonshotai/Kimi-K2-Instruct

LangChainGo 核心功能集成一览

XControl 通过 LangChainGo 统一接入多种大模型,并为 AskAI、CLI 与 Server 提供链式调用能力:

  • LLM 接口层Model I/O:统一调用 Hugging Face、Ollama、OpenAI 兼容模型接口。
  • Chains链式流程:将 prompt、检索结果、工具调用等组合成完整流程支持 RAG、聊天、代码生成等场景。
  • 工具与 Agent 体系:定义 Web 搜索、实现 ReAct 风格的工具调用。
  • 向量检索与数据接入:适配 PGVector 向量存储。
  • 文档加载与分块:提供 Document Loaders 与 Text Splitters用于处理长文本与构建向量检索块。
  • Memory 与历史追踪:支持 Conversation Buffer 等对话记忆机制,增强交互体验。

CMS configuration

A unified CMS setup is defined in config/cms.json. The schema at config/cms.schema.json ensures templates, themes, extensions and content sources stay in sync across deployments.

  • Refer to docs/cms/README.md for usage instructions, extension development notes and theme customization guidelines.
  • Follow the migration playbook in docs/cms/migration-guide.md when switching existing sites to the CMS architecture.

Supported Platforms

Tested on Ubuntu 22.04 x64 and macOS 26 arm64.

Installation

make install
make init-db   # initialize database (optional)

Frontend configuration

The Next.js dashboard now resolves service endpoints through dashboard/config/runtime-service-config.yaml. The runtime configuration selects values based on NEXT_PUBLIC_RUNTIME_ENV (falling back to NODE_ENV and the file's defaultEnvironment). Use NEXT_PUBLIC_ACCOUNT_SERVICE_URL for ad-hoc overrides, otherwise adjust the YAML file to specify environment-specific URLs such as http://localhost:8080 for development/test and https://accounts.svc.plus for production.

Account service configuration

account/config/account.yaml now accepts a server.publicUrl value such as https://accounts.svc.plus:8443. The account service uses this URL to derive a default CORS origin and to document the externally reachable host. Set server.allowedOrigins when you need to expose additional browser clients; omit it to fall back to the public URL or the local development origins (http://localhost:3001 and http://127.0.0.1:3001).

Features

  • XCloudFlow Multi-cloud IaC engine built with Pulumi SDK and Go. GitHub →
  • KubeGuard Kubernetes cluster application and node-level backup system. GitHub →
  • XConfig Lightweight task execution & configuration orchestration engine. GitHub →
  • CodePRobot AI-driven GitHub Issue to Pull Request generator and code patching tool. GitHub →
  • OpsAgent AIOps-powered intelligent monitoring, anomaly detection and RCA. GitHub →
  • XStream Cross-border developer proxy accelerator for global accessibility. GitHub →

The docs directory contains a more detailed overview and design documents for each module.

Building

make build

This produces a binary under bin/xcontrol. Run make agent to build the node agent.

Testing

make test

Deployment

make start

This launches the server, dashboard and panel. Use make stop to stop all components.

The API server also accepts a custom configuration file:

xcontrol-server --config path/to/server.yaml

Logging

Both xcontrol-cli and xcontrol-server accept a --log-level flag to control verbosity. The level may be one of debug, info, warn, or error:

xcontrol-cli --log-level debug
xcontrol-server --log-level warn

The server's log level can also be set in the configuration file:

log:
  level: info

The flag value takes precedence over the configuration file.

Changelog

See docs/changelog.md for a list of completed changes, including all work from Milestone 1.

Roadmap

The roadmap below is also available in docs/Roadmap.md.

License

This project is licensed under the terms of the MIT License.