Skip to content

Commit

Permalink
Fix build + data typing protection
Browse files Browse the repository at this point in the history
  • Loading branch information
MacFJA committed Sep 12, 2020
1 parent 352abc7 commit 6ff3ff1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,10 @@
'vendor/pcrov/jsonreader/src',
'vendor/psr/log/Psr/Log',
'vendor/sensio/framework-extra-bundle/src',
'vendor/symfony/translation-contracts',
'vendor/symfony/config',
'vendor/symfony/console',
'vendor/symfony/translation',
'vendor/symfony/filesystem',
'vendor/symfony/finder',
'vendor/symfony/framework-bundle',
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.1.1] - 2020-09-12

### Fixed

- Unprotected class usage
- Missing translations in the build process

## [1.1.0] - 2020-09-12

### Added
Expand Down Expand Up @@ -44,7 +51,8 @@ Full rewrite of the application.

First version

[Unreleased]: https://github.com/MacFJA/livres/compare/1.1.0...HEAD
[Unreleased]: https://github.com/MacFJA/livres/compare/1.1.1...HEAD
[1.1.1]: https://github.com/MacFJA/livres/releases/tag/1.1.1
[1.1.0]: https://github.com/MacFJA/livres/releases/tag/1.1.0
[1.0.0]: https://github.com/MacFJA/livres/releases/tag/1.0.0
[0.0.1]: https://github.com/MacFJA/livres/releases/tag/0.0.1
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ build:
mkdir -p build/app
cp -Rp node_modules build/app/ || :
cp -Rp vendor build/app/ || :
cp -Rp .make _extra assets bin config src templates .env composer.json composer.lock Makefile package.json symfony.lock webpack.config.js package-lock.json LICENSE.md build/app/
cp -Rp .make _extra assets bin config src templates translations .env composer.json composer.lock Makefile package.json symfony.lock webpack.config.js package-lock.json LICENSE.md build/app/
mkdir -p build/app/public
mkdir -p build/app/public/cover
cp public/index.php build/app/public/
Expand Down
5 changes: 5 additions & 0 deletions src/Controller/HomepageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorBagInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

/**
Expand Down Expand Up @@ -72,6 +73,10 @@ public function base(iterable $providers, ProviderConfigurationInterface $provid
*/
public function translation(string $name, TranslatorInterface $translator): JsonResponse
{
if (!($translator instanceof TranslatorBagInterface)) {
return new JsonResponse([]);
}

return new JsonResponse($translator->getCatalogue($name)->all('front'));
}
}

0 comments on commit 6ff3ff1

Please sign in to comment.