Browse Source

New UA string

• Now Arsse exposes itself properly
• Conf->userAgentString exists to allow for specifying the string
through configuration
microsub
Dustin Wilson 7 years ago
parent
commit
85800b111e
  1. 1
      lib/Conf.php
  2. 8
      lib/Feed.php

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

8
lib/Feed.php

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

Loading…
Cancel
Save