Skip to content

Commit c0b3c9c

Browse files
committed
sync: 全量同步前端上游 b1aefec,移除 sponsor 推广面板
- 全量同步上游 source/main (b1aefec),108 个新提交 包括:重新设计的 quota 系统、LMU AI provider、excluded models 等 - 移除 SponsorQuickStartPanel 推广面板(第三方广告 UI) - 保留 sponsor provider 注册逻辑(kimi 等 provider 依赖) - 放弃本地 usage 统计面板(上游无对应功能) - TypeScript 编译通过
1 parent 0ac2c46 commit c0b3c9c

286 files changed

Lines changed: 25906 additions & 25134 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- dev
9+
10+
jobs:
11+
verify:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '24'
22+
23+
- name: Setup Bun
24+
uses: oven-sh/setup-bun@v2
25+
with:
26+
bun-version: '1.3.14'
27+
28+
- name: Install dependencies
29+
run: bun install --frozen-lockfile
30+
31+
- name: Verify
32+
run: bun run verify

.github/workflows/release.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,25 @@ jobs:
2424
with:
2525
node-version: '24'
2626

27+
- name: Setup Bun
28+
uses: oven-sh/setup-bun@v2
29+
with:
30+
bun-version: '1.3.14'
31+
2732
- name: Install dependencies
28-
run: npm ci
33+
run: bun install --frozen-lockfile
2934

3035
- name: Build all-in-one HTML
31-
run: npm run build
36+
run: bun run build
3237
env:
3338
VERSION: ${{ github.ref_name }}
3439

40+
- name: Prepare release assets
41+
run: |
42+
cd dist
43+
mv index.html management.html
44+
ls -lh management.html
45+
3546
- name: Generate release notes
3647
run: |
3748
set -euo pipefail

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ skills
2323

2424
# Editor directories and files
2525
settings.local.json
26+
.codex
2627
.vscode/*
2728
!.vscode/extensions.json
2829
.idea

AGENTS.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
5+
This is a React 19 + TypeScript Vite frontend for the CLI Proxy API Management API. Main source lives in `src/`: routes in `src/router`, pages in `src/pages`, components in `src/components`, API clients in `src/services/api`, state in `src/stores`, hooks in `src/hooks`, styles in `src/styles`, and types in `src/types`. Assets live in `src/assets`, with provider icons under `src/assets/icons`. Localization files are in `src/i18n/locales`; update all supported locales when adding user-facing text. Production output is `dist/index.html`.
6+
7+
## Build, Test, and Development Commands
8+
9+
- `bun install --frozen-lockfile`: install dependencies from `bun.lock`.
10+
- `bun run dev`: start the Vite dev server at `http://localhost:5173`.
11+
- `bun run build`: run TypeScript compilation and build `dist/`.
12+
- `bun run preview`: serve the built output locally.
13+
- `bun run test`: run the Bun test suite.
14+
- `bun run lint`: run ESLint over TypeScript/TSX files.
15+
- `bun run verify`: run tests, lint, TypeScript compilation, and the production build.
16+
- `bun run type-check`: run `tsc --noEmit`.
17+
- `bun run format`: apply Prettier to `src/**/*.{ts,tsx,css,scss}`.
18+
19+
## Coding Style & Naming Conventions
20+
21+
Use 2-space indentation, semicolons, single quotes, ES5 trailing commas, and 100-character line width. Prefer typed React components and avoid new `any` unless it marks a boundary. Use the `@/` alias for `src` imports. Component files use PascalCase, hooks use `useName`, API modules use domain names such as `oauth.ts`, and SCSS Modules sit beside their page or component as `Name.module.scss`.
22+
23+
## Testing Guidelines
24+
25+
Tests use Bun's built-in test runner and are colocated under `tests/` as `*.test.ts`. Run `bun run test` for focused test work and `bun run verify` before handoff. Use `bun run type-check` as a fast standalone TypeScript check. For UI changes, verify the affected route in the browser and include screenshots or notes.
26+
27+
## Commit & Pull Request Guidelines
28+
29+
Git history follows Conventional Commit style, for example `feat: add support for xAI provider`, `fix(auth-files): keep disabled card actions visible`, and `ci: use node 24 for releases`. Keep commits focused and scoped when useful. Pull requests should include a change summary, linked issue when applicable, UI screenshots, backend version or reproduction details for integration work, and verification notes.
30+
31+
## Architecture & Configuration Notes
32+
33+
This UI is not the proxy; it talks to the backend Management API under `/v0/management`. Treat backend contracts as the source of truth. For OAuth/provider changes, inspect `../CLIProxyAPI` before changing route names, provider keys, callback parameters, or auth-file semantics. Store no secrets in the repo; management keys are entered at runtime and persisted only in browser storage.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A single-file Web UI (React + TypeScript) for operating and troubleshooting the
44

55
[中文文档](README_CN.md)
66

7-
**Main Project**: https://github.com/NGLSL/CLIProxyAPI
7+
**Main Project**: https://github.com/router-for-me/CLIProxyAPI
88
**Example URL**: https://remote.router-for.me/
99
**Minimum Required Version**: ≥ 7.1.0 (recommended latest)
1010

@@ -79,10 +79,8 @@ Check the CLI Proxy API server documentation/config comments for the full authen
7979
- Gemini/Codex/Claude/Vertex key entries (base URL, headers, proxy, model aliases, excluded models, prefix).
8080
- OpenAI-compatible providers (multiple API keys, custom headers, model alias import via `/v1/models`, optional browser-side "chat/completions" test).
8181
- **Auth Files**: upload/download/delete JSON credentials, filter/search/pagination, runtime-only indicators, view supported models per credential (when the server supports it), manage OAuth excluded models (supports `*` wildcards), configure OAuth model alias mappings.
82-
- **OAuth**: start OAuth/device flows for supported providers, poll status, optionally submit callback `redirect_url`.
83-
- **Quota Management**: manage quota limits and usage for Claude, Antigravity, Codex, Gemini CLI, and other providers.
84-
- **Usage**: requests/tokens charts (hour/day), per-API & per-model breakdown, cached/reasoning token breakdown, RPM/TPM window, optional cost estimation with locally-saved model pricing.
85-
- **Config**: edit `/config.yaml` in-browser with YAML highlighting + search, then save/reload.
82+
- **OAuth**: start OAuth/device flows for Codex, Anthropic/Claude, Antigravity, Kimi, and xAI/Grok; poll status; submit callback URLs or xAI/Grok displayed codes; import Vertex JSON credentials and iFlow cookies.
83+
- **Quota Management**: manage quota limits and usage for Claude, Antigravity, Codex, Kimi, xAI/Grok, and other providers.
8684
- **Logs**: tail logs with incremental polling, auto-refresh, search, hide management traffic, clear logs; download request error log files.
8785
- **System**: quick links, update check, request logging toggle, local login data cleanup, and fetch `/v1/models` (grouped view). Requires at least one proxy API key to query models.
8886

@@ -140,7 +138,9 @@ The UI language is automatically detected from browser settings and can be manua
140138
bun run dev # Vite dev server
141139
bun run build # tsc + Vite build
142140
bun run preview # serve dist locally
141+
bun run test # Bun test suite
143142
bun run lint # ESLint (fails on warnings)
143+
bun run verify # test + lint + build
144144
bun run format # Prettier
145145
bun run type-check # tsc --noEmit
146146
```
@@ -151,7 +151,7 @@ Issues and PRs are welcome. Please include:
151151

