Skip to content

merge landing page - #5806

Closed
refeiner wants to merge 3 commits into
QuantumNous:mainfrom
wuqiang44444444:main
Closed

refeiner wants to merge 3 commits into
QuantumNous:mainfrom
wuqiang44444444:main

Conversation

@refeiner

@refeiner refeiner commented Jun 29, 2026 •

Copy link
Copy Markdown

⚠️ 提交说明 / PR Notice

Important

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

📝 变更描述 / Description

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

🚀 变更类型 / Type of change

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

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

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

📸 运行证明 / Proof of Work

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

Summary by CodeRabbit

  • New Features

    • Redesigned the homepage with new sections for capabilities, trust, enterprise offerings, and an interactive playground.
    • Added localized marketing content across multiple languages.
    • Updated the homepage hero with clearer calls to action and endpoint copying.
    • Added a public filing link in the footer.
  • Bug Fixes

    • Hid self-registration entry points from the sign-in and header areas.
    • Removed broken icon usage for LinkedIn.
  • Documentation

    • Added dev notes covering recent build and homepage changes.

refeiner added 3 commits April 9, 2026 23:05
- redesign home page with modular section components
- add new sections: Hero, Capability, Enterprise, Playground, Trust
- add EndpointTicker and SectionHeader components
- update i18n translations for all supported locales
- update .gitignore to exclude docs/dev artifacts
@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR refactors the Home page from a monolithic component into five section components (Hero, Capability, Trust, Playground, Enterprise) with new CSS animations and i18n strings across 7 locales. It also comments out all self-registration UI entry points and fixes three build errors from dependency upgrades (Semi CSS import, LinkedIn icon, Air file-watcher config).

Changes

Build & Dev Tooling Fixes

Layer / File(s) Summary
Semi CSS import removal and LinkedIn icon swap
web/src/index.jsx, web/src/helpers/render.jsx
Removes the broken @douyinfe/semi-ui/dist/css/semi.css import and replaces SiLinkedin with FaLinkedin from react-icons/fa6.
Air watcher config and gitignore
.gitignore, docs/dev/2026-04-09-bugfix-build-errors.md
Adds tmp/main and .air.toml to .gitignore; documents the Air exclude_dir/include_ext fix for the too many open files error.

Self-Registration UI Removal

Layer / File(s) Summary
Route, login form, header, and invite link changes
web/src/App.jsx, web/src/components/auth/LoginForm.jsx, web/src/components/layout/headerbar/UserArea.jsx, web/src/components/topup/index.jsx, web/src/components/topup/InvitationCard.jsx, docs/dev/2026-04-09-refactor-disable-self-registration.md
Comments out the /register route, removes registration links from both login form render paths, simplifies the header to always show a rounded login-only button, and disables getAffLink fetching.

Home Page Redesign

