[Glitch] Expose enabled features to the frontend

Port 94bceb8683 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo authored and Claire committed 2025-07-11 18:59:43 +02:00
1 parent 1716f8da71
commit 1dcf6a3937
1 file changed
+9 -1
@@ -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;