CI / config (push) Canceled after 0s
CI / test-frontend (push) Canceled after 0s
CI / test-rust (push) Canceled after 0s
CI / test-e2e (push) Canceled after 0s
CI / test-e2e-release (push) Canceled after 0s
CI / build (push) Canceled after 0s
CI / release (push) Canceled after 0s
CI / docker (push) Canceled after 0s
CI / docker-website (push) Canceled after 0s
Add Markdown-native planning, repeat rules, subtasks, reminders, transactional backup restore, Chinese account management, and the account-managed NAS migration configuration.\n\nCo-Authored-By: Codex <noreply@anthropic.com>
30 lines
1017 B
TypeScript
30 lines
1017 B
TypeScript
/**
|
|
* What `GET api/admin/server-info` reports under `runtimeApi`. Server-wide and
|
|
* resolved at server boot, so it is not part of any space's own config.
|
|
*/
|
|
export type RuntimeAvailability =
|
|
| { status: "available" }
|
|
| { status: "no_chrome" }
|
|
| { status: "disabled_by_env" }
|
|
| { status: "failed"; message: string };
|
|
|
|
/**
|
|
* The note shown beside a locked "Enable runtime API" checkbox, or `null` when
|
|
* the checkbox should stay usable — either because the runtime is available,
|
|
* or because we do not know yet (the fetch is in flight or failed).
|
|
*/
|
|
export function runtimeApiUnavailableReason(
|
|
availability: RuntimeAvailability | null,
|
|
): string | null {
|
|
switch (availability?.status) {
|
|
case "no_chrome":
|
|
return "服务器未安装运行时 API 所需的 Chromium。";
|
|
case "disabled_by_env":
|
|
return "服务器已通过 SB_RUNTIME_API=0 全局关闭此功能。";
|
|
case "failed":
|
|
return `暂不可用:${availability.message}`;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|