Layer / File(s) Summary
i18n strings and Home.css animations
web/src/i18n/locales/zh-CN.json, web/src/i18n/locales/en.json, web/src/i18n/locales/zh-TW.json, web/src/i18n/locales/fr.json, web/src/i18n/locales/ja.json, web/src/i18n/locales/ru.json, web/src/i18n/locales/vi.json, web/src/pages/Home/Home.css
Adds capability/trust/enterprise marketing translation keys across all seven locales and introduces Home.css with keyframe animations, card styles, playground code block styles, and logo placeholder styles.
SectionHeader and EndpointTicker shared components
web/src/pages/Home/components/SectionHeader.jsx, web/src/pages/Home/components/EndpointTicker.jsx
Adds SectionHeader (title/subtitle with optional centering) and EndpointTicker (3-second cycling endpoint selector with clipboard copy button).
HeroSection component
web/src/pages/Home/sections/HeroSection.jsx
Adds HeroSection with animated blobs, localized title/subtitle, EndpointTicker, CTA buttons to /console and docs/GitHub, and a 30+ provider icon grid.
CapabilitySection, TrustSection, and EnterpriseSection
web/src/pages/Home/sections/CapabilitySection.jsx, web/src/pages/Home/sections/TrustSection.jsx, web/src/pages/Home/sections/EnterpriseSection.jsx
Three new grid-based section components using translated keys and Lucide icons: four capability cards, four trust cards with optional stat badges, and three enterprise delivery cards.
PlaygroundSection with typing animation
web/src/pages/Home/sections/PlaygroundSection.jsx
Adds an interactive code playground with cURL/Python/Node.js tabs, copy button, and a typing animation that progressively reveals a JSON response preview, resetting on tab change.
Home index wiring and footer
web/src/pages/Home/index.jsx, web/src/components/layout/Footer.jsx, 首页设计.md
Replaces the inline banner JSX with section component composition, consolidates mount effects, silences notice fetch errors, adds an ICP beian link to the footer, and removes the "New API" credit block.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HomeIndex
    participant HeroSection
    participant EndpointTicker
    participant Clipboard

    User->>HomeIndex: visits /
    HomeIndex->>HeroSection: render(serverAddress, endpointItems, isMobile, ...)
    HeroSection->>EndpointTicker: render(serverAddress, endpointItems)
    loop every 3 seconds
        EndpointTicker->>EndpointTicker: advance endpointIndex
    end
    User->>EndpointTicker: clicks copy button
    EndpointTicker->>Clipboard: copy(serverAddress)
    Clipboard-->>EndpointTicker: success
    EndpointTicker-->>User: showSuccess toast
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • QuantumNous/new-api#2455: Both PRs modify web/src/i18n/locales/fr.json by updating French translation strings for UI text.
  • QuantumNous/new-api#5232: Both PRs update the render.jsx OAuth provider icon mapping for linkedin from SiLinkedin to FaLinkedin.

Suggested reviewers

  • creamlike1024
  • seefs001

Poem

🐰 The homepage blooms in sections new,
With hero blobs of purple hue.
No register link shall linger here,
Just capability cards, crisp and clear!
The bunny hops past semi.css woes,
And FaLinkedin now proudly glows. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is related to the main change, but it is too generic to describe the redesigned homepage clearly. Rename it to something specific like "Redesign web landing page" or "Refactor homepage into modular landing sections".
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch main

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.

Warning

⚠️ This pull request shows signs of AI-generated slop (description_diff_mismatch, ai_padded_prose). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.

@refeiner refeiner closed this Jun 29, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.gitignore:
- Around line 32-33: The Air development workflow is inconsistent because the
repo ignores .air.toml while the docs still instruct developers to create it and
there is no tracked shared template. Update the workflow by either committing a
shared .air.toml configuration or adding a tracked .air.toml.example and keeping
the real .air.toml ignored, then align any documentation that references the
setup so developers know which file to use.

In `@docs/dev/2026-04-09-refactor-disable-self-registration.md`:
- Around line 34-36: The restore-path breadcrumbs in the LoginForm documentation
are outdated: the component now uses renderOAuthOptions() instead of
renderOAuthLoginForm(), and the second hidden registration-link block is around
the newer location near the email login section rather than the old referenced
line. Update the doc text so it points maintainers to the current symbol names
in LoginForm.jsx and the correct hidden-link blocks, keeping the “how to
restore” guidance accurate and easy to find.

In `@web/src/components/topup/index.jsx`:
- Around line 536-546: The invite card in topup/index.jsx is still rendered even
though getAffLink() and its mount effect are disabled, leaving InvitationCard
with an empty affLink and working copy controls. Update the InvitationCard
render path to use the same self-registration/registration-enabled flag that
guards getAffLink(), and hide or disable the entire card (or at minimum the link
and copy action) when invites are unavailable so users can’t copy a blank link
or see a success toast from an empty value.

In `@web/src/pages/Home/components/EndpointTicker.jsx`:
- Around line 46-51: The icon-only copy control in EndpointTicker’s Button is
missing an accessible name, so add an explicit label for the copy action using
the Button props (for example an aria-label or equivalent) while keeping the
existing handleCopy behavior and IconCopy icon unchanged.

In `@web/src/pages/Home/Home.css`:
- Around line 3-24: Rename the keyframes in Home.css from camelCase to
kebab-case to satisfy the keyframes-name-pattern rule. Update the `@keyframes`
declarations for fadeInUp, floatSlow, and typingCursor to kebab-case names, and
make sure every matching animation: reference in the Home styles uses the same
new names so the animations still resolve correctly.

In `@web/src/pages/Home/index.jsx`:
- Around line 111-113: The home page iframe sync only runs once because the
`useEffect` around `displayHomePageContent()` has an empty dependency list, so
theme/locale updates never reach URL-based homepages. Update the effect in
`Home/index.jsx` to re-run `displayHomePageContent` when the active theme or
language changes, using the relevant values such as `actualTheme` and
`i18n.language` in the dependency list. Make sure the same
`displayHomePageContent` path is used so iframe-backed homepages receive the
latest messaging after user preference changes.

In `@web/src/pages/Home/sections/HeroSection.jsx`:
- Around line 116-136: The external CTA handlers in HeroSection currently use
window.open with '_blank' without protecting against tab-nabbing. Update both
the GitHub button and the docsLink button in HeroSection.jsx to open with
noopener,noreferrer (or otherwise explicitly clear opener) so the new tabs
cannot access window.opener, especially for the config-driven docsLink path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cfa29607-2ded-49b2-8a83-b825ab7e7bc3

📥 Commits

Reviewing files that changed from the base of the PR and between 43591fb and 072c3be.

⛔ Files ignored due to path filters (1)
  • web/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (28)
  • .gitignore
  • docs/dev/2026-04-09-bugfix-build-errors.md
  • docs/dev/2026-04-09-refactor-disable-self-registration.md
  • web/src/App.jsx
  • web/src/components/auth/LoginForm.jsx
  • web/src/components/layout/Footer.jsx
  • web/src/components/layout/headerbar/UserArea.jsx
  • web/src/components/topup/InvitationCard.jsx
  • web/src/components/topup/index.jsx
  • web/src/helpers/render.jsx
  • web/src/i18n/locales/en.json
  • web/src/i18n/locales/fr.json
  • web/src/i18n/locales/ja.json
  • web/src/i18n/locales/ru.json
  • web/src/i18n/locales/vi.json
  • web/src/i18n/locales/zh-CN.json
  • web/src/i18n/locales/zh-TW.json
  • web/src/index.jsx
  • web/src/pages/Home/Home.css
  • web/src/pages/Home/components/EndpointTicker.jsx
  • web/src/pages/Home/components/SectionHeader.jsx
  • web/src/pages/Home/index.jsx
  • web/src/pages/Home/sections/CapabilitySection.jsx
  • web/src/pages/Home/sections/EnterpriseSection.jsx
  • web/src/pages/Home/sections/HeroSection.jsx
  • web/src/pages/Home/sections/PlaygroundSection.jsx
  • web/src/pages/Home/sections/TrustSection.jsx
  • 首页设计.md

Comment thread .gitignore
Comment on lines +32 to +33
tmp/main
.air.toml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if .air.toml exists and whether it's tracked
git ls-files .air.toml
cat .air.toml 2>/dev/null || echo "File not found"

Repository: QuantumNous/new-api

Length of output: 172


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== .gitignore context ==\n'
if [ -f .gitignore ]; then
  nl -ba .gitignore | sed -n '24,40p'
fi

printf '\n== .air.toml presence/tracking ==\n'
git ls-files -- .air.toml || true
[ -f .air.toml ] && { echo "exists"; sed -n '1,120p' .air.toml; } || echo "missing"

printf '\n== references to .air.toml ==\n'
rg -n --hidden --glob '!.git' '\.air\.toml|air\.toml' . || true

Repository: QuantumNous/new-api

Length of output: 223


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== .gitignore lines ==\n'
if [ -f .gitignore ]; then
  awk 'NR>=24 && NR<=40 { printf "%4d %s\n", NR, $0 }' .gitignore
fi

printf '\n== tracked .air.toml files ==\n'
git ls-files -- .air.toml .air.toml.example .air.toml.sample || true

printf '\n== references to air config ==\n'
rg -n --hidden --glob '!.git' '\.air\.toml|air\.toml|exclude_dir\s*=' . || true

Repository: QuantumNous/new-api

Length of output: 674


Clarify the .air.toml workflow

The docs still tell developers to create .air.toml, but it’s ignored here and there’s no committed .air.toml/.example in the repo. Either commit the shared Air config or add a tracked .air.toml.example and keep the real file ignored.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.gitignore around lines 32 - 33, The Air development workflow is
inconsistent because the repo ignores .air.toml while the docs still instruct
developers to create it and there is no tracked shared template. Update the
workflow by either committing a shared .air.toml configuration or adding a
tracked .air.toml.example and keeping the real .air.toml ignored, then align any
documentation that references the setup so developers know which file to use.

Comment on lines +34 to +36
### 2. 注释登录页注册链接 (`LoginForm.jsx`)

两处注册入口分别位于 `renderOAuthLoginForm()` 和 `renderEmailLoginForm()` 中的底部"没有账户?注册"链接,均替换为注释标记。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the LoginForm references to match the current code.

This log points maintainers to renderOAuthLoginForm() and L852, but the current component uses renderOAuthOptions() and the second hidden-link block is around Line 840. Since this doc is supposed to preserve a restore path, these breadcrumbs need to be accurate.

Also applies to: 51-55

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/dev/2026-04-09-refactor-disable-self-registration.md` around lines 34 -
36, The restore-path breadcrumbs in the LoginForm documentation are outdated:
the component now uses renderOAuthOptions() instead of renderOAuthLoginForm(),
and the second hidden registration-link block is around the newer location near
the email login section rather than the old referenced line. Update the doc text
so it points maintainers to the current symbol names in LoginForm.jsx and the
correct hidden-link blocks, keeping the “how to restore” guidance accurate and
easy to find.

Comment on lines +536 to +546
// 获取邀请链接 — Registration disabled, invite link won't work
// const getAffLink = async () => {
// const res = await API.get('/api/user/aff');
// const { success, message, data } = res.data;
// if (success) {
// let link = `${window.location.origin}/register?aff=${data}`;
// setAffLink(link);
// } else {
// showError(message);
// }
// };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Hide or disable the invite card together with this fetch path.

With getAffLink() and its mount effect disabled here, InvitationCard still renders with an empty affLink and an active copy action, so users can copy a blank string and still see a success toast. If self-registration is off, gate the whole card (or at least the link/copy controls) behind the same flag instead of only removing the fetch path.

Also applies to: 588-592

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/components/topup/index.jsx` around lines 536 - 546, The invite card
in topup/index.jsx is still rendered even though getAffLink() and its mount
effect are disabled, leaving InvitationCard with an empty affLink and working
copy controls. Update the InvitationCard render path to use the same
self-registration/registration-enabled flag that guards getAffLink(), and hide
or disable the entire card (or at minimum the link and copy action) when invites
are unavailable so users can’t copy a blank link or see a success toast from an
empty value.

Comment on lines +46 to +51
<Button
type='primary'
onClick={handleCopy}
icon={<IconCopy />}
className='!rounded-full'
/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Give the copy button an accessible name.

Line 46 renders an icon-only control with no text or aria-label, so screen readers just get an unnamed button here. Add an explicit label for the copy action.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/pages/Home/components/EndpointTicker.jsx` around lines 46 - 51, The
icon-only copy control in EndpointTicker’s Button is missing an accessible name,
so add an explicit label for the copy action using the Button props (for example
an aria-label or equivalent) while keeping the existing handleCopy behavior and
IconCopy icon unchanged.

Comment on lines +3 to +24
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(24px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

@keyframes floatSlow {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-18px);
}
}

@keyframes typingCursor {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Rename these keyframes to kebab-case.

Stylelint is already flagging fadeInUp, floatSlow, and typingCursor, so this file will fail the configured keyframes-name-pattern check until the declarations and matching animation: references use kebab-case.

Also applies to: 78-80, 109-115, 130-132

🧰 Tools
🪛 Stylelint (17.13.0)

[error] 3-3: Expected keyframe name "fadeInUp" to be kebab-case (keyframes-name-pattern)

(keyframes-name-pattern)


[error] 14-14: Expected keyframe name "floatSlow" to be kebab-case (keyframes-name-pattern)

(keyframes-name-pattern)


[error] 24-24: Expected keyframe name "typingCursor" to be kebab-case (keyframes-name-pattern)

(keyframes-name-pattern)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/pages/Home/Home.css` around lines 3 - 24, Rename the keyframes in
Home.css from camelCase to kebab-case to satisfy the keyframes-name-pattern
rule. Update the `@keyframes` declarations for fadeInUp, floatSlow, and
typingCursor to kebab-case names, and make sure every matching animation:
reference in the Home styles uses the same new names so the animations still
resolve correctly.

Source: Linters/SAST tools

Comment on lines 111 to 113
useEffect(() => {
displayHomePageContent().then();
displayHomePageContent();
}, []);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep iframe-backed homepages synced after theme/locale changes.

This only runs once, but the iframe messaging path in displayHomePageContent() uses the current actualTheme and i18n.language only during the initial load. If the user switches theme or language later, URL-based homepages stay stale until a full reload.

Suggested fix
   useEffect(() => {
     displayHomePageContent();
   }, []);
+
+  useEffect(() => {
+    if (!homePageContent.startsWith('https://')) return;
+    const iframe = document.querySelector('iframe');
+    if (!iframe?.contentWindow) return;
+    iframe.contentWindow.postMessage({ themeMode: actualTheme }, '*');
+    iframe.contentWindow.postMessage({ lang: i18n.language }, '*');
+  }, [actualTheme, i18n.language, homePageContent]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
displayHomePageContent().then();
displayHomePageContent();
}, []);
useEffect(() => {
displayHomePageContent();
}, []);
useEffect(() => {
if (!homePageContent.startsWith('https://')) return;
const iframe = document.querySelector('iframe');
if (!iframe?.contentWindow) return;
iframe.contentWindow.postMessage({ themeMode: actualTheme }, '*');
iframe.contentWindow.postMessage({ lang: i18n.language }, '*');
}, [actualTheme, i18n.language, homePageContent]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/pages/Home/index.jsx` around lines 111 - 113, The home page iframe
sync only runs once because the `useEffect` around `displayHomePageContent()`
has an empty dependency list, so theme/locale updates never reach URL-based
homepages. Update the effect in `Home/index.jsx` to re-run
`displayHomePageContent` when the active theme or language changes, using the
relevant values such as `actualTheme` and `i18n.language` in the dependency
list. Make sure the same `displayHomePageContent` path is used so iframe-backed
homepages receive the latest messaging after user preference changes.

Comment on lines +116 to +136
{isDemoSiteMode && statusVersion ? (
<Button
size={isMobile ? 'default' : 'large'}
className='flex items-center !rounded-3xl px-6 py-2'
icon={<IconGithubLogo />}
onClick={() =>
window.open(
'https://github.com/QuantumNous/new-api',
'_blank',
)
}
>
{statusVersion}
</Button>
) : (
docsLink && (
<Button
size={isMobile ? 'default' : 'large'}
className='flex items-center !rounded-3xl px-6 py-2'
icon={<IconFile />}
onClick={() => window.open(docsLink, '_blank')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n--- HeroSection.jsx ---\n'
sed -n '1,220p' web/src/pages/Home/sections/HeroSection.jsx | cat -n

printf '\n--- Home index.jsx docsLink source ---\n'
sed -n '1,220p' web/src/pages/Home/index.jsx | cat -n

printf '\n--- Search for other window.open usages in web/src/pages/Home ---\n'
rg -n "window\.open\(" web/src/pages/Home -S

Repository: QuantumNous/new-api

Length of output: 14004


Harden the external CTA opens in HeroSection.jsx.

Both window.open(..., '_blank') calls leave window.opener available; add noopener,noreferrer (or otherwise clear opener) so these tabs can’t tab-nab the page. This applies to both the GitHub and docs links, and the docsLink path is config-driven.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/pages/Home/sections/HeroSection.jsx` around lines 116 - 136, The
external CTA handlers in HeroSection currently use window.open with '_blank'
without protecting against tab-nabbing. Update both the GitHub button and the
docsLink button in HeroSection.jsx to open with noopener,noreferrer (or
otherwise explicitly clear opener) so the new tabs cannot access window.opener,
especially for the config-driven docsLink path.

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