registerTranslates(); $this->registerHook('entry_before_display', [$this, 'addSummarizeButton']); Minz_View::appendScript($this->getFileUrl('script.js', 'js'), false, false, false); Minz_View::appendStyle($this->getFileUrl('style.css', 'css')); Minz_View::appendScript(_url('kagiSummarizer', 'kagiStrings'), false, true, false); $this->registerViews(); $this->registerController('kagiSummarizer'); } public function handleConfigureAction() { if (Minz_Request::isPost()) { $kagi_token = Minz_Request::param('kagi_token', ''); $prefix = 'https://kagi.com/search?token='; if (substr($kagi_token, 0, strlen($prefix)) == $prefix) { $kagi_token = substr($kagi_token, strlen($prefix)); } FreshRSS_Context::$user_conf->kagi_token = $kagi_token; FreshRSS_Context::$user_conf->kagi_language = Minz_Request::param('kagi_language', ''); FreshRSS_Context::$user_conf->kagi_custom_css = Minz_Request::param('kagi_custom_css', ''); FreshRSS_Context::$user_conf->save(); } } public function addSummarizeButton(FreshRSS_Entry $entry): FreshRSS_Entry { $custom_css = $this->getUserConfigurationValue('kagi_custom_css'); $this->registerTranslates(); $url_summary = Minz_Url::display(array( 'c' => 'kagiSummarizer', 'a' => 'summarize', 'params' => array( 'id' => $entry->id(), 'type' => 'summary', ))); $url_key_moments = Minz_Url::display(array( 'c' => 'kagiSummarizer', 'a' => 'summarize', 'params' => array( 'id' => $entry->id(), 'type' => 'takeaway', ))); $entry->_content( '
' . $entry->content()); return $entry; } }