152152
- Reproduction steps (server version + UI version)
153153
- Screenshots for UI changes
154-
- Verification notes (`bun run lint`, `bun run type-check`, `bun run build`)
154+
- Verification notes (`bun run verify`, plus `bun run type-check` when run separately)
155155

156156
## License
157157

README_CN.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[English](README.md)
66

7-
**主项目**: https://github.com/NGLSL/CLIProxyAPI
7+
**主项目**: https://github.com/router-for-me/CLIProxyAPI
88
**示例地址**: https://remote.router-for.me/
99
**最低版本要求**: ≥ 7.1.0(推荐最新)
1010

@@ -79,10 +79,8 @@ bun run build
7979
- Gemini/Codex/Claude/Vertex 配置(Base URL、Headers、代理、模型别名、排除模型、Prefix)。
8080
- OpenAI 兼容提供商(多 Key、Header、自助从 `/v1/models` 拉取并导入模型别名、可选浏览器侧 `chat/completions` 测试)。
8181
- **认证文件**:上传/下载/删除 JSON 凭据,筛选/搜索/分页,标记 runtime-only;查看单个凭据可用模型(依赖后端支持);管理 OAuth 排除模型(支持 `*` 通配符);配置 OAuth 模型别名映射。
82-
- **OAuth**:对支持的提供商发起 OAuth/设备码流程,轮询状态;可选提交回调 `redirect_url`
83-
- **配额管理**:管理 Claude、Antigravity、Codex、Gemini CLI 等提供商的配额上限与使用情况。
84-
- **使用统计**:按小时/天图表、按 API 与按模型统计、缓存/推理 Token 拆分、RPM/TPM 时间窗、可选本地保存的模型价格用于费用估算。
85-
- **配置文件**:浏览器内编辑 `/config.yaml`(YAML 高亮 + 搜索),保存/重载。
82+
- **OAuth**:对 Codex、Anthropic/Claude、Antigravity、Kimi、xAI/Grok 发起 OAuth/设备码流程并轮询状态;支持提交回调 URL 或 xAI/Grok 页面显示的 code;包含 Vertex JSON 凭据导入与 iFlow Cookie 导入。
83+
- **配额管理**:管理 Claude、Antigravity、Codex、Kimi、xAI/Grok 等提供商的配额上限与使用情况。
8684
- **日志**:增量拉取日志、自动刷新、搜索、隐藏管理端流量、清空日志;下载请求错误日志文件。
8785
- **系统信息**:快捷链接、版本检查、请求日志开关、本地登录信息清理,以及拉取 `/v1/models` 并分组展示(需要至少一个代理 API Key 才能查询模型)。
8886

@@ -140,7 +138,9 @@ bun run build
140138
bun run dev # 启动开发服务器
141139
bun run build # tsc + Vite 构建
142140
bun run preview # 本地预览 dist
141+
bun run test # Bun 测试套件
143142
bun run lint # ESLint(warnings 视为失败)
143+
bun run verify # 测试 + lint + 构建
144144
bun run format # Prettier
145145
bun run type-check # tsc --noEmit
146146
```
@@ -151,7 +151,7 @@ bun run type-check # tsc --noEmit
151151

152152
- 复现步骤(服务端版本 + UI 版本)
153153
- UI 改动截图
154-
- 验证记录(`bun run lint``bun run type-check``bun run build`
154+
- 验证记录(`bun run verify`,以及按需单独运行的 `bun run type-check`
155155

156156
## 许可证
157157

0 commit comments

Comments
 (0)