1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-06-27 16:36:00 +00:00
wallabag/src/Controller/Import/ChromeController.php

49 lines
1.5 KiB
PHP
Raw Normal View History

<?php
2024-02-19 01:30:12 +01:00
namespace Wallabag\Controller\Import;
2022-08-28 02:01:46 +02:00
use Craue\ConfigBundle\Util\Config;
use OldSound\RabbitMqBundle\RabbitMq\Producer as RabbitMqProducer;
2025-03-11 00:54:02 +01:00
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
2024-02-19 01:30:12 +01:00
use Wallabag\Import\ChromeImport;
use Wallabag\Redis\Producer as RedisProducer;
class ChromeController extends BrowserController
{
public function __construct(
2025-04-05 13:59:36 +02:00
private readonly ChromeImport $chromeImport,
private readonly Config $craueConfig,
private readonly RabbitMqProducer $rabbitMqProducer,
private readonly RedisProducer $redisProducer,
) {
}
2017-07-01 09:52:38 +02:00
/**
2025-03-11 00:54:02 +01:00
* @IsGranted("IMPORT_ENTRIES")
2017-07-01 09:52:38 +02:00
*/
2025-04-05 15:06:57 +02:00
#[Route(path: '/import/chrome', name: 'import_chrome', methods: ['GET', 'POST'])]
public function indexAction(Request $request, TranslatorInterface $translator)
2017-07-01 09:52:38 +02:00
{
return parent::indexAction($request, $translator);
2017-07-01 09:52:38 +02:00
}
protected function getImportService()
{
if ($this->craueConfig->get('import_with_rabbitmq')) {
$this->chromeImport->setProducer($this->rabbitMqProducer);
} elseif ($this->craueConfig->get('import_with_redis')) {
$this->chromeImport->setProducer($this->redisProducer);
}
return $this->chromeImport;
}
protected function getImportTemplate()
{
2024-02-19 00:03:14 +01:00
return 'Import/Chrome/index.html.twig';
}
}