Browse Source

fixes for test environment and http lib change

main
Aaron Parecki 8 years ago
parent
commit
367ab364b3
3 changed files with 8 additions and 3 deletions
  1. +5
    -1
      lib/Telegraph/ProfileFetcher.php
  2. +2
    -2
      lib/helpers.php
  3. +1
    -0
      views/api.php

+ 5
- 1
lib/Telegraph/ProfileFetcher.php View File

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

+ 2
- 2
lib/helpers.php View File

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

+ 1
- 0
views/api.php View File

@ -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:

Loading…
Cancel
Save