[Glitch] Expose enabled features to the frontend
Port 94bceb8683e1993842bdb0344c8c70c6fdabc652 to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
1716f8da71
commit
1dcf6a3937
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user