Skip to content

fix: defaut ui triage - #4802

Merged
Calcium-Ion merged 2 commits into
mainfrom
fix/new-ui-triage
May 12, 2026
Merged

fix: defaut ui triage#4802
Calcium-Ion merged 2 commits into
mainfrom
fix/new-ui-triage

Conversation

@Calcium-Ion

@Calcium-Ion Calcium-Ion commented May 12, 2026

Copy link
Copy Markdown
Member

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • New Features

    • Module-level access control for rankings and pricing features
    • Theme-aware routing for console paths and redirects
    • Configurable rankings endpoint access based on configuration
  • Refactor

    • Unified payment return URL handling across all payment providers (Stripe, Epay, Waffo)
    • Improved group selection with fallback validation in playground
    • Enhanced sidebar module enablement detection for feature gating

Review Change Stack

…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
@Calcium-Ion Calcium-Ion changed the title Fix/new UI triage fix: new-ui-triage May 12, 2026
@Calcium-Ion Calcium-Ion changed the title fix: new-ui-triage fix: defaut ui triage May 12, 2026
@Calcium-Ion
Calcium-Ion merged commit 469d374 into main May 12, 2026
1 of 2 checks passed
@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf6f9b62-530f-43ae-b7ea-9f2ed8c8f465

📥 Commits

Reviewing files that changed from the base of the PR and between a720064 and 35f6880.

📒 Files selected for processing (27)
  • common/constants.go
  • controller/perf_metrics.go
  • controller/rankings.go
  • controller/return_path.go
  • controller/subscription_payment_epay.go
  • controller/subscription_payment_stripe.go
  • controller/telegram.go
  • controller/topup.go
  • controller/topup_stripe.go
  • controller/topup_waffo.go
  • controller/topup_waffo_pancake.go
  • service/quota.go
  • service/return_path.go
  • web/default/src/features/home/components/sections/hero.tsx
  • web/default/src/features/keys/components/api-keys-mutate-drawer.tsx
  • web/default/src/features/playground/constants.ts
  • web/default/src/features/playground/index.tsx
  • web/default/src/i18n/locales/en.json
  • web/default/src/i18n/locales/fr.json
  • web/default/src/i18n/locales/ja.json
  • web/default/src/i18n/locales/ru.json
  • web/default/src/i18n/locales/vi.json
  • web/default/src/i18n/locales/zh.json
  • web/default/src/lib/nav-modules.ts
  • web/default/src/routes/_authenticated/playground/index.tsx
  • web/default/src/routes/console/topup.tsx
  • web/default/src/routes/rankings/index.tsx

Walkthrough

This PR consolidates payment URL construction through theme-aware helpers, refactors ranking and metrics endpoints with feature gating, and enhances frontend module access control with route guards. Group selection logic is refactored to use backend availability checks, and hero messaging is updated to a static translated string across all locales.

Changes

Backend: Theme-Aware Paths, Payment Consolidation, and Feature Gating

