diff --git a/Controllers/kagiSummarizerController.php b/Controllers/kagiSummarizerController.php index c2a0c54..3fa1b84 100644 --- a/Controllers/kagiSummarizerController.php +++ b/Controllers/kagiSummarizerController.php @@ -3,6 +3,18 @@ class FreshExtension_kagiSummarizer_Controller extends Minz_ActionController { public function summarizeAction() { $this->view->_layout(false); + + $kagi_token = FreshRSS_Context::$user_conf->kagi_token; + + if ($kagi_token === null || trim($kagi_token) ==='') { + echo json_encode(array( + 'response' => array( + 'output_text' => 'No Kagi token configured.', + 'error' => 'configuration'), + 'status' => 200)); + return; + } + $entry_id = Minz_Request::param('id'); $entry_dao = FreshRSS_Factory::createEntryDao(); $entry = $entry_dao->searchById($entry_id); @@ -19,7 +31,7 @@ class FreshExtension_kagiSummarizer_Controller extends Minz_ActionController { curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json; charset=UTF-8', - 'Authorization: ' . FreshRSS_Context::$user_conf->kagi_token + 'Authorization: ' . $kagi_token )); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true);