From 1dcf6a39377e0f53f13e249363bd02052409face Mon Sep 17 00:00:00 2001 From: Echo Date: Fri, 11 Jul 2025 15:15:22 +0200 Subject: [PATCH] [Glitch] Expose enabled features to the frontend Port 94bceb8683e1993842bdb0344c8c70c6fdabc652 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/initial_state.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/initial_state.js b/app/javascript/flavours/glitch/initial_state.js index 9332b7ebc6..7114a1e28e 100644 --- a/app/javascript/flavours/glitch/initial_state.js +++ b/app/javascript/flavours/glitch/initial_state.js @@ -1,6 +1,5 @@ // @ts-check - /** * @typedef {[code: string, name: string, localName: string]} InitialStateLanguage */ @@ -72,6 +71,7 @@ * @property {object} local_settings * @property {number} max_feed_hashtags * @property {number} poll_limits + * @property {string[]} features */ const element = document.getElementById('initial-state'); @@ -166,4 +166,12 @@ export function getAccessToken() { return getMeta('access_token'); } +/** + * @param {string} feature + * @returns {boolean} + */ +export function isFeatureEnabled(feature) { + return initialState?.features?.includes(feature) || false; +} + export default initialState;