From cd9b3bfce5ef06bedf18bf3b37a0862d563f4998 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Tue, 23 Dec 2025 18:18:22 +0000 Subject: [PATCH] feat(license): grant Pro features in demo/mock mode When PULSE_MOCK_MODE=true, automatically grant all Pro features so the demo server can showcase AI Patrol findings without needing a license. This is specifically for public demo instances. --- frontend-modern/src/components/Login.tsx | 15 +++++++-------- internal/license/license.go | 10 ++++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/frontend-modern/src/components/Login.tsx b/frontend-modern/src/components/Login.tsx index 5e117bc20..247183807 100644 --- a/frontend-modern/src/components/Login.tsx +++ b/frontend-modern/src/components/Login.tsx @@ -377,18 +377,17 @@ const LoginForm: Component<{
{/* Demo Credentials Banner */} -
+
-
- - +
+ +
-
Demo Credentials
-
- Username: demo{' '} - Password: demo +
Demo Mode
+
+ Login with demo / demo
diff --git a/internal/license/license.go b/internal/license/license.go index f395265a7..81c43556b 100644 --- a/internal/license/license.go +++ b/internal/license/license.go @@ -226,6 +226,11 @@ func (s *Service) IsValid() bool { // HasFeature checks if the current license grants a feature. func (s *Service) HasFeature(feature string) bool { + // In demo mode, grant all Pro features for showcase purposes + if isDemoMode() { + return true + } + s.mu.Lock() // Need write lock since we may update grace period defer s.mu.Unlock() @@ -247,6 +252,11 @@ func (s *Service) HasFeature(feature string) bool { return s.license.HasFeature(feature) } +// isDemoMode returns true if the demo/mock mode is enabled +func isDemoMode() bool { + return strings.EqualFold(os.Getenv("PULSE_MOCK_MODE"), "true") +} + // LicenseState represents the current state of the license type LicenseState string