Commit 1d3203ee authored by Zot's avatar Zot

move ap_probe to pubcrawl addon

parent c0a83f7c
<?php
namespace Zotlabs\Module;
require_once('include/zot.php');
require_once('addon/pubcrawl/HTTPSig.php');
class Ap_probe extends \Zotlabs\Web\Controller {
function get() {
$o .= '<h3>ActivityPub Probe Diagnostic</h3>';
$o .= '<form action="ap_probe" method="get">';
$o .= 'Lookup URI: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" /><br>';
$o .= 'Request Signed version: <input type=checkbox name="magenv" value="1" ><br>';
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<br /><br />';
if(x($_GET,'addr')) {
$addr = $_GET['addr'];
if($_GET['magenv']) {
$headers = 'Accept: application/magic-envelope+json, application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
}
else {
$headers = 'Accept: application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
}
$redirects = 0;
$x = z_fetch_url($addr,true,$redirects, [ 'headers' => [ $headers ]]);
if($x['success'])
$o .= '<pre>' . $x['header'] . '</pre>' . EOL;
$o .= 'verify returns: ' . \HTTPSig::verify($x) . EOL;
$o .= '<pre>' . str_replace(['\\n','\\'],["\n",''],jindent($x['body'])) . '</pre>';
}
return $o;
}
}
......@@ -123,6 +123,11 @@ function pubcrawl_load_module(&$b) {
$b['controller'] = new \Zotlabs\Module\Nullbox();
$b['installed'] = true;
}
if($b['module'] === 'ap_probe') {
require_once('addon/pubcrawl/Mod_Ap_probe.php');
$b['controller'] = new \Zotlabs\Module\Ap_probe();
$b['installed'] = true;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment