From b539f2b03035bea416d2dfe405198bbc72d10cae Mon Sep 17 00:00:00 2001 From: Rudis Muiznieks Date: Mon, 25 Sep 2023 12:38:33 -0500 Subject: [PATCH] strip url prefix from token --- extension.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extension.php b/extension.php index 9b409e5..f1f30fb 100644 --- a/extension.php +++ b/extension.php @@ -16,7 +16,12 @@ class KagiSummarizerExtension extends Minz_Extension { $this->registerTranslates(); 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(); } }