From 85800b111eb9522374591778a98903c46c4cf160 Mon Sep 17 00:00:00 2001 From: Dustin Wilson Date: Tue, 28 Mar 2017 18:19:12 -0500 Subject: [PATCH] New UA string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Now Arsse exposes itself properly • Conf->userAgentString exists to allow for specifying the string through configuration --- lib/Conf.php | 1 + lib/Feed.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Conf.php b/lib/Conf.php index bc5a7692..352cc42c 100644 --- a/lib/Conf.php +++ b/lib/Conf.php @@ -29,6 +29,7 @@ class Conf { public $userComposeNames = true; public $userTempPasswordLength = 20; + public $userAgentString = 'Arsse (https://code.jkingweb.ca/jking/arsse)'; public function __construct(string $import_file = "") { if($import_file != "") $this->importFile($import_file); diff --git a/lib/Feed.php b/lib/Feed.php index 444b14e2..3eecbce3 100644 --- a/lib/Feed.php +++ b/lib/Feed.php @@ -1,8 +1,10 @@ reader = new Reader; + $config = new Config; + $config->setClientUserAgent(Data::$conf->userAgentString); + $config->setGrabberUserAgent(Data::$conf->userAgentString); + + $this->reader = new Reader($config); $this->resource = $reader->download($url, $lastModified, $etag, $username, $password); // Grab the favicon for the feed; returns an empty string if it cannot find one. $this->favicon = (new Favicon)->find($url);