big overhaul for server and webui feature matching, things default to disabled and disappear from UI when disabled.

This commit is contained in:
legop3
2026-07-05 14:42:43 -04:00
parent 29bf4cc5d2
commit 40e8adf15a
34 changed files with 592 additions and 211 deletions
+15
View File
@@ -0,0 +1,15 @@
// Feature Helpers
// Purpose: Centralizes client-side reads of server-advertised optional features.
// Scope: Keeps layout/components from each inventing their own "is this feature configured?" rule.
export function isFeatureEnabled(state, featureName) {
/*
The server owns feature detection because only it can reliably know whether
config-driven hardware integrations exist. React should treat missing flags
as disabled so old or partial session payloads fail closed and hide extras.
*/
return Boolean(state?.session?.features?.[featureName]);
}
export function anyFeatureEnabled(state, featureNames = []) {
return featureNames.some((featureName) => isFeatureEnabled(state, featureName));
}