From e9398f3f8cb703ec68422509ff50c97beae83c4d Mon Sep 17 00:00:00 2001 From: Eugen Gorbunov Date: Sat, 21 Sep 2024 12:34:38 +0400 Subject: Add HTTP Headers option (#6820) * Add new strings to lang files * Add HTTP headers field to feed forms * A few improvements --------- Co-authored-by: Alexandre Alapetite --- app/Controllers/feedController.php | 4 ++++ app/Controllers/subscriptionController.php | 5 +++++ app/i18n/cs/sub.php | 2 ++ app/i18n/de/sub.php | 2 ++ app/i18n/el/sub.php | 2 ++ app/i18n/en-us/sub.php | 2 ++ app/i18n/en/sub.php | 2 ++ app/i18n/es/sub.php | 2 ++ app/i18n/fa/sub.php | 2 ++ app/i18n/fr/sub.php | 2 ++ app/i18n/he/sub.php | 2 ++ app/i18n/hu/sub.php | 2 ++ app/i18n/id/sub.php | 2 ++ app/i18n/it/sub.php | 2 ++ app/i18n/ja/sub.php | 2 ++ app/i18n/ko/sub.php | 2 ++ app/i18n/lv/sub.php | 2 ++ app/i18n/nl/sub.php | 2 ++ app/i18n/oc/sub.php | 2 ++ app/i18n/pl/sub.php | 2 ++ app/i18n/pt-br/sub.php | 2 ++ app/i18n/ru/sub.php | 2 ++ app/i18n/sk/sub.php | 2 ++ app/i18n/tr/sub.php | 2 ++ app/i18n/zh-cn/sub.php | 2 ++ app/i18n/zh-tw/sub.php | 2 ++ app/views/helpers/feed/update.phtml | 8 ++++++++ app/views/subscription/add.phtml | 8 ++++++++ 28 files changed, 73 insertions(+) (limited to 'app') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 9c4860521..c2d25821d 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -178,6 +178,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { $proxy_type = Minz_Request::paramString('proxy_type'); $request_method = Minz_Request::paramString('curl_method'); $request_fields = Minz_Request::paramString('curl_fields', true); + $headers = Minz_Request::paramTextToArray('http_headers'); $opts = []; if ($proxy_type !== '') { @@ -208,6 +209,9 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { } } } + if(!empty($headers)) { + $opts[CURLOPT_HTTPHEADER] = array_merge($headers, $opts[CURLOPT_HTTPHEADER] ?? []); + } $attributes = [ 'curl_params' => empty($opts) ? null : $opts, diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index fe228829a..225e93f95 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -146,6 +146,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { $proxy_type = Minz_Request::paramString('proxy_type'); $request_method = Minz_Request::paramString('curl_method'); $request_fields = Minz_Request::paramString('curl_fields', true); + $headers = Minz_Request::paramTextToArray('http_headers'); $opts = []; if ($proxy_type !== '') { $opts[CURLOPT_PROXY] = $proxy_address; @@ -177,6 +178,10 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { } } + if(!empty($headers)) { + $opts[CURLOPT_HTTPHEADER] = array_merge($headers, $opts[CURLOPT_HTTPHEADER] ?? []); + } + $feed->_attribute('curl_params', empty($opts) ? null : $opts); $feed->_attribute('content_action', Minz_Request::paramString('content_action', true) ?: 'replace'); diff --git a/app/i18n/cs/sub.php b/app/i18n/cs/sub.php index 352189e90..a9f7d198a 100644 --- a/app/i18n/cs/sub.php +++ b/app/i18n/cs/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Akce filtrování', 'help' => 'Zapište jeden filtr hledání na řádek. Operátoři viz dokumentace.', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Informace', 'keep_min' => 'Minimální počet článků pro ponechání', 'kind' => array( diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php index f1dbed6fb..958107e8a 100644 --- a/app/i18n/de/sub.php +++ b/app/i18n/de/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filteraktionen', 'help' => 'Ein Suchfilter pro Zeile. Operatoren siehe Dokumentation.', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Information', // IGNORE 'keep_min' => 'Minimale Anzahl an Artikeln, die behalten wird', 'kind' => array( diff --git a/app/i18n/el/sub.php b/app/i18n/el/sub.php index b69bd8f4c..3d95d0e31 100644 --- a/app/i18n/el/sub.php +++ b/app/i18n/el/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filter actions', // TODO 'help' => 'Write one search filter per line. Operators see documentation.', // TODO ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Information', // TODO 'keep_min' => 'Minimum number of articles to keep', // TODO 'kind' => array( diff --git a/app/i18n/en-us/sub.php b/app/i18n/en-us/sub.php index 84fdb2e4d..7c574f326 100644 --- a/app/i18n/en-us/sub.php +++ b/app/i18n/en-us/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filter actions', // IGNORE 'help' => 'Write one search filter per line. Operators see documentation.', // IGNORE ), + 'http_headers' => 'HTTP Headers', // IGNORE + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // IGNORE 'information' => 'Information', // IGNORE 'keep_min' => 'Minimum number of articles to keep', // IGNORE 'kind' => array( diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php index 397cdb99c..4c514ac0c 100644 --- a/app/i18n/en/sub.php +++ b/app/i18n/en/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filter actions', 'help' => 'Write one search filter per line. Operators see documentation.', ), + 'http_headers' => 'HTTP Headers', + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', 'information' => 'Information', 'keep_min' => 'Minimum number of articles to keep', 'kind' => array( diff --git a/app/i18n/es/sub.php b/app/i18n/es/sub.php index 21a21a879..853684712 100644 --- a/app/i18n/es/sub.php +++ b/app/i18n/es/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filtrar acciones', 'help' => 'Escribir un filtro de búsqueda por línea. Ver documentación de operadores de búsqueda.', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Información', 'keep_min' => 'Número mínimo de artículos a conservar', 'kind' => array( diff --git a/app/i18n/fa/sub.php b/app/i18n/fa/sub.php index 735576e61..5dfd82c60 100644 --- a/app/i18n/fa/sub.php +++ b/app/i18n/fa/sub.php @@ -77,6 +77,8 @@ return array( '_' => ' اعمال فیلتر', 'help' => ' در هر خط یک فیلتر جستجو بنویسید. اپراتورها مستندات را ببینید.', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => ' اطلاعات', 'keep_min' => ' حداقل تعداد مقالات برای نگهداری', 'kind' => array( diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php index c8ba35d89..4a8c21d69 100644 --- a/app/i18n/fr/sub.php +++ b/app/i18n/fr/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filtres d’action', 'help' => 'Écrivez une recherche par ligne. Voir la documentation des opérateurs.', ), + 'http_headers' => 'Entêtes HTTP', + 'http_headers_help' => 'Un entête HTTP par ligne, avec le nom et la valeur séparés par un deux-points (ex. : Accept: application/atom+xml
Authorization: Bearer some-token
).', 'information' => 'Informations', 'keep_min' => 'Nombre minimum d’articles à conserver', 'kind' => array( diff --git a/app/i18n/he/sub.php b/app/i18n/he/sub.php index b7d67a308..bd5f2446d 100644 --- a/app/i18n/he/sub.php +++ b/app/i18n/he/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filter actions', // TODO 'help' => 'Write one search filter per line. Operators see documentation.', // TODO ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'מידע', 'keep_min' => 'מסםר מינימלי של מאמרים לשמור', 'kind' => array( diff --git a/app/i18n/hu/sub.php b/app/i18n/hu/sub.php index 84e47fde9..c91a6c5b4 100644 --- a/app/i18n/hu/sub.php +++ b/app/i18n/hu/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Szűrő műveletek', 'help' => 'Írj egy szűrőt soronként. Műveletek a dokumentációban.', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Információ', 'keep_min' => 'Megtartandó cikkek minimális száma', 'kind' => array( diff --git a/app/i18n/id/sub.php b/app/i18n/id/sub.php index 09354ab73..24a8dad2f 100644 --- a/app/i18n/id/sub.php +++ b/app/i18n/id/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filter actions', // TODO 'help' => 'Write one search filter per line. Operators see documentation.', // TODO ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Information', // TODO 'keep_min' => 'Minimum number of articles to keep', // TODO 'kind' => array( diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.php index b6f4506c9..683785d45 100644 --- a/app/i18n/it/sub.php +++ b/app/i18n/it/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Azioni di filtro', 'help' => 'Scrivi un filtro di ricerca per riga. Per li operatori vedi la documentazione.', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Informazioni', 'keep_min' => 'Numero minimo di articoli da mantenere', 'kind' => array( diff --git a/app/i18n/ja/sub.php b/app/i18n/ja/sub.php index ad1b18622..0395d78c9 100644 --- a/app/i18n/ja/sub.php +++ b/app/i18n/ja/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'フィルターアクション', 'help' => '1行に1つの検索フィルターを設定してください。演算子はドキュメントを参照してください。', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'インフォメーション', 'keep_min' => '最小数の記事は保持されます', 'kind' => array( diff --git a/app/i18n/ko/sub.php b/app/i18n/ko/sub.php index 42a263fe8..00190e9c8 100644 --- a/app/i18n/ko/sub.php +++ b/app/i18n/ko/sub.php @@ -77,6 +77,8 @@ return array( '_' => '필터 동작', 'help' => '한 줄에 한 검색 필터를 작성해 주세요. 실행시 문서 참고.', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => '정보', 'keep_min' => '최소 유지 글 개수', 'kind' => array( diff --git a/app/i18n/lv/sub.php b/app/i18n/lv/sub.php index de86a6e08..bacc28500 100644 --- a/app/i18n/lv/sub.php +++ b/app/i18n/lv/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filtra darbības', 'help' => 'Uzrakstiet vienu meklēšanas filtru katrā rindā. Operators see documentation.', // DIRTY ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Informācija', 'keep_min' => 'Minimālais saglabājamo izstrādājumu skaits', 'kind' => array( diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.php index c14ea5587..d624d01c4 100644 --- a/app/i18n/nl/sub.php +++ b/app/i18n/nl/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filteracties', 'help' => 'Voer één zoekfilter per lijn in. Operators see documentation.', // DIRTY ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Informatie', 'keep_min' => 'Minimum aantal artikelen om te houden', 'kind' => array( diff --git a/app/i18n/oc/sub.php b/app/i18n/oc/sub.php index 12f14c00f..95e810171 100644 --- a/app/i18n/oc/sub.php +++ b/app/i18n/oc/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filtre d’accion', 'help' => 'Escrivètz una recèrca per linha. Operators see documentation.', // DIRTY ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Informacions', 'keep_min' => 'Nombre minimum d’articles de servar', 'kind' => array( diff --git a/app/i18n/pl/sub.php b/app/i18n/pl/sub.php index f8bf7f2ff..13ad11bc3 100644 --- a/app/i18n/pl/sub.php +++ b/app/i18n/pl/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Akcje filtrowania', 'help' => 'Jedno zapytanie na linię. Operatory opisane są w dokumentacji.', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Informacja', 'keep_min' => 'Minimalna liczba wiadomości do do przechowywania', 'kind' => array( diff --git a/app/i18n/pt-br/sub.php b/app/i18n/pt-br/sub.php index 581186309..d7fef476c 100644 --- a/app/i18n/pt-br/sub.php +++ b/app/i18n/pt-br/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Ações do filtro', 'help' => 'Escreva um filtro de pesquisa por linha. Operators see documentation.', // DIRTY ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Informações', 'keep_min' => 'Número mínimo de artigos para manter', 'kind' => array( diff --git a/app/i18n/ru/sub.php b/app/i18n/ru/sub.php index ab747abb4..6f4a4da18 100644 --- a/app/i18n/ru/sub.php +++ b/app/i18n/ru/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Действия фильтрации', 'help' => 'Введите по одному поисковому фильтру в строке. См. документацию.', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Информация', 'keep_min' => 'Оставлять статей не менее', 'kind' => array( diff --git a/app/i18n/sk/sub.php b/app/i18n/sk/sub.php index d0b1f5874..a3b9856cd 100644 --- a/app/i18n/sk/sub.php +++ b/app/i18n/sk/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Filtrovať akcie', 'help' => 'Napíšte jeden výraz hľadania na riadok. Operators see documentation.', // DIRTY ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Informácia', 'keep_min' => 'Minimálny počet článkov na uchovanie', 'kind' => array( diff --git a/app/i18n/tr/sub.php b/app/i18n/tr/sub.php index a550017ab..c08132ce4 100644 --- a/app/i18n/tr/sub.php +++ b/app/i18n/tr/sub.php @@ -77,6 +77,8 @@ return array( '_' => 'Eylemi filtrele', 'help' => 'Her satıra tek bir arama filtresi yaz. dökümantasyonu incele.', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => 'Bilgi', 'keep_min' => 'En az tutulacak makale sayısı', 'kind' => array( diff --git a/app/i18n/zh-cn/sub.php b/app/i18n/zh-cn/sub.php index 36bbf115c..2ccd4bcf6 100644 --- a/app/i18n/zh-cn/sub.php +++ b/app/i18n/zh-cn/sub.php @@ -77,6 +77,8 @@ return array( '_' => '过滤动作', 'help' => '每行写一条过滤规则,过滤规则可见 文档。', ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => '信息', 'keep_min' => '至少保存的文章数', 'kind' => array( diff --git a/app/i18n/zh-tw/sub.php b/app/i18n/zh-tw/sub.php index f0997ef8f..56237d9ed 100644 --- a/app/i18n/zh-tw/sub.php +++ b/app/i18n/zh-tw/sub.php @@ -77,6 +77,8 @@ return array( '_' => '過濾動作', 'help' => '每行寫一條過濾搜尋 Operators see documentation.', // DIRTY ), + 'http_headers' => 'HTTP Headers', // TODO + 'http_headers_help' => 'Headers are separated by a newline, and the name and value of a header are separated by a colon (e.g: Accept: application/atom+xml
Authorization: Bearer some-token
).', // TODO 'information' => '信息', 'keep_min' => '至少保存的文章數', 'kind' => array( diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 7f0be0f0c..5a08d1a3e 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -748,6 +748,14 @@ +
+ +
+ +

+
+
+
+ +
+ +
+ +

+
+
-- cgit v1.2.3