<?php
namespace Elements\Bundle\HashCashBundle\Controller;
use Pimcore\Cache;
use Pimcore\Controller\FrontendController;
use Elements\Bundle\HashCashBundle\Service\HashCashService;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
class AjaxController extends FrontendController
{
#[Route(path: '/elhc/ajax/create-stamp', name: 'elhc_create-stamp')]
public function createStamp(Request $request, HashCashService $hashCashService) {
Cache::disable();
$uri = crc32($request->get('uri'));
return $this->json($hashCashService->createStamp($uri), 200, [
'cache-control' => 'no-cache, no-store, must-revalidate',
'pragma' => 'no-cache',
'expires' => 0
]);
}
}