Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions packages/app/src/components/dialog-connect-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -427,20 +427,28 @@ function ProviderConnection(props: {
const loading = createMemo(() => integration.loading)
const methods = createMemo<ConnectMethod[]>(() => {
const values = integration.latest?.methods.filter(
(method): method is ConnectMethod => method.type === "key" || method.type === "oauth",
(method): method is ConnectMethod =>
(method.type === "key" || method.type === "oauth") && !(method.label ?? "").startsWith("Stored API key "),
)
return values?.length ? values : fallback()
})
const storedKeys = createMemo(() =>
(integration.latest?.connections?.filter((c) => c.type === "credential") ?? []) as Array<{
type: "credential"
id: string
label: string
displayPrefix?: string
displaySuffix?: string
createdAt?: number
cooldownUntil?: number
}>,
(integration.latest?.methods ?? []).flatMap((method) => {
if (method.type !== "key") return []
const match = (method.label ?? "").match(/^Stored API key (\d+) \(([^.]+)\.\.\.([^)]+)\)$/)
if (!match) return []
return [
{
type: "credential" as const,
id: `${props.provider}:${Number(match[1]) - 1}`,
label: `Workspace ${match[1]}`,
displayPrefix: match[2],
displaySuffix: match[3],
createdAt: undefined,
cooldownUntil: undefined,
},
]
}),
)
const [store, setStore] = createStore({
methodIndex: undefined as undefined | number,
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/utils/server-compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ function createV1Api(input: CompatibleInput): CompatibleApi {
displaySuffix: match[3],
}
})
const methods = authMethods.filter((_, index) => !stored[index]).map((method, index) =>
const methods = authMethods.map((method, index) =>
method.type === "api"
? { type: "key" as const, label: method.label }
: { type: "oauth" as const, id: String(index), label: method.label, prompts: method.prompts },
Expand Down
Loading