2025-12-22 22:01:36 +00:00
|
|
|
/**
|
|
|
|
|
* Feature Flags Configuration
|
|
|
|
|
*
|
|
|
|
|
* Controls which features are enabled/disabled for MVP.
|
|
|
|
|
* Features marked as false are not yet implemented in the backend.
|
|
|
|
|
*
|
|
|
|
|
* TODO: Move these to environment variables or backend config after MVP.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
export const FEATURES = {
|
|
|
|
|
/**
|
|
|
|
|
* Two-Factor Authentication
|
2025-12-23 00:45:47 +00:00
|
|
|
* Backend endpoints: /auth/2fa/setup, /auth/2fa/verify, /auth/2fa/disable, /auth/2fa/status
|
2025-12-22 22:01:36 +00:00
|
|
|
*/
|
2025-12-23 00:45:47 +00:00
|
|
|
TWO_FACTOR_AUTH: true,
|
2025-12-22 22:01:36 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Playlist Collaboration Features
|
|
|
|
|
* Backend endpoints: /api/v1/playlists/:id/collaborators, /playlists/search, /playlists/:id/share, /playlists/recommendations (NOT IMPLEMENTED)
|
|
|
|
|
*/
|
|
|
|
|
PLAYLIST_COLLABORATION: false,
|
|
|
|
|
PLAYLIST_SEARCH: false,
|
|
|
|
|
PLAYLIST_SHARE: false,
|
|
|
|
|
PLAYLIST_RECOMMENDATIONS: false,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* HLS Streaming
|
|
|
|
|
* Backend endpoints: /api/v1/tracks/:id/hls/info, /api/v1/tracks/:id/hls/status (NOT IMPLEMENTED)
|
|
|
|
|
*/
|
|
|
|
|
HLS_STREAMING: false,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Role Management
|
|
|
|
|
* Backend endpoints: /api/v1/users/:userId/roles, /api/v1/roles/* (NOT IMPLEMENTED)
|
|
|
|
|
*/
|
|
|
|
|
ROLE_MANAGEMENT: false,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Notifications API
|
|
|
|
|
* Backend endpoints: /api/v1/notifications/* (NOT IMPLEMENTED)
|
|
|
|
|
*/
|
|
|
|
|
NOTIFICATIONS: false,
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Type for feature flags
|
|
|
|
|
*/
|
|
|
|
|
export type FeatureFlag = keyof typeof FEATURES;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if a feature is enabled
|
|
|
|
|
*/
|
|
|
|
|
export function isFeatureEnabled(feature: FeatureFlag): boolean {
|
|
|
|
|
return Boolean(FEATURES[feature]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Assert that a feature is enabled, throw error if not
|
|
|
|
|
*/
|
|
|
|
|
export function requireFeature(feature: FeatureFlag): void {
|
|
|
|
|
if (!isFeatureEnabled(feature)) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
`Feature "${feature}" is not enabled. This feature is not available in the MVP.`,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|