implement "finger" command
This commit is contained in:
parent
5cb970963b
commit
f24ce35603
@ -154,6 +154,7 @@ function zot_finger($webbie,$channel) {
|
|||||||
|
|
||||||
$rhs = '/.well-known/zot-info';
|
$rhs = '/.well-known/zot-info';
|
||||||
|
|
||||||
|
|
||||||
if($channel) {
|
if($channel) {
|
||||||
$postvars = array(
|
$postvars = array(
|
||||||
'address' => $address,
|
'address' => $address,
|
||||||
@ -161,12 +162,13 @@ function zot_finger($webbie,$channel) {
|
|||||||
'target_sig' => $channel['channel_guid_sig'],
|
'target_sig' => $channel['channel_guid_sig'],
|
||||||
'key' => $channel['channel_pubkey']
|
'key' => $channel['channel_pubkey']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = z_post_url($url . $rhs,$postvars);
|
$result = z_post_url($url . $rhs,$postvars);
|
||||||
if(! $result['success'])
|
if(! $result['success'])
|
||||||
$result = z_post_url('http://' . $host . $rhs,$postvars);
|
$result = z_post_url('http://' . $host . $rhs,$postvars);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$rhs .= 'address=' . urlencode($address);
|
$rhs .= '?f=&address=' . urlencode($address);
|
||||||
|
|
||||||
$result = z_fetch_url($url . $rhs);
|
$result = z_fetch_url($url . $rhs);
|
||||||
if(! $result['success'])
|
if(! $result['success'])
|
||||||
|
25
util/fresh
25
util/fresh
@ -4,6 +4,7 @@
|
|||||||
// Red cli interpreter
|
// Red cli interpreter
|
||||||
|
|
||||||
require_once('include/cli_startup.php');
|
require_once('include/cli_startup.php');
|
||||||
|
require_once('include/zot.php');
|
||||||
|
|
||||||
cli_startup();
|
cli_startup();
|
||||||
|
|
||||||
@ -42,16 +43,40 @@ fresh_main($argc,$argv);
|
|||||||
|
|
||||||
function process_command($line) {
|
function process_command($line) {
|
||||||
|
|
||||||
|
$a = get_app();
|
||||||
|
|
||||||
// split args
|
// split args
|
||||||
|
|
||||||
|
$a->cmd = $line;
|
||||||
|
$a->argv = explode(' ',$line);
|
||||||
|
$a->argc = count($a->argv);
|
||||||
|
|
||||||
|
$authenticated = false;
|
||||||
|
$channel = null;
|
||||||
|
|
||||||
if($line == 'version') {
|
if($line == 'version') {
|
||||||
echo 'Fresh version 0.1';
|
echo 'Fresh version 0.1';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch(argv(0)) {
|
||||||
|
case 'finger':
|
||||||
|
if(argv(1)) {
|
||||||
|
$x = zot_finger(argv(1),$channel);
|
||||||
|
if($x['success'])
|
||||||
|
print_r(json_decode($x['body'],true));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user