🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style(oauth-apps): rework the OAuth Apps settings flow (#20766)
Arvin Xud360dd2df049
diff --git a/.agents/skills/ux-audit/SKILL.md b/.agents/skills/ux-audit/SKILL.mdindex e99778df0c8..362c65baeaf 100644--- a/.agents/skills/ux-audit/SKILL.md+++ b/.agents/skills/ux-audit/SKILL.md@@ -228,8 +228,9 @@ good cases`), not a table footnote: bulleted **✅ 亮点** items, each naming tAn audit is not finished when the findings are written — it is finished when they are**landed**. All three steps below are **required** to close a run:-- **Concrete bugs** → fix the top 🔴, or file as Linear sub-issues under the "UX Audit"- parent (per-page container issue → one sub-issue per finding).+- **Concrete bugs** → fix them in the same run, every 🔴 at minimum. Anything left open stays+ in the report's gap list with the reason it was not fixed (needs a product decision, a+ server change, a render to confirm).- **Generalizable gaps → 回灌 `ux` (mandatory).** Every run **must** close the loop back intothe `ux` skill: for each finding that generalizes beyond this surface, add / strengthen a`ux` checklist item (rule + ✅/❌ example in the right module), citing the audited surfacediff --git a/.agents/skills/ux-audit/references/example/oauth-apps.md b/.agents/skills/ux-audit/references/example/oauth-apps.mdnew file mode 100644index 00000000000..b85573574d9--- /dev/null+++ b/.agents/skills/ux-audit/references/example/oauth-apps.md@@ -0,0 +1,220 @@+# Worked example — OAuth Apps settings (`/settings/oauth-apps`) audit++A real run of this skill against **Settings → OAuth 应用**, 2026-10 — a developer-console+surface where a user (or workspace admin) registers OAuth clients that sign in with LobeHub:+a list of apps, a create modal (logo / name / type / description), and an app detail page+(basic info, redirect URIs for web apps, credentials + metadata, usage stats, danger zone).+Use it as a template for the output shape, not as current-state truth (the code moves;+re-verify before citing).++**Surface class:** OAuth client registration console — benchmark against **GitHub → Developer+settings → OAuth Apps**, **Google Cloud → Credentials**, **Auth0 / Okta → Applications**.+Class norms: list shows each app's type + status; create asks only for what defines the app+(name, type, logo) and lands on the app page; the app page leads with the **credentials**+(client ID, secret) and the **integration endpoints** (issuer / discovery URL, authorize /+token URLs, or a quickstart link); a new secret is shown once, inline, with Copy; rotation can+be **zero-downtime** (GitHub keeps two secrets alive at once); disable / delete explain that+they break sign-in for every user of the app.++**Layers run:** L1 (static / code) for the audit. L2 started from two user-supplied screenshots+(the create modal; a new web app's page with the secret modal open). L2 + L3 then ran in full+during the fix's acceptance round, on a local stack in zh-CN: every fixed state was rendered,+the list and detail failures were forced by fault injection, and the disable flow was checked+against the database. That pass also surfaced ⑬.++**Load-bearing files:** `routes/(main)/[workspaceSlug]/settings/oauth-apps/index.tsx`,+`features/Settings/oauth-apps/{index, appList, freshSecret, redirectUris, useLogoUpload}.ts(x)`,+`features/Settings/oauth-apps/features/{OAuthApps, CreateAppButton}.tsx`,+`features/{AppItem, AppLogo, CreateAppModal, FreshSecretCard, ClientIdDisplay}`,+`features/AppDetail/{index, BasicInfoCard, RedirectUrisCard, SectionCard}.tsx`.++## 1 — Patterns in use++| Pattern (family) | Where | Rating | Note |+| ------------------------------------- | ------------------------------------------------------------------------------ | ------- | ------------------------------------------------------------- |+| Overview + Detail (data) | list row → `/settings/oauth-apps/:id` (`OAuthApps.tsx`) | ✅ | deep-linkable detail, back returns to list |+| Modal Panel (nav) | create modal (`CreateAppModal/index.tsx`) | ✅ 亮点 | mask-dismiss locks once dirty (`Content.tsx:150,155`) |+| Illustrated Choices (input) | app-type cards with icon + desc (`Content.tsx` `TypeSelect`) | ✅ | immutability stated at choice time (`Content.tsx:220-221`) |+| Same-Page / Inline Errors (input) | redirect URI row + list validation (`RedirectUrisCard.tsx`, `redirectUris.ts`) | ✅ 亮点 | rules shared with the server via `@lobechat/utils/oauthApp` |+| Titled Sections (layout) | `SectionCard` basic info / redirect URIs | ✅ | read-only until **Edit**, explicit Save / Cancel |+| Empty state as next step (onboarding) | redirect URIs "not configured" + **Configure** (`RedirectUrisCard.tsx:93,183`) | ✅ 亮点 | the label switches from Edit to Configure when nothing is set |+| One-time reveal (commands) | client secret — **was** a modal, now `FreshSecretCard` | ⚠️ → ✅ | gap ③ |+| Empty state — list (onboarding) | `OAuthApps.tsx` | ⚠️ → ✅ | was bare text, no CTA (gap ⑥) |+| Failure + Retry (feedback) | list fetch, detail fetch | — → ✅ | both were missing (gaps ①⑤) |+| Smart Defaults (input) | type defaults to CLI / device (`Content.tsx` `initialValues`) | ✅ | the most common case for this audience |+| Corner treatments / identity (visual) | app logo fallback | ⚠️ → ✅ | letter avatars of the name / a label (gap ④, L2) |+| Integration endpoints (class norm) | app detail | — → ✅ | issuer / discovery / endpoints card (gap ⑦) |++**Read:** the surface is **thoughtful in its forms** — what to ask up front, what to defer,+validation that mirrors the server, a modal that won't eat a half-typed app. Its weak spots+were the usual **Feedback / Read** ones (failures that look like "empty", a silent bounce) plus+two **visual-identity** misses the code could not show but the screenshots did (the logo+fallback, the secret modal stacked on the page). The one class-norm gap left open is+**getting from "app created" to "app integrated"**: the page never says where to send users.++## 2 — Strengths / good cases (don't regress)++- **✅ 亮点 — Create modal protects its draft.** Once any value changes, a mask click no longer+ dismisses the modal; ✕ / Esc still close it (`CreateAppModal/Content.tsx:150,155,165`). A+ half-typed app can't vanish on a stray click outside — Edit §2.1 done with one line.+- **✅ 亮点 — Ask only what defines the app; defer the rest to a real next step.** Redirect URIs+ are not in the create form. The app page shows a "not configured yet" warning and the card's+ button reads **Configure** instead of Edit (`RedirectUrisCard.tsx:93,183`). The type _is_+ asked up front because it decides whether a secret exists, and the form says it can't change+ later (`Content.tsx:220-221`). This is the right split between progressive disclosure and an+ irreversible choice.+- **✅ 亮点 — Validation shared with the server.** `redirectUris.ts` maps the same+ `validateRedirectUri` the server uses to row-level messages, with a separate list-level rule+ (at least one, at most the cap). Client and server can't disagree about what's valid.+- **✅ 亮点 — Only a touched logo is sent.** `BasicInfoCard.tsx:43,73` sends `logoUri` only when the+ user changed it, so renaming an older app whose inline `data:` logo the server now rejects+ doesn't fail on a field nobody touched. `useLogoUpload` uploads to storage because the OIDC+ provider rejects `data:` URIs — both are load-bearing correctness choices.+- **Rotation confirmation names the blast radius** ("deployments still using it will fail to+ sign users in"), and the secret is masked forever after (`secret.hidden`) — Act §3.8.+- **Edit forms reset on each Edit**, so Cancel needs no cleanup and a stale half-edit never+ reappears (`BasicInfoCard.tsx` `startEditing`).+- **Permission-gated Create with a reason tooltip** (`CreateAppButton.tsx:39`), matching the+ server's Admin-or-higher rule for workspace apps.++## 3 — Experience gaps (ranked)++**① List fetch failure rendered as "No OAuth apps yet" — Read §1.1, Feedback §4.2** 🔴 _fixed_+`OAuthApps.tsx` read only `{ data, isLoading }`; on error `!apps?.length` showed the empty copy+— a failed load posing as "you have none", with no retry. Now `resolveAppListState`+(`appList.ts`) returns `error` when nothing is cached, rendered as `AsyncError` + Retry; a+cached list survives a failed revalidation. Regression test: `appList.test.ts`.++**② Every list row said "Device Flow", including web apps — Read §1.12** 🟠 _fixed_+`AppItem.tsx` hard-coded `t('oauthApp.type.deviceFlow')` in the meta line, so a web app read as+a device app. Now `appTypeLabelKey(app.applicationType)` uses the same names as the create+form ("CLI / Device" / "Web App"). Regression test: `appList.test.ts`.++**③ New secret revealed in a modal over the page the user just landed on — Act §3.8** 🟠 _fixed_ (L2)+Creating a web app navigated to its page, then opened "Your client secret" as a modal on top+(screenshot). It blocked the page the secret belongs to, ✕ destroyed the only copy with no+confirmation, and its copy said "before closing". Now `FreshSecretCard` renders inline at the+top of the app page with Copy + "I've saved it"; the warning says "once you leave this page".+The create flow hands the plaintext over through an in-memory one-shot (`freshSecret.ts`), not+router state. Rotation uses the same card. → landed as ux Act §3.8.++**④ Logo fallback rendered a label or the name as giant glyphs — Read §1.14 (new)** 🟠 _fixed_ (L2)+The create modal passed the **name field's label** as the uploader's `title`, so the empty logo+showed "名称" as two oversized glyphs (screenshot). The detail header showed a 72px "LO"+monogram, and the list fed `app.logoUri || app.name` into `Avatar`. Now one `AppLogoPlaceholder`+(app-window glyph) is used by the list, the detail header and — with a dashed outline — both+logo uploaders. The create and edit forms put the logo beside the name instead of on a row of+its own. → landed as ux Read §1.14.++**⑤ Detail load failure silently bounced back to the list — Feedback §4.2** 🟠 _fixed_+`AppDetail` called `onBack()` on **any** error, so a network blip looked like the app had+vanished. Now only a settled "not found" goes back. An error renders `AsyncError` (page) with+**Back to list**, plus **Retry** when the error is retryable.++**⑥ Empty list was a line of grey text with no CTA — Read §1.1** 🟠 _fixed_+Now `Empty` with the app glyph, the existing copy, and the **Create App** button (extracted to+`CreateAppButton.tsx` so header and empty state share the permission logic).++**⑦ No path from "created" to "integrated" — Grow §5.3, Act §3.1** 🟠 _fixed_+The app page showed the client ID (and the secret once) but never the **issuer, discovery URL or+endpoints**, so a developer had to find them elsewhere. Every comparable console puts these+beside the credentials. Now an **Integration** card (`AppDetail/IntegrationCard.tsx`) lists the+issuer, discovery URL, the flow's own first endpoint (authorization for web, device+authorization for CLI / device) and the token endpoint, each copyable. The paths come from+`libs/oidc-provider/routes.ts`, which the provider configuration now uses too, so the page can't+drift from the routes. On desktop the origin is the connected server, not the renderer.+Regression test: `integrationEndpoints.test.ts`.++**⑧ Rotation is break-then-fix, single secret — class norm** 🟡 _open: needs a server change_+Rotation invalidates the old secret immediately (the confirmation says so). GitHub lets two+client secrets coexist so a deployment can switch before the old one is revoked. Fixing it needs+a second secret column (a migration), the adapter returning both, client authentication accepting+either (oidc-provider compares a single `client_secret`), and a "revoke previous secret" action.+That is an auth-layer change with its own rollout, so it is left out of this UI pass.++**⑨ Disable had no confirmation or consequence copy — Act §3.4** 🟡 _fixed_+The detail **Enabled** switch and the list menu's **Disable** fired immediately, yet disabling+makes the provider treat the client as unknown: sign-ins and token refreshes fail for every user.+Rotation was confirmed; disabling, the wider blast radius, was not. Now both paths go through+`confirmDisableOAuthApp` with the consequence spelled out. A disabled app shows a warning banner+with **Enable** at the top of its page, and the action lives in the danger zone with a description.++**⑩ Credentials, metadata and a state toggle shared one card — principle "Layout communicates role"** 🟡 _fixed_+Client ID / type / secret, created / last used, and the **Enabled** switch were rows in one card+below the redirect URIs. Now: a **Credentials** card right after basic info; created / last used+as a quiet line under the title; enable / disable and delete as described rows in the danger zone.++**⑪ Two warning-coloured blocks stacked on a brand-new web app — principle "Review messages in page context"** 🟡 _fixed_+The one-time secret card and the "no redirect URIs yet" alert were both yellow. Only the secret is+action-blocking right now; the redirect URI is the next setup step. The empty redirect state is+now a neutral dashed block with an **Add redirect URI** primary button.++**⑫ Small consistency misses** 🟡 _fixed_+Detail timestamps used `toLocaleString()` while the list used "last used 3 days ago"; both are+now relative. The back button was a hand-rolled `span` with its own hover CSS; it is now an+`ActionIcon`.++**⑬ Found while verifying on the render (L2)** 🟡 _fixed_+Four things the code read did not show. The empty state's Create button was a second primary+next to the header's, so it is now secondary. The confirm dialogs (disable, delete, rotate) showed+an English "Cancel" because `confirmModal` was called without `cancelText`. The open-source build's+usage-stats stub renders nothing, which left an empty bordered card, now hidden with `:empty`.+The secret card printed the backticks around `client_secret` literally, so the parameter now+renders as inline code.++**⑭ Owner review of the first acceptance round** _fixed_+The owner rejected three checks, and each rejection corrected the audit itself, not just the+fix:++- **③ was only half right.** Moving the secret from a modal to a yellow inline card fixed where+ it showed, not when it was minted. A web app's secret should not exist until the owner asks+ for it. Web apps are now created without a secret. The Credentials row offers **Generate+ secret**, reveals the value once in place in neutral styling, then shows it masked with+ **Rotate**. The OIDC adapter treats a secret-less web client as not found. → refined ux Act §3.8.+- **⑥'s empty state** was still inside the list's bordered frame, titled "No OAuth apps yet" and+ sharing the screen with the header's Create. It is now unframed, its title states the outcome+ ("Create your first OAuth app"), and it owns the single primary Create while the header hides+ its own. → ux Read §1.1.+- **④'s upload placeholder** had a filled background. An upload slot is now outline-only. The+ type cards also lost the 32px right gutter that had been reserved for the check mark, which+ wrapped the description early; the check now sits in the title row.++**⑮ Owner review of the second round** _fixed_++- **The reveal surface.** The in-row reveal was rejected. The owner wants a focused modal, but+ only as the response to their own Generate / Rotate click, with neutral styling instead of the+ first version's yellow alert. → ux Act §3.8 rewritten.+- **Detail page structure.** Three tabs: Basic Info / Credentials / Advanced, with the danger+ zone under Advanced and the tab in `?tab=`. The disabled banner now heads the page above the+ title. Integration leads with a **one-prompt integration**: a ready-to-paste instruction for a+ coding agent, filled with this app's client ID and endpoints. The raw URLs follow as+ "Manual setup".+- **List rows.** The client ID no longer shows in the row (it belongs on the app page). Type and+ last-used moved right, before the ⋮ menu. The chevron was removed.+- **Fills.** The selected type card loses its fill and keeps only the border. The edit form uses+ `filled` inputs.++**⑯ Owner review of the third round** _fixed_++- The landing tab is **Overview**: basic info plus the integration (one-prompt + manual setup)+ and usage stats. The Credentials tab keeps the client ID / secret and the redirect URIs.+- Advanced splits the reversible from the irreversible. Enable / disable is a plain **Status**+ section; only Delete stays in the danger zone.++## 4 — Skill feedback++- **New rule landed — Read §1.14** (gap ④): an entity with no image falls back to a shared+ **type glyph**, never a letter avatar of its name (CJK renders two oversized glyphs), and never+ a UI label passed as `title`. The same glyph is used on every surface; upload slots add only a+ dashed outline. Mirrored into the Quick review.+- **Rule refined — Act §3.8** (gap ③): the one-time reveal now says **where** it lives. When+ creation lands on the entity's page, show it inline there (dismissed by "I've saved it" or by+ leaving), not as a modal over the page. The warning names the real boundary. The plaintext is+ handed over through memory only, never router state. Quick-review cue updated.+- **Existing rules, new instances (no rule change):** Read §1.1 / Feedback §4.2 (failed list+ load posing as empty — gap ①; detail failure as a silent bounce — gap ⑤); Read §1.12 (a row+ label that isn't true for every row — gap ②); Grow §5.3 (configuration with no path onward to+ integration — gap ⑦).+- **Good cases worth landing later as ✅ examples:** the create modal's dirty-locks-mask-dismiss+ (Edit §2.1) and the Configure-vs-Edit empty config state (Read §1.1). Neither teaches the rule+ a new distinction, so they are recorded here rather than folded in.diff --git a/.agents/skills/ux/SKILL.md b/.agents/skills/ux/SKILL.mdindex 71002574164..b54aecd16ef 100644--- a/.agents/skills/ux/SKILL.md+++ b/.agents/skills/ux/SKILL.md@@ -119,6 +119,7 @@ Use this scan to identify applicable checks, then read the linked module for its- [ ] Keep populated lists visible beneath persistent composers; cap or collapse growing editors.- [ ] Status labels describe every member accurately.- [ ] Embedded documents collapse to titled rows and expand to full text with subordinate typography.+- [ ] Entities without an image fall back to a shared type glyph, never a letter avatar of the name or a UI label.**Edit — entering & changing content** ([edit.md](references/edit.md))@@ -139,7 +140,7 @@ Use this scan to identify applicable checks, then read the linked module for its- [ ] Provide the lifecycle operations appropriate to each entity's source; honor pin/keep/lock on every removal path.- [ ] Show the acting identity and an account-switch or re-authentication path.- [ ] Require a deliberate gesture for unrecoverable or broad destructive actions and report partial failure.-- [ ] Reveal newly minted secrets once with Copy, hash them at rest, and mask subsequent views.+- [ ] Reveal newly minted secrets once with Copy, then mask them; hash verify-only secrets and encrypt protocol credentials the server needs in plaintext; generate an entity's credential on demand in its own row, not at creation.- [ ] User-memory/profile stores support correction, retaining without use, export, and undo or soft-delete.**Feedback — loading & system response** ([feedback.md](references/feedback.md))diff --git a/.agents/skills/ux/references/act.md b/.agents/skills/ux/references/act.mdindex b9a1a7d1598..60146c6e886 100644--- a/.agents/skills/ux/references/act.md+++ b/.agents/skills/ux/references/act.md@@ -317,7 +317,7 @@ per Feedback §4.2 and §3.1's confirm → in-progress(locked) → done/**error*- [ ] Unrecoverable / wide-blast action requires an explicit deliberate gesture (type-to-confirm / checkbox), not a one-click danger button. _(Certainty)_- [ ] The destructive run is wrapped so a partial failure is reported (what failed), never silent half-completion. _(Meaningful・Certainty)_-## 3.8 Secrets are revealed once, stored hashed, masked thereafter・Certainty・Meaningful+## 3.8 Secrets are revealed once, stored safely, masked thereafter・Certainty・MeaningfulA surface that mints a **secret** — an API key, a personal access token, a webhook signingsecret — carries a security-shaped class norm every mature product follows (GitHub / OpenAI /@@ -330,16 +330,54 @@ key stays viewable — hides the missing one-time-reveal screen (the create resuonly because the secret is wrongly re-viewable). The one-time reveal is also a §3.5persistent-result state, not a toast: the user must be able to copy before dismissing.+**Hashed or encrypted depends on who checks the secret.** Hash a secret the product only ever+_verifies_ by comparison (an API key, a personal access token: the server hashes the presented+value and compares). A **protocol credential** the server must use in plaintext — an OAuth+client secret that `oidc-provider` compares during client authentication, a webhook signing+secret the server signs with — cannot be hashed; store it **reversibly encrypted** (key vault /+KMS), decrypt only inside the component that needs it, and still never return it to a browser+after the one-time reveal. Hashing a protocol credential breaks the flow; storing a+verify-only key reversibly widens the blast radius. Pick by the consumer, not by the word+"secret".++**When to mint, and where the reveal lives.** Distinguish a secret that _is_ the created+thing (an API key, a personal access token: the user created it to get the value) from a+credential that _belongs to_ a larger entity (an OAuth app's client secret, a webhook's signing+secret). For the first, the reveal is the create result. For the second, don't mint the secret+as a side effect of creating the entity: the user has just landed on a page with other setup+to do and is not ready to store it. Give the credential row a **Generate** action instead; once+one exists the row shows it masked with **Rotate** (confirmed, since rotating breaks live+deployments). The reveal that follows the user's own Generate / Rotate click is a **focused+modal** — the user asked for exactly this value and must copy it before doing anything else —+with Copy, a neutral "you won't see it again after closing" line (no warning-coloured block:+the reveal is routine, not an alarm), an explicit "I've saved it", and no mask-click dismiss.+What the modal must never do is open unprompted over a page the user just navigated to. An+entity whose secret has not been generated yet must be unusable server-side, not half-configured.+Changing when a server issues a secret is a contract change: keep the old behaviour as the+default for clients that don't ask for the new one.+> ❌ Settings **API Key**: `ApiKeyModel.query()` decrypts and returns the **full plaintext** on> every list fetch (`packages/database/src/models/apiKey.ts`), the table masks client-side only> with an eye-toggle that re-reveals at will, and create just closes the modal (result discarded)> — no one-time reveal. ✅ Hash at rest; return plaintext only from `createApiKey`; list returns> a masked prefix; on create, show a persistent reveal panel (full key + Copy + warning).+>+> ❌ Settings **OAuth Apps**, pre-fix: creating a web app minted its client secret and opened a+> "Your client secret" **modal** over the new app's page, dismissable by ✕ with no confirmation.+> A first fix moved it to a yellow inline card at the top of the page; the owner rejected that+> too (too loud, and still revealed at creation, when they weren't ready). ✅ Web apps are+> created without a secret; the Credentials card's secret row offers **Generate secret**, reveals+> the value once in place (neutral outlined box, Copy, "I've saved it"), then shows it masked with+> **Rotate**. Until a secret exists the OIDC adapter treats the client as not found+> (`oauth-apps/features/AppDetail/CredentialsCard.tsx`, `libs/oidc-provider/adapter.ts`).**Checklist**- [ ] A minted secret is shown in full exactly once at creation (persistent reveal + Copy + "won't see again"), not a toast. _(Meaningful・Certainty)_-- [ ] Secret stored hashed at rest; list / detail return a masked prefix, never re-reveal plaintext. _(Certainty)_+- [ ] At rest: a verify-only secret (API key, PAT) is hashed; a protocol credential the server needs in plaintext (OAuth client secret, signing secret) is reversibly encrypted and decrypted only where used. Either way, list / detail return a masked value and never re-reveal plaintext. _(Certainty)_+- [ ] A credential that belongs to a larger entity is generated on demand from its own row, not minted at entity creation; the entity is unusable until it exists. _(Natural・Certainty)_+- [ ] The reveal follows the user's own Generate / Rotate click in a focused, neutral modal (Copy, "I've saved it", no mask dismiss) — never a modal popped unprompted on page arrival. _(Natural・Certainty)_+- [ ] Changing when the server issues a secret keeps the old behaviour as the default for clients that don't opt in. _(Certainty)_## 3.9 A store of data about the user owes correction, retain-without-use, export & undo・Meaningful・Certaintydiff --git a/.agents/skills/ux/references/read.md b/.agents/skills/ux/references/read.mdindex e0f8d83d6e6..8960e43bdcd 100644--- a/.agents/skills/ux/references/read.md+++ b/.agents/skills/ux/references/read.md@@ -104,6 +104,7 @@ Distinguish `error` (transient → reason + retry, keep the URL) from a resolved- [ ] Empty state is a real page with explanation + CTA, not a blank screen. _(Meaningful)_- [ ] Empty variants distinguished: "no data yet" vs "no filter match". _(Certainty)_+- [ ] An empty state that replaces a list sits in place **unframed** (not inside the list's bordered container), its title states the outcome ("Create your first OAuth app", not "No apps yet"), and it owns the page's one primary action — the header hides its duplicate Create while empty. ❌ OAuth Apps, first pass: the empty state rendered inside the list frame with "No OAuth apps yet" next to a header Create button. _(Meaningful・Certainty)_- [ ] Error is checked **before** the empty branch — a failed fetch never renders as empty (`!error && length === 0` gates empty); read `error`, don't coerce `data ?? []`. _(Certainty・Meaningful)_- [ ] On a **metrics / aggregate** surface (dashboard, stats, cost), a failed fetch never falls through to a **zero-valued default** (`data?.summary ?? {…:0}`, `?? 0`) — a confident `$0` reads as real data, not "empty"; branch `error` before rendering any aggregate. _(Certainty・Meaningful)_- [ ] A list merged from a fetched set + a **static/frontend set** (`[...fetched, ...placeholders]`, a catalog padded with "coming soon" rows) branches `error` **before** merging — a failed fetch there keeps `length > 0` via the static entries, so neither the empty guard nor an error-unread call site catches it (a plausible partial catalog); `fallbackData: []` makes it automatic. _(Certainty・Meaningful)_@@ -553,3 +554,32 @@ material, not as the page.- [ ] An embedded document folds to a **titled row** (first meaningful line as label) that expands to full text — no first-N-px cropped preview with a fade. _(Natural)_- [ ] Quoted/embedded content is visually subordinated: a quiet container + capped heading scale, never sharing the host page's typographic hierarchy. _(Meaningful)_- [ ] A mask/fade helper's `size` unit is verified against its implementation (px vs %) before shipping — a wrong unit blanks real content. _(Certainty)_++## 1.14 An entity without an image falls back to its type glyph, not a letter avatar・Certainty・Natural++Entities that carry an optional image — an app logo, an agent avatar, a workspace icon — need+a **no-image** rendering, and the generic letter-avatar (`<Avatar title={name} />` with no+`avatar`) is the wrong default for most of them. It renders the first characters of the+name at half the avatar's size: Latin names become a shouting "LO" monogram, CJK names+become **two oversized glyphs** that overflow the tile, and the slot reads as an unfinished+state rather than "no logo set". Worse, the `title` that feeds it is easy to wire to the+wrong string: a **field label** passed as `title` makes every empty logo slot render that+label ("名称") as its avatar. Fall back to a **type-semantic glyph** (an app-window icon for+an OAuth app, the product's agent glyph for an agent) on a quiet fill, shared by every surface+that shows the entity — list row, detail header, edit form, create form — so "no logo" looks+the same everywhere. Where the same slot is also an **upload target**, the same glyph with a+dashed outline and no fill signals "you can set one" without a second placeholder style.++> ✅ OAuth apps: one `AppLogoPlaceholder` (app-window glyph, quiet fill) renders in the list+> row, the detail header and — outlined, unfilled — in the create / edit logo uploaders+> (`features/Settings/oauth-apps/features/AppLogo`).+> ❌ OAuth apps, pre-fix: the create modal passed the **name field's label** as the uploader's+> `title`, so the empty logo rendered "名称" as two giant glyphs; the detail header rendered a+> 72px "LO" monogram from the app name, and the list row fed `app.logoUri || app.name` straight+> into `Avatar` (`AppItem.tsx`).++**Checklist**++- [ ] An entity with no image renders a shared type glyph placeholder, not a letter avatar of its name — check a CJK name. _(Certainty)_+- [ ] A fallback `title` is the entity's own data, never a form label or other UI string. _(Certainty)_+- [ ] The placeholder is identical across list, detail, create and edit; upload slots differ only by an outline. _(Natural)_diff --git a/apps/server/src/globalConfig/getServerGlobalConfig.test.ts b/apps/server/src/globalConfig/getServerGlobalConfig.test.tsindex cdc8334a0ef..037b81d7352 100644--- a/apps/server/src/globalConfig/getServerGlobalConfig.test.ts+++ b/apps/server/src/globalConfig/getServerGlobalConfig.test.ts@@ -18,6 +18,7 @@ const mocks = vi.hoisted(() => ({interface MockGlobalConfigOptions {agentGatewayProtocol?: number;agentGatewayUrl?: string;+ appUrl?: string;enableAgentGateway?: boolean;toolNameMaxLengthEnv?: string;}@@ -44,6 +45,7 @@ const mockGlobalConfigDependencies = (? {}: { AGENT_GATEWAY_PROTOCOL: options.agentGatewayProtocol }),...(options.agentGatewayUrl ? { AGENT_GATEWAY_URL: options.agentGatewayUrl } : {}),+ ...(options.appUrl ? { APP_URL: options.appUrl } : {}),...(options.enableAgentGateway === undefined? {}: { ENABLE_AGENT_GATEWAY: options.enableAgentGateway }),@@ -278,4 +280,14 @@ describe('getServerGlobalConfig', () => {'https://device-gateway.example.com',);});++ it('should expose the OIDC issuer derived from APP_URL, as the provider does', async () => {+ await expect(+ loadServerConfig(false, { appUrl: 'https://chat.example.com/' }),+ ).resolves.toHaveProperty('oidcIssuer', 'https://chat.example.com/oidc');+ });++ it('should omit the OIDC issuer when APP_URL is not configured', async () => {+ await expect(loadServerConfig(false)).resolves.not.toHaveProperty('oidcIssuer');+ });});diff --git a/apps/server/src/globalConfig/index.ts b/apps/server/src/globalConfig/index.tsindex cbec817b53b..22865e9d2a8 100644--- a/apps/server/src/globalConfig/index.ts+++ b/apps/server/src/globalConfig/index.ts@@ -1,6 +1,7 @@import { ENABLE_BUSINESS_FEATURES } from '@lobechat/business-const';import { parseToolNameMaxLength } from '@lobechat/const/plugin';import { ModelProvider } from 'model-bank';+import urlJoin from 'url-join';import { composioEnv } from '@/config/composio';import { isDesktop } from '@/const/version';@@ -14,6 +15,7 @@ import { langfuseEnv } from '@/envs/langfuse';import { sandboxEnv } from '@/envs/sandbox';import { toolsEnv } from '@/envs/tools';import { parseSSOProviders } from '@/libs/better-auth/utils/server';+import { OIDC_ISSUER_PATH } from '@/libs/oidc-provider/routes';import { parseSystemAgent } from '@/server/globalConfig/parseSystemAgent';import { isLlmRelayDeploymentReady } from '@/server/modules/AgentRuntime/llmRelay/deployment';import { type GlobalServerConfig } from '@/types/serverConfig';@@ -169,6 +171,8 @@ export const getServerGlobalConfig = async () => {userMemory: cleanObject(getPublicMemoryExtractionConfig()),},oAuthSSOProviders: getBetterAuthSSOProviders(),+ // Same derivation as the provider's own issuer (`libs/oidc-provider/provider.ts`).+ ...(appEnv.APP_URL ? { oidcIssuer: urlJoin(appEnv.APP_URL, OIDC_ISSUER_PATH) } : undefined),systemAgent: parseSystemAgent(appEnv.SYSTEM_AGENT),telemetry: {langfuse: langfuseEnv.ENABLE_LANGFUSE,diff --git a/apps/server/src/routers/lambda/__tests__/oauthApp.test.ts b/apps/server/src/routers/lambda/__tests__/oauthApp.test.tsindex fedb5a8659b..d0e444448f5 100644--- a/apps/server/src/routers/lambda/__tests__/oauthApp.test.ts+++ b/apps/server/src/routers/lambda/__tests__/oauthApp.test.ts@@ -51,33 +51,46 @@ describe('oauthAppRouter', () => {beforeEach(() => {vi.clearAllMocks();- mockCreate.mockResolvedValue({ client: webApp, secret: 'lcs_plain' });+ mockCreate.mockResolvedValue({ client: { ...webApp, clientSecret: null } });});describe('create', () => {it('defaults to a device app when no type is given', async () => {- mockCreate.mockResolvedValue({- client: { ...webApp, clientSecret: null },- secret: undefined,- });+ mockCreate.mockResolvedValue({ client: { ...webApp, clientSecret: null } });await caller().create({ name: 'My CLI' });expect(mockCreate).toHaveBeenCalledWith(expect.objectContaining({ type: 'device' }));});- it('returns the plaintext secret exactly once, alongside hasSecret', async () => {+ it('keeps the original contract for clients that omit issueSecret', async () => {+ mockCreate.mockResolvedValue({ client: webApp, secret: 'lcs_plain' });+const created = await caller().create({name: 'Develop Center',redirectUris: ['https://dc.lobehub.com/callback'],type: 'web',});+ expect(mockCreate).toHaveBeenCalledWith(expect.objectContaining({ issueSecret: true }));expect(created.clientSecret).toBe('lcs_plain');expect(created.hasSecret).toBe(true);expect(created).not.toHaveProperty('clientSecret', 'iv:tag:cipher');});+ it('creates a web app without a secret when the client generates it on demand', async () => {+ const created = await caller().create({+ issueSecret: false,+ name: 'Develop Center',+ redirectUris: ['https://dc.lobehub.com/callback'],+ type: 'web',+ });++ expect(mockCreate).toHaveBeenCalledWith(expect.objectContaining({ issueSecret: false }));+ expect(created.clientSecret).toBeUndefined();+ expect(created.hasSecret).toBe(false);+ });+it('lets a web app be created before its redirect URIs are configured', async () => {await caller().create({ name: 'Develop Center', type: 'web' });diff --git a/apps/server/src/routers/lambda/oauthApp.ts b/apps/server/src/routers/lambda/oauthApp.tsindex 49bb4a18d56..46ae08dce73 100644--- a/apps/server/src/routers/lambda/oauthApp.ts+++ b/apps/server/src/routers/lambda/oauthApp.ts@@ -29,7 +29,8 @@ const oauthAppWriteProcedure = oauthAppProcedure.use(requireWorkspaceRoleWhenSco/*** The stored secret is encrypted and is never a useful thing to ship to a* browser, so every read path replaces it with a boolean. The plaintext is- * returned exactly once, by `create` and `rotateSecret`.+ * returned exactly once: by `rotateSecret` (which also issues a web app's+ * first secret on demand), or by `create` when the caller asks for it.*/const stripSecret = <T extends { clientSecret?: string | null }>(client: T) => {const { clientSecret, ...rest } = client;@@ -76,6 +77,12 @@ export const oauthAppRouter = router({// added, and the provider refuses any unregistered redirect in the meantime.z.object({description: z.string().max(500).optional(),+ // Defaults to the original contract: a web app's secret is issued at+ // creation and returned once. Clients released before generate-on-demand+ // (cached PWA tabs, shipped desktop builds) omit this and can only obtain+ // a first secret from this response — their detail page offers rotation+ // only once a secret exists. The current UI sends `false`.+ issueSecret: z.boolean().default(true),logoUri: logoUriSchema.optional(),name: z.string().min(1).max(64),redirectUris: redirectUrisSchema.optional(),@@ -85,7 +92,6 @@ export const oauthAppRouter = router({.mutation(async ({ input, ctx }) => {const { client, secret } = await ctx.oidcClientModel.create(input);- // The only time the plaintext secret ever leaves the server.return { ...stripSecret(client), clientSecret: secret };}),diff --git a/locales/ar/auth.json b/locales/ar/auth.jsonindex bf0f5d772a1..c4981a96ee1 100644--- a/locales/ar/auth.json+++ b/locales/ar/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "إلغاء","oauthApp.detail.clientId": "معرف العميل","oauthApp.detail.clientSecret": "السر الخاص بالعميل",- "oauthApp.detail.createdAt": "تاريخ الإنشاء","oauthApp.detail.dangerZone": "منطقة الخطر","oauthApp.detail.delete": "حذف التطبيق","oauthApp.detail.edit": "تعديل",- "oauthApp.detail.enabled": "ممكّن",- "oauthApp.detail.lastUsedAt": "آخر استخدام","oauthApp.detail.neverUsed": "لم يتم استخدامه مطلقًا",- "oauthApp.detail.noDescription": "لا يوجد وصف","oauthApp.detail.save": "حفظ التغييرات","oauthApp.detail.saveSuccess": "تم حفظ التغييرات","oauthApp.detail.title": "تفاصيل التطبيق",@@ -275,14 +271,12 @@"oauthApp.list.empty": "لا توجد تطبيقات OAuth حتى الآن. قم بإنشاء واحد للبدء.","oauthApp.list.neverUsed": "لم يتم استخدامه مطلقًا","oauthApp.redirectUris.add": "إضافة عنوان URI لإعادة التوجيه",- "oauthApp.redirectUris.configure": "تكوين","oauthApp.redirectUris.empty": "لا توجد عناوين URI لإعادة التوجيه حتى الآن. لا يمكن استخدام هذا التطبيق لتسجيل الدخول حتى تضيف واحدًا.","oauthApp.redirectUris.remove": "إزالة","oauthApp.redirectUris.title": "عناوين URI لإعادة التوجيه","oauthApp.secret.copy": "نسخ السر","oauthApp.secret.hidden": "مخفي بعد الإنشاء","oauthApp.secret.onceWarning": "هذه هي المرة الوحيدة التي يتم فيها عرض السر الخاص بالعميل. احفظه في مكان آمن قبل الإغلاق.",- "oauthApp.secret.revealTitle": "السر الخاص بالعميل الخاص بك","oauthApp.secret.rotate": "تدوير","oauthApp.secret.rotateConfirm.content": "يتوقف السر الحالي عن العمل فورًا. أي نشر لا يزال يستخدمه سيفشل في تسجيل دخول المستخدمين حتى تقوم بتحديثه.","oauthApp.secret.rotateConfirm.ok": "تدوير السر",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "الرموز","oauthApp.type.badge": "أصلي · تدفق الجهاز","oauthApp.type.device": "واجهة أوامر / جهاز",- "oauthApp.type.deviceFlow": "تدفق الجهاز","oauthApp.type.web": "تطبيق ويب","oauthApp.type.webBadge": "ويب · رمز التفويض","oauthApp.validation.nameRequired": "الاسم مطلوب",diff --git a/locales/bg-BG/auth.json b/locales/bg-BG/auth.jsonindex 2a7a121b686..980edd579d1 100644--- a/locales/bg-BG/auth.json+++ b/locales/bg-BG/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "Отказ","oauthApp.detail.clientId": "Идентификатор на клиента","oauthApp.detail.clientSecret": "Клиентски секрет",- "oauthApp.detail.createdAt": "Създадено","oauthApp.detail.dangerZone": "Опасна зона","oauthApp.detail.delete": "Изтрий приложението","oauthApp.detail.edit": "Редактиране",- "oauthApp.detail.enabled": "Активирано",- "oauthApp.detail.lastUsedAt": "Последно използвано","oauthApp.detail.neverUsed": "Никога не е използвано",- "oauthApp.detail.noDescription": "Няма описание","oauthApp.detail.save": "Запази промените","oauthApp.detail.saveSuccess": "Промените са запазени","oauthApp.detail.title": "Детайли за приложението",@@ -275,14 +271,12 @@"oauthApp.list.empty": "Все още няма OAuth приложения. Създайте едно, за да започнете.","oauthApp.list.neverUsed": "Никога не е използвано","oauthApp.redirectUris.add": "Добавяне на пренасочващ URI",- "oauthApp.redirectUris.configure": "Конфигуриране","oauthApp.redirectUris.empty": "Все още няма пренасочващи URIs. Това приложение не може да се използва за вход, докато не добавите такъв.","oauthApp.redirectUris.remove": "Премахване","oauthApp.redirectUris.title": "Пренасочващи URIs","oauthApp.secret.copy": "Копиране на секрета","oauthApp.secret.hidden": "Скрит след създаването","oauthApp.secret.onceWarning": "Това е единственият път, когато клиентският секрет се показва. Съхранете го на сигурно място, преди да затворите.",- "oauthApp.secret.revealTitle": "Вашият клиентски секрет","oauthApp.secret.rotate": "Ротация","oauthApp.secret.rotateConfirm.content": "Текущият секрет спира да работи незабавно. Всяко внедряване, което все още го използва, няма да може да удостоверява потребители, докато не го актуализирате.","oauthApp.secret.rotateConfirm.ok": "Ротиране на секрета",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Токени","oauthApp.type.badge": "Нативно · Устройство Flow","oauthApp.type.device": "CLI / Устройство",- "oauthApp.type.deviceFlow": "Устройство Flow","oauthApp.type.web": "Уеб приложение","oauthApp.type.webBadge": "Уеб · Код за удостоверяване","oauthApp.validation.nameRequired": "Името е задължително",diff --git a/locales/de-DE/auth.json b/locales/de-DE/auth.jsonindex 3331c13b947..9ede869c5ee 100644--- a/locales/de-DE/auth.json+++ b/locales/de-DE/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "Abbrechen","oauthApp.detail.clientId": "Client-ID","oauthApp.detail.clientSecret": "Client-Geheimnis",- "oauthApp.detail.createdAt": "Erstellt","oauthApp.detail.dangerZone": "Gefahrenzone","oauthApp.detail.delete": "App löschen","oauthApp.detail.edit": "Bearbeiten",- "oauthApp.detail.enabled": "Aktiviert",- "oauthApp.detail.lastUsedAt": "Zuletzt verwendet","oauthApp.detail.neverUsed": "Nie verwendet",- "oauthApp.detail.noDescription": "Keine Beschreibung","oauthApp.detail.save": "Änderungen speichern","oauthApp.detail.saveSuccess": "Änderungen gespeichert","oauthApp.detail.title": "App-Details",@@ -275,14 +271,12 @@"oauthApp.list.empty": "Noch keine OAuth-Apps. Erstellen Sie eine, um loszulegen.","oauthApp.list.neverUsed": "Nie verwendet","oauthApp.redirectUris.add": "Redirect-URI hinzufügen",- "oauthApp.redirectUris.configure": "Konfigurieren","oauthApp.redirectUris.empty": "Noch keine Redirect-URIs. Diese App kann nicht verwendet werden, um sich anzumelden, bis Sie eine hinzufügen.","oauthApp.redirectUris.remove": "Entfernen","oauthApp.redirectUris.title": "Redirect-URIs","oauthApp.secret.copy": "Geheimnis kopieren","oauthApp.secret.hidden": "Nach der Erstellung verborgen","oauthApp.secret.onceWarning": "Dies ist das einzige Mal, dass das Client-Geheimnis angezeigt wird. Speichern Sie es an einem sicheren Ort, bevor Sie schließen.",- "oauthApp.secret.revealTitle": "Ihr Client-Geheimnis","oauthApp.secret.rotate": "Rotieren","oauthApp.secret.rotateConfirm.content": "Das aktuelle Geheimnis funktioniert sofort nicht mehr. Jede Bereitstellung, die es noch verwendet, wird fehlschlagen, bis Sie es aktualisieren.","oauthApp.secret.rotateConfirm.ok": "Geheimnis rotieren",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Tokens","oauthApp.type.badge": "Native · Gerätefluss","oauthApp.type.device": "CLI / Gerät",- "oauthApp.type.deviceFlow": "Gerätefluss","oauthApp.type.web": "Web-App","oauthApp.type.webBadge": "Web · Autorisierungscode","oauthApp.validation.nameRequired": "Name ist erforderlich",diff --git a/locales/en-US/auth.json b/locales/en-US/auth.jsonindex e6bfae71639..d3b1b0f29c0 100644--- a/locales/en-US/auth.json+++ b/locales/en-US/auth.json@@ -239,18 +239,27 @@"oauthApp.detail.cancel": "Cancel","oauthApp.detail.clientId": "Client ID","oauthApp.detail.clientSecret": "Client Secret",- "oauthApp.detail.createdAt": "Created",+ "oauthApp.detail.createdRelative": "Created {{time}}",+ "oauthApp.detail.credentials": "Credentials","oauthApp.detail.dangerZone": "Danger Zone","oauthApp.detail.delete": "Delete App",+ "oauthApp.detail.deleteDesc": "Deletes the app and its authorizations. They can no longer be renewed, and the app loses access once its current tokens expire. This cannot be undone.",+ "oauthApp.detail.disableDesc": "Users can't sign in with this app and its tokens stop refreshing until you enable it again.","oauthApp.detail.edit": "Edit",- "oauthApp.detail.enabled": "Enabled",- "oauthApp.detail.lastUsedAt": "Last Used",+ "oauthApp.detail.enableDesc": "Let users sign in with this app again.","oauthApp.detail.neverUsed": "Never used",- "oauthApp.detail.noDescription": "No description","oauthApp.detail.save": "Save Changes","oauthApp.detail.saveSuccess": "Changes saved",+ "oauthApp.detail.status": "Status",+ "oauthApp.detail.tabs.advanced": "Advanced",+ "oauthApp.detail.tabs.credentials": "Credentials",+ "oauthApp.detail.tabs.overview": "Overview","oauthApp.detail.title": "App Details","oauthApp.detail.type": "Type",+ "oauthApp.disableConfirm.content": "Users can't sign in with this app and its tokens stop refreshing until you enable it again.",+ "oauthApp.disableConfirm.ok": "Disable",+ "oauthApp.disableConfirm.title": "Disable this app?",+ "oauthApp.disabled.banner": "This app is disabled. Users can't sign in with it until you enable it again.","oauthApp.form.description.label": "Description","oauthApp.form.description.placeholder": "What is this app for? (optional)","oauthApp.form.logo.label": "Logo",@@ -267,21 +276,39 @@"oauthApp.form.type.immutable": "The type cannot be changed after the app is created.","oauthApp.form.type.label": "Application Type","oauthApp.form.type.webDesc": "For server-side apps. Users are redirected back to your app, which authenticates with a client secret.",- "oauthApp.form.type.webNext": "You will add redirect URIs on the app page after it is created.",+ "oauthApp.form.type.webNext": "After it is created, add redirect URIs and generate a client secret on the app page.",+ "oauthApp.integration.authorization": "Authorization endpoint",+ "oauthApp.integration.copyPrompt": "Copy prompt",+ "oauthApp.integration.desc": "Point your OAuth / OIDC client at these URLs. Most libraries only need the issuer or the discovery URL.",+ "oauthApp.integration.deviceAuthorization": "Device authorization endpoint",+ "oauthApp.integration.discovery": "Discovery URL",+ "oauthApp.integration.endpoints": "Endpoint URLs",+ "oauthApp.integration.issuer": "Issuer",+ "oauthApp.integration.oneClick": "One-prompt integration",+ "oauthApp.integration.oneClickDesc": "Paste this prompt into a coding agent such as Claude Code or Codex to add LobeHub sign-in to your project.",+ "oauthApp.integration.prompt.device": "Add LobeHub sign-in to this command-line tool using the OAuth 2.0 device authorization flow.\n\n- Issuer: {{issuer}} (discover the endpoints from {{discovery}})\n- Client ID: {{clientId}} (public client, no secret)\n- Device authorization endpoint: {{deviceAuthorization}}\n- Token endpoint: {{token}}\n- Scopes: openid profile email offline_access\n\nRequest a device code, show the user the verification URL and code, and poll the token endpoint until they approve. Store the refresh token securely (for example in the OS keychain) and refresh the access token when it expires.",+ "oauthApp.integration.prompt.web": "Add \"Sign in with LobeHub\" to this project using OpenID Connect (authorization code flow with PKCE S256).\n\n- Issuer: {{issuer}} (discover the endpoints from {{discovery}})\n- Client ID: {{clientId}}\n- Client secret: read it from the LOBEHUB_CLIENT_SECRET environment variable and never hard-code it; send it as client_secret in the token request body (client_secret_post)\n- Scopes: openid profile email offline_access\n\nUse the OAuth / OIDC library this project already uses, or the standard one for its framework. Add a callback route, then tell me its full URL so I can register it as a redirect URI of the \"{{appName}}\" app. After sign-in, read the user's id (sub), name and email from the ID token.",+ "oauthApp.integration.promptCopied": "Prompt copied",+ "oauthApp.integration.title": "Integration",+ "oauthApp.integration.token": "Token endpoint","oauthApp.item.disabledTag": "Disabled","oauthApp.item.lastUsed": "Last used {{time}}","oauthApp.list.actions.create": "Create App","oauthApp.list.actions.delete": "Delete",- "oauthApp.list.empty": "No OAuth apps yet. Create one to get started.",+ "oauthApp.list.empty": "Let a CLI tool or your own website sign people in with their LobeHub account.",+ "oauthApp.list.emptyTitle": "Create your first OAuth app","oauthApp.list.neverUsed": "Never used","oauthApp.redirectUris.add": "Add redirect URI",- "oauthApp.redirectUris.configure": "Configure",- "oauthApp.redirectUris.empty": "No redirect URIs yet. This app can't be used to sign in until you add one.",+ "oauthApp.redirectUris.empty": "No redirect URIs yet. Add one so users can sign in with this app.","oauthApp.redirectUris.remove": "Remove","oauthApp.redirectUris.title": "Redirect URIs","oauthApp.secret.copy": "Copy secret",- "oauthApp.secret.hidden": "Hidden after creation",- "oauthApp.secret.onceWarning": "This is the only time the client secret is shown. Store it somewhere safe before closing.",+ "oauthApp.secret.dismiss": "I've saved it",+ "oauthApp.secret.generate": "Generate secret",+ "oauthApp.secret.hidden": "Hidden once generated",+ "oauthApp.secret.issueFailed": "The client secret couldn't be generated. Try again.",+ "oauthApp.secret.notGenerated": "Not generated yet",+ "oauthApp.secret.onceWarning": "You won't be able to see this secret again after closing. Copy it now and store it somewhere safe.","oauthApp.secret.revealTitle": "Your client secret","oauthApp.secret.rotate": "Rotate","oauthApp.secret.rotateConfirm.content": "The current secret stops working immediately. Any deployment still using it will fail to sign users in until you update it.",@@ -298,7 +325,6 @@"oauthApp.stats.tokens": "Tokens","oauthApp.type.badge": "Native · Device Flow","oauthApp.type.device": "CLI / Device",- "oauthApp.type.deviceFlow": "Device Flow","oauthApp.type.web": "Web App","oauthApp.type.webBadge": "Web · Authorization Code","oauthApp.validation.nameRequired": "Name is required",diff --git a/locales/es-ES/auth.json b/locales/es-ES/auth.jsonindex 8eda8893ff8..6f3dc20e7f4 100644--- a/locales/es-ES/auth.json+++ b/locales/es-ES/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "Cancelar","oauthApp.detail.clientId": "ID de cliente","oauthApp.detail.clientSecret": "Secreto del cliente",- "oauthApp.detail.createdAt": "Creado","oauthApp.detail.dangerZone": "Zona de peligro","oauthApp.detail.delete": "Eliminar aplicación","oauthApp.detail.edit": "Editar",- "oauthApp.detail.enabled": "Activado",- "oauthApp.detail.lastUsedAt": "Último uso","oauthApp.detail.neverUsed": "Nunca usado",- "oauthApp.detail.noDescription": "Sin descripción","oauthApp.detail.save": "Guardar cambios","oauthApp.detail.saveSuccess": "Cambios guardados","oauthApp.detail.title": "Detalles de la aplicación",@@ -275,14 +271,12 @@"oauthApp.list.empty": "Aún no hay aplicaciones OAuth. Crea una para comenzar.","oauthApp.list.neverUsed": "Nunca usado","oauthApp.redirectUris.add": "Agregar URI de redirección",- "oauthApp.redirectUris.configure": "Configurar","oauthApp.redirectUris.empty": "Aún no hay URIs de redirección. Esta aplicación no se puede usar para iniciar sesión hasta que agregues una.","oauthApp.redirectUris.remove": "Eliminar","oauthApp.redirectUris.title": "URIs de redirección","oauthApp.secret.copy": "Copiar secreto","oauthApp.secret.hidden": "Oculto después de la creación","oauthApp.secret.onceWarning": "Esta es la única vez que se muestra el secreto del cliente. Guárdalo en un lugar seguro antes de cerrar.",- "oauthApp.secret.revealTitle": "Tu secreto del cliente","oauthApp.secret.rotate": "Rotar","oauthApp.secret.rotateConfirm.content": "El secreto actual deja de funcionar inmediatamente. Cualquier implementación que aún lo use fallará al iniciar sesión hasta que lo actualices.","oauthApp.secret.rotateConfirm.ok": "Rotar secreto",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Tokens","oauthApp.type.badge": "Nativo · Flujo de dispositivo","oauthApp.type.device": "CLI / Dispositivo",- "oauthApp.type.deviceFlow": "Flujo de dispositivo","oauthApp.type.web": "Aplicación web","oauthApp.type.webBadge": "Web · Código de autorización","oauthApp.validation.nameRequired": "El nombre es obligatorio",diff --git a/locales/fa-IR/auth.json b/locales/fa-IR/auth.jsonindex a299ecbc70c..3ab68852842 100644--- a/locales/fa-IR/auth.json+++ b/locales/fa-IR/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "لغو","oauthApp.detail.clientId": "شناسه کلاینت","oauthApp.detail.clientSecret": "کلید مخفی کلاینت",- "oauthApp.detail.createdAt": "ایجاد شده","oauthApp.detail.dangerZone": "منطقه خطر","oauthApp.detail.delete": "حذف اپلیکیشن","oauthApp.detail.edit": "ویرایش",- "oauthApp.detail.enabled": "فعال",- "oauthApp.detail.lastUsedAt": "آخرین استفاده","oauthApp.detail.neverUsed": "هرگز استفاده نشده",- "oauthApp.detail.noDescription": "بدون توضیح","oauthApp.detail.save": "ذخیره تغییرات","oauthApp.detail.saveSuccess": "تغییرات ذخیره شد","oauthApp.detail.title": "جزئیات اپلیکیشن",@@ -275,14 +271,12 @@"oauthApp.list.empty": "هنوز هیچ اپلیکیشن OAuth وجود ندارد. یکی ایجاد کنید تا شروع کنید.","oauthApp.list.neverUsed": "هرگز استفاده نشده","oauthApp.redirectUris.add": "اضافه کردن آدرس بازگشت",- "oauthApp.redirectUris.configure": "پیکربندی","oauthApp.redirectUris.empty": "هنوز هیچ آدرس بازگشتی وجود ندارد. این برنامه نمیتواند برای ورود استفاده شود تا زمانی که یکی اضافه کنید.","oauthApp.redirectUris.remove": "حذف","oauthApp.redirectUris.title": "آدرسهای بازگشت","oauthApp.secret.copy": "کپی کلید مخفی","oauthApp.secret.hidden": "پس از ایجاد مخفی است","oauthApp.secret.onceWarning": "این تنها زمانی است که کلید مخفی کلاینت نمایش داده میشود. قبل از بستن آن را در جایی امن ذخیره کنید.",- "oauthApp.secret.revealTitle": "کلید مخفی کلاینت شما","oauthApp.secret.rotate": "چرخش","oauthApp.secret.rotateConfirm.content": "کلید مخفی فعلی بلافاصله از کار میافتد. هر استقراری که هنوز از آن استفاده میکند، تا زمانی که آن را بهروزرسانی کنید، نمیتواند کاربران را وارد کند.","oauthApp.secret.rotateConfirm.ok": "چرخش کلید مخفی",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "توکنها","oauthApp.type.badge": "بومی · جریان دستگاه","oauthApp.type.device": "CLI / دستگاه",- "oauthApp.type.deviceFlow": "جریان دستگاه","oauthApp.type.web": "برنامه وب","oauthApp.type.webBadge": "وب · کد مجوز","oauthApp.validation.nameRequired": "نام الزامی است",diff --git a/locales/fr-FR/auth.json b/locales/fr-FR/auth.jsonindex aa6c54d31fd..f5d1bd11709 100644--- a/locales/fr-FR/auth.json+++ b/locales/fr-FR/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "Annuler","oauthApp.detail.clientId": "ID client","oauthApp.detail.clientSecret": "Secret client",- "oauthApp.detail.createdAt": "Créé","oauthApp.detail.dangerZone": "Zone de danger","oauthApp.detail.delete": "Supprimer l'application","oauthApp.detail.edit": "Modifier",- "oauthApp.detail.enabled": "Activé",- "oauthApp.detail.lastUsedAt": "Dernière utilisation","oauthApp.detail.neverUsed": "Jamais utilisé",- "oauthApp.detail.noDescription": "Aucune description","oauthApp.detail.save": "Enregistrer les modifications","oauthApp.detail.saveSuccess": "Modifications enregistrées","oauthApp.detail.title": "Détails de l'application",@@ -275,14 +271,12 @@"oauthApp.list.empty": "Aucune application OAuth pour le moment. Créez-en une pour commencer.","oauthApp.list.neverUsed": "Jamais utilisé","oauthApp.redirectUris.add": "Ajouter une URI de redirection",- "oauthApp.redirectUris.configure": "Configurer","oauthApp.redirectUris.empty": "Aucune URI de redirection pour le moment. Cette application ne peut pas être utilisée pour se connecter tant que vous n'en ajoutez pas une.","oauthApp.redirectUris.remove": "Supprimer","oauthApp.redirectUris.title": "URIs de redirection","oauthApp.secret.copy": "Copier le secret","oauthApp.secret.hidden": "Caché après la création","oauthApp.secret.onceWarning": "C'est la seule fois où le secret client est affiché. Stockez-le en lieu sûr avant de fermer.",- "oauthApp.secret.revealTitle": "Votre secret client","oauthApp.secret.rotate": "Faire tourner","oauthApp.secret.rotateConfirm.content": "Le secret actuel cesse de fonctionner immédiatement. Tout déploiement l'utilisant échouera à connecter les utilisateurs tant que vous ne le mettez pas à jour.","oauthApp.secret.rotateConfirm.ok": "Faire tourner le secret",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Jetons","oauthApp.type.badge": "Natif · Flux de périphérique","oauthApp.type.device": "CLI / Appareil",- "oauthApp.type.deviceFlow": "Flux de périphérique","oauthApp.type.web": "Application Web","oauthApp.type.webBadge": "Web · Code d'autorisation","oauthApp.validation.nameRequired": "Le nom est requis",diff --git a/locales/it-IT/auth.json b/locales/it-IT/auth.jsonindex 7d537c2bc65..60b5bbe0c22 100644--- a/locales/it-IT/auth.json+++ b/locales/it-IT/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "Annulla","oauthApp.detail.clientId": "ID client","oauthApp.detail.clientSecret": "Segreto del client",- "oauthApp.detail.createdAt": "Creato","oauthApp.detail.dangerZone": "Zona pericolosa","oauthApp.detail.delete": "Elimina app","oauthApp.detail.edit": "Modifica",- "oauthApp.detail.enabled": "Abilitato",- "oauthApp.detail.lastUsedAt": "Ultimo utilizzo","oauthApp.detail.neverUsed": "Mai utilizzato",- "oauthApp.detail.noDescription": "Nessuna descrizione","oauthApp.detail.save": "Salva modifiche","oauthApp.detail.saveSuccess": "Modifiche salvate","oauthApp.detail.title": "Dettagli app",@@ -275,14 +271,12 @@"oauthApp.list.empty": "Non ci sono ancora app OAuth. Creane una per iniziare.","oauthApp.list.neverUsed": "Mai utilizzato","oauthApp.redirectUris.add": "Aggiungi URI di reindirizzamento",- "oauthApp.redirectUris.configure": "Configura","oauthApp.redirectUris.empty": "Nessun URI di reindirizzamento ancora. Questa app non può essere utilizzata per accedere finché non ne aggiungi uno.","oauthApp.redirectUris.remove": "Rimuovi","oauthApp.redirectUris.title": "URI di reindirizzamento","oauthApp.secret.copy": "Copia segreto","oauthApp.secret.hidden": "Nascosto dopo la creazione","oauthApp.secret.onceWarning": "Questa è l'unica volta in cui il segreto del client viene mostrato. Conservalo in un luogo sicuro prima di chiudere.",- "oauthApp.secret.revealTitle": "Il tuo segreto del client","oauthApp.secret.rotate": "Ruota","oauthApp.secret.rotateConfirm.content": "Il segreto attuale smette di funzionare immediatamente. Qualsiasi distribuzione che lo utilizza non sarà in grado di autenticare gli utenti finché non lo aggiorni.","oauthApp.secret.rotateConfirm.ok": "Ruota segreto",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Token","oauthApp.type.badge": "Nativo · Device Flow","oauthApp.type.device": "CLI / Dispositivo",- "oauthApp.type.deviceFlow": "Device Flow","oauthApp.type.web": "App Web","oauthApp.type.webBadge": "Web · Codice di autorizzazione","oauthApp.validation.nameRequired": "Il nome è obbligatorio",diff --git a/locales/ja-JP/auth.json b/locales/ja-JP/auth.jsonindex a819a9cf0ae..c6eba1bf7b8 100644--- a/locales/ja-JP/auth.json+++ b/locales/ja-JP/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "キャンセル","oauthApp.detail.clientId": "クライアントID","oauthApp.detail.clientSecret": "クライアントシークレット",- "oauthApp.detail.createdAt": "作成日","oauthApp.detail.dangerZone": "危険ゾーン","oauthApp.detail.delete": "アプリを削除","oauthApp.detail.edit": "編集",- "oauthApp.detail.enabled": "有効",- "oauthApp.detail.lastUsedAt": "最終使用日","oauthApp.detail.neverUsed": "未使用",- "oauthApp.detail.noDescription": "説明なし","oauthApp.detail.save": "変更を保存","oauthApp.detail.saveSuccess": "変更が保存されました","oauthApp.detail.title": "アプリ詳細",@@ -275,14 +271,12 @@"oauthApp.list.empty": "OAuthアプリはまだありません。作成して始めましょう。","oauthApp.list.neverUsed": "未使用","oauthApp.redirectUris.add": "リダイレクトURIを追加",- "oauthApp.redirectUris.configure": "設定","oauthApp.redirectUris.empty": "まだリダイレクトURIがありません。このアプリはリダイレクトURIを追加するまでサインインに使用できません。","oauthApp.redirectUris.remove": "削除","oauthApp.redirectUris.title": "リダイレクトURI","oauthApp.secret.copy": "シークレットをコピー","oauthApp.secret.hidden": "作成後は非表示","oauthApp.secret.onceWarning": "クライアントシークレットが表示されるのはこれが唯一の機会です。閉じる前に安全な場所に保存してください。",- "oauthApp.secret.revealTitle": "クライアントシークレット","oauthApp.secret.rotate": "ローテーション","oauthApp.secret.rotateConfirm.content": "現在のシークレットは直ちに無効になります。それを使用しているデプロイメントは、更新されるまでサインインに失敗します。","oauthApp.secret.rotateConfirm.ok": "シークレットをローテーション",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "トークン","oauthApp.type.badge": "ネイティブ · デバイスフロー","oauthApp.type.device": "CLI / デバイス",- "oauthApp.type.deviceFlow": "デバイスフロー","oauthApp.type.web": "ウェブアプリ","oauthApp.type.webBadge": "ウェブ · 認可コード","oauthApp.validation.nameRequired": "名前は必須です",diff --git a/locales/ko-KR/auth.json b/locales/ko-KR/auth.jsonindex 9e117e8ad22..908e91e2029 100644--- a/locales/ko-KR/auth.json+++ b/locales/ko-KR/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "취소","oauthApp.detail.clientId": "클라이언트 ID","oauthApp.detail.clientSecret": "클라이언트 비밀키",- "oauthApp.detail.createdAt": "생성일","oauthApp.detail.dangerZone": "위험 구역","oauthApp.detail.delete": "앱 삭제","oauthApp.detail.edit": "편집",- "oauthApp.detail.enabled": "활성화됨",- "oauthApp.detail.lastUsedAt": "마지막 사용일","oauthApp.detail.neverUsed": "사용된 적 없음",- "oauthApp.detail.noDescription": "설명이 없습니다","oauthApp.detail.save": "변경 사항 저장","oauthApp.detail.saveSuccess": "변경 사항이 저장되었습니다","oauthApp.detail.title": "앱 세부 정보",@@ -275,14 +271,12 @@"oauthApp.list.empty": "OAuth 앱이 아직 없습니다. 시작하려면 하나를 생성하세요.","oauthApp.list.neverUsed": "사용된 적 없음","oauthApp.redirectUris.add": "리디렉션 URI 추가",- "oauthApp.redirectUris.configure": "구성","oauthApp.redirectUris.empty": "아직 리디렉션 URI가 없습니다. 리디렉션 URI를 추가하기 전까지 이 앱은 로그인에 사용할 수 없습니다.","oauthApp.redirectUris.remove": "제거","oauthApp.redirectUris.title": "리디렉션 URI","oauthApp.secret.copy": "비밀키 복사","oauthApp.secret.hidden": "생성 후 숨겨짐","oauthApp.secret.onceWarning": "클라이언트 비밀키는 이때만 표시됩니다. 닫기 전에 안전한 곳에 저장하세요.",- "oauthApp.secret.revealTitle": "클라이언트 비밀키","oauthApp.secret.rotate": "비밀키 교체","oauthApp.secret.rotateConfirm.content": "현재 비밀키는 즉시 작동을 중지합니다. 이를 사용하는 배포는 사용자 로그인에 실패할 수 있으니 업데이트하세요.","oauthApp.secret.rotateConfirm.ok": "비밀키 교체",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "토큰","oauthApp.type.badge": "네이티브 · 디바이스 플로우","oauthApp.type.device": "CLI / 장치",- "oauthApp.type.deviceFlow": "디바이스 플로우","oauthApp.type.web": "웹 앱","oauthApp.type.webBadge": "웹 · 인증 코드","oauthApp.validation.nameRequired": "이름은 필수 항목입니다",diff --git a/locales/nl-NL/auth.json b/locales/nl-NL/auth.jsonindex 730f5302e60..21186a3fed6 100644--- a/locales/nl-NL/auth.json+++ b/locales/nl-NL/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "Annuleren","oauthApp.detail.clientId": "Client-ID","oauthApp.detail.clientSecret": "Clientgeheim",- "oauthApp.detail.createdAt": "Aangemaakt","oauthApp.detail.dangerZone": "Gevarenzone","oauthApp.detail.delete": "App verwijderen","oauthApp.detail.edit": "Bewerken",- "oauthApp.detail.enabled": "Ingeschakeld",- "oauthApp.detail.lastUsedAt": "Laatst gebruikt","oauthApp.detail.neverUsed": "Nooit gebruikt",- "oauthApp.detail.noDescription": "Geen beschrijving","oauthApp.detail.save": "Wijzigingen opslaan","oauthApp.detail.saveSuccess": "Wijzigingen opgeslagen","oauthApp.detail.title": "App Details",@@ -275,14 +271,12 @@"oauthApp.list.empty": "Nog geen OAuth-apps. Maak er een om te beginnen.","oauthApp.list.neverUsed": "Nooit gebruikt","oauthApp.redirectUris.add": "Redirect-URI toevoegen",- "oauthApp.redirectUris.configure": "Configureren","oauthApp.redirectUris.empty": "Nog geen redirect-URI's. Deze app kan niet worden gebruikt om in te loggen totdat u er een toevoegt.","oauthApp.redirectUris.remove": "Verwijderen","oauthApp.redirectUris.title": "Redirect-URI's","oauthApp.secret.copy": "Geheim kopiëren","oauthApp.secret.hidden": "Verborgen na aanmaak","oauthApp.secret.onceWarning": "Dit is de enige keer dat het clientgeheim wordt weergegeven. Sla het ergens veilig op voordat u dit venster sluit.",- "oauthApp.secret.revealTitle": "Uw clientgeheim","oauthApp.secret.rotate": "Roteren","oauthApp.secret.rotateConfirm.content": "Het huidige geheim stopt onmiddellijk met werken. Elke implementatie die het nog gebruikt, zal falen bij het inloggen van gebruikers totdat u het bijwerkt.","oauthApp.secret.rotateConfirm.ok": "Geheim roteren",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Tokens","oauthApp.type.badge": "Native · Device Flow","oauthApp.type.device": "CLI / Apparaat",- "oauthApp.type.deviceFlow": "Device Flow","oauthApp.type.web": "Webapp","oauthApp.type.webBadge": "Web · Autorisatiecode","oauthApp.validation.nameRequired": "Naam is verplicht",diff --git a/locales/pl-PL/auth.json b/locales/pl-PL/auth.jsonindex b3db11b41b9..71e32487f79 100644--- a/locales/pl-PL/auth.json+++ b/locales/pl-PL/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "Anuluj","oauthApp.detail.clientId": "ID klienta","oauthApp.detail.clientSecret": "Sekret klienta",- "oauthApp.detail.createdAt": "Utworzono","oauthApp.detail.dangerZone": "Strefa zagrożenia","oauthApp.detail.delete": "Usuń aplikację","oauthApp.detail.edit": "Edytuj",- "oauthApp.detail.enabled": "Włączona",- "oauthApp.detail.lastUsedAt": "Ostatnio używane","oauthApp.detail.neverUsed": "Nigdy nie używane",- "oauthApp.detail.noDescription": "Brak opisu","oauthApp.detail.save": "Zapisz zmiany","oauthApp.detail.saveSuccess": "Zmiany zapisane","oauthApp.detail.title": "Szczegóły aplikacji",@@ -275,14 +271,12 @@"oauthApp.list.empty": "Brak aplikacji OAuth. Utwórz jedną, aby rozpocząć.","oauthApp.list.neverUsed": "Nigdy nie używane","oauthApp.redirectUris.add": "Dodaj URI przekierowania",- "oauthApp.redirectUris.configure": "Konfiguruj","oauthApp.redirectUris.empty": "Brak URI przekierowania. Ta aplikacja nie może być używana do logowania, dopóki nie dodasz URI.","oauthApp.redirectUris.remove": "Usuń","oauthApp.redirectUris.title": "URI przekierowania","oauthApp.secret.copy": "Skopiuj sekret","oauthApp.secret.hidden": "Ukryty po utworzeniu","oauthApp.secret.onceWarning": "To jedyny moment, w którym sekret klienta jest wyświetlany. Przechowaj go w bezpiecznym miejscu przed zamknięciem.",- "oauthApp.secret.revealTitle": "Twój sekret klienta","oauthApp.secret.rotate": "Obróć","oauthApp.secret.rotateConfirm.content": "Obecny sekret przestaje działać natychmiast. Każde wdrożenie nadal go używające nie będzie mogło zalogować użytkowników, dopóki go nie zaktualizujesz.","oauthApp.secret.rotateConfirm.ok": "Obróć sekret",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Tokeny","oauthApp.type.badge": "Natywne · Device Flow","oauthApp.type.device": "CLI / Urządzenie",- "oauthApp.type.deviceFlow": "Device Flow","oauthApp.type.web": "Aplikacja webowa","oauthApp.type.webBadge": "Web · Kod autoryzacyjny","oauthApp.validation.nameRequired": "Nazwa jest wymagana",diff --git a/locales/pt-BR/auth.json b/locales/pt-BR/auth.jsonindex 2b8a33e4d9f..5d292606c65 100644--- a/locales/pt-BR/auth.json+++ b/locales/pt-BR/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "Cancelar","oauthApp.detail.clientId": "ID do Cliente","oauthApp.detail.clientSecret": "Segredo do Cliente",- "oauthApp.detail.createdAt": "Criado","oauthApp.detail.dangerZone": "Zona de Perigo","oauthApp.detail.delete": "Excluir Aplicativo","oauthApp.detail.edit": "Editar",- "oauthApp.detail.enabled": "Ativado",- "oauthApp.detail.lastUsedAt": "Último Uso","oauthApp.detail.neverUsed": "Nunca usado",- "oauthApp.detail.noDescription": "Sem descrição","oauthApp.detail.save": "Salvar Alterações","oauthApp.detail.saveSuccess": "Alterações salvas","oauthApp.detail.title": "Detalhes do Aplicativo",@@ -275,14 +271,12 @@"oauthApp.list.empty": "Ainda não há aplicativos OAuth. Crie um para começar.","oauthApp.list.neverUsed": "Nunca usado","oauthApp.redirectUris.add": "Adicionar URI de Redirecionamento",- "oauthApp.redirectUris.configure": "Configurar","oauthApp.redirectUris.empty": "Ainda não há URIs de redirecionamento. Este aplicativo não pode ser usado para login até que você adicione uma.","oauthApp.redirectUris.remove": "Remover","oauthApp.redirectUris.title": "URIs de Redirecionamento","oauthApp.secret.copy": "Copiar segredo","oauthApp.secret.hidden": "Oculto após a criação","oauthApp.secret.onceWarning": "Esta é a única vez que o segredo do cliente será exibido. Armazene-o em um local seguro antes de fechar.",- "oauthApp.secret.revealTitle": "Seu segredo do cliente","oauthApp.secret.rotate": "Rotacionar","oauthApp.secret.rotateConfirm.content": "O segredo atual para de funcionar imediatamente. Qualquer implantação que ainda o utilize falhará ao tentar autenticar usuários até que você o atualize.","oauthApp.secret.rotateConfirm.ok": "Rotacionar segredo",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Tokens","oauthApp.type.badge": "Nativo · Fluxo de Dispositivo","oauthApp.type.device": "CLI / Dispositivo",- "oauthApp.type.deviceFlow": "Fluxo de Dispositivo","oauthApp.type.web": "Aplicativo Web","oauthApp.type.webBadge": "Web · Código de Autorização","oauthApp.validation.nameRequired": "O nome é obrigatório",diff --git a/locales/ru-RU/auth.json b/locales/ru-RU/auth.jsonindex 12689142d3b..4e7a489578d 100644--- a/locales/ru-RU/auth.json+++ b/locales/ru-RU/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "Отмена","oauthApp.detail.clientId": "Идентификатор клиента","oauthApp.detail.clientSecret": "Секрет клиента",- "oauthApp.detail.createdAt": "Создано","oauthApp.detail.dangerZone": "Опасная зона","oauthApp.detail.delete": "Удалить приложение","oauthApp.detail.edit": "Редактировать",- "oauthApp.detail.enabled": "Включено",- "oauthApp.detail.lastUsedAt": "Последнее использование","oauthApp.detail.neverUsed": "Никогда не использовалось",- "oauthApp.detail.noDescription": "Нет описания","oauthApp.detail.save": "Сохранить изменения","oauthApp.detail.saveSuccess": "Изменения сохранены","oauthApp.detail.title": "Детали приложения",@@ -275,14 +271,12 @@"oauthApp.list.empty": "OAuth приложения пока отсутствуют. Создайте одно, чтобы начать.","oauthApp.list.neverUsed": "Никогда не использовалось","oauthApp.redirectUris.add": "Добавить URI перенаправления",- "oauthApp.redirectUris.configure": "Настроить","oauthApp.redirectUris.empty": "URI перенаправления еще не добавлены. Это приложение не может быть использовано для входа, пока вы не добавите хотя бы один.","oauthApp.redirectUris.remove": "Удалить","oauthApp.redirectUris.title": "URI перенаправления","oauthApp.secret.copy": "Скопировать секрет","oauthApp.secret.hidden": "Скрыт после создания","oauthApp.secret.onceWarning": "Это единственный раз, когда секрет клиента отображается. Сохраните его в безопасном месте перед закрытием.",- "oauthApp.secret.revealTitle": "Ваш секрет клиента","oauthApp.secret.rotate": "Обновить","oauthApp.secret.rotateConfirm.content": "Текущий секрет перестанет работать немедленно. Любое развертывание, которое его использует, не сможет авторизовать пользователей, пока вы не обновите его.","oauthApp.secret.rotateConfirm.ok": "Обновить секрет",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Токены","oauthApp.type.badge": "Нативное · Device Flow","oauthApp.type.device": "CLI / Устройство",- "oauthApp.type.deviceFlow": "Device Flow","oauthApp.type.web": "Веб-приложение","oauthApp.type.webBadge": "Веб · Код авторизации","oauthApp.validation.nameRequired": "Название обязательно",diff --git a/locales/tr-TR/auth.json b/locales/tr-TR/auth.jsonindex ad63d172484..0fb3f04ce75 100644--- a/locales/tr-TR/auth.json+++ b/locales/tr-TR/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "İptal","oauthApp.detail.clientId": "Müşteri Kimliği","oauthApp.detail.clientSecret": "İstemci Sırrı",- "oauthApp.detail.createdAt": "Oluşturulma Tarihi","oauthApp.detail.dangerZone": "Tehlike Bölgesi","oauthApp.detail.delete": "Uygulamayı Sil","oauthApp.detail.edit": "Düzenle",- "oauthApp.detail.enabled": "Etkin",- "oauthApp.detail.lastUsedAt": "Son Kullanım","oauthApp.detail.neverUsed": "Hiç kullanılmadı",- "oauthApp.detail.noDescription": "Açıklama yok","oauthApp.detail.save": "Değişiklikleri Kaydet","oauthApp.detail.saveSuccess": "Değişiklikler kaydedildi","oauthApp.detail.title": "Uygulama Detayları",@@ -275,14 +271,12 @@"oauthApp.list.empty": "Henüz OAuth uygulaması yok. Başlamak için bir tane oluşturun.","oauthApp.list.neverUsed": "Hiç kullanılmadı","oauthApp.redirectUris.add": "Yönlendirme URI'si ekle",- "oauthApp.redirectUris.configure": "Yapılandır","oauthApp.redirectUris.empty": "Henüz yönlendirme URI'si yok. Bu uygulama, bir URI eklenene kadar oturum açmak için kullanılamaz.","oauthApp.redirectUris.remove": "Kaldır","oauthApp.redirectUris.title": "Yönlendirme URI'leri","oauthApp.secret.copy": "Sırrı kopyala","oauthApp.secret.hidden": "Oluşturulduktan sonra gizlenir","oauthApp.secret.onceWarning": "İstemci sırrı yalnızca bu sefer gösterilir. Kapatmadan önce güvenli bir yerde saklayın.",- "oauthApp.secret.revealTitle": "İstemci sırrınız","oauthApp.secret.rotate": "Sırrı döndür","oauthApp.secret.rotateConfirm.content": "Mevcut sır hemen çalışmayı durdurur. Hâlâ bunu kullanan herhangi bir dağıtım, kullanıcıları oturum açtırmakta başarısız olur. Güncelleme yapana kadar.","oauthApp.secret.rotateConfirm.ok": "Sırrı döndür",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Jetonlar","oauthApp.type.badge": "Yerel · Cihaz Akışı","oauthApp.type.device": "CLI / Cihaz",- "oauthApp.type.deviceFlow": "Cihaz Akışı","oauthApp.type.web": "Web Uygulaması","oauthApp.type.webBadge": "Web · Yetkilendirme Kodu","oauthApp.validation.nameRequired": "Ad gereklidir",diff --git a/locales/vi-VN/auth.json b/locales/vi-VN/auth.jsonindex 2aee55a3a5f..267232e4f31 100644--- a/locales/vi-VN/auth.json+++ b/locales/vi-VN/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "Hủy","oauthApp.detail.clientId": "ID khách hàng","oauthApp.detail.clientSecret": "Mã bí mật của ứng dụng",- "oauthApp.detail.createdAt": "Đã tạo","oauthApp.detail.dangerZone": "Khu vực nguy hiểm","oauthApp.detail.delete": "Xóa ứng dụng","oauthApp.detail.edit": "Chỉnh sửa",- "oauthApp.detail.enabled": "Đã bật",- "oauthApp.detail.lastUsedAt": "Lần sử dụng cuối","oauthApp.detail.neverUsed": "Chưa từng sử dụng",- "oauthApp.detail.noDescription": "Không có mô tả","oauthApp.detail.save": "Lưu thay đổi","oauthApp.detail.saveSuccess": "Thay đổi đã được lưu","oauthApp.detail.title": "Chi tiết ứng dụng",@@ -275,14 +271,12 @@"oauthApp.list.empty": "Chưa có ứng dụng OAuth nào. Tạo một ứng dụng để bắt đầu.","oauthApp.list.neverUsed": "Chưa từng sử dụng","oauthApp.redirectUris.add": "Thêm URI chuyển hướng",- "oauthApp.redirectUris.configure": "Cấu hình","oauthApp.redirectUris.empty": "Chưa có URI chuyển hướng. Ứng dụng này không thể được sử dụng để đăng nhập cho đến khi bạn thêm một URI.","oauthApp.redirectUris.remove": "Xóa","oauthApp.redirectUris.title": "URI chuyển hướng","oauthApp.secret.copy": "Sao chép mã bí mật","oauthApp.secret.hidden": "Ẩn sau khi tạo","oauthApp.secret.onceWarning": "Đây là lần duy nhất mã bí mật của ứng dụng được hiển thị. Lưu trữ nó ở nơi an toàn trước khi đóng.",- "oauthApp.secret.revealTitle": "Mã bí mật của ứng dụng của bạn","oauthApp.secret.rotate": "Thay đổi","oauthApp.secret.rotateConfirm.content": "Mã bí mật hiện tại sẽ ngừng hoạt động ngay lập tức. Bất kỳ triển khai nào vẫn sử dụng nó sẽ không thể đăng nhập người dùng cho đến khi bạn cập nhật.","oauthApp.secret.rotateConfirm.ok": "Thay đổi mã bí mật",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "Token","oauthApp.type.badge": "Bản địa · Device Flow","oauthApp.type.device": "CLI / Thiết bị",- "oauthApp.type.deviceFlow": "Device Flow","oauthApp.type.web": "Ứng dụng Web","oauthApp.type.webBadge": "Web · Mã ủy quyền","oauthApp.validation.nameRequired": "Tên là bắt buộc",diff --git a/locales/zh-CN/auth.json b/locales/zh-CN/auth.jsonindex b050ab6a719..fd919596ed4 100644--- a/locales/zh-CN/auth.json+++ b/locales/zh-CN/auth.json@@ -239,18 +239,27 @@"oauthApp.detail.cancel": "取消","oauthApp.detail.clientId": "Client ID","oauthApp.detail.clientSecret": "客户端密钥",- "oauthApp.detail.createdAt": "创建时间",+ "oauthApp.detail.createdRelative": "创建于 {{time}}",+ "oauthApp.detail.credentials": "凭据","oauthApp.detail.dangerZone": "危险操作","oauthApp.detail.delete": "删除应用",+ "oauthApp.detail.deleteDesc": "删除应用及其授权。已有授权将无法再续期,当前令牌过期后该应用即失去访问权限。此操作无法撤销。",+ "oauthApp.detail.disableDesc": "停用后,用户无法通过此应用登录,它的令牌也无法刷新,直到重新启用。","oauthApp.detail.edit": "编辑",- "oauthApp.detail.enabled": "已启用",- "oauthApp.detail.lastUsedAt": "最后使用时间",+ "oauthApp.detail.enableDesc": "允许用户重新通过此应用登录。","oauthApp.detail.neverUsed": "从未使用",- "oauthApp.detail.noDescription": "暂无描述","oauthApp.detail.save": "保存更改","oauthApp.detail.saveSuccess": "已保存",+ "oauthApp.detail.status": "应用状态",+ "oauthApp.detail.tabs.advanced": "高级设置",+ "oauthApp.detail.tabs.credentials": "凭据",+ "oauthApp.detail.tabs.overview": "概览","oauthApp.detail.title": "应用详情","oauthApp.detail.type": "类型",+ "oauthApp.disableConfirm.content": "停用后,用户无法通过此应用登录,它的令牌也无法刷新,直到重新启用。",+ "oauthApp.disableConfirm.ok": "停用",+ "oauthApp.disableConfirm.title": "要停用这个应用吗?",+ "oauthApp.disabled.banner": "此应用已停用,重新启用前用户无法通过它登录。","oauthApp.form.description.label": "描述","oauthApp.form.description.placeholder": "这个应用是做什么的?(选填)","oauthApp.form.logo.label": "图标",@@ -267,21 +276,39 @@"oauthApp.form.type.immutable": "应用类型创建后不可更改。","oauthApp.form.type.label": "应用类型","oauthApp.form.type.webDesc": "适用于服务端应用,用户授权后跳回你的应用,由服务端用客户端密钥完成认证。",- "oauthApp.form.type.webNext": "创建后在应用详情页添加回调地址。",+ "oauthApp.form.type.webNext": "创建后,在应用页添加回调地址并生成客户端密钥。",+ "oauthApp.integration.authorization": "授权端点",+ "oauthApp.integration.copyPrompt": "复制提示词",+ "oauthApp.integration.desc": "在你的 OAuth / OIDC 客户端中配置以下地址。大多数库只需要 Issuer 或发现文档地址。",+ "oauthApp.integration.deviceAuthorization": "设备授权端点",+ "oauthApp.integration.discovery": "发现文档地址",+ "oauthApp.integration.endpoints": "端点地址",+ "oauthApp.integration.issuer": "Issuer",+ "oauthApp.integration.oneClick": "一键接入",+ "oauthApp.integration.oneClickDesc": "把这段提示词发给 Claude Code、Codex 等编码助手,即可在你的项目里接入 LobeHub 登录。",+ "oauthApp.integration.prompt.device": "为这个命令行工具接入 LobeHub 登录,使用 OAuth 2.0 设备授权流程。\n\n- Issuer:{{issuer}}(通过 {{discovery}} 发现各端点)\n- Client ID:{{clientId}}(公开客户端,没有密钥)\n- 设备授权端点:{{deviceAuthorization}}\n- 令牌端点:{{token}}\n- Scopes:openid profile email offline_access\n\n先申请设备码,向用户展示验证地址和验证码,然后轮询令牌端点直到用户确认。把 refresh token 安全地保存(例如系统钥匙串),并在 access token 过期时刷新。",+ "oauthApp.integration.prompt.web": "在这个项目里接入「使用 LobeHub 登录」,使用 OpenID Connect(授权码流程 + PKCE S256)。\n\n- Issuer:{{issuer}}(通过 {{discovery}} 发现各端点)\n- Client ID:{{clientId}}\n- Client Secret:从环境变量 LOBEHUB_CLIENT_SECRET 读取,不要写进代码;在令牌请求的请求体里以 client_secret 发送(client_secret_post)\n- Scopes:openid profile email offline_access\n\n优先使用项目里已有的 OAuth / OIDC 库,没有的话选该框架的标准库。添加一个回调路由,然后告诉我它的完整 URL,我会把它注册为「{{appName}}」应用的回调地址。登录后从 ID Token 中读取用户的 id(sub)、姓名和邮箱。",+ "oauthApp.integration.promptCopied": "提示词已复制",+ "oauthApp.integration.title": "接入信息",+ "oauthApp.integration.token": "令牌端点","oauthApp.item.disabledTag": "已停用","oauthApp.item.lastUsed": "最后使用 {{time}}","oauthApp.list.actions.create": "创建应用","oauthApp.list.actions.delete": "删除",- "oauthApp.list.empty": "还没有 OAuth 应用,创建一个开始吧。",+ "oauthApp.list.empty": "让命令行工具或你自己的网站使用 LobeHub 账号登录。",+ "oauthApp.list.emptyTitle": "创建你的第一个 OAuth 应用","oauthApp.list.neverUsed": "从未使用","oauthApp.redirectUris.add": "添加回调地址",- "oauthApp.redirectUris.configure": "配置",- "oauthApp.redirectUris.empty": "还没有配置回调地址。添加之前,这个应用无法用于登录。",+ "oauthApp.redirectUris.empty": "还没有回调地址。添加一个后,用户才能通过此应用登录。","oauthApp.redirectUris.remove": "移除","oauthApp.redirectUris.title": "回调地址","oauthApp.secret.copy": "复制密钥",- "oauthApp.secret.hidden": "创建后不再展示",- "oauthApp.secret.onceWarning": "客户端密钥只会展示这一次,请先妥善保存再关闭。",+ "oauthApp.secret.dismiss": "我已保存",+ "oauthApp.secret.generate": "生成密钥",+ "oauthApp.secret.hidden": "生成后不再展示",+ "oauthApp.secret.issueFailed": "客户端密钥生成失败,请重试。",+ "oauthApp.secret.notGenerated": "尚未生成",+ "oauthApp.secret.onceWarning": "关闭后将无法再次查看该密钥,请立即复制并妥善保存。","oauthApp.secret.revealTitle": "你的客户端密钥","oauthApp.secret.rotate": "轮换","oauthApp.secret.rotateConfirm.content": "当前密钥会立即失效。仍在使用它的部署在你更新之前将无法完成登录。",@@ -298,7 +325,6 @@"oauthApp.stats.tokens": "Tokens","oauthApp.type.badge": "原生 · 设备流","oauthApp.type.device": "命令行 / 设备",- "oauthApp.type.deviceFlow": "设备流","oauthApp.type.web": "Web 应用","oauthApp.type.webBadge": "Web · 授权码","oauthApp.validation.nameRequired": "请输入名称",diff --git a/locales/zh-TW/auth.json b/locales/zh-TW/auth.jsonindex 2506e5cb9e0..d0dde4b47f2 100644--- a/locales/zh-TW/auth.json+++ b/locales/zh-TW/auth.json@@ -239,14 +239,10 @@"oauthApp.detail.cancel": "取消","oauthApp.detail.clientId": "客戶端 ID","oauthApp.detail.clientSecret": "用戶端密鑰",- "oauthApp.detail.createdAt": "建立時間","oauthApp.detail.dangerZone": "危險區域","oauthApp.detail.delete": "刪除應用程式","oauthApp.detail.edit": "編輯",- "oauthApp.detail.enabled": "已啟用",- "oauthApp.detail.lastUsedAt": "上次使用時間","oauthApp.detail.neverUsed": "從未使用",- "oauthApp.detail.noDescription": "無描述","oauthApp.detail.save": "儲存變更","oauthApp.detail.saveSuccess": "變更已儲存","oauthApp.detail.title": "應用程式詳細資訊",@@ -275,14 +271,12 @@"oauthApp.list.empty": "尚無 OAuth 應用程式。建立一個以開始使用。","oauthApp.list.neverUsed": "從未使用","oauthApp.redirectUris.add": "新增重定向 URI",- "oauthApp.redirectUris.configure": "配置","oauthApp.redirectUris.empty": "尚無重定向 URI。在新增重定向 URI 之前,此應用程式無法用於登入。","oauthApp.redirectUris.remove": "移除","oauthApp.redirectUris.title": "重定向 URI","oauthApp.secret.copy": "複製密鑰","oauthApp.secret.hidden": "建立後隱藏","oauthApp.secret.onceWarning": "這是唯一一次顯示用戶端密鑰。在關閉之前,請將其安全地存儲起來。",- "oauthApp.secret.revealTitle": "您的用戶端密鑰","oauthApp.secret.rotate": "旋轉","oauthApp.secret.rotateConfirm.content": "當前密鑰將立即停止工作。任何仍在使用它的部署將無法登入用戶,直到您更新它。","oauthApp.secret.rotateConfirm.ok": "旋轉密鑰",@@ -298,7 +292,6 @@"oauthApp.stats.tokens": "令牌","oauthApp.type.badge": "原生 · 裝置流程","oauthApp.type.device": "CLI / 設備",- "oauthApp.type.deviceFlow": "裝置流程","oauthApp.type.web": "網頁應用程式","oauthApp.type.webBadge": "網頁 · 授權碼","oauthApp.validation.nameRequired": "名稱為必填項目",diff --git a/packages/database/src/models/__tests__/oidcClient.test.ts b/packages/database/src/models/__tests__/oidcClient.test.tsindex cdd10fad4ee..66541bf7098 100644--- a/packages/database/src/models/__tests__/oidcClient.test.ts+++ b/packages/database/src/models/__tests__/oidcClient.test.ts@@ -376,7 +376,7 @@ describe('OidcClientModel', () => {const redirectUris = ['https://dc.lobehub.com/api/auth/oauth2/callback/lobehub'];it('should create a confidential client that can run the authorization code flow', async () => {- const { client, secret } = await oidcClientModel.create({+ const { client } = await oidcClientModel.create({name: 'Develop Center',redirectUris,type: 'web',@@ -388,27 +388,39 @@ describe('OidcClientModel', () => {expect(client.redirectUris).toEqual(redirectUris);expect(client.tokenEndpointAuthMethod).toBe('client_secret_post');expect(client.isFirstParty).toBe(false);- expect(secret).toMatch(/^lcs_[\w-]{43}$/);});- it('should store the secret encrypted rather than in plaintext', async () => {+ it('should not issue a secret at creation unless asked; the owner generates it on demand', async () => {+ const result = await oidcClientModel.create({+ name: 'Develop Center',+ redirectUris,+ type: 'web',+ });++ expect(result.secret).toBeUndefined();+ expect(result.client.clientSecret).toBeNull();+ });++ it('should issue the secret at creation when asked, stored encrypted', async () => {const { client, secret } = await oidcClientModel.create({+ issueSecret: true,name: 'Develop Center',redirectUris,type: 'web',});+ expect(secret).toMatch(/^lcs_[\w-]{43}$/);expect(client.clientSecret).not.toBe(secret);const gateKeeper = await KeyVaultsGateKeeper.initWithEnvKey();- const { plaintext, wasAuthentic } = await gateKeeper.decrypt(client.clientSecret!);+ const { plaintext } = await gateKeeper.decrypt(client.clientSecret!);- expect(wasAuthentic).toBe(true);expect(plaintext).toBe(secret);});it('should not give a device app a secret or redirect uris', async () => {const { client, secret } = await oidcClientModel.create({+ issueSecret: true,name: 'My CLI',redirectUris,type: 'device',@@ -428,13 +440,31 @@ describe('OidcClientModel', () => {type: 'web',});+ it("should issue a web app's first secret, stored encrypted rather than in plaintext", async () => {+ const { client } = await createWebApp();++ const secret = await oidcClientModel.rotateSecret(client.id);++ expect(secret).toMatch(/^lcs_[\w-]{43}$/);++ const stored = await oidcClientModel.findById(client.id);+ expect(stored.clientSecret).not.toBe(secret);++ const gateKeeper = await KeyVaultsGateKeeper.initWithEnvKey();+ const { plaintext, wasAuthentic } = await gateKeeper.decrypt(stored.clientSecret!);++ expect(wasAuthentic).toBe(true);+ expect(plaintext).toBe(secret);+ });+it('should replace the stored secret and return the new plaintext', async () => {- const { client, secret } = await createWebApp();+ const { client } = await createWebApp();+ const first = await oidcClientModel.rotateSecret(client.id);const rotated = await oidcClientModel.rotateSecret(client.id);expect(rotated).toMatch(/^lcs_[\w-]{43}$/);- expect(rotated).not.toBe(secret);+ expect(rotated).not.toBe(first);const stored = await oidcClientModel.findById(client.id);const gateKeeper = await KeyVaultsGateKeeper.initWithEnvKey();@@ -453,12 +483,14 @@ describe('OidcClientModel', () => {it("should not rotate another user's app", async () => {const { client } = await createWebApp();+ await oidcClientModel.rotateSecret(client.id);+ const before = await oidcClientModel.findById(client.id);const otherModel = new OidcClientModel(serverDB, otherUserId);expect(await otherModel.rotateSecret(client.id)).toBeUndefined();const stored = await oidcClientModel.findById(client.id);- expect(stored.clientSecret).toBe(client.clientSecret);+ expect(stored.clientSecret).toBe(before.clientSecret);});});diff --git a/packages/database/src/models/oidcClient.ts b/packages/database/src/models/oidcClient.tsindex 5f8cc26a45c..94bbb292178 100644--- a/packages/database/src/models/oidcClient.ts+++ b/packages/database/src/models/oidcClient.ts@@ -17,6 +17,8 @@ import { buildWorkspacePayload, buildWorkspaceWhere } from '../utils/workspace';interface CreateOidcClientParams {description?: string | null;+ /** Issue a `web` app's client secret at creation. Ignored for `device` apps. */+ issueSecret?: boolean;logoUri?: string | null;name: string;/** Required for `web` apps, ignored for `device` apps. */@@ -85,18 +87,22 @@ export class OidcClientModel {};/**- * Creates an app and, for `web` apps, issues its one-time client secret.+ * Creates an app and, for a `web` app when `issueSecret` is set, issues its+ * client secret, returned once as `secret`.** `device` apps stay public clients with no secret: the device flow has no* confidential channel to keep one in. `web` apps are confidential clients- * because the only consumer that can use a redirect flow here is a server- * that can hold a secret.+ * (the only consumer that can use a redirect flow here is a server that can+ * hold a secret). Without `issueSecret` their secret is minted later through+ * `rotateSecret`, when the owner is ready to store it; until then the+ * provider treats the client as unusable (see the adapter).*/create = async (params: CreateOidcClientParams) => {const isWeb = params.type === 'web';- const { encrypted, secret } = isWeb- ? await this.issueClientSecret()- : { encrypted: null, secret: undefined };+ const { encrypted, secret } =+ isWeb && params.issueSecret+ ? await this.issueClientSecret()+ : { encrypted: null, secret: undefined };const [result] = await this.db.insert(oidcClients)@@ -125,15 +131,18 @@ export class OidcClientModel {};/**- * Replaces the client secret and returns the new plaintext once.+ * Issues the client secret of a web app — the first one, or a replacement —+ * and returns the new plaintext once.*- * Returns `undefined` when the app is not the caller's or has no secret to- * rotate, so a device-flow app can never be turned into a confidential one- * through this path.+ * Returns `undefined` when the app is not the caller's or is not a+ * confidential client, so a device-flow app can never be turned into a+ * confidential one through this path.*/rotateSecret = async (id: string) => {const existing = await this.findById(id);- if (!existing || !existing.clientSecret) return undefined;+ if (!existing || !existing.tokenEndpointAuthMethod?.startsWith('client_secret')) {+ return undefined;+ }const { encrypted, secret } = await this.issueClientSecret();diff --git a/packages/locales/src/default/auth.ts b/packages/locales/src/default/auth.tsindex 8afc38a3521..467ca04adb3 100644--- a/packages/locales/src/default/auth.ts+++ b/packages/locales/src/default/auth.ts@@ -259,18 +259,31 @@ export default {'oauthApp.detail.cancel': 'Cancel','oauthApp.detail.clientId': 'Client ID','oauthApp.detail.clientSecret': 'Client Secret',- 'oauthApp.detail.createdAt': 'Created',+ 'oauthApp.detail.createdRelative': 'Created {{time}}',+ 'oauthApp.detail.credentials': 'Credentials','oauthApp.detail.dangerZone': 'Danger Zone','oauthApp.detail.delete': 'Delete App',+ 'oauthApp.detail.deleteDesc':+ 'Deletes the app and its authorizations. They can no longer be renewed, and the app loses access once its current tokens expire. This cannot be undone.',+ 'oauthApp.detail.disableDesc':+ "Users can't sign in with this app and its tokens stop refreshing until you enable it again.",'oauthApp.detail.edit': 'Edit',- 'oauthApp.detail.enabled': 'Enabled',- 'oauthApp.detail.lastUsedAt': 'Last Used',+ 'oauthApp.detail.enableDesc': 'Let users sign in with this app again.','oauthApp.detail.neverUsed': 'Never used',- 'oauthApp.detail.noDescription': 'No description','oauthApp.detail.save': 'Save Changes','oauthApp.detail.saveSuccess': 'Changes saved',+ 'oauthApp.detail.status': 'Status',+ 'oauthApp.detail.tabs.advanced': 'Advanced',+ 'oauthApp.detail.tabs.credentials': 'Credentials',+ 'oauthApp.detail.tabs.overview': 'Overview','oauthApp.detail.title': 'App Details','oauthApp.detail.type': 'Type',+ 'oauthApp.disableConfirm.content':+ "Users can't sign in with this app and its tokens stop refreshing until you enable it again.",+ 'oauthApp.disableConfirm.ok': 'Disable',+ 'oauthApp.disableConfirm.title': 'Disable this app?',+ 'oauthApp.disabled.banner':+ "This app is disabled. Users can't sign in with it until you enable it again.",'oauthApp.form.description.label': 'Description','oauthApp.form.description.placeholder': 'What is this app for? (optional)','oauthApp.form.logo.label': 'Logo',@@ -290,23 +303,47 @@ export default {'oauthApp.form.type.label': 'Application Type','oauthApp.form.type.webDesc':'For server-side apps. Users are redirected back to your app, which authenticates with a client secret.',- 'oauthApp.form.type.webNext': 'You will add redirect URIs on the app page after it is created.',+ 'oauthApp.form.type.webNext':+ 'After it is created, add redirect URIs and generate a client secret on the app page.',+ 'oauthApp.integration.authorization': 'Authorization endpoint',+ 'oauthApp.integration.copyPrompt': 'Copy prompt',+ 'oauthApp.integration.desc':+ 'Point your OAuth / OIDC client at these URLs. Most libraries only need the issuer or the discovery URL.',+ 'oauthApp.integration.deviceAuthorization': 'Device authorization endpoint',+ 'oauthApp.integration.discovery': 'Discovery URL',+ 'oauthApp.integration.endpoints': 'Endpoint URLs',+ 'oauthApp.integration.issuer': 'Issuer',+ 'oauthApp.integration.oneClick': 'One-prompt integration',+ 'oauthApp.integration.oneClickDesc':+ 'Paste this prompt into a coding agent such as Claude Code or Codex to add LobeHub sign-in to your project.',+ 'oauthApp.integration.prompt.device':+ 'Add LobeHub sign-in to this command-line tool using the OAuth 2.0 device authorization flow.\n\n- Issuer: {{issuer}} (discover the endpoints from {{discovery}})\n- Client ID: {{clientId}} (public client, no secret)\n- Device authorization endpoint: {{deviceAuthorization}}\n- Token endpoint: {{token}}\n- Scopes: openid profile email offline_access\n\nRequest a device code, show the user the verification URL and code, and poll the token endpoint until they approve. Store the refresh token securely (for example in the OS keychain) and refresh the access token when it expires.',+ 'oauthApp.integration.prompt.web':+ 'Add "Sign in with LobeHub" to this project using OpenID Connect (authorization code flow with PKCE S256).\n\n- Issuer: {{issuer}} (discover the endpoints from {{discovery}})\n- Client ID: {{clientId}}\n- Client secret: read it from the LOBEHUB_CLIENT_SECRET environment variable and never hard-code it; send it as client_secret in the token request body (client_secret_post)\n- Scopes: openid profile email offline_access\n\nUse the OAuth / OIDC library this project already uses, or the standard one for its framework. Add a callback route, then tell me its full URL so I can register it as a redirect URI of the "{{appName}}" app. After sign-in, read the user\'s id (sub), name and email from the ID token.',+ 'oauthApp.integration.promptCopied': 'Prompt copied',+ 'oauthApp.integration.title': 'Integration',+ 'oauthApp.integration.token': 'Token endpoint','oauthApp.item.disabledTag': 'Disabled','oauthApp.item.lastUsed': 'Last used {{time}}','oauthApp.list.actions.create': 'Create App','oauthApp.list.actions.delete': 'Delete',- 'oauthApp.list.empty': 'No OAuth apps yet. Create one to get started.',+ 'oauthApp.list.empty':+ 'Let a CLI tool or your own website sign people in with their LobeHub account.',+ 'oauthApp.list.emptyTitle': 'Create your first OAuth app','oauthApp.list.neverUsed': 'Never used','oauthApp.redirectUris.add': 'Add redirect URI',- 'oauthApp.redirectUris.configure': 'Configure','oauthApp.redirectUris.empty':- "No redirect URIs yet. This app can't be used to sign in until you add one.",+ 'No redirect URIs yet. Add one so users can sign in with this app.','oauthApp.redirectUris.remove': 'Remove','oauthApp.redirectUris.title': 'Redirect URIs','oauthApp.secret.copy': 'Copy secret',- 'oauthApp.secret.hidden': 'Hidden after creation',+ 'oauthApp.secret.dismiss': "I've saved it",+ 'oauthApp.secret.generate': 'Generate secret',+ 'oauthApp.secret.hidden': 'Hidden once generated',+ 'oauthApp.secret.issueFailed': "The client secret couldn't be generated. Try again.",+ 'oauthApp.secret.notGenerated': 'Not generated yet','oauthApp.secret.onceWarning':- 'This is the only time the client secret is shown. Store it somewhere safe before closing.',+ "You won't be able to see this secret again after closing. Copy it now and store it somewhere safe.",'oauthApp.secret.revealTitle': 'Your client secret','oauthApp.secret.rotate': 'Rotate','oauthApp.secret.rotateConfirm.content':@@ -324,7 +361,6 @@ export default {'oauthApp.stats.tokens': 'Tokens','oauthApp.type.badge': 'Native · Device Flow','oauthApp.type.device': 'CLI / Device',- 'oauthApp.type.deviceFlow': 'Device Flow','oauthApp.type.web': 'Web App','oauthApp.type.webBadge': 'Web · Authorization Code','oauthApp.validation.nameRequired': 'Name is required',diff --git a/packages/types/src/oauthApp.ts b/packages/types/src/oauthApp.tsindex 350ccb084fe..378fb581b52 100644--- a/packages/types/src/oauthApp.ts+++ b/packages/types/src/oauthApp.ts@@ -20,6 +20,12 @@ export interface OAuthAppItem {export interface CreateOAuthAppParams {description?: string;+ /**+ * Whether a web app gets its client secret at creation (returned once as+ * `clientSecret`). Clients that generate it on demand send `false`; older+ * clients omit it and rely on the server default of `true`.+ */+ issueSecret?: boolean;logoUri?: string;name: string;redirectUris?: string[];diff --git a/packages/types/src/serverConfig.ts b/packages/types/src/serverConfig.tsindex e1f5217cdc2..b9a8d5c2d14 100644--- a/packages/types/src/serverConfig.ts+++ b/packages/types/src/serverConfig.ts@@ -159,6 +159,13 @@ export interface GlobalServerConfig {memory?: GlobalMemoryConfig;multimodalUnderstanding?: MultimodalUnderstandingConfig;oAuthSSOProviders?: string[];+ /**+ * Public issuer of the built-in OIDC provider (`APP_URL` + `/oidc`) — the+ * exact value the provider signs into tokens and discovery. Clients show+ * this to developers instead of their own origin, which differs behind a+ * reverse proxy or on desktop.+ */+ oidcIssuer?: string;systemAgent?: PartialDeep<UserServiceModelConfig>;telemetry: {langfuse?: boolean;diff --git a/src/components/AvatarUpload/index.tsx b/src/components/AvatarUpload/index.tsxindex 4673fc20d3a..6d1ac948be1 100644--- a/src/components/AvatarUpload/index.tsx+++ b/src/components/AvatarUpload/index.tsx@@ -4,7 +4,7 @@ import { Icon } from '@lobehub/ui';import { Avatar, Spin, Upload } from '@lobehub/ui/base-ui';import { createStaticStyles, cssVar } from 'antd-style';import { PencilIcon, X } from 'lucide-react';-import { memo, useMemo } from 'react';+import { memo, type ReactNode, useMemo } from 'react';import { imageToBase64 } from '@/utils/imageToBase64';import { createUploadImageHandler } from '@/utils/uploadFIle';@@ -18,6 +18,8 @@ interface AvatarUploadProps {loading?: boolean;onDelete?: () => void;onUpload?: (file: File) => void;+ /** Rendered in place of the letter-avatar while no image is set. */+ placeholder?: ReactNode;shape?: 'circle' | 'square';size?: number;title?: string;@@ -90,6 +92,7 @@ const AvatarUpload = memo<AvatarUploadProps>(loading,compressSize = 256,shape = 'square',+ placeholder,size = 72,title,}) => {@@ -113,7 +116,7 @@ const AvatarUpload = memo<AvatarUploadProps>(<Upload maxCount={1} onFiles={([file]) => handleUpload(file)}><Spin size="small" spinning={!!loading}><div className={styles.wrapper}>- <Avatar avatar={value} shape={shape} size={size} title={title} />+ <Avatar avatar={value || placeholder} shape={shape} size={size} title={title} /><div className={`${styles.overlay} avatar-edit-overlay`}><Iconcolor={cssVar.colorTextLightSolid}diff --git a/src/features/Settings/oauth-apps/appList.test.ts b/src/features/Settings/oauth-apps/appList.test.tsnew file mode 100644index 00000000000..12d5ca37078--- /dev/null+++ b/src/features/Settings/oauth-apps/appList.test.ts@@ -0,0 +1,29 @@+import { describe, expect, it } from 'vitest';++import { appTypeLabelKey, resolveAppListState } from './appList';++describe('appTypeLabelKey', () => {+ it('labels each app with its own type', () => {+ expect(appTypeLabelKey('web')).toBe('oauthApp.type.web');+ expect(appTypeLabelKey('device')).toBe('oauthApp.type.device');+ expect(appTypeLabelKey(null)).toBe('oauthApp.type.device');+ });+});++describe('resolveAppListState', () => {+ it('reads a failed load as an error, not as the empty state', () => {+ expect(resolveAppListState({ error: new Error('boom'), isLoading: false })).toBe('error');+ });++ it('keeps showing a cached list when a revalidation fails', () => {+ expect(resolveAppListState({ count: 2, error: new Error('boom'), isLoading: false })).toBe(+ 'list',+ );+ });++ it('distinguishes loading, empty and populated', () => {+ expect(resolveAppListState({ isLoading: true })).toBe('loading');+ expect(resolveAppListState({ count: 0, isLoading: false })).toBe('empty');+ expect(resolveAppListState({ count: 1, isLoading: false })).toBe('list');+ });+});diff --git a/src/features/Settings/oauth-apps/appList.ts b/src/features/Settings/oauth-apps/appList.tsnew file mode 100644index 00000000000..71d09b8b6cf--- /dev/null+++ b/src/features/Settings/oauth-apps/appList.ts@@ -0,0 +1,28 @@+/**+ * The type label a list row shows. Each row reads its own app's type; a web+ * app must never be labelled with the device flow.+ */+export const appTypeLabelKey = (applicationType?: string | null) =>+ applicationType === 'web' ? ('oauthApp.type.web' as const) : ('oauthApp.type.device' as const);++export type AppListState = 'empty' | 'error' | 'list' | 'loading';++/**+ * Which body the app list renders. A failed fetch with nothing cached is a+ * failure (with Retry), never the "no apps yet" empty state; once a list is+ * cached, a failed revalidation keeps showing it.+ */+export const resolveAppListState = ({+ count,+ error,+ isLoading,+}: {+ count?: number;+ error?: unknown;+ isLoading: boolean;+}): AppListState => {+ if (count !== undefined) return count > 0 ? 'list' : 'empty';+ if (error) return 'error';+ if (isLoading) return 'loading';+ return 'empty';+};diff --git a/src/features/Settings/oauth-apps/features/AppDetail/BasicInfoCard.tsx b/src/features/Settings/oauth-apps/features/AppDetail/BasicInfoCard.tsxindex deba28b00ab..39fa22a888d 100644--- a/src/features/Settings/oauth-apps/features/AppDetail/BasicInfoCard.tsx+++ b/src/features/Settings/oauth-apps/features/AppDetail/BasicInfoCard.tsx@@ -1,9 +1,8 @@'use client';import { Flexbox } from '@lobehub/ui';-import { Button, Input, Text, TextArea } from '@lobehub/ui/base-ui';-import { Form, useForm } from '@lobehub/ui/base-ui/form';-import { PencilIcon } from 'lucide-react';+import { Button, Input, TextArea } from '@lobehub/ui/base-ui';+import { Form, useForm, useWatch } from '@lobehub/ui/base-ui/form';import { type FC, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -11,8 +10,11 @@ import AvatarUpload from '@/components/AvatarUpload';import { type OAuthAppItem, type UpdateOAuthAppParams } from '@/types/oauthApp';import { useLogoUpload } from '../../useLogoUpload';+import { AppLogoPlaceholder } from '../AppLogo';import SectionCard from './SectionCard';+const LOGO_SIZE = 64;+interface BasicInfoValues {description?: string;name: string;@@ -25,13 +27,11 @@ interface BasicInfoCardProps {}/**- * Name, logo and description, read-only until the user asks to edit. The edit- * form is reset to the saved values each time editing starts, so cancelling- * needs no reset and a half-typed change never lingers into the next edit.+ * Name, logo and description as a form from the start — no separate Edit step.+ * Cancel / Save appear only once something differs from the saved app.*/const BasicInfoCard: FC<BasicInfoCardProps> = ({ canEdit, detail, onSubmit }) => {const { t } = useTranslation('auth');- const [editing, setEditing] = useState(false);const [saving, setSaving] = useState(false);const [logoUri, setLogoUri] = useState<string | null>(detail.logoUri ?? null);// Only a logo the user actually touched is sent. Older apps may still hold an@@ -40,15 +40,29 @@ const BasicInfoCard: FC<BasicInfoCardProps> = ({ canEdit, detail, onSubmit }) =>const [logoChanged, setLogoChanged] = useState(false);const { upload: uploadLogo, uploading: logoUploading } = useLogoUpload();- const form = useForm<BasicInfoValues>({ onSubmit: (values) => handleFinish(values) });+ const saved = { description: detail.description ?? '', name: detail.name };- const startEditing = () => {- form.reset({ description: detail.description ?? '', name: detail.name });- setLogoUri(detail.logoUri ?? null);- setLogoChanged(false);- setEditing(true);+ const handleFinish = async (values: BasicInfoValues) => {+ setSaving(true);+ try {+ await onSubmit({+ description: values.description,+ name: values.name.trim(),+ ...(logoChanged ? { logoUri } : {}),+ });+ // The saved values are the new baseline.+ form.reset({ description: values.description ?? '', name: values.name.trim() });+ setLogoChanged(false);+ } finally {+ setSaving(false);+ }};+ const form = useForm<BasicInfoValues>({ initialValues: saved, onSubmit: handleFinish });+ const name = useWatch(form, 'name') ?? saved.name;+ const description = useWatch(form, 'description') ?? saved.description;+ const dirty = logoChanged || name !== saved.name || description !== saved.description;+const handleUpload = async (file: File) => {const url = await uploadLogo(file);if (!url) return;@@ -61,71 +75,62 @@ const BasicInfoCard: FC<BasicInfoCardProps> = ({ canEdit, detail, onSubmit }) =>setLogoChanged(true);};- const handleFinish = async (values: BasicInfoValues) => {- setSaving(true);- try {- await onSubmit({- description: values.description,- name: values.name.trim(),- ...(logoChanged ? { logoUri } : {}),- });- setEditing(false);- } finally {- setSaving(false);- }+ const handleCancel = () => {+ form.reset(saved);+ setLogoUri(detail.logoUri ?? null);+ setLogoChanged(false);};const itemStyle = { paddingBlock: 0 };return (- <SectionCard- title={t('oauthApp.detail.basicInfo')}- extra={- !editing && (- <Button- disabled={!canEdit}- icon={<PencilIcon size={14} />}- size={'small'}- onClick={startEditing}- >- {t('oauthApp.detail.edit')}- </Button>- )- }- >- {editing ? (- <Form form={form} layout={'vertical'}>- <Flexbox gap={16}>- <Form.Field label={t('oauthApp.form.logo.label')} style={itemStyle}>- <AvatarUpload- allowDelete={!!logoUri}- loading={logoUploading}- title={detail.name}- value={logoUri ?? undefined}- onDelete={handleDeleteLogo}- onUpload={handleUpload}- />- </Form.Field>-+ <SectionCard title={t('oauthApp.detail.basicInfo')}>+ <Form form={form} layout={'vertical'}>+ <Flexbox gap={16}>+ {/* Same logo-beside-name layout as the create modal. */}+ <Flexbox horizontal align={'flex-end'} gap={16}>+ <AvatarUpload+ allowDelete={canEdit && !!logoUri}+ loading={logoUploading}+ placeholder={<AppLogoPlaceholder size={LOGO_SIZE} />}+ size={LOGO_SIZE}+ title={t('oauthApp.form.logo.label')}+ value={logoUri ?? undefined}+ onDelete={handleDeleteLogo}+ onUpload={canEdit ? handleUpload : undefined}+ /><Form.Fieldlabel={t('oauthApp.form.name.label')}name={'name'}required={t('oauthApp.validation.nameRequired')}- style={itemStyle}+ style={{ ...itemStyle, flex: 1, minWidth: 0 }}>- <Input placeholder={t('oauthApp.form.name.placeholder')} />- </Form.Field>-- <Form.Field- label={t('oauthApp.form.description.label')}- name={'description'}- style={itemStyle}- >- <TextArea placeholder={t('oauthApp.form.description.placeholder')} rows={3} />+ <Input+ disabled={!canEdit}+ placeholder={t('oauthApp.form.name.placeholder')}+ variant={'filled'}+ /></Form.Field>+ </Flexbox>+ <Form.Field+ label={t('oauthApp.form.description.label')}+ name={'description'}+ style={itemStyle}+ >+ <TextArea+ disabled={!canEdit}+ placeholder={t('oauthApp.form.description.placeholder')}+ rows={2}+ variant={'filled'}+ />+ </Form.Field>++ {dirty && (<Flexbox horizontal gap={8} justify={'flex-end'}>- <Button onClick={() => setEditing(false)}>{t('oauthApp.detail.cancel')}</Button>+ <Button disabled={saving} onClick={handleCancel}>+ {t('oauthApp.detail.cancel')}+ </Button><Buttondisabled={logoUploading}htmlType={'submit'}@@ -135,21 +140,9 @@ const BasicInfoCard: FC<BasicInfoCardProps> = ({ canEdit, detail, onSubmit }) =>{t('oauthApp.detail.save')}</Button></Flexbox>- </Flexbox>- </Form>- ) : (- <Flexbox horizontal align={'center'} gap={16}>- <AvatarUpload title={detail.name} value={detail.logoUri ?? undefined} />- <Flexbox gap={4} style={{ minWidth: 0 }}>- <Text strong style={{ fontSize: 16 }}>- {detail.name}- </Text>- <Text type={'secondary'}>- {detail.description || t('oauthApp.detail.noDescription')}- </Text>- </Flexbox>+ )}</Flexbox>- )}+ </Form></SectionCard>);};diff --git a/src/features/Settings/oauth-apps/features/AppDetail/CredentialsCard.tsx b/src/features/Settings/oauth-apps/features/AppDetail/CredentialsCard.tsxnew file mode 100644index 00000000000..a5f5c8a606a--- /dev/null+++ b/src/features/Settings/oauth-apps/features/AppDetail/CredentialsCard.tsx@@ -0,0 +1,103 @@+'use client';++import { Flexbox } from '@lobehub/ui';+import { Button, Tag, Text } from '@lobehub/ui/base-ui';+import { createStaticStyles } from 'antd-style';+import { type FC } from 'react';+import { useTranslation } from 'react-i18next';++import { type OAuthAppItem } from '@/types/oauthApp';++import ClientIdDisplay from '../ClientIdDisplay';+import SectionCard from './SectionCard';++const styles = createStaticStyles(({ css, cssVar }) => ({+ label: css`+ flex: none;+ font-size: 12px;+ color: ${cssVar.colorTextSecondary};+ `,+ row: css`+ display: flex;+ gap: 16px;+ align-items: center;+ justify-content: space-between;++ min-width: 0;+ `,+}));++interface CredentialsCardProps {+ canEdit: boolean;+ detail: OAuthAppItem;+ /** Issues the first secret; nothing to invalidate yet, so no confirmation. */+ onGenerateSecret: () => void;+ /** Replaces the current secret; the caller confirms first. */+ onRotateSecret: () => void;+ secretPending: boolean;+}++/**+ * What a developer copies into their client: the client ID, the type that+ * decides the flow, and — for web apps — the client secret.+ *+ * A web app gets no secret at creation. The owner generates it here when they+ * are ready to store it; the caller reveals the plaintext once in a modal, and+ * the row shows it masked from then on.+ */+const CredentialsCard: FC<CredentialsCardProps> = ({+ canEdit,+ detail,+ onGenerateSecret,+ onRotateSecret,+ secretPending,+}) => {+ const { t } = useTranslation('auth');+ const isWebApp = detail.applicationType === 'web';++ const renderSecretAction = () => {+ if (!detail.hasSecret)+ return (+ <Flexbox horizontal align={'center'} gap={8}>+ <Text type={'secondary'}>{t('oauthApp.secret.notGenerated')}</Text>+ <Button disabled={!canEdit} loading={secretPending} onClick={onGenerateSecret}>+ {t('oauthApp.secret.generate')}+ </Button>+ </Flexbox>+ );++ return (+ <Flexbox horizontal align={'center'} gap={8}>+ <Text type={'secondary'}>{t('oauthApp.secret.hidden')}</Text>+ <Button disabled={!canEdit} loading={secretPending} onClick={onRotateSecret}>+ {t('oauthApp.secret.rotate')}+ </Button>+ </Flexbox>+ );+ };++ return (+ <SectionCard title={t('oauthApp.detail.credentials')}>+ <Flexbox gap={16}>+ <div className={styles.row}>+ <span className={styles.label}>{t('oauthApp.detail.clientId')}</span>+ <ClientIdDisplay clientId={detail.id} />+ </div>++ <div className={styles.row}>+ <span className={styles.label}>{t('oauthApp.detail.type')}</span>+ <Tag>{t(isWebApp ? 'oauthApp.type.webBadge' : 'oauthApp.type.badge')}</Tag>+ </div>++ {isWebApp && (+ <div className={styles.row}>+ <span className={styles.label}>{t('oauthApp.detail.clientSecret')}</span>+ {renderSecretAction()}+ </div>+ )}+ </Flexbox>+ </SectionCard>+ );+};++export default CredentialsCard;diff --git a/src/features/Settings/oauth-apps/features/AppDetail/IntegrationCard.tsx b/src/features/Settings/oauth-apps/features/AppDetail/IntegrationCard.tsxnew file mode 100644index 00000000000..7acb3e6fcd9--- /dev/null+++ b/src/features/Settings/oauth-apps/features/AppDetail/IntegrationCard.tsx@@ -0,0 +1,109 @@+'use client';++import { Flexbox } from '@lobehub/ui';+import { Button, Text, toast } from '@lobehub/ui/base-ui';+import { createStaticStyles } from 'antd-style';+import { CopyIcon } from 'lucide-react';+import { type FC, useMemo } from 'react';+import { useTranslation } from 'react-i18next';++import { useAppOrigin } from '@/hooks/useAppOrigin';+import { useServerConfigStore } from '@/store/serverConfig';+import { serverConfigSelectors } from '@/store/serverConfig/selectors';++import { getIntegrationEndpoints, resolveIssuer } from '../../integrationEndpoints';+import { integrationPromptKey, integrationPromptValues } from '../../integrationPrompt';+import SectionCard from './SectionCard';++const styles = createStaticStyles(({ css, cssVar }) => ({+ prompt: css`+ overflow: auto;++ max-height: 180px;+ padding-block: 10px;+ padding-inline: 12px;+ border-radius: ${cssVar.borderRadius};++ font-size: 13px;+ line-height: 1.6;+ color: ${cssVar.colorTextSecondary};+ white-space: pre-wrap;++ background: ${cssVar.colorFillTertiary};+ `,+ subTitle: css`+ font-size: 13px;+ font-weight: 500;+ `,+}));++interface IntegrationCardProps {+ applicationType?: string | null;+ clientId: string;+ name: string;+}++/**+ * The endpoints of this deployment's OIDC provider for an app of the given+ * type: the server's configured issuer (APP_URL), which also covers desktop and+ * reverse-proxied deployments; the app origin (the connected server on+ * desktop) is only a fallback for a server too old to send it.+ */+export const useIntegrationEndpoints = (applicationType?: string | null) => {+ const configuredIssuer = useServerConfigStore(serverConfigSelectors.oidcIssuer);+ const appOrigin = useAppOrigin();+ const issuer = resolveIssuer(configuredIssuer, appOrigin);++ return useMemo(() => getIntegrationEndpoints(issuer, applicationType), [issuer, applicationType]);+};++/**+ * How to wire the app into a project: one prompt the developer pastes into a+ * coding agent, filled with this app's real client ID and endpoints. The raw+ * URLs for configuring a client by hand live on the Credentials tab+ * (`ManualSetupCard`).+ */+const IntegrationCard: FC<IntegrationCardProps> = ({ applicationType, clientId, name }) => {+ const { t } = useTranslation('auth');+ const endpoints = useIntegrationEndpoints(applicationType);++ const prompt = t(+ integrationPromptKey(applicationType),+ integrationPromptValues(endpoints, { clientId, name }),+ );++ const copyPrompt = async () => {+ try {+ await navigator.clipboard.writeText(prompt);+ toast.success(t('oauthApp.integration.promptCopied'));+ } catch {+ toast.error(t('oauthApp.copy.error'));+ }+ };++ return (+ <SectionCard title={t('oauthApp.integration.title')}>+ <Flexbox gap={12}>+ <Flexbox horizontal align={'center'} gap={12} justify={'space-between'}>+ <Flexbox gap={2}>+ <span className={styles.subTitle}>{t('oauthApp.integration.oneClick')}</span>+ <Text style={{ fontSize: 12 }} type={'secondary'}>+ {t('oauthApp.integration.oneClickDesc')}+ </Text>+ </Flexbox>+ <Button+ icon={<CopyIcon size={14} />}+ style={{ flex: 'none' }}+ type={'primary'}+ onClick={copyPrompt}+ >+ {t('oauthApp.integration.copyPrompt')}+ </Button>+ </Flexbox>+ <div className={styles.prompt}>{prompt}</div>+ </Flexbox>+ </SectionCard>+ );+};++export default IntegrationCard;diff --git a/src/features/Settings/oauth-apps/features/AppDetail/ManualSetupCard.tsx b/src/features/Settings/oauth-apps/features/AppDetail/ManualSetupCard.tsxnew file mode 100644index 00000000000..5297aa60865--- /dev/null+++ b/src/features/Settings/oauth-apps/features/AppDetail/ManualSetupCard.tsx@@ -0,0 +1,115 @@+'use client';++import { CopyButton, Flexbox, Icon } from '@lobehub/ui';+import { Text } from '@lobehub/ui/base-ui';+import { createStaticStyles } from 'antd-style';+import { ChevronDownIcon } from 'lucide-react';+import { type FC, useState } from 'react';+import { useTranslation } from 'react-i18next';++import { type IntegrationEndpointKey } from '../../integrationEndpoints';+import { useIntegrationEndpoints } from './IntegrationCard';+import SectionCard from './SectionCard';++const styles = createStaticStyles(({ css, cssVar }) => ({+ chevron: css`+ color: ${cssVar.colorTextTertiary};+ transition: transform 0.2s ease;+ `,+ chevronOpen: css`+ transform: rotate(180deg);+ `,+ header: css`+ cursor: pointer;+ user-select: none;+ `,+ label: css`+ font-size: 12px;+ color: ${cssVar.colorTextSecondary};+ `,+ value: css`+ padding-block: 2px;+ padding-inline: 12px 2px;+ border-radius: ${cssVar.borderRadius};++ font-family: ${cssVar.fontFamilyCode};+ font-size: 13px;+ overflow-wrap: anywhere;++ background: ${cssVar.colorFillQuaternary};+ `,+}));++const LABEL_KEYS = {+ authorization: 'oauthApp.integration.authorization',+ deviceAuthorization: 'oauthApp.integration.deviceAuthorization',+ discovery: 'oauthApp.integration.discovery',+ issuer: 'oauthApp.integration.issuer',+ token: 'oauthApp.integration.token',+} as const satisfies Record<IntegrationEndpointKey, string>;++interface ManualSetupCardProps {+ applicationType?: string | null;+}++/**+ * The raw issuer and endpoint URLs, for configuring an OAuth / OIDC client by+ * hand. Reference material most developers never need (the one-prompt+ * integration and discovery cover them), so it sits last on the Credentials+ * tab and starts folded.+ */+const ManualSetupCard: FC<ManualSetupCardProps> = ({ applicationType }) => {+ const { t } = useTranslation('auth');+ const endpoints = useIntegrationEndpoints(applicationType);+ const [open, setOpen] = useState(false);+ const toggle = () => setOpen((value) => !value);++ return (+ <SectionCard+ extra={+ <Icon+ className={open ? `${styles.chevron} ${styles.chevronOpen}` : styles.chevron}+ icon={ChevronDownIcon}+ size={16}+ onClick={toggle}+ />+ }+ title={+ <span+ aria-expanded={open}+ className={styles.header}+ role={'button'}+ tabIndex={0}+ onClick={toggle}+ onKeyDown={(e) => {+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ toggle();+ }+ }}+ >+ {t('oauthApp.integration.endpoints')}+ </span>+ }+ >+ {open && (+ <Flexbox gap={12}>+ <Text style={{ fontSize: 12 }} type={'secondary'}>+ {t('oauthApp.integration.desc')}+ </Text>+ {endpoints.map(({ key, url }) => (+ <Flexbox gap={6} key={key}>+ <span className={styles.label}>{t(LABEL_KEYS[key])}</span>+ <Flexbox horizontal align={'center'} className={styles.value} gap={8}>+ <Flexbox flex={1}>{url}</Flexbox>+ <CopyButton content={url} size={'small'} title={t('oauthApp.copy.tooltip')} />+ </Flexbox>+ </Flexbox>+ ))}+ </Flexbox>+ )}+ </SectionCard>+ );+};++export default ManualSetupCard;diff --git a/src/features/Settings/oauth-apps/features/AppDetail/RedirectUrisCard.tsx b/src/features/Settings/oauth-apps/features/AppDetail/RedirectUrisCard.tsxindex 4b03d283d0c..34349df99d2 100644--- a/src/features/Settings/oauth-apps/features/AppDetail/RedirectUrisCard.tsx+++ b/src/features/Settings/oauth-apps/features/AppDetail/RedirectUrisCard.tsx@@ -1,7 +1,7 @@'use client';import { Flexbox } from '@lobehub/ui';-import { ActionIcon, Alert, Button, Input, Text } from '@lobehub/ui/base-ui';+import { ActionIcon, Button, Input, Text } from '@lobehub/ui/base-ui';import { Form, useForm } from '@lobehub/ui/base-ui/form';import { createStaticStyles } from 'antd-style';import { PencilIcon, PlusIcon, Trash2Icon } from 'lucide-react';@@ -19,6 +19,11 @@ import {import SectionCard from './SectionCard';const styles = createStaticStyles(({ css, cssVar }) => ({+ empty: css`+ padding: 16px;+ border: 1px dashed ${cssVar.colorBorder};+ border-radius: ${cssVar.borderRadius};+ `,fieldError: css`font-size: 12px;color: ${cssVar.colorError};@@ -53,8 +58,9 @@ interface RedirectUrisCardProps {/*** The redirect URIs a web app may send users back to. A freshly created app has- * none, which is a legitimate "not yet configured" state shown as a warning;- * once the user opens the editor, a save needs at least one URI.+ * none, which is a legitimate "not yet configured" state: it reads as the next+ * setup step with its own button, not as a warning competing with the one-time+ * secret card above it. Once the editor is open, a save needs at least one URI.*/const RedirectUrisCard: FC<RedirectUrisCardProps> = ({ canEdit, detail, onSubmit }) => {const { t } = useTranslation('auth');@@ -83,14 +89,15 @@ const RedirectUrisCard: FC<RedirectUrisCardProps> = ({ canEdit, detail, onSubmit<SectionCardtitle={t('oauthApp.redirectUris.title')}extra={- !editing && (+ !editing &&+ saved.length > 0 && (<Buttondisabled={!canEdit}icon={<PencilIcon size={14} />}size={'small'}onClick={startEditing}>- {t(saved.length > 0 ? 'oauthApp.detail.edit' : 'oauthApp.redirectUris.configure')}+ {t('oauthApp.detail.edit')}</Button>)}@@ -180,7 +187,23 @@ const RedirectUrisCard: FC<RedirectUrisCardProps> = ({ canEdit, detail, onSubmit))}</Flexbox>) : (- <Alert showIcon message={t('oauthApp.redirectUris.empty')} type={'warning'} />+ <Flexbox+ horizontal+ align={'center'}+ className={styles.empty}+ gap={16}+ justify={'space-between'}+ >+ <Text type={'secondary'}>{t('oauthApp.redirectUris.empty')}</Text>+ <Button+ disabled={!canEdit}+ icon={<PlusIcon size={14} />}+ style={{ flex: 'none' }}+ onClick={startEditing}+ >+ {t('oauthApp.redirectUris.add')}+ </Button>+ </Flexbox>)}</SectionCard>);diff --git a/src/features/Settings/oauth-apps/features/AppDetail/index.tsx b/src/features/Settings/oauth-apps/features/AppDetail/index.tsxindex 8b12387718f..2ba649cb169 100644--- a/src/features/Settings/oauth-apps/features/AppDetail/index.tsx+++ b/src/features/Settings/oauth-apps/features/AppDetail/index.tsx@@ -1,42 +1,42 @@'use client';-import { Flexbox, Icon } from '@lobehub/ui';-import { Button, confirmModal, Skeleton, Switch, Tag, Text, toast } from '@lobehub/ui/base-ui';+import { Flexbox } from '@lobehub/ui';+import {+ ActionIcon,+ Alert,+ Button,+ confirmModal,+ Skeleton,+ Tabs,+ Tag,+ Text,+ toast,+} from '@lobehub/ui/base-ui';import { createStaticStyles } from 'antd-style';-import { ArrowLeftIcon, Trash2Icon } from 'lucide-react';+import dayjs from 'dayjs';+import { ArrowLeftIcon, PowerIcon, PowerOffIcon, Trash2Icon } from 'lucide-react';import { type FC, useEffect } from 'react';import { useTranslation } from 'react-i18next';+import { useSearchParams } from 'react-router';import OAuthAppStats from '@/business/client/OAuthAppStats';+import AsyncError from '@/components/AsyncError';import { useClientDataSWR } from '@/libs/swr';import { authKeys } from '@/libs/swr/keys';+import { normalizeAsyncError } from '@/libs/swr/normalizeError';import { lambdaClient, lambdaQuery } from '@/libs/trpc/client';import { type OAuthAppItem } from '@/types/oauthApp';-import ClientIdDisplay from '../ClientIdDisplay';+import { confirmDisableOAuthApp } from '../confirmDisable';import { showClientSecretModal } from '../SecretModal';import BasicInfoCard from './BasicInfoCard';+import CredentialsCard from './CredentialsCard';+import IntegrationCard from './IntegrationCard';+import ManualSetupCard from './ManualSetupCard';import RedirectUrisCard from './RedirectUrisCard';+import SectionCard from './SectionCard';const styles = createStaticStyles(({ css, cssVar }) => ({- backButton: css`- cursor: pointer;-- display: inline-flex;- align-items: center;- justify-content: center;-- width: 28px;- height: 28px;- border-radius: ${cssVar.borderRadius};-- color: ${cssVar.colorTextSecondary};-- &:hover {- color: ${cssVar.colorText};- background: ${cssVar.colorFillTertiary};- }- `,card: css`padding: 16px;border: 1px solid ${cssVar.colorBorderSecondary};@@ -49,17 +49,36 @@ const styles = createStaticStyles(({ css, cssVar }) => ({border-radius: ${cssVar.borderRadiusLG};background: ${cssVar.colorBgContainer};`,- label: css`+ dangerDesc: css`font-size: 12px;color: ${cssVar.colorTextSecondary};`,- row: css`+ dangerRow: css`display: flex;+ gap: 16px;align-items: center;justify-content: space-between;`,+ // The stats slot is a business stub that renders nothing in the open-source+ // build; an empty bordered card must not be left behind.+ statsCard: css`+ padding: 16px;+ border: 1px solid ${cssVar.colorBorderSecondary};+ border-radius: ${cssVar.borderRadiusLG};+ background: ${cssVar.colorBgContainer};++ &:empty {+ display: none;+ }+ `,+ meta: css`+ font-size: 12px;+ color: ${cssVar.colorTextTertiary};+ `,}));+const TAB_KEYS = ['overview', 'credentials', 'advanced'] as const;+interface AppDetailProps {canEdit: boolean;id: string;@@ -68,15 +87,31 @@ interface AppDetailProps {}const AppDetail: FC<AppDetailProps> = ({ canEdit, id, onBack, onChanged }) => {- const { t } = useTranslation('auth');+ const { t } = useTranslation(['auth', 'common']);- const { data, error, isLoading, mutate } = useClientDataSWR(authKeys.oauthAppById(id), () =>- lambdaClient.oauthApp.getById.query({ id }),+ const { data, error, isLoading, isValidating, mutate } = useClientDataSWR(+ authKeys.oauthAppById(id),+ () => lambdaClient.oauthApp.getById.query({ id }),);const detail = data as OAuthAppItem | undefined;+ // The active tab lives in the URL so a reload or shared link keeps it.+ const [searchParams, setSearchParams] = useSearchParams();+ const tab = TAB_KEYS.find((key) => key === searchParams.get('tab')) ?? 'overview';+ const setTab = (key: string) =>+ setSearchParams(+ (params) => {+ if (key === 'overview') params.delete('tab');+ else params.set('tab', key);+ return params;+ },+ { replace: true },+ );++ // Only a settled "no such app" goes back to the list; a failed load stays here+ // with Retry instead of silently bouncing the user away.useEffect(() => {- if (error || (!isLoading && !detail)) onBack();+ if (!error && !isLoading && !detail) onBack();}, [error, isLoading, detail, onBack]);const revalidate = () => {@@ -92,6 +127,9 @@ const AppDetail: FC<AppDetailProps> = ({ canEdit, id, onBack, onChanged }) => {});const enabledMutation = lambdaQuery.oauthApp.setEnabled.useMutation({ onSuccess: revalidate });const rotateSecretMutation = lambdaQuery.oauthApp.rotateSecret.useMutation({+ // Minting a credential must never fail silently: the user needs to know no+ // secret is waiting for them and that they can try again.+ onError: () => toast.error(t('oauthApp.secret.issueFailed')),onSuccess: ({ clientSecret }) => {revalidate();showClientSecretModal({ clientSecret });@@ -110,6 +148,7 @@ const AppDetail: FC<AppDetailProps> = ({ canEdit, id, onBack, onChanged }) => {const handleRotateSecret = () =>confirmModal({+ cancelText: t('cancel', { ns: 'common' }),content: t('oauthApp.secret.rotateConfirm.content'),okButtonProps: { danger: true },okText: t('oauthApp.secret.rotateConfirm.ok'),@@ -121,6 +160,7 @@ const AppDetail: FC<AppDetailProps> = ({ canEdit, id, onBack, onChanged }) => {const handleDelete = () =>confirmModal({+ cancelText: t('cancel', { ns: 'common' }),content: t('oauthApp.deleteConfirm.content'),okButtonProps: { danger: true },okText: t('oauthApp.deleteConfirm.ok'),@@ -130,7 +170,27 @@ const AppDetail: FC<AppDetailProps> = ({ canEdit, id, onBack, onChanged }) => {title: t('oauthApp.deleteConfirm.title'),});- const isWebApp = detail?.applicationType === 'web';+ const handleEnable = () => enabledMutation.mutate({ enabled: true, id });+ const handleDisable = () =>+ confirmDisableOAuthApp(() => enabledMutation.mutateAsync({ enabled: false, id }));++ if (error && !detail)+ return (+ <AsyncError+ error={error}+ variant={'page'}+ action={+ <Flexbox horizontal gap={8}>+ <Button onClick={onBack}>{t('oauthApp.detail.back')}</Button>+ {normalizeAsyncError(error).retryable && (+ <Button loading={isValidating} onClick={() => mutate()}>+ {t('retry', { ns: 'common' })}+ </Button>+ )}+ </Flexbox>+ }+ />+ );if (!detail)return (@@ -142,37 +202,60 @@ const AppDetail: FC<AppDetailProps> = ({ canEdit, id, onBack, onChanged }) => {</Flexbox>);- return (- <Flexbox gap={20}>- <Flexbox horizontal align={'center'} gap={8}>- <span- aria-label={t('oauthApp.detail.back')}- className={styles.backButton}- role={'button'}- tabIndex={0}- onClick={onBack}- onKeyDown={(e) => {- if (e.key === 'Enter' || e.key === ' ') {- e.preventDefault();- onBack();- }- }}- >- <Icon icon={ArrowLeftIcon} size={'small'} />- </span>- <Text strong style={{ fontSize: 20 }}>- {detail.name}- </Text>- {!detail.enabled && <Tag>{t('oauthApp.item.disabledTag')}</Tag>}- </Flexbox>+ const isWebApp = detail.applicationType === 'web';+ const isDisabled = !detail.enabled;+ // Relative times, matching the list rows.+ const meta = [+ t('oauthApp.detail.createdRelative', { time: dayjs(detail.createdAt).fromNow() }),+ detail.lastUsedAt+ ? t('oauthApp.item.lastUsed', { time: dayjs(detail.lastUsedAt).fromNow() })+ : t('oauthApp.list.neverUsed'),+ ].join(' · ');++ const banner = isDisabled && (+ <Alert+ showIcon+ message={t('oauthApp.disabled.banner')}+ type={'warning'}+ action={+ canEdit && (+ <Button loading={enabledMutation.isPending} size={'small'} onClick={handleEnable}>+ {t('oauthApp.actions.enable')}+ </Button>+ )+ }+ />+ );+ // The landing tab: what the app is and how to wire it in.+ const overviewTab = (+ <><BasicInfoCardcanEdit={canEdit}detail={detail}key={`basic-${detail.id}`}onSubmit={handleUpdate}/>+ <IntegrationCard+ applicationType={detail.applicationType}+ clientId={detail.id}+ name={detail.name}+ />+ <div className={styles.statsCard}>+ <OAuthAppStats clientId={detail.id} />+ </div>+ </>+ );+ const credentialsTab = (+ <>+ <CredentialsCard+ canEdit={canEdit}+ detail={detail}+ secretPending={rotateSecretMutation.isPending}+ onGenerateSecret={() => rotateSecretMutation.mutate({ id })}+ onRotateSecret={handleRotateSecret}+ />{isWebApp && (<RedirectUrisCardcanEdit={canEdit}@@ -181,77 +264,94 @@ const AppDetail: FC<AppDetailProps> = ({ canEdit, id, onBack, onChanged }) => {onSubmit={handleUpdate}/>)}+ {/* Reference material for configuring a client by hand: last, folded. */}+ <ManualSetupCard applicationType={detail.applicationType} />+ </>+ );- <Flexbox className={styles.card} gap={16}>- <div className={styles.row}>- <span className={styles.label}>{t('oauthApp.detail.clientId')}</span>- <ClientIdDisplay clientId={detail.id} />- </div>-- <div className={styles.row}>- <span className={styles.label}>{t('oauthApp.detail.type')}</span>- <Tag>{t(isWebApp ? 'oauthApp.type.webBadge' : 'oauthApp.type.badge')}</Tag>- </div>-- {detail.hasSecret && (- <div className={styles.row}>- <span className={styles.label}>{t('oauthApp.detail.clientSecret')}</span>- <Flexbox horizontal align={'center'} gap={8}>- <Text type={'secondary'}>{t('oauthApp.secret.hidden')}</Text>- <Button- disabled={!canEdit}- loading={rotateSecretMutation.isPending}- size={'small'}- onClick={handleRotateSecret}- >- {t('oauthApp.secret.rotate')}- </Button>- </Flexbox>- </div>- )}-- <div className={styles.row}>- <span className={styles.label}>{t('oauthApp.detail.createdAt')}</span>- <Text type={'secondary'}>{detail.createdAt.toLocaleString()}</Text>- </div>-- <div className={styles.row}>- <span className={styles.label}>{t('oauthApp.detail.lastUsedAt')}</span>- <Text type={'secondary'}>- {detail.lastUsedAt- ? detail.lastUsedAt.toLocaleString()- : t('oauthApp.detail.neverUsed')}- </Text>- </div>-- <div className={styles.row}>- <span className={styles.label}>{t('oauthApp.detail.enabled')}</span>- <Switch- checked={!!detail.enabled}- disabled={!canEdit || enabledMutation.isPending}- onChange={(checked) => enabledMutation.mutate({ enabled: checked, id })}- />+ // Enable / disable is reversible, so it lives in its own section; only the+ // irreversible delete sits in the danger zone.+ const advancedTab = (+ <>+ <SectionCard title={t('oauthApp.detail.status')}>+ <div className={styles.dangerRow}>+ <Flexbox gap={2}>+ <Text>{t(isDisabled ? 'oauthApp.actions.enable' : 'oauthApp.actions.disable')}</Text>+ <span className={styles.dangerDesc}>+ {t(isDisabled ? 'oauthApp.detail.enableDesc' : 'oauthApp.detail.disableDesc')}+ </span>+ </Flexbox>+ <Button+ disabled={!canEdit}+ icon={isDisabled ? <PowerIcon size={16} /> : <PowerOffIcon size={16} />}+ loading={enabledMutation.isPending}+ style={{ flex: 'none' }}+ onClick={isDisabled ? handleEnable : handleDisable}+ >+ {t(isDisabled ? 'oauthApp.actions.enable' : 'oauthApp.actions.disable')}+ </Button></div>- </Flexbox>+ </SectionCard>- <div className={styles.card}>- <OAuthAppStats clientId={detail.id} />- </div>-- <Flexbox className={styles.dangerCard} gap={12}>+ <Flexbox className={styles.dangerCard} gap={16}><Text weight={500}>{t('oauthApp.detail.dangerZone')}</Text>- <div className={styles.row}>+ <div className={styles.dangerRow}>+ <Flexbox gap={2}>+ <Text>{t('oauthApp.detail.delete')}</Text>+ <span className={styles.dangerDesc}>{t('oauthApp.detail.deleteDesc')}</span>+ </Flexbox><Buttondangerdisabled={!canEdit}icon={<Trash2Icon size={16} />}loading={deleteMutation.isPending}+ style={{ flex: 'none' }}onClick={handleDelete}>{t('oauthApp.detail.delete')}</Button></div></Flexbox>+ </>+ );++ return (+ <Flexbox gap={20}>+ {/* The disabled state is about the whole app, so it heads the page. */}+ {banner}++ <Flexbox gap={4}>+ <Flexbox horizontal align={'center'} gap={8}>+ <ActionIcon+ aria-label={t('oauthApp.detail.back')}+ icon={ArrowLeftIcon}+ size={'small'}+ title={t('oauthApp.detail.back')}+ onClick={onBack}+ />+ <Text strong style={{ fontSize: 20 }}>+ {detail.name}+ </Text>+ {isDisabled && <Tag>{t('oauthApp.item.disabledTag')}</Tag>}+ </Flexbox>+ <span className={styles.meta} style={{ paddingInlineStart: 36 }}>+ {meta}+ </span>+ </Flexbox>++ <Tabs+ activeKey={tab}+ items={[+ { key: 'overview', label: t('oauthApp.detail.tabs.overview') },+ { key: 'credentials', label: t('oauthApp.detail.tabs.credentials') },+ { key: 'advanced', label: t('oauthApp.detail.tabs.advanced') },+ ]}+ onChange={setTab}+ />++ {tab === 'overview' && overviewTab}+ {tab === 'credentials' && credentialsTab}+ {tab === 'advanced' && advancedTab}</Flexbox>);};diff --git a/src/features/Settings/oauth-apps/features/AppItem/index.tsx b/src/features/Settings/oauth-apps/features/AppItem/index.tsxindex 189d40ca7df..6100d1cdcc2 100644--- a/src/features/Settings/oauth-apps/features/AppItem/index.tsx+++ b/src/features/Settings/oauth-apps/features/AppItem/index.tsx@@ -1,32 +1,25 @@'use client';import { DropdownMenu, Flexbox, Icon } from '@lobehub/ui';-import { ActionIcon, Avatar, confirmModal, Tag, Text } from '@lobehub/ui/base-ui';+import { ActionIcon, confirmModal, Tag, Text } from '@lobehub/ui/base-ui';import { createStaticStyles } from 'antd-style';import dayjs from 'dayjs';-import {- ChevronRightIcon,- MoreVerticalIcon,- PowerIcon,- PowerOffIcon,- Trash2Icon,-} from 'lucide-react';+import { MoreVerticalIcon, PowerIcon, PowerOffIcon, Trash2Icon } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';import { lambdaQuery } from '@/libs/trpc/client';import { type OAuthAppItem } from '@/types/oauthApp';-import ClientIdDisplay from '../ClientIdDisplay';+import { appTypeLabelKey } from '../../appList';+import AppLogo from '../AppLogo';+import { confirmDisableOAuthApp } from '../confirmDisable';const styles = createStaticStyles(({ css, cssVar }) => ({- chevron: css`- flex: none;- color: ${cssVar.colorTextQuaternary};- `,meta: css`+ flex: none;font-size: ${cssVar.fontSizeSM};- color: ${cssVar.colorTextSecondary};+ color: ${cssVar.colorTextTertiary};`,row: css`cursor: pointer;@@ -57,13 +50,14 @@ interface AppItemProps {}const AppItem = memo<AppItemProps>(({ app, canEdit, onChanged, onDeleted, onOpen }) => {- const { t } = useTranslation('auth');+ const { t } = useTranslation(['auth', 'common']);const setEnabled = lambdaQuery.oauthApp.setEnabled.useMutation({ onSuccess: onChanged });const deleteApp = lambdaQuery.oauthApp.delete.useMutation({ onSuccess: onDeleted });const handleDelete = () =>confirmModal({+ cancelText: t('cancel', { ns: 'common' }),content: t('oauthApp.deleteConfirm.content'),okButtonProps: { danger: true },okText: t('oauthApp.deleteConfirm.ok'),@@ -93,8 +87,9 @@ const AppItem = memo<AppItemProps>(({ app, canEdit, onChanged, onDeleted, onOpen}}}>- <Avatar avatar={app.logoUri || app.name} shape={'square'} size={36} title={app.name} />+ <AppLogo logoUri={app.logoUri} name={app.name} size={36} />+ {/* The client ID lives on the app page; the row only identifies the app. */}<Flexbox flex={1} gap={2} style={{ minWidth: 0 }}><Flexbox horizontal align={'center'} gap={8}><Text ellipsis weight={500}>@@ -102,14 +97,17 @@ const AppItem = memo<AppItemProps>(({ app, canEdit, onChanged, onDeleted, onOpen</Text>{!app.enabled && <Tag>{t('oauthApp.item.disabledTag')}</Tag>}</Flexbox>- <span style={{ alignSelf: 'flex-start' }} onClick={(e) => e.stopPropagation()}>- <ClientIdDisplay clientId={app.id} />- </span>- <span className={styles.meta}>- {t('oauthApp.type.deviceFlow')} · {lastUsed}- </span>+ {app.description && (+ <Text ellipsis style={{ fontSize: 12 }} type={'secondary'}>+ {app.description}+ </Text>+ )}</Flexbox>+ <span className={styles.meta}>+ {t(appTypeLabelKey(app.applicationType))} · {lastUsed}+ </span>+{canEdit && (<span style={{ flex: 'none' }} onClick={(e) => e.stopPropagation()}><DropdownMenu@@ -119,7 +117,10 @@ const AppItem = memo<AppItemProps>(({ app, canEdit, onChanged, onDeleted, onOpenicon: <Icon icon={PowerOffIcon} />,key: 'disable',label: t('oauthApp.actions.disable'),- onClick: () => setEnabled.mutate({ enabled: false, id: app.id }),+ onClick: () =>+ confirmDisableOAuthApp(() =>+ setEnabled.mutateAsync({ enabled: false, id: app.id }),+ ),}: {icon: <Icon icon={PowerIcon} />,@@ -140,8 +141,6 @@ const AppItem = memo<AppItemProps>(({ app, canEdit, onChanged, onDeleted, onOpen</DropdownMenu></span>)}-- <Icon className={styles.chevron} icon={ChevronRightIcon} size={'small'} /></Flexbox>);});diff --git a/src/features/Settings/oauth-apps/features/AppLogo/index.tsx b/src/features/Settings/oauth-apps/features/AppLogo/index.tsxnew file mode 100644index 00000000000..8d6399964f2--- /dev/null+++ b/src/features/Settings/oauth-apps/features/AppLogo/index.tsx@@ -0,0 +1,65 @@+'use client';++import { Icon } from '@lobehub/ui';+import { Avatar } from '@lobehub/ui/base-ui';+import { createStaticStyles, cx } from 'antd-style';+import { AppWindowIcon } from 'lucide-react';+import { memo } from 'react';++const styles = createStaticStyles(({ css, cssVar }) => ({+ // An upload target reads as an empty slot: outline only, no fill.+ dashed: css`+ border: 1px dashed ${cssVar.colorBorder};+ `,+ filled: css`+ background: ${cssVar.colorFillTertiary};+ `,+ placeholder: css`+ display: flex;+ flex: none;+ align-items: center;+ justify-content: center;++ color: ${cssVar.colorTextTertiary};+ `,+}));++interface AppLogoPlaceholderProps {+ /** Dashed outline, for slots where the placeholder is also an upload target. */+ dashed?: boolean;+ size: number;+}++/**+ * Stand-in for an OAuth app without a logo. A letter avatar built from the app+ * name renders CJK names as two oversized glyphs and reads as an unfinished+ * state, so every surface falls back to the same app glyph instead.+ */+export const AppLogoPlaceholder = memo<AppLogoPlaceholderProps>(({ dashed, size }) => (+ <span+ className={cx(styles.placeholder, dashed ? styles.dashed : styles.filled)}+ style={{ borderRadius: Math.max(size / 6, 2), height: size, width: size }}+ >+ <Icon icon={AppWindowIcon} size={Math.round(size * 0.45)} />+ </span>+));++AppLogoPlaceholder.displayName = 'AppLogoPlaceholder';++interface AppLogoProps {+ logoUri?: string | null;+ name: string;+ size: number;+}++const AppLogo = memo<AppLogoProps>(({ logoUri, name, size }) =>+ logoUri ? (+ <Avatar avatar={logoUri} shape={'square'} size={size} title={name} />+ ) : (+ <AppLogoPlaceholder size={size} />+ ),+);++AppLogo.displayName = 'AppLogo';++export default AppLogo;diff --git a/src/features/Settings/oauth-apps/features/CreateAppButton.tsx b/src/features/Settings/oauth-apps/features/CreateAppButton.tsxnew file mode 100644index 00000000000..51e57f2586f--- /dev/null+++ b/src/features/Settings/oauth-apps/features/CreateAppButton.tsx@@ -0,0 +1,50 @@+'use client';++import { Button } from '@lobehub/ui/base-ui';+import { useTranslation } from 'react-i18next';++import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { usePermission } from '@/hooks/usePermission';+import { lambdaClient } from '@/libs/trpc/client';++import { createOAuthAppModal } from './CreateAppModal';+import { showClientSecretModal } from './SecretModal';++const CreateAppButton = () => {+ const { t } = useTranslation('auth');+ const { allowed: hasEditPermission, reason } = usePermission('create_content');+ const activeWorkspaceId = useActiveWorkspaceId();+ // Workspace OAuth apps are shared admin config — Admin-or-higher, matching+ // the server's `requireWorkspaceRoleWhenScoped('admin')` gate.+ const { allowed: canManageWorkspaceApps } = usePermission('manage_settings');+ const canEdit = hasEditPermission && (!activeWorkspaceId || canManageWorkspaceApps);+ const navigate = useWorkspaceAwareNavigate();++ const handleCreate = () => {+ if (!canEdit) return;+ createOAuthAppModal({+ onSubmit: async (values) => {+ // The secret is generated on demand on the app page, not at creation.+ const created = await lambdaClient.oauthApp.create.mutate({+ ...values,+ issueSecret: false,+ });+ navigate(`/settings/oauth-apps/${created.id}`);++ // An older server ignores `issueSecret` and still mints a web app's+ // secret, returning its only plaintext copy here. Reveal it rather than+ // drop it, or the app could only ever be rotated.+ if (created.clientSecret) showClientSecretModal({ clientSecret: created.clientSecret });+ },+ });+ };++ return (+ <Button disabled={!canEdit} title={reason} type={'primary'} onClick={handleCreate}>+ {t('oauthApp.list.actions.create')}+ </Button>+ );+};++export default CreateAppButton;diff --git a/src/features/Settings/oauth-apps/features/CreateAppModal/Content.tsx b/src/features/Settings/oauth-apps/features/CreateAppModal/Content.tsxindex 3e61f20b4ea..27c9980322f 100644--- a/src/features/Settings/oauth-apps/features/CreateAppModal/Content.tsx+++ b/src/features/Settings/oauth-apps/features/CreateAppModal/Content.tsx@@ -13,6 +13,9 @@ import AvatarUpload from '@/components/AvatarUpload';import { type CreateOAuthAppParams } from '@/types/oauthApp';import { useLogoUpload } from '../../useLogoUpload';+import { AppLogoPlaceholder } from '../AppLogo';++const LOGO_SIZE = 64;const styles = createStaticStyles(({ css, cssVar }) => ({typeCard: css`@@ -22,7 +25,8 @@ const styles = createStaticStyles(({ css, cssVar }) => ({flex: 1;- padding: 14px;+ min-width: 0;+ padding: 12px;border: 1px solid ${cssVar.colorBorderSecondary};border-radius: ${cssVar.borderRadiusLG};@@ -40,36 +44,35 @@ const styles = createStaticStyles(({ css, cssVar }) => ({}`,// LobeHub's primary is a near-black neutral, so the selection rides a- // text-colored border and a light fill instead of `colorPrimaryBg`.+ // text-colored border alone — no fill, which read as a disabled block.typeCardSelected: css`border-color: ${cssVar.colorText};- background: ${cssVar.colorFillQuaternary};&:hover {border-color: ${cssVar.colorText};}`,typeCheck: css`- position: absolute;- inset-block-start: 12px;- inset-inline-end: 12px;+ flex: none;+ margin-inline-start: auto;color: ${cssVar.colorText};`,typeDesc: css`font-size: 12px;line-height: 1.5;- color: ${cssVar.colorTextSecondary};+ color: ${cssVar.colorTextTertiary};`,typeIcon: css`display: inline-flex;+ flex: none;align-items: center;justify-content: center;- width: 32px;- height: 32px;+ width: 28px;+ height: 28px;border-radius: ${cssVar.borderRadius};- color: ${cssVar.colorText};+ color: ${cssVar.colorTextSecondary};background: ${cssVar.colorFillTertiary};`,@@ -97,7 +100,7 @@ const TypeSelect: FC<TypeSelectProps> = ({ onChange, options, value }) => (<Flexboxaria-checked={selected}className={cx(styles.typeCard, selected && styles.typeCardSelected)}- gap={10}+ gap={8}key={option.value}role={'radio'}tabIndex={0}@@ -109,12 +112,14 @@ const TypeSelect: FC<TypeSelectProps> = ({ onChange, options, value }) => (}}}>- <span className={styles.typeIcon}>- <Icon icon={option.icon} size={18} />- </span>- <Text weight={500}>{option.title}</Text>+ <Flexbox horizontal align={'center'} gap={8}>+ <span className={styles.typeIcon}>+ <Icon icon={option.icon} size={16} />+ </span>+ <Text weight={500}>{option.title}</Text>+ {selected && <Icon className={styles.typeCheck} icon={CheckIcon} size={16} />}+ </Flexbox><span className={styles.typeDesc}>{option.description}</span>- {selected && <Icon className={styles.typeCheck} icon={CheckIcon} size={16} />}</Flexbox>);})}@@ -132,7 +137,7 @@ export interface CreateAppModalContentProps {}const CreateAppModalContent: FC<CreateAppModalContentProps> = ({ onSubmit }) => {- const { t } = useTranslation('auth');+ const { t } = useTranslation(['auth', 'common']);const { close, setCanDismissByClickOutside } = useModalContext();const [loading, setLoading] = useState(false);const [logoUri, setLogoUri] = useState<string>();@@ -180,32 +185,35 @@ const CreateAppModalContent: FC<CreateAppModalContentProps> = ({ onSubmit }) =>return (<Form form={form} layout={'vertical'}><Flexbox gap={16}>- <Form.Field label={t('oauthApp.form.logo.label')} style={itemStyle}>+ {/* The logo sits beside the name, the way the app will appear in lists+ and on the consent screen, instead of taking a row of its own. */}+ <Flexbox horizontal align={'flex-end'} gap={16}><AvatarUploadallowDelete={!!logoUri}loading={logoUploading}- title={t('oauthApp.form.name.label')}+ placeholder={<AppLogoPlaceholder dashed size={LOGO_SIZE} />}+ size={LOGO_SIZE}+ title={t('oauthApp.form.logo.label')}value={logoUri}onDelete={() => setLogoUri(undefined)}onUpload={handleUpload}/>- </Form.Field>-- <Form.Field- label={t('oauthApp.form.name.label')}- name={'name'}- required={t('oauthApp.validation.nameRequired')}- style={itemStyle}- >- <Input placeholder={t('oauthApp.form.name.placeholder')} />- </Form.Field>+ <Form.Field+ label={t('oauthApp.form.name.label')}+ name={'name'}+ required={t('oauthApp.validation.nameRequired')}+ style={{ ...itemStyle, flex: 1, minWidth: 0 }}+ >+ <Input placeholder={t('oauthApp.form.name.placeholder')} />+ </Form.Field>+ </Flexbox><Form.Fieldlabel={t('oauthApp.form.type.label')}name={'type'}style={itemStyle}extra={- <Flexbox gap={2} style={{ marginTop: 8 }}>+ <Flexbox gap={2} style={{ fontSize: 12, marginTop: 8 }}><span>{t('oauthApp.form.type.immutable')}</span>{type === 'web' && <span>{t('oauthApp.form.type.webNext')}</span>}</Flexbox>@@ -234,18 +242,15 @@ const CreateAppModalContent: FC<CreateAppModalContentProps> = ({ onSubmit }) =>name={'description'}style={itemStyle}>- <TextArea placeholder={t('oauthApp.form.description.placeholder')} rows={3} />+ <TextArea placeholder={t('oauthApp.form.description.placeholder')} rows={2} /></Form.Field>- <Button- block- disabled={logoUploading}- htmlType={'submit'}- loading={loading}- type={'primary'}- >- {t('oauthApp.form.submit')}- </Button>+ <Flexbox horizontal gap={8} justify={'flex-end'} style={{ marginTop: 8 }}>+ <Button onClick={close}>{t('cancel', { ns: 'common' })}</Button>+ <Button disabled={logoUploading} htmlType={'submit'} loading={loading} type={'primary'}>+ {t('oauthApp.form.submit')}+ </Button>+ </Flexbox></Flexbox></Form>);diff --git a/src/features/Settings/oauth-apps/features/OAuthApps.tsx b/src/features/Settings/oauth-apps/features/OAuthApps.tsxindex 53993874ba4..4810f65c983 100644--- a/src/features/Settings/oauth-apps/features/OAuthApps.tsx+++ b/src/features/Settings/oauth-apps/features/OAuthApps.tsx@@ -1,20 +1,21 @@'use client';-import { Flexbox } from '@lobehub/ui';-import { Skeleton, Text } from '@lobehub/ui/base-ui';+import { Empty, Flexbox } from '@lobehub/ui';+import { Skeleton } from '@lobehub/ui/base-ui';import { createStaticStyles } from 'antd-style';+import { AppWindowIcon } from 'lucide-react';import { type FC } from 'react';import { useTranslation } from 'react-i18next';import { useParams } from 'react-router';+import AsyncError from '@/components/AsyncError';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';-import { useClientDataSWR } from '@/libs/swr';-import { authKeys } from '@/libs/swr/keys';-import { lambdaClient } from '@/libs/trpc/client';-import { type OAuthAppItem } from '@/types/oauthApp';+import { resolveAppListState } from '../appList';import AppDetail from './AppDetail';import AppItem from './AppItem';+import CreateAppButton from './CreateAppButton';+import { useOAuthAppList } from './useOAuthAppList';const styles = createStaticStyles(({ css, cssVar }) => ({listCol: css`@@ -34,14 +35,7 @@ const OAuthApps: FC<OAuthAppsProps> = ({ canEdit }) => {const navigate = useWorkspaceAwareNavigate();const params = useParams<{ sub?: string }>();- const {- data: apps,- isLoading,- mutate,- } = useClientDataSWR(authKeys.oauthAppList(), async () => {- const list = await lambdaClient.oauthApp.list.query();- return list as OAuthAppItem[];- });+ const { data: apps, error, isLoading, isValidating, mutate } = useOAuthAppList();const reload = () => mutate();@@ -50,13 +44,35 @@ const OAuthApps: FC<OAuthAppsProps> = ({ canEdit }) => {<AppDetailcanEdit={canEdit}id={params.sub}+ key={params.sub}onBack={() => navigate('/settings/oauth-apps')}onChanged={reload}/>);+ const listState = resolveAppListState({ count: apps?.length, error, isLoading });++ if (listState === 'error')+ return <AsyncError error={error} retrying={isValidating} variant={'block'} onRetry={reload} />;++ // A small list the user builds themselves: the empty state sits in place,+ // unframed, and owns the page's one primary action (the header hides its+ // Create button meanwhile).+ if (listState === 'empty' || (listState === 'list' && !apps))+ return (+ <Empty+ action={canEdit && <CreateAppButton />}+ description={t('oauthApp.list.empty')}+ // The default 34ch cap breaks the one-sentence CJK copy mid-word.+ descriptionProps={{ style: { maxWidth: '48ch' } }}+ icon={AppWindowIcon}+ style={{ paddingBlock: 64 }}+ title={t('oauthApp.list.emptyTitle')}+ />+ );+const renderRows = () => {- if (isLoading)+ if (listState === 'loading')return (<Flexbox gap={12} padding={12}><Skeleton.Text rows={2} />@@ -64,14 +80,7 @@ const OAuthApps: FC<OAuthAppsProps> = ({ canEdit }) => {</Flexbox>);- if (!apps?.length)- return (- <Flexbox align={'center'} gap={12} paddingBlock={40}>- <Text type={'secondary'}>{t('oauthApp.list.empty')}</Text>- </Flexbox>- );-- return apps.map((app) => (+ return apps?.map((app) => (<AppItemapp={app}canEdit={canEdit}diff --git a/src/features/Settings/oauth-apps/features/SecretModal/index.tsx b/src/features/Settings/oauth-apps/features/SecretModal/index.tsxindex c8b28e616d2..4fad007d603 100644--- a/src/features/Settings/oauth-apps/features/SecretModal/index.tsx+++ b/src/features/Settings/oauth-apps/features/SecretModal/index.tsx@@ -1,56 +1,85 @@'use client';import { CopyButton, Flexbox } from '@lobehub/ui';-import { Alert, createModal, type ModalInstance, Text } from '@lobehub/ui/base-ui';+import { Button, createModal, type ModalInstance, useModalContext } from '@lobehub/ui/base-ui';import { createStaticStyles } from 'antd-style';import { t } from 'i18next';import { type FC } from 'react';import { useTranslation } from 'react-i18next';const styles = createStaticStyles(({ css, cssVar }) => ({+ hint: css`+ font-size: 12px;+ line-height: 1.6;+ color: ${cssVar.colorTextSecondary};+ `,+ inlineCode: css`+ padding-inline: 4px;+ border-radius: 4px;+ font-family: ${cssVar.fontFamilyCode};+ background: ${cssVar.colorFillTertiary};+ `,secret: css`padding-block: 4px;padding-inline: 12px 4px;+ border: 1px solid ${cssVar.colorBorderSecondary};border-radius: ${cssVar.borderRadius};font-family: ${cssVar.fontFamilyCode};font-size: 13px;overflow-wrap: anywhere;-- background: ${cssVar.colorFillTertiary};`,}));-interface ClientSecretContentProps {+/** Renders the copy's backtick-quoted parameter names as inline code. */+const withInlineCode = (text: string, className: string) =>+ text.split('`').map((part, index) =>+ index % 2 === 1 ? (+ <code className={className} key={index}>+ {part}+ </code>+ ) : (+ part+ ),+ );++interface SecretContentProps {clientSecret: string;}-const ClientSecretContent: FC<ClientSecretContentProps> = ({ clientSecret }) => {+const SecretContent: FC<SecretContentProps> = ({ clientSecret }) => {const { t } = useTranslation('auth');+ const { close } = useModalContext();return (<Flexbox gap={12}>- <Alert message={t('oauthApp.secret.onceWarning')} type={'warning'} /><Flexbox horizontal align={'center'} className={styles.secret} gap={8}><Flexbox flex={1}>{clientSecret}</Flexbox><CopyButton content={clientSecret} title={t('oauthApp.secret.copy')} /></Flexbox>- <Text style={{ fontSize: 12 }} type={'secondary'}>- {t('oauthApp.secret.usage')}- </Text>+ <span className={styles.hint}>+ {t('oauthApp.secret.onceWarning')}{' '}+ {withInlineCode(t('oauthApp.secret.usage'), styles.inlineCode)}+ </span>+ <Flexbox horizontal justify={'flex-end'} style={{ marginTop: 4 }}>+ <Button type={'primary'} onClick={close}>+ {t('oauthApp.secret.dismiss')}+ </Button>+ </Flexbox></Flexbox>);};/**- * Shows a freshly issued client secret. This is the only moment the plaintext- * exists outside the creating request, so the modal is deliberately explicit- * that it will not be shown again.+ * Reveals a client secret the owner just generated or rotated. It opens only+ * in response to that action — never as a side effect of creating the app —+ * and a stray click outside cannot close it: this is the only copy.*/-export const showClientSecretModal = (props: ClientSecretContentProps): ModalInstance =>+export const showClientSecretModal = (props: SecretContentProps): ModalInstance =>createModal({- content: <ClientSecretContent {...props} />,+ content: <SecretContent {...props} />,footer: null,+ maskClosable: false,title: t('oauthApp.secret.revealTitle', { ns: 'auth' }),width: 'min(90vw, 520px)',});diff --git a/src/features/Settings/oauth-apps/features/confirmDisable.tsx b/src/features/Settings/oauth-apps/features/confirmDisable.tsxnew file mode 100644index 00000000000..4eecacca69c--- /dev/null+++ b/src/features/Settings/oauth-apps/features/confirmDisable.tsx@@ -0,0 +1,19 @@+import { confirmModal } from '@lobehub/ui/base-ui';+import { t } from 'i18next';++/**+ * Disabling makes the provider treat the client as unknown: new sign-ins and+ * token refreshes fail for every user of the app. That is a wider blast radius+ * than rotating the secret, so it gets the same explicit confirmation.+ */+export const confirmDisableOAuthApp = (onOk: () => Promise<unknown>) =>+ confirmModal({+ cancelText: t('cancel', { ns: 'common' }),+ content: t('oauthApp.disableConfirm.content', { ns: 'auth' }),+ okButtonProps: { danger: true },+ okText: t('oauthApp.disableConfirm.ok', { ns: 'auth' }),+ onOk: async () => {+ await onOk();+ },+ title: t('oauthApp.disableConfirm.title', { ns: 'auth' }),+ });diff --git a/src/features/Settings/oauth-apps/features/index.ts b/src/features/Settings/oauth-apps/features/index.tsindex 7ad16dc2858..45a2470c93c 100644--- a/src/features/Settings/oauth-apps/features/index.ts+++ b/src/features/Settings/oauth-apps/features/index.ts@@ -1,4 +1,3 @@export { default as AppDetail } from './AppDetail';export { default as ClientIdDisplay } from './ClientIdDisplay';export { createOAuthAppModal } from './CreateAppModal';-export { showClientSecretModal } from './SecretModal';diff --git a/src/features/Settings/oauth-apps/features/useOAuthAppList.ts b/src/features/Settings/oauth-apps/features/useOAuthAppList.tsnew file mode 100644index 00000000000..2ab9aeb861e--- /dev/null+++ b/src/features/Settings/oauth-apps/features/useOAuthAppList.ts@@ -0,0 +1,14 @@+import { useClientDataSWR } from '@/libs/swr';+import { authKeys } from '@/libs/swr/keys';+import { lambdaClient } from '@/libs/trpc/client';+import { type OAuthAppItem } from '@/types/oauthApp';++/**+ * The app list, shared by the list body and the page header (which hides its+ * Create button while the empty state shows its own). SWR dedupes the request.+ */+export const useOAuthAppList = (enabled = true) =>+ useClientDataSWR(enabled ? authKeys.oauthAppList() : null, async () => {+ const list = await lambdaClient.oauthApp.list.query();+ return list as OAuthAppItem[];+ });diff --git a/src/features/Settings/oauth-apps/index.test.tsx b/src/features/Settings/oauth-apps/index.test.tsxindex 014ce8debeb..d7088ddcf89 100644--- a/src/features/Settings/oauth-apps/index.test.tsx+++ b/src/features/Settings/oauth-apps/index.test.tsx@@ -44,6 +44,10 @@ vi.mock('./features/CreateAppModal', () => ({createOAuthAppModal: vi.fn(),}));+vi.mock('./features/useOAuthAppList', () => ({+ useOAuthAppList: () => ({ data: undefined }),+}));+vi.mock('./features/OAuthApps', () => ({default: () => <div>oauth-apps-page</div>,}));diff --git a/src/features/Settings/oauth-apps/index.tsx b/src/features/Settings/oauth-apps/index.tsxindex c8fa885bef7..345cd2a5a92 100644--- a/src/features/Settings/oauth-apps/index.tsx+++ b/src/features/Settings/oauth-apps/index.tsx@@ -1,56 +1,23 @@-import { Button, Skeleton } from '@lobehub/ui/base-ui';+import { Skeleton } from '@lobehub/ui/base-ui';import { useTranslation } from 'react-i18next';import { useParams } from 'react-router';import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';import NotFound from '@/components/404';import SettingHeader from '@/features/Settings/features/SettingHeader';-import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import { usePermission } from '@/hooks/usePermission';-import { lambdaClient } from '@/libs/trpc/client';import { useUserStore } from '@/store/user';import { labPreferSelectors, preferenceSelectors } from '@/store/user/selectors';-import { createOAuthAppModal } from './features/CreateAppModal';+import CreateAppButton from './features/CreateAppButton';import OAuthApps from './features/OAuthApps';-import { showClientSecretModal } from './features/SecretModal';--const CreateAppButton = () => {- const { t } = useTranslation('auth');- const { allowed: hasEditPermission, reason } = usePermission('create_content');- const activeWorkspaceId = useActiveWorkspaceId();- // Workspace OAuth apps are shared admin config — Admin-or-higher, matching- // the server's `requireWorkspaceRoleWhenScoped('admin')` gate.- const { allowed: canManageWorkspaceApps } = usePermission('manage_settings');- const canEdit = hasEditPermission && (!activeWorkspaceId || canManageWorkspaceApps);- const navigate = useWorkspaceAwareNavigate();-- const handleCreate = () => {- if (!canEdit) return;- createOAuthAppModal({- onSubmit: async (values) => {- const created = await lambdaClient.oauthApp.create.mutate(values);- navigate(`/settings/oauth-apps/${created.id}`);-- // Web apps get a confidential secret, and this is the one and only- // render of its plaintext.- if (created.clientSecret) showClientSecretModal({ clientSecret: created.clientSecret });- },- });- };-- return (- <Button disabled={!canEdit} title={reason} type={'primary'} onClick={handleCreate}>- {t('oauthApp.list.actions.create')}- </Button>- );-};+import { useOAuthAppList } from './features/useOAuthAppList';const Page = () => {const { t } = useTranslation('auth');const { allowed: hasEditPermission } = usePermission('create_content');const activeWorkspaceId = useActiveWorkspaceId();- // Same Admin-or-higher rule as `CreateAppButton` above.+ // Same Admin-or-higher rule as `CreateAppButton`.const { allowed: canManageWorkspaceApps } = usePermission('manage_settings');const params = useParams<{ sub?: string }>();const canEdit = hasEditPermission && (!activeWorkspaceId || canManageWorkspaceApps);@@ -59,13 +26,17 @@ const Page = () => {labPreferSelectors.enableOAuthApps(s),]);+ // While the list is empty its empty state carries the Create button.+ const { data: apps } = useOAuthAppList(isPreferenceInit && enableOAuthApps);+ const listEmpty = apps?.length === 0;+if (!isPreferenceInit) return <Skeleton.Text rows={5} />;if (!enableOAuthApps) return <NotFound />;return (<><SettingHeader- extra={!params.sub && canEdit && <CreateAppButton />}+ extra={!params.sub && canEdit && !listEmpty && <CreateAppButton />}title={t('tab.oauthApps')}/><OAuthApps canEdit={canEdit} />diff --git a/src/features/Settings/oauth-apps/integrationEndpoints.test.ts b/src/features/Settings/oauth-apps/integrationEndpoints.test.tsnew file mode 100644index 00000000000..ac5688af05e--- /dev/null+++ b/src/features/Settings/oauth-apps/integrationEndpoints.test.ts@@ -0,0 +1,55 @@+import { describe, expect, it } from 'vitest';++import { getIntegrationEndpoints, resolveIssuer } from './integrationEndpoints';++describe('getIntegrationEndpoints', () => {+ it('gives a web app the authorization-code endpoints', () => {+ expect(getIntegrationEndpoints('https://app.lobehub.com/oidc', 'web')).toEqual([+ { key: 'issuer', url: 'https://app.lobehub.com/oidc' },+ {+ key: 'discovery',+ url: 'https://app.lobehub.com/oidc/.well-known/openid-configuration',+ },+ { key: 'authorization', url: 'https://app.lobehub.com/oidc/auth' },+ { key: 'token', url: 'https://app.lobehub.com/oidc/token' },+ ]);+ });++ it('gives a device app the device authorization endpoint instead', () => {+ const endpoints = getIntegrationEndpoints('http://localhost:3010/oidc/', 'native');++ expect(endpoints.map((e) => e.key)).toEqual([+ 'issuer',+ 'discovery',+ 'deviceAuthorization',+ 'token',+ ]);+ expect(endpoints[0].url).toBe('http://localhost:3010/oidc');+ expect(endpoints[2].url).toBe('http://localhost:3010/oidc/device/auth');+ });++ it('keeps the configured issuer verbatim, including a reverse-proxy path prefix', () => {+ const endpoints = getIntegrationEndpoints('https://example.com/lobe/oidc', 'web');++ expect(endpoints[0].url).toBe('https://example.com/lobe/oidc');+ expect(endpoints[1].url).toBe('https://example.com/lobe/oidc/.well-known/openid-configuration');+ expect(endpoints[3].url).toBe('https://example.com/lobe/oidc/token');+ });+});++describe('resolveIssuer', () => {+ it("prefers the server's configured issuer", () => {+ expect(resolveIssuer('https://auth.example.com/lobe/oidc', 'app://renderer')).toBe(+ 'https://auth.example.com/lobe/oidc',+ );+ });++ it('falls back to the app origin (the connected server on desktop) for an older server', () => {+ expect(resolveIssuer(undefined, 'https://my-lobehub.example.com')).toBe(+ 'https://my-lobehub.example.com/oidc',+ );+ expect(resolveIssuer(undefined, 'https://my-lobehub.example.com/')).toBe(+ 'https://my-lobehub.example.com/oidc',+ );+ });+});diff --git a/src/features/Settings/oauth-apps/integrationEndpoints.ts b/src/features/Settings/oauth-apps/integrationEndpoints.tsnew file mode 100644index 00000000000..c903af20432--- /dev/null+++ b/src/features/Settings/oauth-apps/integrationEndpoints.ts@@ -0,0 +1,51 @@+import urlJoin from 'url-join';++import { OIDC_DISCOVERY_PATH, OIDC_ISSUER_PATH, OIDC_ROUTES } from '@/libs/oidc-provider/routes';++export type IntegrationEndpointKey =+ 'authorization' | 'deviceAuthorization' | 'discovery' | 'issuer' | 'token';++/**+ * The issuer to show: the server's configured one (`APP_URL` + `/oidc`), or —+ * for a server too old to send it — the app origin, which on desktop is the+ * connected server rather than the renderer's own `app://` origin.+ */+export const resolveIssuer = (configured: string | undefined, appOrigin: string) =>+ configured || urlJoin(appOrigin, OIDC_ISSUER_PATH);++export interface IntegrationEndpoint {+ key: IntegrationEndpointKey;+ url: string;+}++/**+ * The URLs a developer configures in their OAuth / OIDC client, in the order+ * they need them. Each app type gets only the endpoints its flow uses: a web+ * app redirects users to the authorization endpoint, a CLI / device app starts+ * at the device authorization endpoint instead.+ *+ * Everything derives from the provider's configured `issuer`, never from the+ * page's own origin: strict clients reject a discovery document whose issuer+ * differs from the one they were given, and the page origin differs behind a+ * reverse proxy or on desktop.+ */+export const getIntegrationEndpoints = (+ issuer: string,+ applicationType?: string | null,+): IntegrationEndpoint[] => {+ const normalizedIssuer = issuer.replace(/\/+$/, '');+ const base = normalizedIssuer.endsWith(OIDC_ISSUER_PATH)+ ? normalizedIssuer.slice(0, -OIDC_ISSUER_PATH.length)+ : normalizedIssuer;+ const url = (path: string) => urlJoin(base, path);+ const isWeb = applicationType === 'web';++ return [+ { key: 'issuer', url: normalizedIssuer },+ { key: 'discovery', url: url(OIDC_DISCOVERY_PATH) },+ isWeb+ ? { key: 'authorization', url: url(OIDC_ROUTES.authorization) }+ : { key: 'deviceAuthorization', url: url(OIDC_ROUTES.device_authorization) },+ { key: 'token', url: url(OIDC_ROUTES.token) },+ ];+};diff --git a/src/features/Settings/oauth-apps/integrationPrompt.test.ts b/src/features/Settings/oauth-apps/integrationPrompt.test.tsnew file mode 100644index 00000000000..0b2637d0976--- /dev/null+++ b/src/features/Settings/oauth-apps/integrationPrompt.test.ts@@ -0,0 +1,27 @@+import { describe, expect, it } from 'vitest';++import auth from '../../../../packages/locales/src/default/auth';+import { getIntegrationEndpoints } from './integrationEndpoints';+import { integrationPromptKey, integrationPromptValues } from './integrationPrompt';++const placeholders = (template: string) =>+ [...template.matchAll(/\{\{(\w+)\}\}/g)].map(([, name]) => name);++describe('integration prompt', () => {+ it.each(['web', 'native'])('fills every placeholder of the %s template', (type) => {+ const template = auth[integrationPromptKey(type)];+ const values = integrationPromptValues(+ getIntegrationEndpoints('https://app.lobehub.com/oidc', type),+ { clientId: 'lca_test', name: 'My App' },+ );++ expect(placeholders(template).length).toBeGreaterThan(0);+ for (const name of placeholders(template))+ expect(values[name as keyof typeof values]).toBeTruthy();+ });++ it('picks the flow by app type', () => {+ expect(integrationPromptKey('web')).toBe('oauthApp.integration.prompt.web');+ expect(integrationPromptKey('native')).toBe('oauthApp.integration.prompt.device');+ });+});diff --git a/src/features/Settings/oauth-apps/integrationPrompt.ts b/src/features/Settings/oauth-apps/integrationPrompt.tsnew file mode 100644index 00000000000..0e4d6df5728--- /dev/null+++ b/src/features/Settings/oauth-apps/integrationPrompt.ts@@ -0,0 +1,21 @@+import { type IntegrationEndpoint, type IntegrationEndpointKey } from './integrationEndpoints';++/**+ * The one-prompt integration: a ready-to-paste instruction for a coding agent+ * (Claude Code, Codex, …) that wires LobeHub sign-in into the user's project.+ * The template is per flow; the values are this app's real credentials and+ * endpoints, so the pasted prompt works without editing.+ */+export const integrationPromptKey = (applicationType?: string | null) =>+ applicationType === 'web'+ ? ('oauthApp.integration.prompt.web' as const)+ : ('oauthApp.integration.prompt.device' as const);++export const integrationPromptValues = (+ endpoints: IntegrationEndpoint[],+ app: { clientId: string; name: string },+): { appName: string; clientId: string } & Partial<Record<IntegrationEndpointKey, string>> => ({+ appName: app.name,+ clientId: app.clientId,+ ...Object.fromEntries(endpoints.map(({ key, url }) => [key, url])),+});diff --git a/src/libs/oidc-provider/adapter.test.ts b/src/libs/oidc-provider/adapter.test.tsindex cac1996d5fc..56094ca3a22 100644--- a/src/libs/oidc-provider/adapter.test.ts+++ b/src/libs/oidc-provider/adapter.test.ts@@ -95,6 +95,20 @@ describe('OIDCAdapter (DrizzleAdapter)', () => {expect(result).toBeUndefined();});+ it('returns undefined for a web app whose secret has not been generated yet', async () => {+ const db = createSelectDb([+ {+ ...clientRow,+ applicationType: 'web',+ clientSecret: null,+ tokenEndpointAuthMethod: 'client_secret_post',+ },+ ]);+ const adapter = new DrizzleAdapter('Client', db as any);++ expect(await adapter.find('lca_client_1')).toBeUndefined();+ });+it('hands oidc-provider the decrypted client secret', async () => {mockDecrypt.mockResolvedValue({ plaintext: 'lcs_plain', wasAuthentic: true });const db = createSelectDb([{ ...clientRow, clientSecret: 'iv:tag:cipher' }]);diff --git a/src/libs/oidc-provider/adapter.ts b/src/libs/oidc-provider/adapter.tsindex e76089e3b9c..854df0c30a3 100644--- a/src/libs/oidc-provider/adapter.ts+++ b/src/libs/oidc-provider/adapter.ts@@ -344,6 +344,14 @@ class OIDCAdapter {log('[Client] Client %s is disabled, treating as not found', id);return undefined;}+ // A web app's secret is issued on demand, not at creation. Until the owner+ // generates one, a secret-authenticated client cannot authenticate, so it+ // is as unusable as a disabled one — and passing it on would make+ // oidc-provider reject the metadata as a server error.+ if (model.tokenEndpointAuthMethod?.startsWith('client_secret') && !model.clientSecret) {+ log('[Client] Client %s has no secret issued yet, treating as not found', id);+ return undefined;+ }log('[Client] Converting client record to expected format');const clientMetadata: Record<string, any> = {application_type: model.applicationType,diff --git a/src/libs/oidc-provider/http-adapter.ts b/src/libs/oidc-provider/http-adapter.tsindex a97efc4d233..a70706116ae 100644--- a/src/libs/oidc-provider/http-adapter.ts+++ b/src/libs/oidc-provider/http-adapter.ts@@ -7,6 +7,7 @@ import { type NextRequest } from 'next/server';import urlJoin from 'url-join';import { appEnv } from '@/envs/app';+import { OIDC_DISCOVERY_PATH } from '@/libs/oidc-provider/routes';const log = debug('lobe-oidc:http-adapter');@@ -27,7 +28,6 @@ export const convertHeadersToNodeHeaders = (nextHeaders: Headers): Record<string* Create a Node.js HTTP request object for OIDC Provider* @param req Next.js request object*/-const DISCOVERY_PUBLIC_PATH = '/oidc/.well-known/openid-configuration';const DISCOVERY_PROVIDER_PATH = '/.well-known/openid-configuration';export const createNodeRequest = async (req: NextRequest): Promise<IncomingMessage> => {@@ -46,7 +46,7 @@ export const createNodeRequest = async (req: NextRequest): Promise<IncomingMessa// under the `/oidc` prefix the way every other route is. The document lives// where clients look for it (`/oidc/.well-known/openid-configuration`, the// issuer plus the well-known suffix) and is translated back here.- if (providerPath === DISCOVERY_PUBLIC_PATH) {+ if (providerPath === OIDC_DISCOVERY_PATH) {providerPath = DISCOVERY_PROVIDER_PATH;}diff --git a/src/libs/oidc-provider/provider.ts b/src/libs/oidc-provider/provider.tsindex 4f8e6e5dc92..f376b952855 100644--- a/src/libs/oidc-provider/provider.ts+++ b/src/libs/oidc-provider/provider.ts@@ -7,6 +7,7 @@ import urlJoin from 'url-join';import { UserModel } from '@/database/models/user';import { appEnv } from '@/envs/app';import { getJWKS } from '@/libs/oidc-provider/jwt';+import { OIDC_ISSUER_PATH, OIDC_ROUTES } from '@/libs/oidc-provider/routes';import { normalizeLocale } from '@/locales/resources';import { isOIDCUserBanned } from './access-control';@@ -310,15 +311,7 @@ export const createOIDCProvider = async (db: LobeChatDatabase): Promise<Provider// mounted under it and the adapter hands it the untouched pathname. A route// left at its default (e.g. `/jwks`) is therefore unreachable: the request// arrives as `/oidc/jwks` and the provider answers 404.- routes: {- authorization: '/oidc/auth',- code_verification: '/oidc/device',- device_authorization: '/oidc/device/auth',- end_session: '/oidc/session/end',- jwks: '/oidc/jwks',- token: '/oidc/token',- userinfo: '/oidc/me',- },+ routes: { ...OIDC_ROUTES },// 3. Scopes definitionscopes: defaultScopes,@@ -327,7 +320,7 @@ export const createOIDCProvider = async (db: LobeChatDatabase): Promise<Provider};// Create provider instance- const baseUrl = urlJoin(appEnv.APP_URL!, '/oidc');+ const baseUrl = urlJoin(appEnv.APP_URL!, OIDC_ISSUER_PATH);const provider = new Provider(baseUrl, configuration);provider.proxy = true;diff --git a/src/libs/oidc-provider/routes.ts b/src/libs/oidc-provider/routes.tsnew file mode 100644index 00000000000..8415aafbb40--- /dev/null+++ b/src/libs/oidc-provider/routes.ts@@ -0,0 +1,22 @@+/**+ * Public paths of the OIDC provider, shared by the provider configuration and+ * the settings page that shows developers where to point their clients.+ *+ * Every route carries the `/oidc` prefix because the provider is mounted under+ * it and receives the untouched pathname; a route left at its default (e.g.+ * `/jwks`) would be unreachable.+ */+export const OIDC_ISSUER_PATH = '/oidc';++export const OIDC_ROUTES = {+ authorization: '/oidc/auth',+ code_verification: '/oidc/device',+ device_authorization: '/oidc/device/auth',+ end_session: '/oidc/session/end',+ jwks: '/oidc/jwks',+ token: '/oidc/token',+ userinfo: '/oidc/me',+} as const;++/** Where clients fetch discovery: the issuer plus the well-known suffix. */+export const OIDC_DISCOVERY_PATH = '/oidc/.well-known/openid-configuration';diff --git a/src/store/serverConfig/selectors.ts b/src/store/serverConfig/selectors.tsindex 26b6b26dbbc..14e778dc4b8 100644--- a/src/store/serverConfig/selectors.ts+++ b/src/store/serverConfig/selectors.ts@@ -30,5 +30,6 @@ export const serverConfigSelectors = {s.serverConfig.widgetSandboxNetworkFormat === 'allowlist',isMobile: (s: ServerConfigStore) => s.isMobile || false,oAuthSSOProviders: (s: ServerConfigStore) => s.serverConfig.oAuthSSOProviders,+ oidcIssuer: (s: ServerConfigStore) => s.serverConfig.oidcIssuer,multimodalUnderstanding: (s: ServerConfigStore) => s.serverConfig.multimodalUnderstanding,};