@allbluecn/admin-app 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/package.json +86 -0
  2. package/src/client.tsx +31 -0
  3. package/src/components/admin/admin-user-menu.tsx +90 -0
  4. package/src/components/admin/developer-log.tsx +356 -0
  5. package/src/components/ai-provider/model-list-editor.tsx +147 -0
  6. package/src/components/ai-provider/provider-form.tsx +434 -0
  7. package/src/components/ai-provider/provider-icon.tsx +43 -0
  8. package/src/components/ai-provider/provider-logo.tsx +87 -0
  9. package/src/components/ai-provider/provider-table.tsx +258 -0
  10. package/src/components/auth/admin-login-form.tsx +214 -0
  11. package/src/components/auth/auth-brand-panel.tsx +60 -0
  12. package/src/components/auth/auth-header.tsx +38 -0
  13. package/src/components/auth/auth-layout.tsx +66 -0
  14. package/src/components/auth/auth-providers.tsx +34 -0
  15. package/src/components/auth/icon-input.tsx +46 -0
  16. package/src/components/auth/oauth-section.tsx +51 -0
  17. package/src/components/auth/password-input.tsx +67 -0
  18. package/src/components/common/page-header.tsx +42 -0
  19. package/src/components/common/placeholder-page.tsx +42 -0
  20. package/src/components/component/component-form-dialog.tsx +348 -0
  21. package/src/components/component/component-import-dialog.tsx +235 -0
  22. package/src/components/component/component-table.tsx +153 -0
  23. package/src/components/data-table/data-table-pagination.tsx +114 -0
  24. package/src/components/data-table/data-table.tsx +218 -0
  25. package/src/components/data-table/table-detail-layout.tsx +99 -0
  26. package/src/components/dependency/changelog-dialog.tsx +108 -0
  27. package/src/components/dependency/columns.tsx +232 -0
  28. package/src/components/dependency/dependency-table.tsx +368 -0
  29. package/src/components/dependency/edit-dialog.tsx +200 -0
  30. package/src/components/knowledge-public/bookmark-form-dialog.tsx +215 -0
  31. package/src/components/knowledge-public/compliance-form-dialog.tsx +308 -0
  32. package/src/components/knowledge-public/legal-form-dialog.tsx +315 -0
  33. package/src/components/layout/sidebar-02/app-sidebar.tsx +160 -0
  34. package/src/components/layout/sidebar-02/index.tsx +33 -0
  35. package/src/components/layout/sidebar-02/logo.tsx +40 -0
  36. package/src/components/layout/sidebar-02/nav-main.tsx +153 -0
  37. package/src/components/layout/sidebar-02/nav-notifications.tsx +78 -0
  38. package/src/components/layout/sidebar-02/team-switcher.tsx +106 -0
  39. package/src/components/magicui/animated-theme-toggler.tsx +272 -0
  40. package/src/components/magicui/rainbow-button.tsx +78 -0
  41. package/src/components/market/columns.tsx +151 -0
  42. package/src/components/market/market-app-form.tsx +237 -0
  43. package/src/components/market/market-app-list.tsx +156 -0
  44. package/src/components/monitoring/error-list.tsx +143 -0
  45. package/src/components/monitoring/health-cards.tsx +152 -0
  46. package/src/components/monitoring/metrics-stats.tsx +184 -0
  47. package/src/components/monitoring/request-log-table.tsx +179 -0
  48. package/src/components/providers/theme-toggle.tsx +59 -0
  49. package/src/components/settings/avatar/avatar-config.ts +46 -0
  50. package/src/components/ui/alert-dialog.tsx +216 -0
  51. package/src/components/ui/alert.tsx +76 -0
  52. package/src/components/ui/avatar.tsx +129 -0
  53. package/src/components/ui/badge.tsx +66 -0
  54. package/src/components/ui/button.tsx +84 -0
  55. package/src/components/ui/card.tsx +120 -0
  56. package/src/components/ui/checkbox.tsx +50 -0
  57. package/src/components/ui/collapsible.tsx +50 -0
  58. package/src/components/ui/dialog.tsx +185 -0
  59. package/src/components/ui/dropdown-menu.tsx +286 -0
  60. package/src/components/ui/field.tsx +255 -0
  61. package/src/components/ui/input-group.tsx +171 -0
  62. package/src/components/ui/input.tsx +36 -0
  63. package/src/components/ui/label.tsx +41 -0
  64. package/src/components/ui/pagination.tsx +146 -0
  65. package/src/components/ui/select.tsx +209 -0
  66. package/src/components/ui/separator.tsx +45 -0
  67. package/src/components/ui/sheet.tsx +164 -0
  68. package/src/components/ui/sidebar.tsx +719 -0
  69. package/src/components/ui/skeleton.tsx +30 -0
  70. package/src/components/ui/sonner.tsx +37 -0
  71. package/src/components/ui/switch.tsx +48 -0
  72. package/src/components/ui/table.tsx +133 -0
  73. package/src/components/ui/textarea.tsx +35 -0
  74. package/src/components/ui/tooltip.tsx +74 -0
  75. package/src/components/user/columns.tsx +153 -0
  76. package/src/components/user/settings-activity-log.tsx +358 -0
  77. package/src/components/user/settings-profile/constants.ts +42 -0
  78. package/src/components/user/settings-profile/types.ts +47 -0
  79. package/src/components/user/settings-profile.tsx +664 -0
  80. package/src/components/user/user-create-dialog.tsx +137 -0
  81. package/src/components/user/user-filters.tsx +117 -0
  82. package/src/hooks/use-mobile.ts +36 -0
  83. package/src/instrument.client.ts +34 -0
  84. package/src/lib/anyhub/capabilities.ts +59 -0
  85. package/src/lib/anyhub/types.ts +43 -0
  86. package/src/lib/auth-client.ts +83 -0
  87. package/src/lib/auth-utils.ts +24 -0
  88. package/src/lib/auth.config.ts +264 -0
  89. package/src/lib/avatar.ts +41 -0
  90. package/src/lib/i18n/client.ts +32 -0
  91. package/src/lib/i18n/config.ts +40 -0
  92. package/src/lib/i18n/detect.ts +43 -0
  93. package/src/lib/i18n/locales/en/admin-ai.json +128 -0
  94. package/src/lib/i18n/locales/en/admin-billing.json +56 -0
  95. package/src/lib/i18n/locales/en/admin-users.json +88 -0
  96. package/src/lib/i18n/locales/en/common.json +877 -0
  97. package/src/lib/i18n/locales/en/enterprise.json +208 -0
  98. package/src/lib/i18n/locales/zh/admin-ai.json +128 -0
  99. package/src/lib/i18n/locales/zh/admin-billing.json +56 -0
  100. package/src/lib/i18n/locales/zh/admin-users.json +88 -0
  101. package/src/lib/i18n/locales/zh/common.json +877 -0
  102. package/src/lib/i18n/locales/zh/enterprise.json +208 -0
  103. package/src/lib/i18n/server.ts +18 -0
  104. package/src/lib/i18n/types.ts +5 -0
  105. package/src/lib/monitoring-benchmarks.ts +85 -0
  106. package/src/lib/monitoring-descriptions.ts +78 -0
  107. package/src/lib/prisma.ts +18 -0
  108. package/src/lib/router-context.ts +38 -0
  109. package/src/lib/session.ts +38 -0
  110. package/src/lib/utils.ts +23 -0
  111. package/src/providers/index.tsx +45 -0
  112. package/src/routeTree.gen.ts +1199 -0
  113. package/src/router.tsx +51 -0
  114. package/src/routes/__root.tsx +170 -0
  115. package/src/routes/_nav/ai-providers/$id/edit/route.lazy.tsx +74 -0
  116. package/src/routes/_nav/ai-providers/$id/edit/route.tsx +35 -0
  117. package/src/routes/_nav/ai-providers/index/route.lazy.tsx +33 -0
  118. package/src/routes/_nav/ai-providers/new/route.lazy.tsx +31 -0
  119. package/src/routes/_nav/ai-providers/new/route.tsx +20 -0
  120. package/src/routes/_nav/ai-providers/route.lazy.tsx +26 -0
  121. package/src/routes/_nav/ai-providers/route.tsx +31 -0
  122. package/src/routes/_nav/apps/route.lazy.tsx +30 -0
  123. package/src/routes/_nav/apps/route.tsx +20 -0
  124. package/src/routes/_nav/audit/route.lazy.tsx +100 -0
  125. package/src/routes/_nav/audit/route.tsx +25 -0
  126. package/src/routes/_nav/billing/invoices/route.lazy.tsx +86 -0
  127. package/src/routes/_nav/billing/invoices/route.tsx +25 -0
  128. package/src/routes/_nav/billing/route.lazy.tsx +48 -0
  129. package/src/routes/_nav/billing/route.tsx +27 -0
  130. package/src/routes/_nav/billing/subscriptions/$subscriptionId/route.lazy.tsx +160 -0
  131. package/src/routes/_nav/billing/subscriptions/$subscriptionId/route.tsx +25 -0
  132. package/src/routes/_nav/billing/subscriptions/route.lazy.tsx +113 -0
  133. package/src/routes/_nav/billing/subscriptions/route.tsx +28 -0
  134. package/src/routes/_nav/compliance/route.lazy.tsx +184 -0
  135. package/src/routes/_nav/compliance/route.tsx +25 -0
  136. package/src/routes/_nav/components/route.lazy.tsx +184 -0
  137. package/src/routes/_nav/components/route.tsx +40 -0
  138. package/src/routes/_nav/dashboard/route.lazy.tsx +33 -0
  139. package/src/routes/_nav/dashboard/route.tsx +20 -0
  140. package/src/routes/_nav/dependencies/route.lazy.tsx +66 -0
  141. package/src/routes/_nav/dependencies/route.tsx +32 -0
  142. package/src/routes/_nav/developer-logs/route.lazy.tsx +6 -0
  143. package/src/routes/_nav/developer-logs/route.tsx +14 -0
  144. package/src/routes/_nav/docs/route.lazy.tsx +30 -0
  145. package/src/routes/_nav/docs/route.tsx +20 -0
  146. package/src/routes/_nav/knowledge-public/bookmarks/route.lazy.tsx +355 -0
  147. package/src/routes/_nav/knowledge-public/bookmarks/route.tsx +40 -0
  148. package/src/routes/_nav/knowledge-public/compliance/route.lazy.tsx +245 -0
  149. package/src/routes/_nav/knowledge-public/compliance/route.tsx +40 -0
  150. package/src/routes/_nav/knowledge-public/legal/route.lazy.tsx +242 -0
  151. package/src/routes/_nav/knowledge-public/legal/route.tsx +40 -0
  152. package/src/routes/_nav/licenses/$licenseId/route.lazy.tsx +235 -0
  153. package/src/routes/_nav/licenses/$licenseId/route.tsx +25 -0
  154. package/src/routes/_nav/licenses/new/route.lazy.tsx +237 -0
  155. package/src/routes/_nav/licenses/route.lazy.tsx +143 -0
  156. package/src/routes/_nav/licenses/route.tsx +25 -0
  157. package/src/routes/_nav/market/route.lazy.tsx +31 -0
  158. package/src/routes/_nav/market/route.tsx +20 -0
  159. package/src/routes/_nav/monitoring/ai-usage/route.lazy.tsx +305 -0
  160. package/src/routes/_nav/monitoring/ai-usage/route.tsx +3 -0
  161. package/src/routes/_nav/monitoring/errors/route.lazy.tsx +111 -0
  162. package/src/routes/_nav/monitoring/health/route.lazy.tsx +260 -0
  163. package/src/routes/_nav/monitoring/logs/route.lazy.tsx +165 -0
  164. package/src/routes/_nav/monitoring/metrics/route.lazy.tsx +240 -0
  165. package/src/routes/_nav/monitoring/overview/route.lazy.tsx +138 -0
  166. package/src/routes/_nav/monitoring/route.lazy.tsx +68 -0
  167. package/src/routes/_nav/monitoring/route.tsx +20 -0
  168. package/src/routes/_nav/monitoring/sentry/route.lazy.tsx +399 -0
  169. package/src/routes/_nav/monitoring/sentry/route.tsx +20 -0
  170. package/src/routes/_nav/permissions/route.lazy.tsx +504 -0
  171. package/src/routes/_nav/permissions/route.tsx +26 -0
  172. package/src/routes/_nav/route.lazy.tsx +31 -0
  173. package/src/routes/_nav/route.tsx +34 -0
  174. package/src/routes/_nav/settings/route.lazy.tsx +30 -0
  175. package/src/routes/_nav/settings/route.tsx +20 -0
  176. package/src/routes/_nav/sso/route.lazy.tsx +145 -0
  177. package/src/routes/_nav/sso/route.tsx +25 -0
  178. package/src/routes/_nav/users/$userId/route.lazy.tsx +432 -0
  179. package/src/routes/_nav/users/$userId/route.tsx +27 -0
  180. package/src/routes/_nav/users/-components/users-table.tsx +38 -0
  181. package/src/routes/_nav/users/route.lazy.tsx +74 -0
  182. package/src/routes/_nav/users/route.tsx +43 -0
  183. package/src/routes/api/compliance-download/$jobId.ts +35 -0
  184. package/src/routes/api/observability/errors.ts +41 -0
  185. package/src/routes/api/observability/health.ts +30 -0
  186. package/src/routes/api.auth.$.ts +31 -0
  187. package/src/routes/api.sentry-test.ts +33 -0
  188. package/src/routes/index/route.lazy.tsx +22 -0
  189. package/src/routes/index/route.tsx +24 -0
  190. package/src/routes/login/route.lazy.tsx +46 -0
  191. package/src/routes/login/route.tsx +28 -0
  192. package/src/routes/sentry-tunnel.ts +61 -0
  193. package/src/routes/setup/route.lazy.tsx +94 -0
  194. package/src/routes/setup/route.tsx +28 -0
  195. package/src/server/__tests__/admin-ai-alerts.test.ts +113 -0
  196. package/src/server/__tests__/licenses-issue.test.ts +98 -0
  197. package/src/server/admin-ai-alerts.ts +177 -0
  198. package/src/server/admin-ai-usage.ts +134 -0
  199. package/src/server/auth-helpers.ts +51 -0
  200. package/src/server/entitlements.ts +24 -0
  201. package/src/server/knowledge-public/canonical-id.ts +55 -0
  202. package/src/server/knowledge-public/github-sync.ts +86 -0
  203. package/src/server/license-issue.ts +78 -0
  204. package/src/server/middlewares/request.ts +26 -0
  205. package/src/server/observability/debug-middleware.ts +39 -0
  206. package/src/server/observability/error-reporter.ts +99 -0
  207. package/src/server/observability/health-check.ts +140 -0
  208. package/src/server/observability/index.ts +33 -0
  209. package/src/server/observability/logger.ts +49 -0
  210. package/src/server/observability/metrics.ts +105 -0
  211. package/src/server/observability/request-middleware.ts +125 -0
  212. package/src/server/observability/timing.ts +42 -0
  213. package/src/server/pro-services.ts +32 -0
  214. package/src/server/serverFns/admin-billing.ts +94 -0
  215. package/src/server/serverFns/ai-provider/create.ts +92 -0
  216. package/src/server/serverFns/ai-provider/delete.ts +42 -0
  217. package/src/server/serverFns/ai-provider/get.ts +35 -0
  218. package/src/server/serverFns/ai-provider/list.ts +92 -0
  219. package/src/server/serverFns/ai-provider/update.ts +73 -0
  220. package/src/server/serverFns/anyhub/market.ts +64 -0
  221. package/src/server/serverFns/audit.ts +57 -0
  222. package/src/server/serverFns/auth/session.ts +26 -0
  223. package/src/server/serverFns/auth/setup.ts +73 -0
  224. package/src/server/serverFns/compliance.ts +85 -0
  225. package/src/server/serverFns/components/import.ts +197 -0
  226. package/src/server/serverFns/components/list.ts +51 -0
  227. package/src/server/serverFns/components/mutations.ts +84 -0
  228. package/src/server/serverFns/dependency/helpers.ts +245 -0
  229. package/src/server/serverFns/dependency/list.ts +127 -0
  230. package/src/server/serverFns/dependency/sync.ts +123 -0
  231. package/src/server/serverFns/dependency/update.ts +51 -0
  232. package/src/server/serverFns/developer-log-auto-generate.ts +176 -0
  233. package/src/server/serverFns/developer-logs.ts +132 -0
  234. package/src/server/serverFns/knowledge-public/bookmarks/create.ts +53 -0
  235. package/src/server/serverFns/knowledge-public/bookmarks/delete.ts +31 -0
  236. package/src/server/serverFns/knowledge-public/bookmarks/detail.ts +32 -0
  237. package/src/server/serverFns/knowledge-public/bookmarks/list.ts +66 -0
  238. package/src/server/serverFns/knowledge-public/bookmarks/sync-all-github.ts +56 -0
  239. package/src/server/serverFns/knowledge-public/bookmarks/update.ts +50 -0
  240. package/src/server/serverFns/knowledge-public/compliance/create.ts +58 -0
  241. package/src/server/serverFns/knowledge-public/compliance/delete.ts +31 -0
  242. package/src/server/serverFns/knowledge-public/compliance/detail.ts +32 -0
  243. package/src/server/serverFns/knowledge-public/compliance/list.ts +59 -0
  244. package/src/server/serverFns/knowledge-public/compliance/update.ts +53 -0
  245. package/src/server/serverFns/knowledge-public/legal/create.ts +62 -0
  246. package/src/server/serverFns/knowledge-public/legal/delete.ts +31 -0
  247. package/src/server/serverFns/knowledge-public/legal/detail.ts +32 -0
  248. package/src/server/serverFns/knowledge-public/legal/list.ts +60 -0
  249. package/src/server/serverFns/knowledge-public/legal/update.ts +55 -0
  250. package/src/server/serverFns/licenses.ts +92 -0
  251. package/src/server/serverFns/locale.ts +10 -0
  252. package/src/server/serverFns/monitoring/check-ai-alerts.ts +13 -0
  253. package/src/server/serverFns/monitoring/get-ai-usage-overview.ts +25 -0
  254. package/src/server/serverFns/monitoring/get-errors.ts +43 -0
  255. package/src/server/serverFns/monitoring/get-health-settings.ts +35 -0
  256. package/src/server/serverFns/monitoring/get-health.ts +55 -0
  257. package/src/server/serverFns/monitoring/get-metrics.ts +46 -0
  258. package/src/server/serverFns/monitoring/get-request-logs.ts +66 -0
  259. package/src/server/serverFns/monitoring/report-error.ts +55 -0
  260. package/src/server/serverFns/monitoring/reset.ts +70 -0
  261. package/src/server/serverFns/permissions.ts +214 -0
  262. package/src/server/serverFns/sentry/config.ts +88 -0
  263. package/src/server/serverFns/sso-config.ts +83 -0
  264. package/src/server/serverFns/user/create.ts +40 -0
  265. package/src/server/serverFns/user/delete.ts +29 -0
  266. package/src/server/serverFns/user/detail.ts +45 -0
  267. package/src/server/serverFns/user/list.ts +56 -0
  268. package/src/server/serverFns/user/reset-password.ts +28 -0
  269. package/src/server/serverFns/user/update-role.ts +26 -0
  270. package/src/server/serverFns/user/update-status.ts +26 -0
  271. package/src/server.ts +27 -0
  272. package/src/start.ts +85 -0
  273. package/src/styles/_keyframe-animations.scss +91 -0
  274. package/src/styles/_variables.scss +296 -0
  275. package/src/styles/globals.css +200 -0
  276. package/src/types/start-authjs.d.ts +27 -0
