strip url prefix from token

This commit is contained in:
Rudis Muiznieks 2023-09-25 12:38:33 -05:00
parent 74dd5d0170
commit b539f2b030
Signed by: rudism
GPG Key ID: CABF2F86EF7884F9
1 changed files with 6 additions and 1 deletions

View File

@ -16,7 +16,12 @@ class KagiSummarizerExtension extends Minz_Extension {
$this->registerTranslates(); $this->registerTranslates();
if (Minz_Request::isPost()) { if (Minz_Request::isPost()) {
FreshRSS_Context::$user_conf->kagi_token = Minz_Request::param('kagi_token', ''); $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->save(); FreshRSS_Context::$user_conf->save();
} }
} }