Browse Source

self hosted branding

Bernt Christian Egeland 7 months ago
parent
commit
592a98bf2c
1 changed files with 7 additions and 7 deletions
  1. 7 7
      src/lib/features.ts

+ 7 - 7
src/lib/features.ts

@@ -86,22 +86,22 @@ export const getFeatures = cache(async (organizationId: string): Promise<PlanFea
     return PLAN_FEATURES[planName] ?? PLAN_FEATURES.free
   }
 
-  // Self-hosted mode — license is per-org in AppSetting
+  // Self-hosted mode — all features unlocked, license only controls branding
   const settings = await db.appSetting.findMany({
     where: {
       organizationId,
-      key: { in: ['license.valid', 'license.plan'] },
+      key: { in: ['license.valid'] },
     },
   })
 
   const map = new Map(settings.map((s) => [s.key, s.value]))
-  const isValid = map.get('license.valid') === 'true'
+  const hasLicense = map.get('license.valid') === 'true'
 
-  if (isValid) {
-    return PLAN_FEATURES['white-label']
+  return {
+    ...PLAN_FEATURES['white-label'],
+    brandingRemoved: hasLicense,
+    customPlatformName: hasLicense,
   }
-
-  return PLAN_FEATURES.free
 })
 
 export class FeatureGatedError extends Error {