This commit is contained in:
Rudis Muiznieks 2023-09-25 16:40:22 -05:00
parent 19af1022da
commit 62e8cd7508
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
1 changed files with 13 additions and 1 deletions

View File

@ -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);