aboutsummaryrefslogtreecommitdiffstats
path: root/include/zot.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/zot.php')
-rw-r--r--include/zot.php39
1 files changed, 35 insertions, 4 deletions
diff --git a/include/zot.php b/include/zot.php
index 8b0efe09d..54efe1343 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -117,8 +117,11 @@ function zot_build_packet($channel,$type = 'notify',$recipients = null, $remote_
'version' => ZOT_REVISION
);
- if($recipients)
+ if($recipients) {
+ for($x = 0; $x < count($recipients); $x ++)
+ unset($recipients[$x]['hash']);
$data['recipients'] = $recipients;
+ }
if($secret) {
$data['secret'] = $secret;
@@ -198,11 +201,17 @@ function zot_finger($webbie,$channel,$autofallback = true) {
if($r) {
$url = $r[0]['hubloc_url'];
+
+ if($r[0]['hubloc_network'] && $r[0]['hubloc_network'] !== 'zot') {
+ logger('zot_finger: alternate network: ' . $webbie);
+ return array('success' => false);
+ }
}
else {
$url = 'https://' . $host;
}
-
+
+
$rhs = '/.well-known/zot-info';
$https = ((strpos($url,'https://') === 0) ? true : false);
@@ -271,6 +280,11 @@ function zot_finger($webbie,$channel,$autofallback = true) {
function zot_refresh($them,$channel = null, $force = false) {
+ if(array_key_exists('xchan_network',$them) && ($them['xchan_network'] !== 'zot')) {
+ logger('zot_refresh: not got zot. ' . $them['xchan_name']);
+ return true;
+ }
+
logger('zot_refresh: them: ' . print_r($them,true), LOGGER_DATA);
if($channel)
logger('zot_refresh: channel: ' . print_r($channel,true), LOGGER_DATA);
@@ -507,6 +521,22 @@ function zot_refresh($them,$channel = null, $force = false) {
function zot_gethub($arr) {
if($arr['guid'] && $arr['guid_sig'] && $arr['url'] && $arr['url_sig']) {
+
+ $blacklisted = false;
+ $bl1 = get_config('system','blacklisted_sites');
+ if(is_array($bl1) && $bl1) {
+ foreach($bl1 as $bl) {
+ if($bl && strpos($arr['url'],$bl) !== false) {
+ $blacklisted = true;
+ break;
+ }
+ }
+ }
+ if($blacklisted) {
+ logger('zot_gethub: blacklisted site: ' . $arr['url']);
+ return null;
+ }
+
$r = q("select * from hubloc
where hubloc_guid = '%s' and hubloc_guid_sig = '%s'
and hubloc_url = '%s' and hubloc_url_sig = '%s'
@@ -943,12 +973,13 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) {
);
}
logger('import_xchan: new hub: ' . $location['url']);
- $r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_flags, hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey, hubloc_updated, hubloc_connected)
- values ( '%s','%s','%s','%s', %d ,'%s','%s','%s','%s','%s','%s','%s')",
+ $r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_network, hubloc_flags, hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey, hubloc_updated, hubloc_connected)
+ values ( '%s','%s','%s','%s', '%s', %d ,'%s','%s','%s','%s','%s','%s','%s')",
dbesc($arr['guid']),
dbesc($arr['guid_sig']),
dbesc($xchan_hash),
dbesc($location['address']),
+ dbesc('zot'),
intval((intval($location['primary'])) ? HUBLOC_FLAGS_PRIMARY : 0),
dbesc($location['url']),
dbesc($location['url_sig']),