@@ -0,0 +1,208 @@
1
+ {
2
+ "page": {
3
+ "title": "企业治理",
4
+ "description": "管理企业级许可、审计、SSO 与合规"
5
+ },
6
+ "license": {
7
+ "title": "许可证管理",
8
+ "status": "许可证状态",
9
+ "key": "许可证 Key",
10
+ "issuedAt": "签发时间",
11
+ "expiresAt": "过期时间",
12
+ "maxUsers": "最大用户数",
13
+ "usedUsers": "已用用户数",
14
+ "features": "功能列表",
15
+ "active": "有效",
16
+ "expired": "已过期",
17
+ "gracePeriod": "宽限期",
18
+ "pendingActivation": "待激活",
19
+ "managementTitle": "License 管理",
20
+ "issue": "签发 License",
21
+ "count": "共 {{count}} 个 License",
22
+ "empty": "暂无 License 记录",
23
+ "customer": "客户",
24
+ "email": "邮箱",
25
+ "plan": "方案",
26
+ "seats": "席位",
27
+ "activationCount": "激活数",
28
+ "expiresAtLabel": "过期时间",
29
+ "revoked": "已吊销",
30
+ "notYet": "暂未过期",
31
+ "action": "操作",
32
+ "detail": "详情",
33
+ "detailTitle": "License 详情",
34
+ "revokedToast": "该 License 已被吊销",
35
+ "revokedSuccess": "License 已吊销",
36
+ "revoke": "吊销 License",
37
+ "basicInfo": "基本信息",
38
+ "customerId": "客户 ID",
39
+ "issuer": "签发人",
40
+ "permanent": "永久",
41
+ "featureAuthorization": "功能授权",
42
+ "noFeatureAuthorization": "无特殊功能授权",
43
+ "keyTitle": "License Key(前 20 位)",
44
+ "activationsTitle": "激活实例({{count}})",
45
+ "instance": "实例",
46
+ "activatedAt": "激活于 {{date}}",
47
+ "fingerprint": "指纹 {{fingerprint}}...",
48
+ "lastActive": "最后活跃 {{date}}",
49
+ "neverActive": "从未活跃"
50
+ },
51
+ "audit": {
52
+ "title": "审计日志",
53
+ "event": "事件",
54
+ "actor": "操作人",
55
+ "target": "目标",
56
+ "action": "操作",
57
+ "timestamp": "时间",
58
+ "ip": "IP 地址",
59
+ "userAgent": "User Agent",
60
+ "result": "结果",
61
+ "success": "成功",
62
+ "failure": "失败"
63
+ },
64
+ "sso": {
65
+ "title": "SSO 配置",
66
+ "provider": "身份提供方",
67
+ "type": "协议类型",
68
+ "enabled": "已启用",
69
+ "disabled": "已停用",
70
+ "domain": "域名",
71
+ "entityId": "Entity ID",
72
+ "metadataUrl": "元数据 URL",
73
+ "syncEnabled": "用户同步",
74
+ "justInTime": "即时配置"
75
+ },
76
+ "permissions": {
77
+ "title": "权限管理",
78
+ "subtitle": "管理工作空间内的角色与权限分配",
79
+ "role": "角色",
80
+ "scope": "权限范围",
81
+ "grant": "授予",
82
+ "revoke": "撤销",
83
+ "inherited": "继承",
84
+ "custom": "自定义",
85
+ "workspaceLabel": "工作空间:",
86
+ "empty": "当前工作空间暂无角色,系统将自动装配预置角色",
87
+ "createRole": "新建角色",
88
+ "createRoleDesc": "创建一个自定义角色,配置各资源的权限级别",
89
+ "roleName": "角色名称",
90
+ "roleNamePlaceholder": "输入角色名称(如 内容编辑)",
91
+ "permissionsMatrix": "权限矩阵(资源 × 操作)",
92
+ "level": {
93
+ "admin": "管理",
94
+ "write": "写",
95
+ "read": "读",
96
+ "none": "无"
97
+ },
98
+ "type": {
99
+ "system": "系统",
100
+ "custom": "自定义"
101
+ },
102
+ "table": {
103
+ "role": "角色",
104
+ "type": "类型",
105
+ "members": "成员数",
106
+ "permissions": "权限",
107
+ "actions": "操作"
108
+ },
109
+ "action": {
110
+ "createRole": "新建角色",
111
+ "delete": "删除",
112
+ "notAvailable": "不可删除",
113
+ "viewAssignments": "查看分配"
114
+ },
115
+ "assign": "分配用户({{name}})",
116
+ "assignDesc": "搜索用户 ID 并将其分配到该角色",
117
+ "assignUser": "分配",
118
+ "unassign": "移除分配",
119
+ "searchUserPlaceholder": "输入用户 ID",
120
+ "noAssignments": "暂无用户分配到该角色",
121
+ "dialog": {
122
+ "cancel": "取消",
123
+ "create": "创建",
124
+ "close": "关闭"
125
+ },
126
+ "toast": {
127
+ "systemRole": "系统预置角色不可删除",
128
+ "deleted": "角色 {{name}} 已删除",
129
+ "created": "角色 {{name}} 已创建",
130
+ "assigned": "用户已分配到角色",
131
+ "unassigned": "用户已从角色中移除",
132
+ "nameRequired": "请输入角色名称",
133
+ "seedDone": "系统预置角色已装配"
134
+ }
135
+ },
136
+ "compliance": {
137
+ "title": "合规管理",
138
+ "policy": "策略",
139
+ "status": "状态",
140
+ "lastReview": "上次审核",
141
+ "nextReview": "下次审核",
142
+ "dataResidency": "数据驻留",
143
+ "encryption": "加密方式",
144
+ "retentionDays": "保留天数",
145
+ "certified": "已认证",
146
+ "pendingReview": "待审核",
147
+ "export": {
148
+ "title": "合规导出任务",
149
+ "subtitle": "共 {{count}} 个导出/删除任务",
150
+ "empty": "暂无合规导出任务",
151
+ "type": {
152
+ "export": "导出",
153
+ "delete": "删除"
154
+ },
155
+ "scope": {
156
+ "user": "用户",
157
+ "workspace": "工作空间"
158
+ },
159
+ "status": {
160
+ "pending": "待处理",
161
+ "processing": "处理中",
162
+ "completed": "已完成",
163
+ "failed": "失败",
164
+ "expired": "已过期"
165
+ },
166
+ "table": {
167
+ "type": "类型",
168
+ "scope": "范围",
169
+ "target": "目标",
170
+ "status": "状态",
171
+ "requester": "请求人",
172
+ "createdAt": "创建时间",
173
+ "error": "错误信息",
174
+ "actions": "操作"
175
+ },
176
+ "actions": {
177
+ "execute": "执行",
178
+ "processing": "执行中...",
179
+ "download": "下载",
180
+ "expired": "已过期"
181
+ },
182
+ "toast": {
183
+ "executed": "已提交执行",
184
+ "executeFailed": "执行失败"
185
+ }
186
+ }
187
+ },
188
+ "issue": {
189
+ "title": "签发 License",
190
+ "enterpriseTitle": "企业版 License 签发",
191
+ "description": "License 签发依赖 Ed25519 私钥,需要企业版环境。",
192
+ "alertTitle": "需要企业版环境",
193
+ "alertDescription": "License 签发功能需要配置 <code>LICENSE_SIGNING_PRIVATE_KEY</code> 环境变量,该私钥仅在企业版部署环境中提供。开源版不支持签发 License。请联系 AllBlue 团队获取企业版 License。",
194
+ "successTitle": "签发成功",
195
+ "keyOnceTitle": "请立即复制保存 license key",
196
+ "keyOnceDescription": "该 key 仅此次展示,关闭页面后无法再次获取完整内容。",
197
+ "customerName": "客户名称",
198
+ "customerEmail": "客户邮箱",
199
+ "customerId": "客户 ID",
200
+ "plan": "授权方案",
201
+ "planHint": "输入 Plan 名称(如 enterprise / pro),须与 Plan 表中的 name 字段一致",
202
+ "seats": "授权席位数",
203
+ "expiresAt": "到期日期",
204
+ "expiresAtHint": "留空 = 永久授权",
205
+ "features": "授权功能",
206
+ "submit": "签发 license"
207
+ }
208
+ }
@@ -0,0 +1,18 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ import i18next from 'i18next'
3
+ import { initReactI18next } from 'react-i18next'
4
+ import { resources, fallbackLng, defaultNs, type AppLocale } from './config'
5
+
6
+ export function createServerI18n(locale: AppLocale) {
7
+ const i18n = i18next.createInstance()
8
+ i18n.use(initReactI18next)
9
+ i18n.init({
10
+ lng: locale,
11
+ fallbackLng,
12
+ defaultNS: defaultNs,
13
+ resources,
14
+ interpolation: { escapeValue: false },
15
+ react: { useSuspense: false },
16
+ })
17
+ return i18n
18
+ }
@@ -0,0 +1,5 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ import type { i18n as I18nInstance } from 'i18next'
3
+ import type { AppLocale, NamespaceKey } from './config'
4
+
5
+ export type { AppLocale, NamespaceKey, I18nInstance }
@@ -0,0 +1,85 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License as published by
7
+ // the Free Software Foundation, either version 3 of the License, or
8
+ // (at your option) any later version.
9
+ //
10
+ // This program is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU Affero General Public License for more details.
14
+ //
15
+ // You should have received a copy of the GNU Affero General Public License
16
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ interface BenchmarkResult {
19
+ benchmark: number
20
+ direction: 'above' | 'below'
21
+ ratio: number
22
+ }
23
+
24
+ const BENCHMARK_RULES: Array<{
25
+ match: (path: string) => boolean
26
+ benchmark: number
27
+ }> = [
28
+ {
29
+ match: (path) => path.startsWith('/src/') || path.startsWith('/node_modules/'),
30
+ benchmark: 10,
31
+ },
32
+ {
33
+ match: (path) => path.includes('/api/observability/health'),
34
+ benchmark: 50,
35
+ },
36
+ {
37
+ match: (path) => path.startsWith('/api/auth/'),
38
+ benchmark: 200,
39
+ },
40
+ {
41
+ match: (path) => path.startsWith('/src/routes/'),
42
+ benchmark: 300,
43
+ },
44
+ {
45
+ match: (path) => path.startsWith('/api/'),
46
+ benchmark: 200,
47
+ },
48
+ ]
49
+
50
+ const DEFAULT_BENCHMARK = 200
51
+
52
+ export function getBenchmark(path: string): number {
53
+ for (const rule of BENCHMARK_RULES) {
54
+ if (rule.match(path)) return rule.benchmark
55
+ }
56
+ return DEFAULT_BENCHMARK
57
+ }
58
+
59
+ export function compareDuration(duration: number, benchmark: number): BenchmarkResult {
60
+ const ratio = duration / benchmark
61
+ return {
62
+ benchmark,
63
+ direction: duration > benchmark ? 'below' : 'above',
64
+ ratio,
65
+ }
66
+ }
67
+
68
+ export function getBenchmarkSource(path: string): string {
69
+ if (path.startsWith('/src/') || path.startsWith('/node_modules/')) {
70
+ return 'Cloudflare CDN edge 缓存命中目标'
71
+ }
72
+ if (path.includes('/api/observability/health')) {
73
+ return 'Cloudflare 监控端点 SLA'
74
+ }
75
+ if (path.startsWith('/api/auth/')) {
76
+ return 'Stripe/Google Auth 公开 API 目标'
77
+ }
78
+ if (path.startsWith('/src/routes/')) {
79
+ return 'Google Cloud 服务端渲染页面目标'
80
+ }
81
+ if (path.startsWith('/api/')) {
82
+ return 'Google Cloud API 最佳实践'
83
+ }
84
+ return '通用 Web API 行业基准'
85
+ }
@@ -0,0 +1,78 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License as published by
7
+ // the Free Software Foundation, either version 3 of the License, or
8
+ // (at your option) any later version.
9
+ //
10
+ // This program is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU Affero General Public License for more details.
14
+ //
15
+ // You should have received a copy of the GNU Affero General Public License
16
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ const METHOD_DESCRIPTIONS: Record<string, string> = {
19
+ GET: '读取资源',
20
+ POST: '创建或提交数据',
21
+ PUT: '全量更新资源',
22
+ DELETE: '删除资源',
23
+ PATCH: '局部更新资源',
24
+ OPTIONS: '获取资源支持的 HTTP 方法',
25
+ HEAD: '仅获取资源头部信息',
26
+ }
27
+
28
+ const API_PATH_DESCRIPTIONS: Record<string, string> = {
29
+ '/api/observability/health': '系统健康检查',
30
+ '/api/observability/errors': '错误报告查询',
31
+ '/api/auth/csrf': 'CSRF 令牌获取',
32
+ '/api/auth/callback/credentials': '凭证登录回调',
33
+ '/api/auth/signout': '退出登录',
34
+ '/api/auth/session': '会话状态查询',
35
+ '/api/auth/signin': '登录页',
36
+ '/api/sentry': 'Sentry 错误上报隧道',
37
+ '/api/chat': 'AI 对话接口',
38
+ }
39
+
40
+ const API_PATH_PREFIX_DESCRIPTIONS: Record<string, string> = {
41
+ '/api/observability': '可观测性监控',
42
+ '/api/auth': '认证鉴权',
43
+ '/api': '后端 API',
44
+ '/src/': '静态资源',
45
+ '/node_modules/': '依赖资源',
46
+ }
47
+
48
+ function describePath(path: string): string {
49
+ if (API_PATH_DESCRIPTIONS[path]) {
50
+ return API_PATH_DESCRIPTIONS[path]
51
+ }
52
+ for (const [prefix, desc] of Object.entries(API_PATH_PREFIX_DESCRIPTIONS)) {
53
+ if (path.startsWith(prefix)) {
54
+ return desc
55
+ }
56
+ }
57
+ return '自定义路由'
58
+ }
59
+
60
+ function describeMethod(method: string): string {
61
+ return METHOD_DESCRIPTIONS[method] || method
62
+ }
63
+
64
+ function describeMetric(metricName: string): string {
65
+ const path = metricName.replace(/^request\./, '')
66
+ if (path) {
67
+ const desc = describePath(path)
68
+ return `${desc}响应耗时`
69
+ }
70
+ return metricName
71
+ }
72
+
73
+ export {
74
+ METHOD_DESCRIPTIONS,
75
+ describePath,
76
+ describeMethod,
77
+ describeMetric,
78
+ }
@@ -0,0 +1,18 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License as published by
7
+ // the Free Software Foundation, either version 3 of the License, or
8
+ // (at your option) any later version.
9
+ //
10
+ // This program is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU Affero General Public License for more details.
14
+ //
15
+ // You should have received a copy of the GNU Affero General Public License
16
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ export { prisma } from "@allbluecn/database";
@@ -0,0 +1,38 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License as published by
7
+ // the Free Software Foundation, either version 3 of the License, or
8
+ // (at your option) any later version.
9
+ //
10
+ // This program is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU Affero General Public License for more details.
14
+ //
15
+ // You should have received a copy of the GNU Affero General Public License
16
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ import type { QueryClient } from '@tanstack/react-query'
19
+ import type { AppLocale } from '@/lib/i18n/config'
20
+
21
+ export interface RouterContext {
22
+ queryClient: QueryClient
23
+ session?: {
24
+ user: {
25
+ id: string
26
+ email: string
27
+ name: string | null
28
+ role: 'USER' | 'ADMIN' | 'SUPER_ADMIN'
29
+ avatarConfig?: Record<string, number> | null
30
+ bgShape?: string | null
31
+ bgColor?: string | null
32
+ aiProvider?: string | null
33
+ aiModel?: string | null
34
+ hasAiKey?: boolean | null
35
+ } | null
36
+ } | null
37
+ locale: AppLocale
38
+ }
@@ -0,0 +1,38 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License as published by
7
+ // the Free Software Foundation, either version 3 of the License, or
8
+ // (at your option) any later version.
9
+ //
10
+ // This program is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU Affero General Public License for more details.
14
+ //
15
+ // You should have received a copy of the GNU Affero General Public License
16
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ import { getSession } from 'start-authjs'
19
+ import type { AuthSession } from 'start-authjs'
20
+ import { authConfig } from './auth.config'
21
+
22
+ export type SessionUser = NonNullable<AuthSession['user']> & {
23
+ id?: string
24
+ role?: string | null
25
+ avatarConfig?: Record<string, number> | null
26
+ bgShape?: string | null
27
+ bgColor?: string | null
28
+ lastActivity?: number
29
+ adminTimeout?: number
30
+ planLabel?: 'free' | 'pro'
31
+ }
32
+
33
+ export type Session = Omit<AuthSession, 'user'> & { user?: SessionUser | null }
34
+
35
+ export async function getCurrentSession(request?: Request): Promise<Session | null> {
36
+ if (!request) return null
37
+ return (await getSession(request, authConfig)) as Session | null
38
+ }
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License as published by
7
+ // the Free Software Foundation, either version 3 of the License, or
8
+ // (at your option) any later version.
9
+ //
10
+ // This program is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU Affero General Public License for more details.
14
+ //
15
+ // You should have received a copy of the GNU Affero General Public License
16
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ import { clsx, type ClassValue } from "clsx"
19
+ import { twMerge } from "tailwind-merge"
20
+
21
+ export function cn(...inputs: ClassValue[]) {
22
+ return twMerge(clsx(inputs))
23
+ }
@@ -0,0 +1,45 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ // AllBlue - 理想之海
3
+ // Copyright (C) 2026 AllBlue Contributors
4
+ //
5
+ // This program is free software: you can redistribute it and/or modify
6
+ // it under the terms of the GNU Affero General Public License as published by
7
+ // the Free Software Foundation, either version 3 of the License, or
8
+ // (at your option) any later version.
9
+ //
10
+ // This program is distributed in the hope that it will be useful,
11
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ // GNU Affero General Public License for more details.
14
+ //
15
+ // You should have received a copy of the GNU Affero General Public License
16
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+
19
+ import { ThemeProvider } from "next-themes";
20
+ import { type ReactNode } from "react";
21
+ import { I18nextProvider } from "react-i18next";
22
+ import { getClientI18n } from "@/lib/i18n/client";
23
+ import { createServerI18n } from "@/lib/i18n/server";
24
+ import { TooltipProvider } from "@/components/ui/tooltip";
25
+
26
+ export function Providers({
27
+ children,
28
+ locale,
29
+ }: {
30
+ children: ReactNode;
31
+ locale?: string;
32
+ }) {
33
+ const isServer = typeof window === 'undefined'
34
+ const i18n = isServer && locale ? createServerI18n(locale as 'zh' | 'en') : getClientI18n()
35
+
36
+ return (
37
+ <I18nextProvider i18n={i18n}>
38
+ <ThemeProvider attribute="class" defaultTheme="light" enableSystem>
39
+ <TooltipProvider>
40
+ {children}
41
+ </TooltipProvider>
42
+ </ThemeProvider>
43
+ </I18nextProvider>
44
+ );
45
+ }