From 64b467ea98fd4cf3cb6215be9ff8e5a9d13ba1a8 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 27 Nov 2013 02:51:16 -0800 Subject: reduce the likelihood that a given channel will have 30-40 valid hublocs with the same hubloc_url. --- mod/zfinger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/zfinger.php') diff --git a/mod/zfinger.php b/mod/zfinger.php index 59cef5549..2eb6adc75 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -164,7 +164,7 @@ function zfinger_init(&$a) { $ret['locations'] = array(); - $x = zot_get_hubloc(array($e['channel_hash'])); + $x = zot_get_hublocs($e['channel_hash']); if($x && count($x)) { foreach($x as $hub) { if(! ($hub['hubloc_flags'] & HUBLOC_FLAGS_UNVERIFIED)) { -- cgit v1.2.3 From df66c510c9e47750ec7382d6933ff72372c426c1 Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 29 Nov 2013 00:57:47 -0800 Subject: allow zot-info to return results for address= with webbies or naked nicknames --- mod/zfinger.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mod/zfinger.php') diff --git a/mod/zfinger.php b/mod/zfinger.php index 2eb6adc75..ff1bf3a35 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -53,7 +53,8 @@ function zfinger_init(&$a) { } elseif(strlen($zaddr)) { $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash - where channel_address = '%s' limit 1", + where ( channel_address = '%s' or xchan_addr = '%s' ) limit 1", + dbesc($zaddr), dbesc($zaddr) ); } -- cgit v1.2.3 From 7187c493e16abc98a8e1ed53d63a3d93e63db4af Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 3 Dec 2013 17:55:10 -0800 Subject: add hooks to zot-finger and import_xchan --- mod/zfinger.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod/zfinger.php') diff --git a/mod/zfinger.php b/mod/zfinger.php index ff1bf3a35..0827f3424 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -252,6 +252,7 @@ function zfinger_init(&$a) { $ret['site']['location'] = get_config('system','site_location'); } + call_hooks('zot_finger',$ret); json_return_and_die($ret); } -- cgit v1.2.3 From 0272ab4cd9a6428396489d88c7a1a89be76e5810 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 15 Dec 2013 14:36:43 -0800 Subject: Provide a fallback channel to probe for magic-auth when we have no prior communications with a site. This will be a system channel if one exists, otherwise any channel will do. We'll try to use the first valid channel on the site because that was probably created when the site was installed and is the closest thing to a system channel we've got. --- mod/zfinger.php | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'mod/zfinger.php') diff --git a/mod/zfinger.php b/mod/zfinger.php index 0827f3424..aad8e224d 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -52,11 +52,33 @@ function zfinger_init(&$a) { ); } elseif(strlen($zaddr)) { - $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash - where ( channel_address = '%s' or xchan_addr = '%s' ) limit 1", - dbesc($zaddr), - dbesc($zaddr) - ); + if(strpos($zaddr,'[system]') === false) { /* normal address lookup */ + $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash + where ( channel_address = '%s' or xchan_addr = '%s' ) limit 1", + dbesc($zaddr), + dbesc($zaddr) + ); + } + + else { + + /** + * The special address '[system]' will return a system channel if one has been defined, + * Or the first valid channel we find if there are no system channels. + * + * This is used by magic-auth if we have no prior communications with this site - and + * returns an identity on this site which we can use to create a valid hub record so that + * we can exchange signed messages. The precise identity is irrelevant. It's the hub + * information that we really need at the other end - and this will return it. + * + */ + + $r = q("select channel.*, xchan.* from channel left join xchan on channel_hash = xchan_hash + where (( channel_pageflags & %d ) or not ( channel_pageflags & %d )) order by channel_id limit 1", + intval(PAGE_SYSTEM), + intval(PAGE_REMOVED) + ); + } } else { $ret['message'] = 'Invalid request'; -- cgit v1.2.3