initial commit

This commit is contained in:
Rudis Muiznieks 2023-09-25 11:49:34 -05:00
commit 0b916786c2
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
4 changed files with 58 additions and 0 deletions

18
configure.phtml Normal file
View File

@ -0,0 +1,18 @@
<?php
$api_key = FreshRSS_Context::$user_conf->kagi_api_key;
?>
<form action="<?php echo _url('extension', 'configure', 'e', urlencode($this->getName())); ?>" method="post">
<input type="hidden" name="_csrf" value="<?php echo FreshRSS_Auth::csrfToken(); ?>" />
<div class="form-group">
<label class="group-name" for="api_key"><?php echo _t('ext.kagiSummarizer.configure.api_key'); ?></label>
<div class="group-controls">
<input type="text" name="api_key" id="api_key" maxlength="1" value="<?php echo $kagi_api_key; ?>">
</div>
</div>
<div class="form-group form-actions">
<div class="group-controls">
<button type="submit" class="btn btn-important"><?php echo _t('gen.action.submit'); ?></button>
</div>
</div>
</form>

23
extension.php Normal file
View File

@ -0,0 +1,23 @@
<?php
class KagiSummarizerExtension extends Minz_Extension {
public function init() {
$this->registerTranslates();
Minz_View::appendScript($this->getFileUrl('script.js', 'js'), false, false, false);
Minz_View::appendStyle($this->getFileUrl('style.css', 'css'));
Minz_View::appendScript(_url('kagiSummarizer', 'jsVars', false, true, false);
$this->registerController('kagiSummarizer');
$this->registerViews();
}
public function handleConfigureAction() {
$this->registerTranslates();
if (Minz_Request::isPost()) {
$api_key = Minz_Request::param('api_key', '');
FreshRSS_Context::$user_conf->kagi_api_key = $api_key;
FreshRSS_Context::$user_conf->save();
}
}

9
i18n/en/ext.php Normal file
View File

@ -0,0 +1,9 @@
<?php
return array(
'kagiSummarizer' => array(
'configure' => array(
'api_key' => 'Kagi API Key'
)
)
);

8
metadata.json Normal file
View File

@ -0,0 +1,8 @@
{
"name": "Kagi Summarizer",
"author": "Rudis Muiznieks",
"description": "Add a button to summarize articles with the Kagi Universal Summarizer.",
"version": 0.1,
"entrypoint": "KagiSummarizer",
"type": "user"
}