Layer / File(s) Summary
Theme-aware path infrastructure
common/constants.go, controller/return_path.go, service/return_path.go
New ThemeAwarePath helper rewrites known /console/* paths to default-theme equivalents when active theme is "default"; controller and service layers provide paymentReturnPath and PaymentReturnURL helpers that normalize server address and append theme-aware paths for payment redirects.
Payment controller URL consolidation
controller/subscription_payment_epay.go, controller/subscription_payment_stripe.go, controller/topup.go, controller/topup_stripe.go, controller/topup_waffo.go, controller/topup_waffo_pancake.go, service/quota.go
All payment-related controllers and quota service refactored to use centralized paymentReturnPath or PaymentReturnURL helpers instead of direct system_setting.ServerAddress concatenation; removes redundant imports and unifies redirect URL construction across Epay, Stripe, Waffo, and Pancake payment flows.
Feature gating and metrics filtering
controller/rankings.go, controller/perf_metrics.go
Rankings endpoint conditionally returns 403 Forbidden based on isRankingsEnabled() which parses HeaderNavModules config; performance metrics responses filtered to retain only configured active groups from ratio settings while always including "auto" group.

Frontend: Module Access Control, Group Handling, and Messaging

Layer / File(s) Summary
Navigation module access infrastructure
web/default/src/lib/nav-modules.ts
New module exports ModuleAccess type with enabled and requireAuth flags, and provides getModuleAccess and isSidebarModuleEnabled functions that read cached localStorage status, parse configurations with fallback defaults, and determine module visibility and authentication requirements.
Route guards and module enforcement
web/default/src/routes/rankings/index.tsx, web/default/src/routes/_authenticated/playground/index.tsx
Rankings route adds beforeLoad guard that redirects to "/" when module is disabled or to "/sign-in" (with redirect target) when authentication is required; playground route enforces sidebar module enablement with redirect to "/dashboard" when disabled.
Group selection logic and defaults
web/default/src/features/playground/constants.ts, web/default/src/features/playground/index.tsx, web/default/src/features/keys/components/api-keys-mutate-drawer.tsx
DEFAULT_GROUP changed from "auto" to "default"; playground and API keys drawer components validate selected group against loaded backend groups, with revalidation effects that fall back to "default" or first available group when current selection is invalid; API keys drawer checks for backend "auto" availability before applying auto-related form defaults.
Top-up route search validation
web/default/src/routes/console/topup.tsx
Topup route adds Zod-based search parameter validation schema and extends beforeLoad to accept and merge existing search state while forcing show_history: true when redirecting to /wallet, preserving other search parameters.
Hero messaging and i18n updates
web/default/src/features/home/components/sections/hero.tsx, web/default/src/i18n/locales/en.json, web/default/src/i18n/locales/fr.json, web/default/src/i18n/locales/ja.json, web/default/src/i18n/locales/ru.json, web/default/src/i18n/locales/vi.json, web/default/src/i18n/locales/zh.json
Hero component removes useSystemConfig dependency and replaces dynamic systemName interpolation with static translated string "Power AI applications, manage digital assets, connect the Future"; all i18n locale files updated with the new marketing tagline translation.

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🐰 Through the corridors of URLs we hop,
Where themes rewrite the redirect stops,
With modules gated and groups made fair,
The hero's song floats through the air!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/new-ui-triage

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

xyfacai pushed a commit to xyfacai/new-api that referenced this pull request May 30, 2026
* 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 (QuantumNous#4765)
- Validate auto-group availability against getUserGroups before defaulting
  form values; playground falls back to 'default' group when 'auto' is
  unavailable (QuantumNous#4796, QuantumNous#4799)
- Enforce HeaderNavModules settings in rankings route (frontend + backend
  API) and SidebarModulesAdmin in playground route to block direct URL
  access when features are disabled (QuantumNous#4704, QuantumNous#4512)
- Filter perf_metrics API response to only include currently configured
  groups, hiding stale data from deleted groups (QuantumNous#4790)
- Preserve query params (pay=success/fail) in /console/topup → /wallet
  frontend redirect

* fix: update hero section text and localization strings for clarity
SamuelSxy pushed a commit to SamuelSxy/new-api-rh that referenced this pull request Jun 7, 2026
* 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 (QuantumNous#4765)
- Validate auto-group availability against getUserGroups before defaulting
  form values; playground falls back to 'default' group when 'auto' is
  unavailable (QuantumNous#4796, QuantumNous#4799)
- Enforce HeaderNavModules settings in rankings route (frontend + backend
  API) and SidebarModulesAdmin in playground route to block direct URL
  access when features are disabled (QuantumNous#4704, QuantumNous#4512)
- Filter perf_metrics API response to only include currently configured
  groups, hiding stale data from deleted groups (QuantumNous#4790)
- Preserve query params (pay=success/fail) in /console/topup → /wallet
  frontend redirect

* fix: update hero section text and localization strings for clarity
fx247562340 pushed a commit to fx247562340/vancine-platform that referenced this pull request Jun 11, 2026
* 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 (QuantumNous#4765)
- Validate auto-group availability against getUserGroups before defaulting
  form values; playground falls back to 'default' group when 'auto' is
  unavailable (QuantumNous#4796, QuantumNous#4799)
- Enforce HeaderNavModules settings in rankings route (frontend + backend
  API) and SidebarModulesAdmin in playground route to block direct URL
  access when features are disabled (QuantumNous#4704, QuantumNous#4512)
- Filter perf_metrics API response to only include currently configured
  groups, hiding stale data from deleted groups (QuantumNous#4790)
- Preserve query params (pay=success/fail) in /console/topup → /wallet
  frontend redirect

* fix: update hero section text and localization strings for clarity
@Calcium-Ion
Calcium-Ion deleted the fix/new-ui-triage branch June 13, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant