feat(profile): 密钥管理入口 (Infisical) + CONTRIBUTING 基础设施访问段#303
feat(profile): 密钥管理入口 (Infisical) + CONTRIBUTING 基础设施访问段#303longsizhuo merged 3 commits intomainfrom
Conversation
和 AdminLinkIfOwnerAdmin 刻意分开:AdminLink 是 admin 专属入口,这个对所有登录 用户开放(只要访问的是自己主页)。对应的访问控制不在前端——Infisical 自己有 GitHub OAuth + project-level RBAC,非 admin 协作者登录后只看得到自己有权限的 secrets。 - 新加 DeveloperToolsIfOwner client 组件:owner 判定条件和 AdminLinkIfOwnerAdmin 保持一致(githubId 或 username 任一匹配即视为本人) - profile 页按钮栏里插在 AdminLink 前,顺序:编辑 → 密钥管理 → 管理员界面 → 排行 - data-umami-event 埋点 profile_devtools_secrets_click,方便看谁在用 - target=_blank 到 secrets.involutionhell.com(自托管 Infisical 实例)
新协作者进来要知道怎么登主站 / Infisical / pgAdmin,怎么申请 admin 角色, .env 文件的分布与规则。之前这些都在脑子里或散在 wiki 里,CONTRIBUTING 作为贡献指南得自带一份快速索引。 - 服务一览表:谁能进 / 登录方式 - admin 权限申请流程(别手工 insert user_accounts 踩孤儿坑) - .env 文件位置和为什么 prod/dev 故意不一样(链到 wiki changelog) - 个人主页的开发者自助入口说明 - Spring Boot 本地启动的 source .env 姿势(memory 里的 feedback_ih_backend_dev_start) 放在 🚀 开发环境 和 📚 文档规范 之间,让人 setup 完环境后紧接着看到。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
为个人主页增加一个仅“主页本人”可见的开发者工具入口(当前指向自托管 Infisical 密钥管理),并在 CONTRIBUTING.md 中补充基础设施访问说明,帮助协作者了解各服务的访问方式与权限申请流程。
Changes:
- 在个人主页按钮区新增
DeveloperToolsIfOwner,渲染 “密钥管理 ↗” 外链并增加 Umami 埋点 - 新增
DeveloperToolsIfOwner客户端组件:基于useAuth()判断“已登录 + 主页 owner” CONTRIBUTING.md增加“🔐 基础设施访问”章节并整理部分 Markdown 格式空行
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| app/u/[username]/page.tsx | 在个人主页按钮栏中加入开发者工具入口组件 |
| app/u/[username]/DeveloperToolsIfOwner.tsx | 新增仅 owner 可见的 Infisical 外链按钮 + Umami 事件 |
| CONTRIBUTING.md | 新增基础设施访问说明与本地启动/环境变量相关说明 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <Link | ||
| href="https://secrets.involutionhell.com" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="font-mono text-[11px] uppercase tracking-widest px-2 py-1 border border-[var(--foreground)] text-[var(--foreground)] hover:bg-[var(--foreground)] hover:text-[var(--background)] transition-colors font-bold" | ||
| data-umami-event="profile_devtools_secrets_click" | ||
| title="Infisical 密钥管理(GitHub OAuth 登录,按 project 权限查看)" |
There was a problem hiding this comment.
href is hard-coded to the production Infisical domain. Other “open external infra” links in the codebase are configurable via a NEXT_PUBLIC_* env override (e.g. pgAdmin uses NEXT_PUBLIC_PGADMIN_URL), which makes preview deployments / self-host / domain changes possible without code changes. Consider reading the URL from an env var (e.g. NEXT_PUBLIC_INFISICAL_URL) and documenting it in .env.sample.
| | 用途 | URL | 谁能进 | 登录方式 | | ||
| | ------------ | ----------------------------------------------- | --------------------------------------- | --------------------------------------- | | ||
| | 主站 | `https://involutionhell.com` | 所有登录用户 | GitHub OAuth | | ||
| | 后端 API | `https://api.involutionhell.com` | — (内部调用) | sa-token (cookie/header) | | ||
| | **密钥管理** | `https://secrets.involutionhell.com` | **所有登录协作者**,按 project 权限查看 | GitHub OAuth(复用主站 App) | | ||
| | 数据库管理 | `https://api.involutionhell.com/admin/pgadmin/` | **仅 admin** | 主站 cookie 自动通过 Caddy forward_auth | | ||
| | 网站分析 | `https://umami.involutionhell.com` | **仅 admin** | 本地 umami 账号 | |
There was a problem hiding this comment.
The “后端 API” row says auth is sa-token (cookie/header), but the frontend code actually sends the token under the satoken header and syncs a satoken cookie (see lib/use-auth.tsx). Please clarify the exact header/cookie key names here to avoid misconfiguration when people try to call the API directly.
| | 用途 | URL | 谁能进 | 登录方式 | | |
| | ------------ | ----------------------------------------------- | --------------------------------------- | --------------------------------------- | | |
| | 主站 | `https://involutionhell.com` | 所有登录用户 | GitHub OAuth | | |
| | 后端 API | `https://api.involutionhell.com` | — (内部调用) | sa-token (cookie/header) | | |
| | **密钥管理** | `https://secrets.involutionhell.com` | **所有登录协作者**,按 project 权限查看 | GitHub OAuth(复用主站 App) | | |
| | 数据库管理 | `https://api.involutionhell.com/admin/pgadmin/` | **仅 admin** | 主站 cookie 自动通过 Caddy forward_auth | | |
| | 网站分析 | `https://umami.involutionhell.com` | **仅 admin** | 本地 umami 账号 | | |
| | 用途 | URL | 谁能进 | 登录方式 | | |
| | ------------ | ----------------------------------------------- | --------------------------------------- | ---------------------------------------------------------- | | |
| | 主站 | `https://involutionhell.com` | 所有登录用户 | GitHub OAuth | | |
| | 后端 API | `https://api.involutionhell.com` | — (内部调用) | sa-token(header: `satoken` / cookie: `satoken`) | | |
| | **密钥管理** | `https://secrets.involutionhell.com` | **所有登录协作者**,按 project 权限查看 | GitHub OAuth(复用主站 App) | | |
| | 数据库管理 | `https://api.involutionhell.com/admin/pgadmin/` | **仅 admin** | 主站 cookie 自动通过 Caddy forward_auth | | |
| | 网站分析 | `https://umami.involutionhell.com` | **仅 admin** | 本地 umami 账号 | |
| - 本地 dev: | ||
| - 后端:`involution-hell-project/backend/.env`(`set -a && . ./.env && set +a` 注入 Spring Boot) | ||
| - 前端:`involution-hell-project/frontend/.env` | ||
| - 生产:`/home/ubuntu/involution-hell/.env`(**只在部署机**,不在仓库里;CI 不覆盖) | ||
| - 两份 .env **故意有差异**(PGHOST / SERVER_PORT / AUTH_URL)—— 不要强行统一,参见 wiki [Changelog 2026-04-17](https://github.com/InvolutionHell/involutionhell/wiki/Changelog-2026-04-17-Self-Hosted-Infra) 的架构说明 | ||
| - **所有秘密值**将来会迁到 Infisical 单一真源,`.env` 只存极少数 bootstrap 配置。改动期间前后仓两份并存,改值要同步改两处 |
There was a problem hiding this comment.
The .env paths here don’t match this repository’s layout (this repo has .env.sample at the root and typically uses .env.local for Next.js; there is no frontend/ directory in-repo). Please rewrite this section to describe the env file location(s) for this repo explicitly, and (if needed) separately describe the external backend repo’s .env so contributors don’t create files in non-existent paths.
| - 本地 dev: | |
| - 后端:`involution-hell-project/backend/.env`(`set -a && . ./.env && set +a` 注入 Spring Boot) | |
| - 前端:`involution-hell-project/frontend/.env` | |
| - 生产:`/home/ubuntu/involution-hell/.env`(**只在部署机**,不在仓库里;CI 不覆盖) | |
| - 两份 .env **故意有差异**(PGHOST / SERVER_PORT / AUTH_URL)—— 不要强行统一,参见 wiki [Changelog 2026-04-17](https://github.com/InvolutionHell/involutionhell/wiki/Changelog-2026-04-17-Self-Hosted-Infra) 的架构说明 | |
| - **所有秘密值**将来会迁到 Infisical 单一真源,`.env` 只存极少数 bootstrap 配置。改动期间前后仓两份并存,改值要同步改两处 | |
| - **本仓库(当前仓库)**: | |
| - 根目录的 `.env.sample` 是模板;本地开发时按需在**仓库根目录**创建 `.env.local` | |
| - 这个仓库里**没有** `frontend/` 目录,不要创建 `frontend/.env` | |
| - **外部后端仓库(如你同时在本地跑后端)**: | |
| - 后端的 `.env` 在**后端仓库自己的根目录/约定位置**,不在当前仓库内 | |
| - 如需注入 Spring Boot,进入后端仓库后再使用该仓库自己的 `.env`(例如 `set -a && . ./.env && set +a`) | |
| - **生产环境**:`/home/ubuntu/involution-hell/.env`(**只在部署机**,不在当前仓库里;CI 不覆盖) | |
| - 不同环境 / 不同仓库的 `.env` **故意有差异**(如 PGHOST / SERVER_PORT / AUTH_URL)—— 不要强行统一,参见 wiki [Changelog 2026-04-17](https://github.com/InvolutionHell/involutionhell/wiki/Changelog-2026-04-17-Self-Hosted-Infra) 的架构说明 | |
| - **所有秘密值**将来会迁到 Infisical 单一真源,`.env` 只存极少数 bootstrap 配置。改动期间若前后端仓库同时依赖本地配置,改值时请分别同步到各自仓库 |
| ./mvnw spring-boot:run | ||
| ``` | ||
|
|
||
| 前端 `BACKEND_URL` 指 `http://localhost:8081`,前后一致。 |
There was a problem hiding this comment.
This line hard-codes BACKEND_URL as http://localhost:8081, but the repo’s .env.sample currently documents BACKEND_URL=http://localhost:8080. To prevent local dev confusion, either align the port here with .env.sample or phrase it as “set BACKEND_URL to your backend’s local address (see .env.sample)”.
| 前端 `BACKEND_URL` 指 `http://localhost:8081`,前后一致。 | |
| 前端 `BACKEND_URL` 请设置为你本地后端的访问地址,具体示例请参见 `.env.sample`,并确保前后一致。 |
|
|
||
| 登录主站后,访问**自己**的个人主页 `/u/<你的 github id>`,在顶部按钮栏能看到: | ||
|
|
||
| - **密钥管理 ↗**(所有登录协作者可见) → 跳 Infisical |
There was a problem hiding this comment.
In this list you say “密钥管理 ↗(所有登录协作者可见)”, but the implementation only renders the button when the viewer is the profile owner (and logged in). Please reword this bullet to reflect the actual visibility rule (e.g. “所有登录协作者在访问自己主页时可见/仅本人可见”) to avoid readers thinking they’ll see it on others’ profiles.
| - **密钥管理 ↗**(所有登录协作者可见) → 跳 Infisical | |
| - **密钥管理 ↗**(所有登录协作者在访问自己主页时可见) → 跳 Infisical |
CR 指出 '所有登录协作者可见' 有歧义——按钮实现只在本人访问自己主页时 渲染,路人和其他登录用户在别人主页上看不到。Infisical 站本身才是对所有协作 者开放。分清楚两层语义避免贡献者迷惑。
变更
前端代码
CONTRIBUTING.md 新增 "🔐 基础设施访问" 段
相关 PR
部署顺序