🤯 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
chore: add api key guard
rdmclin22851d780cbf3
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.jsonindex 1a156855936..a40ec696dff 100644--- a/locales/en-US/setting.json+++ b/locales/en-US/setting.json@@ -1325,6 +1325,15 @@"tools.tabs.all": "All","tools.tabs.installed": "Enabled","tools.title": "Skills",+ "workspace.apiKey.upgrade.benefits.integration.desc": "Call workspace agents and resources from your own systems via the LobeHub API.",+ "workspace.apiKey.upgrade.benefits.integration.title": "Programmatic access",+ "workspace.apiKey.upgrade.benefits.security.desc": "Requests run under workspace roles and permissions, and keys can be revoked centrally.",+ "workspace.apiKey.upgrade.benefits.security.title": "Workspace-scoped security",+ "workspace.apiKey.upgrade.benefits.shared.desc": "Keys belong to the workspace instead of one person, so automation survives member changes.",+ "workspace.apiKey.upgrade.benefits.shared.title": "Team-shared keys",+ "workspace.apiKey.upgrade.cta": "Upgrade to Pro",+ "workspace.apiKey.upgrade.desc": "Create workspace-scoped API keys to integrate workspace agents and data into your own workflows and services.",+ "workspace.apiKey.upgrade.title": "Unlock workspace API keys for programmatic access","workspace.auditLog.actions.api_key.created": "API key created","workspace.auditLog.actions.api_key.renamed": "API key renamed","workspace.auditLog.actions.api_key.revoked": "API key revoked",@@ -2504,6 +2513,7 @@"workspace.wizard.step2.features.free.share": "First 3 members are free, including you","workspace.wizard.step2.features.free.upgradable": "Upgrade anytime for more seats","workspace.wizard.step2.features.pro.adminControls": "Centralized billing and role management",+ "workspace.wizard.step2.features.pro.apiKey": "Workspace API keys","workspace.wizard.step2.features.pro.collaboration": "Invite members · share agents and files","workspace.wizard.step2.features.pro.memberBudget": "Per-member budget control","workspace.wizard.step2.features.pro.onDemand": "On-demand usage · Auto top-up (${{price}} / 1M credits)",diff --git a/locales/en-US/subscription.json b/locales/en-US/subscription.jsonindex 231837b25e1..17f8c7872bc 100644--- a/locales/en-US/subscription.json+++ b/locales/en-US/subscription.json@@ -403,6 +403,7 @@"plans.target": "Target Plan","plans.unlimited": "Unlimited","plans.workspace.features.adminControls": "Centralized billing and role management",+ "plans.workspace.features.apiKey": "Workspace API Keys","plans.workspace.features.auditLog": "Audit Logs","plans.workspace.features.inviteMembers": "Invite Members","plans.workspace.features.memberBudget": "Per-member Budget Control",diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.jsonindex 664b2cae398..008672292a5 100644--- a/locales/zh-CN/setting.json+++ b/locales/zh-CN/setting.json@@ -1325,6 +1325,15 @@"tools.tabs.all": "全部","tools.tabs.installed": "已启用","tools.title": "技能",+ "workspace.apiKey.upgrade.benefits.integration.desc": "通过 LobeHub API 在您自己的系统中调用工作区的助理与资源。",+ "workspace.apiKey.upgrade.benefits.integration.title": "编程化访问",+ "workspace.apiKey.upgrade.benefits.security.desc": "请求遵循工作区的角色与权限体系,密钥可集中吊销。",+ "workspace.apiKey.upgrade.benefits.security.title": "工作区级安全",+ "workspace.apiKey.upgrade.benefits.shared.desc": "密钥归属于工作区而非个人,成员变动不影响自动化流程。",+ "workspace.apiKey.upgrade.benefits.shared.title": "团队共享密钥",+ "workspace.apiKey.upgrade.cta": "升级到 Pro",+ "workspace.apiKey.upgrade.desc": "创建工作区级 API 密钥,将工作区的助理与数据集成到您自己的工作流和服务中。",+ "workspace.apiKey.upgrade.title": "解锁工作区 API 密钥,开启编程化访问","workspace.auditLog.actions.api_key.created": "创建 API Key","workspace.auditLog.actions.api_key.renamed": "重命名 API Key","workspace.auditLog.actions.api_key.revoked": "撤销 API Key",@@ -2504,6 +2513,7 @@"workspace.wizard.step2.features.free.share": "前 3 名成员免费(包括你自己)","workspace.wizard.step2.features.free.upgradable": "随时升级以获得更多席位","workspace.wizard.step2.features.pro.adminControls": "集中计费和角色权限管理",+ "workspace.wizard.step2.features.pro.apiKey": "工作区 API 密钥","workspace.wizard.step2.features.pro.collaboration": "邀请成员 · 共享代理和文件","workspace.wizard.step2.features.pro.memberBudget": "成员预算控制","workspace.wizard.step2.features.pro.onDemand": "按需使用 · 自动充值(${{price}} / 百万积分)",diff --git a/locales/zh-CN/subscription.json b/locales/zh-CN/subscription.jsonindex 61a8dc5208f..200c234cdfd 100644--- a/locales/zh-CN/subscription.json+++ b/locales/zh-CN/subscription.json@@ -403,6 +403,7 @@"plans.target": "目标计划","plans.unlimited": "无限制","plans.workspace.features.adminControls": "集中计费和角色权限管理",+ "plans.workspace.features.apiKey": "工作区 API 密钥","plans.workspace.features.auditLog": "审计日志","plans.workspace.features.inviteMembers": "邀请成员","plans.workspace.features.memberBudget": "成员预算控制",diff --git a/packages/locales/src/default/setting.ts b/packages/locales/src/default/setting.tsindex 868b5f6d5ee..9510537244a 100644--- a/packages/locales/src/default/setting.ts+++ b/packages/locales/src/default/setting.ts@@ -1844,6 +1844,19 @@ When I am ___, I need ___'workspace.billingPage.usage.trendTitle': 'Daily spend trend','workspace.billingPage.usage.trendTooltip': '{{date}}: {{value}}','workspace.billingPage.usage.type': 'Type',+ 'workspace.apiKey.upgrade.benefits.integration.desc':+ 'Call workspace agents and resources from your own systems via the LobeHub API.',+ 'workspace.apiKey.upgrade.benefits.integration.title': 'Programmatic access',+ 'workspace.apiKey.upgrade.benefits.security.desc':+ 'Requests run under workspace roles and permissions, and keys can be revoked centrally.',+ 'workspace.apiKey.upgrade.benefits.security.title': 'Workspace-scoped security',+ 'workspace.apiKey.upgrade.benefits.shared.desc':+ 'Keys belong to the workspace instead of one person, so automation survives member changes.',+ 'workspace.apiKey.upgrade.benefits.shared.title': 'Team-shared keys',+ 'workspace.apiKey.upgrade.cta': 'Upgrade to Pro',+ 'workspace.apiKey.upgrade.desc':+ 'Create workspace-scoped API keys to integrate workspace agents and data into your own workflows and services.',+ 'workspace.apiKey.upgrade.title': 'Unlock workspace API keys for programmatic access','workspace.auditLog.actions.billing.default_payment_method_changed':'Default payment method changed','workspace.auditLog.actions.billing.payment_method_added': 'Payment method added',@@ -2587,6 +2600,7 @@ When I am ___, I need ___'workspace.wizard.step2.features.free.upgradable': 'Upgrade anytime for more seats','workspace.wizard.step2.features.business.auditLog': 'Audit logs','workspace.wizard.step2.features.pro.adminControls': 'Centralized billing and role management',+ 'workspace.wizard.step2.features.pro.apiKey': 'Workspace API keys','workspace.wizard.step2.features.pro.collaboration': 'Invite members · share agents and files','workspace.wizard.step2.features.pro.memberBudget': 'Per-member budget control','workspace.wizard.step2.features.pro.onDemand':diff --git a/packages/locales/src/default/subscription.ts b/packages/locales/src/default/subscription.tsindex 750a18abdf1..72d9ddafe18 100644--- a/packages/locales/src/default/subscription.ts+++ b/packages/locales/src/default/subscription.ts@@ -461,6 +461,7 @@ export default {'plans.support.title': 'Support','plans.support.ultimate': 'Priority Chat and Email Support','plans.workspace.features.adminControls': 'Centralized billing and role management',+ 'plans.workspace.features.apiKey': 'Workspace API Keys','plans.workspace.features.auditLog': 'Audit Logs','plans.workspace.features.inviteMembers': 'Invite Members','plans.workspace.features.memberBudget': 'Per-member Budget Control',diff --git a/src/business/client/BusinessSettingPages/WorkspaceApiKeyGuard.tsx b/src/business/client/BusinessSettingPages/WorkspaceApiKeyGuard.tsxnew file mode 100644index 00000000000..7c566d8bac2--- /dev/null+++ b/src/business/client/BusinessSettingPages/WorkspaceApiKeyGuard.tsx@@ -0,0 +1,5 @@+import type { PropsWithChildren, ReactNode } from 'react';++export default function WorkspaceApiKeyGuard({ children }: PropsWithChildren): ReactNode {+ return children;+}diff --git a/src/business/client/hooks/useShowWorkspaceApiKey.ts b/src/business/client/hooks/useShowWorkspaceApiKey.tsdeleted file mode 100644index 12e11ca5556..00000000000--- a/src/business/client/hooks/useShowWorkspaceApiKey.ts+++ /dev/null@@ -1 +0,0 @@-export const useShowWorkspaceApiKey = (): boolean => true;diff --git a/src/features/WorkspaceSetting/hooks/useCategory.tsx b/src/features/WorkspaceSetting/hooks/useCategory.tsxindex df9896720c4..5000f0d29a3 100644--- a/src/features/WorkspaceSetting/hooks/useCategory.tsx+++ b/src/features/WorkspaceSetting/hooks/useCategory.tsx@@ -19,7 +19,6 @@ import { useMemo } from 'react';import { useTranslation } from 'react-i18next';import { useIsWorkspaceOwner } from '@/business/client/hooks/useIsWorkspaceOwner';-import { useShowWorkspaceApiKey } from '@/business/client/hooks/useShowWorkspaceApiKey';import { WorkspaceSettingsTabs } from '@/types/workspaceSettings';export enum WorkspaceSettingsGroupKey {@@ -45,7 +44,6 @@ export const useWorkspaceSettingCategory = (): WorkspaceSettingCategoryGroup[] =const { t } = useTranslation('setting');const { t: tAuth } = useTranslation('auth');const { t: tSubscription } = useTranslation('subscription');- const showApiKey = useShowWorkspaceApiKey();const isOwner = useIsWorkspaceOwner();return useMemo(@@ -148,7 +146,7 @@ export const useWorkspaceSettingCategory = (): WorkspaceSettingCategoryGroup[] =key: WorkspaceSettingsTabs.Storage,label: t('tab.storage'),},- showApiKey && {+ {icon: KeyIcon,key: WorkspaceSettingsTabs.APIKey,label: tAuth('tab.apikey'),@@ -163,6 +161,6 @@ export const useWorkspaceSettingCategory = (): WorkspaceSettingCategoryGroup[] =title: t('workspaceSetting.group.admin'),},].filter(Boolean) as WorkspaceSettingCategoryGroup[],- [t, tAuth, tSubscription, showApiKey, isOwner],+ [t, tAuth, tSubscription, isOwner],);};diff --git a/src/routes/(main)/[workspaceSlug]/settings/apikey/index.tsx b/src/routes/(main)/[workspaceSlug]/settings/apikey/index.tsxindex 22d37252b5d..25b11e986a8 100644--- a/src/routes/(main)/[workspaceSlug]/settings/apikey/index.tsx+++ b/src/routes/(main)/[workspaceSlug]/settings/apikey/index.tsx@@ -1,11 +1,14 @@'use client';+import WorkspaceApiKeyGuard from '@/business/client/BusinessSettingPages/WorkspaceApiKeyGuard';import { WorkspaceAdminOnly } from '@/features/WorkspaceSetting';import Page from '@/routes/(main)/settings/apikey';const WorkspaceApiKeySetting = () => (<WorkspaceAdminOnly>- <Page />+ <WorkspaceApiKeyGuard>+ <Page />+ </WorkspaceApiKeyGuard></WorkspaceAdminOnly>);