5775 Commits

Author SHA1 Message Date
zizi
597fe545b7 feat: add payment encryption helpers
Add AES-GCM encryption utilities for payment credentials with key length and ciphertext validation.
2026-05-20 14:53:18 +08:00
zizi
27a452f8d3 feat: add payment provider contract
Introduce shared payment request, response, order status, and provider interface types.
2026-05-20 14:48:48 +08:00
zizi
cf5160c9f2 feat: add concurrency ops snapshot API
Expose admin Redis snapshot for user and channel concurrency plus current user RPM usage.
2026-05-20 14:46:06 +08:00
zizi
3a25007df2 feat: enforce relay concurrency limits
Add user RPM and concurrency middleware, enforce channel concurrency for relay selection and retry paths, and wire checks into relay routes.
2026-05-20 14:40:36 +08:00
zizi
f069f98b35 feat: add concurrency guard service
Add Redis-backed user and channel concurrency slots plus user RPM checks with fail-open behavior.
2026-05-20 14:27:18 +08:00
zizi
befce8a55c feat: add concurrency limit fields
Add user and channel model fields for concurrency and RPM controls.
2026-05-20 14:21:59 +08:00
zizi
886d32f255 feat: add affiliate admin API
Add admin endpoints for affiliate overview, invites, rebates, transfers, user overrides, batch rate updates, and global rebate config.
2026-05-20 14:18:06 +08:00
zizi
6f134b1a83 feat: add affiliate rebate service
Implement rebate calculation, idempotent record creation, frozen release handling, and tests for rebate configuration behavior.
2026-05-20 14:03:16 +08:00
zizi
16b2853d62 feat: add rebate data models
Add affiliate rebate configuration fields, option defaults, and rebate record persistence for the rebate workflow.
2026-05-20 13:55:41 +08:00
zizi
959ee42bcb feat: add channel monitor rollups
Aggregate monitor history into daily rollups and add maintenance helpers for rollup refresh and history cleanup.
2026-05-20 13:51:22 +08:00
zizi
564a9619ed feat: add channel monitor admin API
Add admin endpoints to manage monitors, run probes, and inspect history and rollups.
2026-05-20 13:44:06 +08:00
zizi
8f91ab1eb6 feat: add channel monitor runner
Implement monitor probe execution, history recording, redirect-safe target checks, and a background runner for due monitors.
2026-05-20 13:38:42 +08:00
zizi
a63300fc1f feat: add channel monitor safety helpers
Add default probe prompts and SSRF validation for channel monitor targets, with focused tests for blocked internal addresses.
2026-05-20 13:28:58 +08:00
zizi
5154ca2e4d feat: add channel monitor data models
Add monitor configuration, history, and daily rollup models for the operations channel monitoring module.
2026-05-20 13:21:11 +08:00
zizi
eec9f4dcae feat: add user announcement endpoints
Expose active announcements to authenticated users, track read state, and feed active database announcements into /api/status with legacy fallback.
2026-05-20 13:15:35 +08:00
zizi
d9d79638c0 feat: add announcement admin API
Add authenticated admin endpoints to create, edit, list, and archive announcements with safe HTML rendering.
2026-05-20 13:06:58 +08:00
zizi
6a409b7724 feat: add announcement data models
Add announcement and read-tracking models with active/unread query helpers for the operations announcement system.
2026-05-20 13:01:47 +08:00
zizi
1de1cdb14f feat: add promo code bonus flow
Add promo code models and APIs, persist selected promo codes on top-up orders, and apply bonus quota idempotently when payments complete.
2026-05-20 12:57:54 +08:00
zizi
059512f6ef docs: add operations capability implementation plan
Document the six-module operations roadmap and executable task breakdown for promo codes, announcements, channel monitoring, rebates, concurrency controls, and domestic payments.
2026-05-20 12:57:40 +08:00
zizi
f245e9bdf5 feat: add channel quota reset controls
Add per-channel quota limits with reset scheduling and runtime checks so channel capacity can be capped and restored on configured periods.
2026-05-20 12:57:19 +08:00
zizi
0a0616a370 feat: add subscription redemption support to redemption codes
Redemption codes can now redeem either quota (existing) or a subscription
plan (new). The Redemption model gains Type (1=quota, 2=subscription) and
PlanId fields. When Type=2, Redeem() calls CreateUserSubscriptionFromPlanTx
to activate the plan, reusing all existing subscription logic (purchase
limits, group upgrade, quota reset, expiry). Old codes default to Type=0
which behaves identically to Type=1 (quota).
2026-05-19 01:10:14 +08:00
zizi
e6bced5dc2 chore: rebuild dev/1.0.0 from main with docs and deploy config
- Rebase dev/1.0.0 on latest upstream main (drop Muse relay code)
- Preserve: troubleshooting records, remote layout, Docker deploy workflow
- Simplify docker-compose.yml to app-only (external PG/Redis)
- Add ops/remote/ host documentation
- Update .env.example with host/docker connection profiles
2026-05-18 23:39:31 +08:00
NitroFire
5dd0d3bcbd
fix: add analytics placeholder (#4928) 2026-05-17 18:54:39 +08:00
QuentinHsu
f69ceb6967
fix: 修复新 UI 语言与文案显示问题 (#4876)
* chore(dev): add local setup state reset target

- add a reset-setup make target to clear setup records, root users, and related options.
- support both docker dev PostgreSQL and local SQLite development databases.
- restart the docker dev backend so setup status is recalculated after reset.

* fix(chat): prevent preset menu text overflow

- add truncation layout for chat preset names to keep long labels inside the sidebar menu.
- prevent loading and external-link icons from shrinking in constrained menu rows.

* fix(i18n): translate dashboard granularity options

- call t() for granularity option labels in dashboard system settings.
- keep localized text consistent between the select trigger and dropdown items.

* chore(dev): add backend dev service rebuild target

- add a dev-api-rebuild make target to rebuild and start the docker backend service.
- reuse DEV_COMPOSE_FILE and DEV_BACKEND_SERVICE variables to avoid repeated compose config literals.

* fix(i18n): align interface language option labels

- add shared interface language options to keep display names consistent.
- reuse the shared options in the header switcher and profile preferences.
- normalize language codes so zh-CN and zh_CN resolve to Simplified Chinese.

* fix(i18n): add missing frontend translation keys

- route channel key prompts, form validation messages, and channel fallback text through i18n.
- add missing translations across six locales for channels, rankings, billing, and logs.
- update i18n sync reports so literal t() keys are present in the base locale.
2026-05-17 11:45:27 +08:00
Seefs
68830e6097
feat: support request_header key source (#4903)
* feat: support request_header key source in backend and settings UI

* feat: support request_header channel affinity source
2026-05-17 11:44:38 +08:00
yyhhyyyyyy
2d968c3eab
fix: apply group filter to channel list queries (#4885) 2026-05-17 11:44:07 +08:00
Seefs
cb7a61466e
Merge pull request #4684 from SAY-5/fix/perf-metric-ambiguous-column
fix: qualify column names in PerfMetric upsert to avoid PG ambiguity
2026-05-16 22:11:38 +08:00
DraftGo
132d7b9f94
fix: GetAllChannels ignores group filter parameter (#4847)
When users filter channels by group without entering a search keyword,
the frontend calls GetAllChannels (GET /api/channel/) instead of
SearchChannels. However, GetAllChannels did not process the group
query parameter, causing the filter to have no effect.

Added group filtering logic to GetAllChannels for both normal mode
and tag mode, using the same CONCAT/|| pattern as SearchChannels
for cross-database compatibility (MySQL, PostgreSQL, SQLite).
2026-05-16 14:54:50 +08:00
yyhhyyyyyy
6f8668e4c3
fix: enforce header nav access control for public modules (#4889) 2026-05-16 14:54:47 +08:00
yyhhyyyyyy
8a10dedb7d
fix(web): handle unlimited API key quota validation (#4881) 2026-05-16 14:54:35 +08:00
yyhhyyyyyy
554defe4f4
fix: correct usage logs filtering (#4883) 2026-05-16 14:54:23 +08:00
yyhhyyyyyy
8f9ee9ba88
fix: allow clearing channel remark (#4886) 2026-05-16 14:54:18 +08:00
CaIon
3caa6e467b
fix(web/default): batch fix new UI issues #4880 #4893 #4817 #4877 #4898
- Add singleSelect to status/role filters in API keys, users, and redemptions tables (#4880)
- Fix affiliate link 404 by changing /register to /sign-up (#4893)
- Open FetchModelsDialog in channel creation mode via customFetcher prop (#4817)
- Add TruncatedText component with tooltip for long channel names, token names, and usernames (#4877)
- Elevate forgot-password link z-index to prevent label click interception (#4898)
2026-05-16 14:48:49 +08:00
CaIon
18282e610d
chore(deps): update axios from 1.15.0 to 1.15.2 2026-05-13 22:23:45 +08:00
skynono
51b5cbe1bd
fix: prevent combobox from over-filtering options on focus (#4829) 2026-05-13 22:21:24 +08:00
dependabot[bot]
3e588b4d4f
chore(deps-dev): bump ip-address from 10.1.0 to 10.2.0 in /electron (#4811)
Bumps [ip-address](https://github.com/beaugunderson/ip-address) from 10.1.0 to 10.2.0.
- [Commits](https://github.com/beaugunderson/ip-address/commits)

---
updated-dependencies:
- dependency-name: ip-address
  dependency-version: 10.2.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-13 22:21:03 +08:00
CaIon
0526a22643
feat: require compliance confirmation for paid features
Gate payment, redemption, subscription, and invitation reward flows behind an audited compliance acknowledgement.
2026-05-13 22:18:46 +08:00
CaIon
aa56667b8f
feat: track upstream request ID and prevent response header override
When proxying through another new-api instance, the upstream
X-Oneapi-Request-Id was overwriting the local one in client responses.
This adds a new `upstream_request_id` field to the logs table, captures
the upstream ID during relay, and filters it from being copied back to
the client. Frontend gains search/filter and detail display support.
2026-05-12 21:53:54 +08:00
CaIon
428e3d91f2
chore: refresh related resources 2026-05-12 21:53:54 +08:00
dependabot[bot]
3856b9d2c0
chore(deps): bump axios from 1.15.0 to 1.15.2 in /web/classic (#4634)
Bumps [axios](https://github.com/axios/axios) from 1.15.0 to 1.15.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.15.0...v1.15.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-version: 1.15.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-12 16:54:30 +08:00
Calcium-Ion
469d3747af
fix: defaut ui triage (#4802)
* fix: theme-aware payment paths, auto-group validation, route guards, perf group filtering

- Add common.ThemeAwarePath to generate correct redirect URLs based on
  active theme (default vs classic), replacing hardcoded /console/* paths
  in 7 controllers and service/quota.go (#4765)
- Validate auto-group availability against getUserGroups before defaulting
  form values; playground falls back to 'default' group when 'auto' is
  unavailable (#4796, #4799)
- Enforce HeaderNavModules settings in rankings route (frontend + backend
  API) and SidebarModulesAdmin in playground route to block direct URL
  access when features are disabled (#4704, #4512)
- Filter perf_metrics API response to only include currently configured
  groups, hiding stale data from deleted groups (#4790)
- Preserve query params (pay=success/fail) in /console/topup → /wallet
  frontend redirect

* fix: update hero section text and localization strings for clarity
2026-05-12 16:47:02 +08:00
CaIon
a720064d91
Merge branch 'main' of github.com:QuantumNous/new-api 2026-05-12 16:24:00 +08:00
skynono
fde2cac9d3
fix(web/default): guard playground messages against legacy classic shape (#4650)
fix(playground): handle legacy localStorage message shape

Sanitizes old-format saved messages to prevent 500 on playground load.
2026-05-12 16:23:33 +08:00
Li Duoyang
2b89989f62
fix(default): support DropdownMenuItem onSelect (#4787)
fix(ui): add onSelect compat wrapper for DropdownMenuItem

Bridges Base UI DropdownMenu with Radix-style onSelect so existing consumers work without migration.
2026-05-12 16:23:24 +08:00
Micah-Zheng
7fe896d2f8
fix: use getUserGroups for ratio display to respect GroupGroupRatio (#4772)
fix(web/default): use getUserGroups for ratio display to respect GroupGroupRatio

Unifies admin/user ratio display so API key list matches the actual billing ratio.
2026-05-12 16:23:14 +08:00
ying2
3057f04a17
fix(wallet): read topup gateway flags from topupInfo instead of status (#4599)
fix(wallet): read topup gateway flags from topupInfo instead of status

Fixes #4632 — subscription purchase modal wrongly said online payment not enabled.
2026-05-12 16:23:04 +08:00
CaIon
03d537328a
fix(default): improve performance health panel layout 2026-05-12 16:13:14 +08:00
CaIon
19fc384e67
feat(performance): update performance metrics handling and UI components 2026-05-12 16:04:15 +08:00
CaIon
ba474393fb
fix(default): resolve v1 frontend issue regressions
Fix v1 frontend regressions across channel forms, dashboard charts, wallet history, payment callbacks, invite links, API key groups, rate-limit errors, and usage-log scrolling.

Fixes #4715
Fixes #4618
Fixes #4699
Fixes #4651
Fixes #4637
Fixes #4682
Fixes #4691
Fixes #4565
Fixes #4334
2026-05-11 11:25:25 +08:00
夜影星辰
5fa103fa5b
fix: exclude THIRD-PARTY-LICENSES.md from .dockerignore for Docker build (#4739) 2026-05-11 10:47:58 +08:00