From 63fe8684c4e02f57deca53d1f530e6207da0c4da Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Mon, 4 Dec 2017 15:57:13 -0500 Subject: [PATCH 1/2] Fix js minification url --- public/js.php | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/public/js.php b/public/js.php index 88523810..305d8863 100644 --- a/public/js.php +++ b/public/js.php @@ -18,7 +18,7 @@ namespace Aviat\EasyMin; use function Amp\wait; use Amp\Artax\{Client, FormBody, Request}; -use Aviat\Ion\Json; +use Aviat\Ion\{Json, JsonException}; // Include Amp and Artax require_once('../vendor/autoload.php'); @@ -121,7 +121,7 @@ class JSMin { $request = (new Request) ->setMethod('POST') - ->setUri('http://closure-compiler.appspot.com/compile') + ->setUri('https://closure-compiler.appspot.com/compile') ->setAllHeaders([ 'Accept' => 'application/json', 'Accept-Encoding' => 'gzip', @@ -144,17 +144,25 @@ class JSMin { */ protected function checkMinifyErrors($options) { - $errorRes = $this->closureCall($options); - $errorJson = $errorRes->getBody(); - $errorObj = Json::decode($errorJson) ?: (object)[]; - - - // Show error if exists - if ( ! empty($errorObj->errors) || ! empty($errorObj->serverErrors)) + try { - $errorJson = Json::encode($errorObj, JSON_PRETTY_PRINT); - header('Content-type: application/javascript'); - echo "console.error(${errorJson});"; + $errorRes = $this->closureCall($options); + $errorJson = $errorRes->getBody(); + $errorObj = Json::decode($errorJson) ?: (object)[]; + + + // Show error if exists + if ( ! empty($errorObj->errors) || ! empty($errorObj->serverErrors)) + { + $errorJson = Json::encode($errorObj, JSON_PRETTY_PRINT); + header('Content-type: application/javascript'); + echo "console.error(${errorJson});"; + die(); + } + } + catch (JsonException $e) + { + print_r($e); die(); } } From 9497f5c3dfc9534b30b8cfff2afb3dda459cc0ed Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Mon, 4 Dec 2017 16:06:27 -0500 Subject: [PATCH 2/2] Fix MAL sync issue for anime --- src/API/Kitsu/Model.php | 2 +- src/Command/SyncKitsuWithMal.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/API/Kitsu/Model.php b/src/API/Kitsu/Model.php index 182519a6..d3609d27 100644 --- a/src/API/Kitsu/Model.php +++ b/src/API/Kitsu/Model.php @@ -403,7 +403,7 @@ class Model { * @return array */ public function getFullAnimeList(array $options = [ - 'include' => 'media.mappings' + 'include' => 'anime.mappings' ]): array { $status = $options['filter']['status'] ?? ''; diff --git a/src/Command/SyncKitsuWithMal.php b/src/Command/SyncKitsuWithMal.php index 56bda066..c4638bc5 100644 --- a/src/Command/SyncKitsuWithMal.php +++ b/src/Command/SyncKitsuWithMal.php @@ -112,7 +112,7 @@ class SyncKitsuWithMal extends BaseCommand { if ( ! empty($data['updateKitsu'])) { - print_r($data['updateKitsu']); + // print_r($data['updateKitsu']); $count = count($data['updateKitsu']); $this->echoBox("Updating {$count} outdated Kitsu {$type} list items"); $this->updateKitsuListItems($data['updateKitsu'], $type); @@ -244,6 +244,7 @@ class SyncKitsuWithMal extends BaseCommand { foreach($data['data'] as $listItem) { $id = $listItem['relationships'][$type]['data']['id']; + $potentialMappings = $includes[$type][$id]['relationships']['mappings']; $malId = NULL; @@ -291,7 +292,6 @@ class SyncKitsuWithMal extends BaseCommand { foreach($missingMalIds as $mid) { - // print_r($malList[$mid]); $itemsToAddToKitsu[] = array_merge($malList[$mid]['data'], [ 'id' => $this->kitsuModel->getKitsuIdFromMALId($mid, $type), 'type' => $type