From aa83f94ac1e3ebb797529ba34764aab9db453df5 Mon Sep 17 00:00:00 2001 From: Echo Date: Tue, 13 Jan 2026 15:17:43 +0100 Subject: [PATCH] [Glitch] Add feature flag detection for profile redesign Port 122b1592ed543838f2047ef82e570ca58a087b32 to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/utils/environment.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/javascript/flavours/glitch/utils/environment.ts b/app/javascript/flavours/glitch/utils/environment.ts index 95075454f2..84767322b0 100644 --- a/app/javascript/flavours/glitch/utils/environment.ts +++ b/app/javascript/flavours/glitch/utils/environment.ts @@ -12,8 +12,21 @@ export function isProduction() { else return import.meta.env.PROD; } -export type Features = 'fasp' | 'http_message_signatures'; +export type ServerFeatures = 'fasp'; -export function isFeatureEnabled(feature: Features) { +export function isServerFeatureEnabled(feature: ServerFeatures) { return initialState?.features.includes(feature) ?? false; } + +type ClientFeatures = 'profile_redesign'; + +export function isClientFeatureEnabled(feature: ClientFeatures) { + try { + const features = + window.localStorage.getItem('experiments')?.split(',') ?? []; + return features.includes(feature); + } catch (err) { + console.warn('Could not access localStorage to get client features', err); + return false; + } +}