diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/api_zot.php | 15 | ||||
-rw-r--r-- | include/network.php | 2 | ||||
-rw-r--r-- | include/zot.php | 5 |
3 files changed, 19 insertions, 3 deletions
diff --git a/include/api_zot.php b/include/api_zot.php index 287720484..8f621d998 100644 --- a/include/api_zot.php +++ b/include/api_zot.php @@ -1,7 +1,9 @@ <?php function zot_api_init() { - api_register_func('api/red/version','api_zot_version',false); + api_register_func('api/z/1.0/verify','api_verify', true); + + api_register_func('api/red/version','api_zot_version',false); api_register_func('api/z/1.0/version','api_zot_version',false); api_register_func('api/export/basic','api_export_basic', true); api_register_func('api/red/channel/export/basic','api_export_basic', true); @@ -47,6 +49,17 @@ return; } + function api_verify($type) { + if (api_user() === false) { + logger('no channel'); + return false; + } + $channel = channelx_by_n(api_user()); + // logger('channel: ' . print_r($channel,true)); + + json_return_and_die($channel); + } + function api_zot_version($type) { diff --git a/include/network.php b/include/network.php index aada36fba..d9d534cd7 100644 --- a/include/network.php +++ b/include/network.php @@ -1101,7 +1101,7 @@ function discover_by_webbie($webbie, $protocol = '') { $network = null; $x = webfinger_rfc7033($webbie, true); - if($x && array_key_exists('links',$x) && $x['links']) { + if($x && array_key_exists('links',$x) && is_array($x['links'])) { foreach($x['links'] as $link) { if(array_key_exists('rel',$link)) { diff --git a/include/zot.php b/include/zot.php index fb0804aa7..e10ef6fd7 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2763,6 +2763,8 @@ function sync_locations($sender, $arr, $absolute = false) { } logger('New hub: ' . $location['url']); + $addr_arr = explode('@', $location['address']); + $r = hubloc_store_lowlevel( [ 'hubloc_guid' => $sender['guid'], @@ -2777,7 +2779,8 @@ function sync_locations($sender, $arr, $absolute = false) { 'hubloc_callback' => $location['callback'], 'hubloc_sitekey' => $location['sitekey'], 'hubloc_updated' => datetime_convert(), - 'hubloc_connected' => datetime_convert() + 'hubloc_connected' => datetime_convert(), + 'hubloc_id_url' => $location['url'] . '/channel/' . $addr_arr[0] ] ); |