Commit 503cd0e8 authored by Zot's avatar Zot

add HTTP link header to channel page, making it pluggable

escape HTML chars in ap_probe so they are visible
parent 68f24156
......@@ -26,10 +26,10 @@ class Ap_probe extends \Zotlabs\Web\Controller {
$x = z_fetch_url($addr,true,$redirects, [ 'headers' => [ $headers ]]);
if($x['success'])
$o .= '<pre>' . $x['header'] . '</pre>' . EOL;
$o .= '<pre>' . htmlspecialchars($x['header']) . '</pre>' . EOL;
$o .= '<pre>' . $x['body'] . '</pre>' . EOL;
$o .= '<pre>' . htmlspecialchars($x['body']) . '</pre>' . EOL;
$o .= 'verify returns: ' . str_replace("\n",EOL,print_r(\Zotlabs\Web\HTTPSig::verify($x),true)) . EOL;
......@@ -40,10 +40,10 @@ class Ap_probe extends \Zotlabs\Web\Controller {
// $o .= '<pre>' . json_encode($normalized1, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . '</pre>';
// }
$o .= '<pre>' . str_replace(['\\n','\\'],["\n",''],jindent($x['body'])) . '</pre>';
$o .= '<pre>' . str_replace(['\\n','\\'],["\n",''],htmlspecialchars(jindent($x['body']))) . '</pre>';
$AP = new \Zotlabs\Lib\ActivityStreams($x['body']);
$o .= '<pre>' . $AP->debug() . '</pre>';
$o .= '<pre>' . htmlspecialchars($AP->debug()) . '</pre>';
}
......
......@@ -34,6 +34,7 @@ function pubcrawl_load() {
'notifier_hub' => 'pubcrawl_notifier_process',
'feature_settings_post' => 'pubcrawl_feature_settings_post',
'feature_settings' => 'pubcrawl_feature_settings',
'channel_links' => 'pubcrawl_channel_links',
'queue_deliver' => 'pubcrawl_queue_deliver'
]);
}
......@@ -56,6 +57,17 @@ function pubcrawl_follow_allow(&$b) {
}
function pubcrawl_channel_links(&$b) {
$c = channelx_by_nick($b['channel_address']);
if($c && get_pconfig($c['channel_id'],'system','activitypub_allowed')) {
$b['channel_links'][] = [
'rel' => 'alternate',
'type' => 'application/activity+json',
'url' => z_root() . '/channel/' . $c['channel_address']
];
}
}
function pubcrawl_webfinger(&$b) {
if(! $b['channel'])
return;
......@@ -123,6 +135,9 @@ function pubcrawl_discover_channel_webfinger(&$b) {
function pubcrawl_load_module(&$b) {
logger('module: ' . \App::$query_string);
if($b['module'] === 'inbox') {
require_once('addon/pubcrawl/Mod_Inbox.php');
$b['controller'] = new \Zotlabs\Module\Inbox();
......@@ -246,6 +261,7 @@ function pubcrawl_channel_mod_init($x) {
$headers['Digest'] = 'SHA-256=' . $hash;
\Zotlabs\Web\HTTPSig::create_sig('',$headers,$chan['channel_prvkey'],z_root() . '/channel/' . $chan['channel_address'],true);
echo $ret;
logger('channel: ' . $ret, LOGGER_DATA);
killme();
}
}
......
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