cors fix
This commit is contained in:
parent
6a0bef07fb
commit
9fc3de9bd3
1 changed files with 22 additions and 0 deletions
|
@ -27,6 +27,17 @@ class InterfaceControllerProvider implements ControllerProviderInterface
|
||||||
// /interface/game/last
|
// /interface/game/last
|
||||||
$controllers->get('/games/last', function (Application $app) {
|
$controllers->get('/games/last', function (Application $app) {
|
||||||
|
|
||||||
|
|
||||||
|
$http_origin = $_SERVER['HTTP_ORIGIN'];
|
||||||
|
if ($http_origin == "https://emotionhero.com" || $http_origin == "http://emotionhero.com")
|
||||||
|
{
|
||||||
|
header("Access-Control-Allow-Origin: $http_origin");
|
||||||
|
// header("Access-Control-Allow-Origin: https://emotionhero.com");
|
||||||
|
header("Access-Control-Allow-Methods: POST, GET, OPTIONS");
|
||||||
|
header("Access-Control-Allow-Headers: X-PINGOTHER");
|
||||||
|
header("Access-Control-Max-Age: 1728000");
|
||||||
|
}
|
||||||
|
|
||||||
$gameRepo = $this->_eh->getEm()->getRepository(\EmotionHero\Models\Game::class);
|
$gameRepo = $this->_eh->getEm()->getRepository(\EmotionHero\Models\Game::class);
|
||||||
/* @var $hitRepo EmotionHero\Models\HitRepository */
|
/* @var $hitRepo EmotionHero\Models\HitRepository */
|
||||||
$hitRepo = $this->_eh->getEm()->getRepository(\EmotionHero\Models\Hit::class);
|
$hitRepo = $this->_eh->getEm()->getRepository(\EmotionHero\Models\Hit::class);
|
||||||
|
@ -106,6 +117,17 @@ class InterfaceControllerProvider implements ControllerProviderInterface
|
||||||
// /interface/images
|
// /interface/images
|
||||||
$controllers->get('/images', function (Application $app) {
|
$controllers->get('/images', function (Application $app) {
|
||||||
|
|
||||||
|
|
||||||
|
$http_origin = $_SERVER['HTTP_ORIGIN'];
|
||||||
|
if ($http_origin == "https://emotionhero.com" || $http_origin == "http://emotionhero.com")
|
||||||
|
{
|
||||||
|
header("Access-Control-Allow-Origin: $http_origin");
|
||||||
|
// header("Access-Control-Allow-Origin: https://emotionhero.com");
|
||||||
|
header("Access-Control-Allow-Methods: POST, GET, OPTIONS");
|
||||||
|
header("Access-Control-Allow-Headers: X-PINGOTHER");
|
||||||
|
header("Access-Control-Max-Age: 1728000");
|
||||||
|
}
|
||||||
|
|
||||||
$getEmoBlocks = function($emotion, $feature, $steps = 6) {
|
$getEmoBlocks = function($emotion, $feature, $steps = 6) {
|
||||||
$hitRepo = $this->_eh->getEm()->getRepository(Models\Hit::class);
|
$hitRepo = $this->_eh->getEm()->getRepository(Models\Hit::class);
|
||||||
$blocks = [];
|
$blocks = [];
|
||||||
|
|
Loading…
Reference in a new issue