1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

New UA string

• Now Arsse exposes itself properly
• Conf->userAgentString exists to allow for specifying the string
through configuration
This commit is contained in:
Dustin Wilson 2017-03-28 18:19:12 -05:00
parent f902346b6c
commit 85800b111e
2 changed files with 8 additions and 1 deletions

View file

@ -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);

View file

@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
namespace JKingWeb\Arsse;
use PicoFeed\Reader\Reader;
use PicoFeed\PicoFeedException;
use PicoFeed\Reader\Favicon;
use PicoFeed\Config\Config;
class Feed {
public $data = null;
@ -13,7 +15,11 @@ class Feed {
public function __construct(string $url, string $lastModified = '', string $etag = '', string $username = '', string $password = '') {
try {
$this->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);