1127 Commits

Author SHA1 Message Date
Calcium-Ion
e36d191c2e
Merge pull request #4450 from feitianbubu/pr/7fa4a87ad953642a2f454ad0813a0c8b6ac361c6
增加用户创建时间和最后登录时间
2026-04-26 22:12:22 +08:00
Seefs
f424f906d8
feat: sync upstream pricing from pricing endpoint (#4452)
* feat: sync upstream pricing from pricing endpoint

* feat: sync upstream pricing with expression priority

* fix: add feedback while syncing upstream pricing

* fix: show loading state for empty upstream pricing sync
2026-04-26 20:17:35 +08:00
Calcium-Ion
cc4ad6c39e
Merge pull request #4437 from seefs001/fix/channel-upstream-model-sync
fix(channel): load model mapping during upstream model checks
2026-04-26 20:17:14 +08:00
feitianbubu
02aacb38a2
feat: add user created_at and last_login_at 2026-04-25 12:44:44 +08:00
CaIon
a7c38ec851
fix: add PaymentProvider field to prevent cross-gateway callback attacks
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
Build Electron App / build (windows-latest) (push) Has been cancelled
Build Electron App / release (push) Has been cancelled
Release (Linux, macOS, Windows) / Linux Release (push) Has been cancelled
Release (Linux, macOS, Windows) / macOS Release (push) Has been cancelled
Release (Linux, macOS, Windows) / Windows Release (push) Has been cancelled
EPay allows users to switch payment methods (e.g. wxpay→alipay) during
checkout, causing callback rejection. Replace fragile blocklist guard
with a PaymentProvider field on TopUp and SubscriptionOrder that
identifies which gateway created the order.
2026-04-24 22:16:16 +08:00
Seefs
095e1920f1
fix(channel): load model mapping during upstream model checks 2026-04-24 17:51:46 +08:00
CaIon
3a2138ba61
refactor: rename and relocate HasModelBillingConfig function for clarity 2026-04-24 16:39:12 +08:00
yyhhyyyyyy
e3d64cb76d
Merge pull request #4431 from yyhhyyyyyy/fix/tiered-billing-model-list
fix: include tiered billing models in model listing
2026-04-24 16:24:36 +08:00
CaIon
6bde1a9c8d
Merge origin/main into nightly
Resolve conflicts:
- .gitignore: keep nightly additions (.test, skills-lock.json)
- relay/helper/price.go: keep both billingexpr and model imports
- en.json / zh-CN.json: keep nightly's superset of i18n entries
- service/billing_session.go: add missing 3rd arg to DecreaseUserQuota
- en.json / zh-CN.json: deduplicate 129+320 duplicate i18n keys
2026-04-23 21:37:03 +08:00
XiaoAI1024
49474520ec
Protect external token migration tests 2026-04-23 13:29:00 +08:00
XiaoAI1024
0feb6f2c3c
Add cross-database token migration tests 2026-04-23 13:29:00 +08:00
XiaoAI1024
81ddf6e722
Add legacy token migration test 2026-04-23 13:29:00 +08:00
XiaoAI1024
2431efc01f
Support longer legacy token keys 2026-04-23 13:29:00 +08:00
Seefs
1d83b5472a
fix: require proper verification for passkey changes (#4393)
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
Build Electron App / build (windows-latest) (push) Has been cancelled
Build Electron App / release (push) Has been cancelled
Release (Linux, macOS, Windows) / Linux Release (push) Has been cancelled
Release (Linux, macOS, Windows) / macOS Release (push) Has been cancelled
Release (Linux, macOS, Windows) / Windows Release (push) Has been cancelled
2026-04-22 22:55:06 +08:00
Seefs
5f67d2a28b
fix: use stream for codex auto test (#4325) 2026-04-22 22:54:41 +08:00
Seefs
f995a868e4
Merge pull request #4089 from seefs001/feature/waffo-pay
rafactor: payment
2026-04-18 14:22:54 +08:00
CaIon
c31343ac76
fix(log): hide admin identity in user-visible management logs
Admin username/ID was embedded directly into the log Content for
quota changes and forced 2FA disable, leaking the operator's
identity to the target user via their own usage log page.

Move operator info into Other.admin_info so formatUserLogs strips
it for non-admin viewers, and render it in the expand panel only
for admins as "操作管理员".

Closes #4301
2026-04-18 00:16:52 +08:00
CaIon
9253426223
fix(user): invalidate user and token caches when disabling user
When an admin disables/deletes/promotes/demotes a user via ManageUser,
explicitly evict the user cache and all of the user's token caches from
Redis. This prevents a disabled user from continuing to make successful
API requests until the user cache TTL expires, and ensures subsequent
requests reload fresh status from the database.
2026-04-17 23:58:45 +08:00
CaIon
209d90e861
feat(topup): add admin-only audit info to top-up logs
Thread caller IP from webhook/admin controllers through model recharge
functions and record a new RecordTopupLog entry with admin_info (server
IP, caller IP, order payment method, callback payment method, system
version). Frontend shows these fields in the expanded log row and the
IP column for admins on top-up logs, while non-admins continue to see
admin_info stripped by formatUserLogs.
2026-04-17 23:51:30 +08:00
CaIon
22e509c1ef
refactor: simplify ShouldDisableChannel function by removing unused parameters and commented-out code 2026-04-16 20:56:44 +08:00
CaIon
8aaec8b1cc
feat: add PaymentMethod field to TopUp model and enhance payment method validation in topup controllers 2026-04-15 21:17:49 +08:00
CaIon
b2a40d3381
feat: enhance Stripe webhook handling for async payment events
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
Build Electron App / build (windows-latest) (push) Has been cancelled
Build Electron App / release (push) Has been cancelled
Release (Linux, macOS, Windows) / Linux Release (push) Has been cancelled
Release (Linux, macOS, Windows) / macOS Release (push) Has been cancelled
Release (Linux, macOS, Windows) / Windows Release (push) Has been cancelled
2026-04-15 20:56:55 +08:00
feitianbubu
d15e14b117
feat: include admin username in quota adjustment logs 2026-04-13 16:09:59 +08:00
skynono
b4df9955f4
fix: isStream status in error logs instead of hardcoded false (#4195) 2026-04-12 17:41:26 +08:00
CaIon
2819e3a1d1
fix: improve login error handling to distinguish database errors from auth failures
ValidateAndFill now checks the DB query result and returns sentinel errors
(ErrDatabase, ErrInvalidCredentials, ErrUserEmptyCredentials) instead of
hardcoded Chinese strings. The controller maps each sentinel to the
appropriate i18n message, so users see "please contact admin" on DB errors
instead of a misleading "wrong password" message. Non-DB errors still
return a unified vague response to avoid leaking user existence.
2026-04-12 17:11:20 +08:00
CaIon
ed7f839911
feat: improve model price error UX with role-aware messages and cleaner UI
- Backend: differentiate error messages for admin vs regular users in price.go
- Backend: include error_code in channel test response for structured error handling
- Frontend: render model_price_error as a styled card in Playground with admin nav button
- Frontend: show inline error details and settings link in channel test modal
- Frontend: parse error codes from both SSE and non-streaming API responses
- i18n: remove redundant "Settings" suffix from setting tab translations (en/fr/ru/ja/vi)
- i18n: update "Group & Model Pricing" translations across all locales
2026-04-11 17:19:38 +08:00
CaIon
040e8c1da8
feat: replace quota input with amount-first UI and atomic quota adjustment
- Refactor token, redemption, and user quota inputs to prioritize monetary
  amount entry, with raw quota input collapsed by default
- Add atomic quota adjustment modal for users with add/subtract/override modes,
  bypassing batch update queue for immediate DB consistency
- Make user quota fields readonly in edit form; all modifications go through
  the dedicated adjust-quota modal via POST /api/user/manage
- Add DecreaseUserQuota `db` parameter for direct DB writes, matching
  IncreaseUserQuota behavior
- Support negative quota display in amount conversion helpers
- Add i18n keys for all new UI strings across all locales
2026-04-09 22:44:53 +08:00
CaIon
4d2993e4cc
Merge remote-tracking branch 'origin/main' into nightly
Some checks failed
Release (Linux, macOS, Windows) / Linux Release (push) Has been cancelled
Release (Linux, macOS, Windows) / macOS Release (push) Has been cancelled
Release (Linux, macOS, Windows) / Windows Release (push) Has been cancelled
# Conflicts:
#	web/src/helpers/render.jsx
#	web/src/hooks/usage-logs/useUsageLogsData.jsx
#	web/src/i18n/locales/en.json
2026-04-09 17:12:21 +08:00
yyhhyyyyyy
0220df8429
fix(channel-test): support tiered billing model tests (#4145)
Pre-fill BillingRequestInput from dto.Request before ModelPriceHelper,
so tiered_expr billing resolves param() from the structured request
instead of reading HTTP body (which is empty in channel-test context).

- attachTestBillingRequestInput: marshal dto.Request → RequestInput
- ResolveIncomingBillingExprRequestInput: early-return when pre-filled
- settleTestQuota / buildTestLogOther: align test settlement & logging
  with production TryTieredSettle / InjectTieredBillingInfo paths
2026-04-09 17:08:52 +08:00
CaIon
606a4eee96
feat(dashboard): add admin user analytics and fix chart labels
- Add GET /api/data/users endpoint for user-grouped quota data (admin only)
- Add user consumption ranking (horizontal bar, top 10) and user consumption
  trend (area chart) tabs visible only to admin users
- Fix mislabeled "消耗趋势" tab to "调用趋势" (shows call counts, not quota)
- Add processUserData helper for user ranking and trend data extraction
- Add i18n keys for new tabs across all 7 locales
2026-04-08 15:44:01 +08:00
bbbugg
07843d7898 fix(pricing): add filtering for pricing based on usable groups 2026-04-07 15:56:28 +08:00
RedwindA
12a48c620e
feat(token): add batch API for fetching token keys
Add new endpoint POST /api/token/batch/keys to fetch multiple
token keys in a single request, improving performance when
exporting or copying multiple tokens.

- Backend: Add GetTokenKeysBatch controller and GetTokenKeysByIds model
- Backend: Add route with CriticalRateLimit and DisableCache middleware
- Frontend: Add fetchTokenKeysBatch helper function
- Frontend: Update useTokensData to use batch API for token export
2026-04-06 19:46:01 +08:00
CaIon
8fc0eb78e2
feat(billing): enhance task billing process with video input detection and updated pricing logic
- Added `EstimateBilling` function to check for video input in request metadata and return corresponding discount ratios.
- Updated `ModelPriceHelperPerCall` to incorporate new pricing logic based on model ratios and video input.
- Enhanced task billing logs to include model ratio information and adjusted calculations for actual quota based on additional multipliers.
- Introduced `renderTaskBillingProcess` to improve rendering of task billing information in the UI.
2026-04-06 15:54:55 +08:00
CaIon
670abee2f0 fix(EditChannelModal): enhance clipboard handling with error checks
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
Added checks to ensure clipboard functionality is available before attempting to read from it. Improved error handling during clipboard read operations to prevent unhandled exceptions.
2026-03-31 21:42:36 +08:00
CaIon
e099117c61 refactor: use POST for account binding endpoints and normalize reset responses
- Switch /api/oauth/email/bind and /api/oauth/wechat/bind from GET to
  POST with JSON body for better REST semantics
- Normalize password reset endpoint to return consistent responses
- Apply url.QueryEscape to WeChat code parameter for robustness
2026-03-31 18:44:40 +08:00
CaIon
20399d3c8f fix: harden SSRF protection for unauthenticated and user-level endpoints
- Add ValidateURLWithFetchSetting check before fetching MJ image URLs
  in RelayMidjourneyImage (unauthenticated endpoint)
- Add ValidateURLWithFetchSetting check before fetching video URLs
  in VideoProxy (upstream-controlled URL)
- Enable ApplyIPFilterForDomain by default to prevent DNS rebinding
  bypass of SSRF protection
- Elevate FetchModels endpoint from AdminAuth to RootAuth
- Update frontend: mark domain IP filtering as recommended, update
  description and i18n translations (zh-CN/zh-TW/en/fr/ja/ru/vi)
2026-03-31 17:57:47 +08:00
Calcium-Ion
49eb533aaf
Merge pull request #3381 from seefs001/feature/regex-ignored-upstream-models
feat: support regex-prefixed ignored upstream models
2026-03-23 15:02:44 +08:00
Seefs
f40eb4e5d2 fix: oauth bind callback handling 2026-03-23 00:48:55 +08:00
Seefs
45f65c297b feat: support regex-prefixed ignored upstream models 2026-03-22 15:43:03 +08:00
RedwindA
dcd0911612 fix: log management race condition, partial delete reporting, and UX issues
- Fix data race on gin.DefaultWriter during log rotation by adding LogWriterMu
- Report partial failure when some log files fail to delete instead of always returning success
- Fix misleading "logging disabled" banner shown before API responds
- Fix en.json translation for numeric validation message
2026-03-21 20:40:39 +08:00
RedwindA
e904579a5b feat: add server log file management to performance settings
Add API endpoints (GET/DELETE /api/performance/logs) to list and clean up
server log files by count or by age. Track the active log file path in
the logger to prevent deleting the currently open log. Add a management
UI section in the performance settings page with log directory info,
file statistics, and cleanup controls. Includes i18n translations for
all supported languages (en, fr, ja, ru, vi, zh-CN, zh-TW).
2026-03-21 20:06:49 +08:00
zhongyuan.zhao
d595ef4990 fix(waffo): remove dead gatewayOrderId code that never persisted
The code read orderData.AcquiringOrderID but never assigned it to
any TopUp field before calling Update(), making the block a no-op.
Removed since GatewayOrderId storage is not needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 15:57:56 +08:00
zhongyuan.zhao
202a433f86 feat(waffo): Waffo payment gateway integration with configurable methods
- Add Waffo payment SDK integration (waffo-go v1.3.1)
- Backend: webhook handler, pay endpoint, order lock race-condition fix
- Settings: full Waffo config (API keys, sandbox/prod, currency, pay methods)
- Frontend: Waffo payment buttons in topup page, admin settings panel
- i18n: Waffo-related translations for en/fr/ja/ru/vi/zh-TW

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 18:04:58 +08:00
Seefs
c77c82421e enhance channel key viewing 2026-03-15 00:23:13 +08:00
CaIon
d67f446b66 feat: implement token key fetching and masking in API responses
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
2026-03-08 22:40:40 +08:00
CaIon
50ec2bac6b fix(video_proxy): update task retrieval to include user ID for improved context 2026-03-06 22:06:42 +08:00
CaIon
c0a0285f74 fix: update language settings and improve model pricing editor for better clarity and functionality
Some checks failed
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (amd64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Build & push (arm64) [native] (push) Has been cancelled
Publish Docker image (Multi Registries, native amd64+arm64) / Create multi-arch manifests (Docker Hub) (push) Has been cancelled
2026-03-06 21:36:51 +08:00
Seefs
329416d67b fix(relay): skip retries for bad response body errors 2026-03-06 18:22:25 +08:00
feitianbubu
42500b3317 fix: fetch model add header passthrough rule key check 2026-03-05 17:49:36 +08:00
Seefs
f6f5a6f875 fix: refine upstream update ignore UX and detect behavior 2026-03-03 14:00:48 +08:00