分销商后端: - 分销商注册/审核/CRUD API - 分站用户注册/登录/登出 (session cookie auth) - 分站 Token CRUD、充值兑换、套餐订阅 - 分站域名/子域名自动识别中间件 (DistIdentify) - 分销商收益异步记账 + markup 加价计费 - 模型价格快照、渠道路由配置 - 管理员审核/管理分销商 主站前端 (web/): - 分销商注册申请、设置、客户管理(分页)、套餐管理(含速率限制) - 收益管理(含汇总卡片+分页列表)、模型管理 - 管理员分销商审核面板 - DistributorLayout 标签页布局 + 路由 分站前端模板 (dist-site/): - React + Vite + Tailwind 暗色主题 glassmorphism 设计 - react-bits 动画组件 (GradientText, BlurText, CountUp, SpotlightCard 等) - Session cookie 认证 + New-Api-User header - 首页/登录/注册/Dashboard/API Keys/定价/套餐 7 个页面 - Token 创建后一次性密钥展示、余额检查订阅确认 Bug 修复: - 修复 DistUserRegister 密码双重哈希导致用户无法登录 - 修复 401 响应不清除 React user 状态 - 修复订阅确认弹窗不显示余额且提前关闭 - 修复 Home 页 Subscribe 按钮跳转错误 (/dashboard → /packages) - 修复 Login/Register 组件卸载后 setState 警告 - 修复 DistributorEarnings 引用不存在的 username 字段 - 修复 DistributorCustomers 引用不存在的 created_at 字段 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.1 KiB
2.1 KiB
SubRouter Dist-Site Template
A beautiful, open-source frontend template for SubRouter distributors. Built with React, Vite, Tailwind CSS, and react-bits animation components.
Features
- Dark-mode-first design with glassmorphism UI
- Animated landing page with gradient text, spotlight cards, and count-up stats
- User registration, login, and dashboard
- API key management
- Model pricing table
- Package subscription
- Fully responsive
- OpenAI-compatible API endpoint display
Quick Start
# Install dependencies
npm install
# Development server (port 3001, proxies /api to localhost:3000)
npm run dev
# Production build
npm run build
Configuration
The template automatically fetches site configuration from the backend API:
- Site info:
GET /api/dist/site/info— name, logo, favicon, announcement - Models:
GET /api/dist/site/models— available AI models - Pricing:
GET /api/dist/site/pricing— per-model pricing - Packages:
GET /api/dist/site/packages— subscription packages
Customization
Theming
Edit tailwind.config.js to customize colors, fonts, and animations.
Components
react-bits animation components are in src/components/bits/:
GradientText— Animated gradient textShinyText— Sweeping shine effectBlurText— Words blur-in animationCountUp— Spring-physics number counterSpotlightCard— Mouse-following spotlight glowStarBorder— Animated star-light border
Pages
Home— Landing page with hero, features, models previewLogin/Register— AuthenticationDashboard— User overview with balance, usage, redeemTokens— API key managementPricing— Model pricing tablePackages— Subscription packages
Tech Stack
- React 18 + Vite
- Tailwind CSS
- motion/react (Framer Motion)
- react-hot-toast
- react-bits animation components
License
MIT