2024-08-27 16:49:43 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Content;
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
2025-04-08 15:46:03 +02:00
|
|
|
use Illuminate\Support\Facades\Cache;
|
2024-08-27 16:49:43 +02:00
|
|
|
|
|
|
|
|
class FeatureFlagsController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
2025-04-08 15:46:03 +02:00
|
|
|
$featureFlags = Cache::remember('feature_flags', 3600, function () {
|
2024-08-27 16:49:43 +02:00
|
|
|
return [
|
|
|
|
|
'self_hosted' => config('app.self_hosted', true),
|
2024-08-28 17:58:10 +02:00
|
|
|
'custom_domains' => config('custom-domains.enabled', false),
|
2024-08-27 16:49:43 +02:00
|
|
|
'ai_features' => !empty(config('services.openai.api_key')),
|
|
|
|
|
|
|
|
|
|
'billing' => [
|
|
|
|
|
'enabled' => !empty(config('cashier.key')) && !empty(config('cashier.secret')),
|
|
|
|
|
'appsumo' => !empty(config('services.appsumo.api_key')) && !empty(config('services.appsumo.api_secret')),
|
|
|
|
|
],
|
|
|
|
|
'storage' => [
|
|
|
|
|
'local' => config('filesystems.default') === 'local',
|
|
|
|
|
's3' => config('filesystems.default') !== 'local',
|
|
|
|
|
],
|
|
|
|
|
'services' => [
|
|
|
|
|
'unsplash' => !empty(config('services.unsplash.access_key')),
|
|
|
|
|
'google' => [
|
|
|
|
|
'fonts' => !empty(config('services.google.fonts_api_key')),
|
|
|
|
|
'auth' => !empty(config('services.google.client_id')) && !empty(config('services.google.client_secret')),
|
|
|
|
|
],
|
Add Telegram Notification Integration (#732)
* Add Telegram Notification Integration
- Introduce Telegram Notification integration to the forms configuration.
- Add necessary properties including name, icon, section name, file name, actions file name, and pro status.
This update enhances the notification options available in the application, allowing users to integrate Telegram for notifications.
* Add Telegram integration support
- Updated .env.example to include Telegram bot configuration variables.
- Added the Telegram driver to OAuthProviderService for handling Telegram authentication.
- Created OAuthTelegramDriver class to manage Telegram OAuth interactions.
- Registered Telegram service in services.php with necessary credentials.
- Updated ProviderModal and TelegramIntegration components to support Telegram account connection and widget integration.
- Refactored integration forms to utilize FlatSelectInput for selecting Telegram accounts.
These changes enable users to connect their Telegram accounts for notifications, enhancing the integration capabilities of the application.
* Enhance Telegram integration and refactor settings components
- Added Telegram configuration to FeatureFlagsController for bot and redirect settings.
- Updated nuxt.config.ts to include settings components path for better organization.
- Refactored TelegramIntegration component to navigate to settings on connect.
- Renamed and updated ProviderModal and ProviderWidgetModal for consistency.
- Introduced TelegramWidget component for dynamic loading of the Telegram login widget.
- Refactored access tokens and connections pages to use updated component names.
These changes improve the Telegram integration and streamline the settings management interface.
* Refactor Telegram integration for widget-based authentication
- Updated .env.example to rename Telegram bot configuration variable from TELEGRAM_BOT_NAME to TELEGRAM_BOT_ID.
- Removed the Telegram provider from composer.json to streamline dependencies.
- Enhanced FeatureFlagsController to support new bot_id configuration.
- Implemented handleWidgetRedirect method in OAuthProviderController for handling widget authentication.
- Created WidgetOAuthDriver interface and refactored OAuthTelegramDriver to implement widget-based authentication methods.
- Updated services.php to reflect changes in Telegram configuration.
- Added widget callback route for handling authentication responses.
- Refactored TelegramWidget component to utilize the new widget authentication flow.
These changes improve the Telegram integration by enabling widget-based authentication, enhancing user experience and security.
* Enhance Telegram integration by adding provider support and refactoring data retrieval
- Introduced a new protected property `provider` in `AbstractIntegrationHandler` to store provider information.
- Updated the constructor to assign the provider from `formIntegration`.
- Refactored `getChatId` method in `TelegramIntegration` to utilize `provider_user_id` instead of the removed bot token.
- Adjusted the `shouldRun` method to include a check for `oauth_id` in `formIntegration`.
These changes improve the handling of provider data within the Telegram integration, enhancing its functionality and reliability.
* Enhance Telegram integration by adding MarkdownV2 escaping functionality
- Updated the message text formatting in the TelegramIntegration class to escape special characters for MarkdownV2.
- Introduced a new protected method `escapeMarkdownV2` to handle the escaping of special characters, improving message rendering in Telegram.
These changes enhance the Telegram integration by ensuring that messages are properly formatted for MarkdownV2, preventing potential rendering issues.
* fix pint
* Fix ESLint warning for unused variable in TelegramWidget component
* Remove unused variable declaration in TelegramWidget component to address ESLint warning. This change enhances code quality by adhering to linting rules and improving maintainability.
* Refactor Telegram integration components by removing unused code and improving maintainability
- Removed the 'refresh_token' field from the OAuthTelegramDriver as it is no longer needed.
- Eliminated unused variable declarations and interval logic in the TelegramIntegrationActions component to address ESLint warnings and enhance code quality.
These changes streamline the codebase and adhere to best practices for maintainability.
* Enhance Telegram integration by adding validation messages and improving message formatting
- Introduced custom validation messages for the `oauth_id` field in `FormIntegrationsRequest`, enhancing user feedback during integration setup.
- Refactored message construction in `TelegramIntegration` to utilize an array for building the message text, improving readability and maintainability.
- Updated the `handle` method to include error logging for missing `chat_id` and `bot token`, enhancing error handling and debugging capabilities.
These changes improve the user experience and reliability of the Telegram integration by providing clearer validation feedback and more robust error handling.
* Update environment variables documentation for clarity and consistency
- Reformatted the environment variables table for improved readability by aligning headers and descriptions.
- Added new environment variables for Telegram bot integration, including `TELEGRAM_BOT_ID` and `TELEGRAM_BOT_TOKEN`, to support enhanced notification features.
- Adjusted the warning message regarding Docker commands to improve clarity on environment variable reloading.
These changes enhance the documentation by ensuring that it is clear, consistent, and up-to-date with the latest configuration requirements.
---------
Co-authored-by: JhumanJ <julien@nahum.net>
2025-04-08 12:42:47 +02:00
|
|
|
'telegram' => [
|
|
|
|
|
'bot_id' => config('services.telegram.bot_id') ?? false
|
|
|
|
|
]
|
2024-08-27 16:49:43 +02:00
|
|
|
],
|
|
|
|
|
'integrations' => [
|
|
|
|
|
'zapier' => config('services.zapier.enabled'),
|
|
|
|
|
'google_sheets' => !empty(config('services.google.client_id')) && !empty(config('services.google.client_secret')),
|
2025-04-08 15:46:03 +02:00
|
|
|
'telegram' => !empty(config('services.telegram.bot_id')) && !empty(config('services.telegram.bot_token')),
|
2024-08-27 16:49:43 +02:00
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return response()->json($featureFlags);
|
|
|
|
|
}
|
|
|
|
|
}
|