diff --git a/lib/Telegraph/ProfileFetcher.php b/lib/Telegraph/ProfileFetcher.php index b707dc3..8aa551c 100644 --- a/lib/Telegraph/ProfileFetcher.php +++ b/lib/Telegraph/ProfileFetcher.php @@ -5,10 +5,14 @@ use ORM, Exception, Mf2; class ProfileFetcher { public static function fetch($id) { + initdb(); + // Fetch the user's home page and look for profile information there $user = ORM::for_table('users')->where_id_is($id)->find_one(); echo "Looking for representative h-card for ".$user->url."\n"; - $data = HTTP::get($user->url); + + $client = new HTTP(); + $data = $client->get($user->url); $parsed = Mf2\parse($data['body'], $user->url); $representative = Mf2\HCard\representative($parsed, $user->url); if($representative) { diff --git a/lib/helpers.php b/lib/helpers.php index a7a4fe3..e9e84d7 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -4,8 +4,8 @@ use Monolog\Handler\StreamHandler; date_default_timezone_set('UTC'); -if(array_key_exists('ENV', $_ENV)) { - require(dirname(__FILE__).'/../config.'.$_ENV['ENV'].'.php'); +if(getenv('ENV')) { + require(dirname(__FILE__).'/../config.'.getenv('ENV').'.php'); } else { require(dirname(__FILE__).'/../config.php'); } diff --git a/views/api.php b/views/api.php index 093d40f..265affd 100644 --- a/views/api.php +++ b/views/api.php @@ -29,6 +29,7 @@ If you pass `target_domain` instead of `target`, Telegraph will find and enqueue * `invalid_parameter` - one or more of the parameters were invalid, e.g. the target was not a valid URL * `source_not_html` - the source document could not be parsed as HTML (only in extreme cases, most of the time it just accepts whatever) * `no_link_found` - the link to the target URL was not found on the source document +* `not_supported` - the target URL is known to not accept webmentions, so the request is rejected before even queuing it. If you believe this is in error, please file an issue at [github.com/aaronpk/Telegraph/issues](https://github.com/aaronpk/Telegraph/issues) An error response in this case will be returned with an HTTP 400 status code an a JSON body: