* [ADD] Added URI signature for JS and CSS resources

* [MOD] Improved requests handling. It makes them more testing friendly
* [MOD] Code refactoring
This commit is contained in:
nuxsmin
2018-07-08 23:05:30 +02:00
parent 53a2552c05
commit a97b92131f
63 changed files with 914 additions and 618 deletions

View File

@@ -24,8 +24,8 @@
namespace SP\Modules\Web\Controllers;
use SP\Core\Exceptions\SPException;
use SP\Html\Minify;
use SP\Http\Request;
/**
* Class ResourceController
@@ -42,11 +42,14 @@ class ResourceController extends SimpleControllerBase
/**
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws SPException
*/
public function cssAction()
{
$file = Request::analyzeString('f');
$base = Request::analyzeString('b');
$this->request->verifySignature($this->configData->getPasswordSalt());
$file = $this->request->analyzeString('f');
$base = $this->request->analyzeString('b');
$minify = $this->dic->get(Minify::class);
@@ -73,11 +76,14 @@ class ResourceController extends SimpleControllerBase
/**
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws SPException
*/
public function jsAction()
{
$file = Request::analyzeString('f');
$base = Request::analyzeString('b');
$this->request->verifySignature($this->configData->getPasswordSalt());
$file = $this->request->analyzeString('f');
$base = $this->request->analyzeString('b');
$minify = $this->dic->get(Minify::class);
@@ -90,7 +96,7 @@ class ResourceController extends SimpleControllerBase
$minify->setType(Minify::FILETYPE_JS)
->setBase(PUBLIC_PATH . DIRECTORY_SEPARATOR . 'js');
$group = Request::analyzeInt('g', 0);
$group = $this->request->analyzeInt('g', 0);
if ($group === 0) {
$minify->addFiles([