refactor: move system health procedure from system to admin router

- Rename `system.health` → `admin.systemHealth` and gate it behind the admin middleware
- Remove `tmdbConfigured` from `system.status` response; update description to reflect its purpose
- Update all call sites on web and native to use `orpc.admin.systemHealth`
- Rename and relocate the docs page from `system/system.health.mdx` to `admin/admin.systemHealth.mdx`
This commit is contained in:
2026-03-17 11:14:03 -04:00
parent 710c43a01f
commit ca44354240
11 changed files with 135 additions and 98 deletions
+9
View File
@@ -13,6 +13,7 @@ import {
purgeMetadataCache as purgeMetadataFn,
} from "@sofa/core/cache";
import { getSetting, setSetting } from "@sofa/core/settings";
import { getSystemHealth } from "@sofa/core/system-health";
import { isTelemetryEnabled } from "@sofa/core/telemetry";
import {
getCachedUpdateCheck,
@@ -173,3 +174,11 @@ export const purgeMetadataCache = os.admin.purgeMetadataCache
export const purgeImageCache = os.admin.purgeImageCache
.use(admin)
.handler(async () => purgeImagesFn());
// ─── System Health ───────────────────────────────────────────────
export const systemHealth = os.admin.systemHealth
.use(admin)
.handler(async () => {
return await getSystemHealth();
});
+1 -8
View File
@@ -1,15 +1,8 @@
import { getSystemHealth } from "@sofa/core/system-health";
import { isTmdbConfigured } from "@sofa/tmdb/config";
import { os } from "../context";
import { admin, authed } from "../middleware";
import { authed } from "../middleware";
export const status = os.system.status.use(authed).handler(() => {
return {
tmdbConfigured: isTmdbConfigured(),
publicApiUrl: process.env.PUBLIC_API_URL || "https://public-api.sofa.watch",
};
});
export const health = os.system.health.use(admin).handler(async () => {
return await getSystemHealth();
});
+1 -1
View File
@@ -55,7 +55,6 @@ export const implementedRouter = {
publicInfo: system.publicInfo,
authConfig: system.authConfig,
status: status.status,
health: status.health,
},
integrations: {
list: integrations.list,
@@ -81,6 +80,7 @@ export const implementedRouter = {
triggerJob: admin.triggerJob,
purgeMetadataCache: admin.purgeMetadataCache,
purgeImageCache: admin.purgeImageCache,
systemHealth: admin.systemHealth,
},
account: {
updateName: account.updateName,