Files
sdb-back/app/services/oauth_providers/registry.py
JSC 7455811860 feat: Add VLC service for sound playback and management
- Implemented VLCService to handle sound playback using VLC.
- Added routes for soundboard management including play, stop, and status.
- Introduced admin routes for sound normalization and scanning.
- Updated user model and services to accommodate new functionalities.
- Enhanced error handling and logging throughout the application.
- Updated dependencies to include python-vlc for sound playback capabilities.
2025-07-03 21:25:50 +02:00

51 lines
1.7 KiB
Python

import os
from authlib.integrations.flask_client import OAuth
from .base import OAuthProvider
from .github import GitHubOAuthProvider
from .google import GoogleOAuthProvider
class OAuthProviderRegistry:
"""Registry for OAuth providers."""
def __init__(self, oauth: OAuth):
self.oauth = oauth
self._providers: dict[str, OAuthProvider] = {}
self._initialize_providers()
def _initialize_providers(self):
"""Initialize available providers based on environment variables."""
# Google OAuth
google_client_id = os.getenv("GOOGLE_CLIENT_ID")
google_client_secret = os.getenv("GOOGLE_CLIENT_SECRET")
if google_client_id and google_client_secret:
self._providers["google"] = GoogleOAuthProvider(
self.oauth,
google_client_id,
google_client_secret,
)
# GitHub OAuth
github_client_id = os.getenv("GITHUB_CLIENT_ID")
github_client_secret = os.getenv("GITHUB_CLIENT_SECRET")
if github_client_id and github_client_secret:
self._providers["github"] = GitHubOAuthProvider(
self.oauth,
github_client_id,
github_client_secret,
)
def get_provider(self, name: str) -> OAuthProvider | None:
"""Get OAuth provider by name."""
return self._providers.get(name)
def get_available_providers(self) -> dict[str, OAuthProvider]:
"""Get all available providers."""
return self._providers.copy()
def is_provider_available(self, name: str) -> bool:
"""Check if provider is available."""
return name in self._providers