Track HiveGrid Cloud planning reference

This commit is contained in:
david committed 2026-06-26 20:48:01 +02:00
1 parent b3d5ea6764
commit e341c5938a
5784 files changed
+1104929 -3

No files matched your search

@@ -0,0 +1,35 @@
import { useSearchParams } from "react-router";
import PageFeatureDisabled from "~/components/pages/PageFeatureDisabled";
import { appPath } from "~/utils/app/CanonicalUrlUtils";
const MAX_FEATURE_LABEL_LENGTH = 80;
const SECRET_PATTERN = /(secret|token|password|passwd|api[_-]?key|private[_-]?key|credential|bearer|session|jwt)/i;
const SAFE_FEATURE_LABEL_PATTERN = /^[\p{L}\p{N}][\p{L}\p{N} .,&'()/_-]*$/u;
const SAFE_TENANT_SLUG_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}$/;
export function getSafeFeatureLabel(feature: string | null): string | undefined {
const label = feature?.trim();
if (!label || label.length > MAX_FEATURE_LABEL_LENGTH || SECRET_PATTERN.test(label) || !SAFE_FEATURE_LABEL_PATTERN.test(label)) {
return undefined;
}
return label;
}
export function getFeatureDisabledDashboardPath(tenantSlug: string | null) {
const slug = tenantSlug?.trim();
if (!slug || !SAFE_TENANT_SLUG_PATTERN.test(slug)) {
return "/dashboard";
}
return appPath({ tenantSlug: slug, path: "dashboard", mode: "host-aware" });
}
export default function FeatureDisabledRoute() {
const [searchParams] = useSearchParams();
const featureLabel = getSafeFeatureLabel(searchParams.get("feature"));
const dashboardPath = getFeatureDisabledDashboardPath(searchParams.get("tenant"));
return <PageFeatureDisabled featureLabel={featureLabel} dashboardPath={dashboardPath} />;
}