change matrix to grid, begin webfinger optimisation

This commit is contained in:
redmatrix 2015-09-16 21:27:58 -07:00
parent 4c5a74284b
commit c34d8286a3
4 changed files with 15 additions and 18 deletions

View File

@ -943,9 +943,9 @@ function item_photo_menu($item){
t("View Status") => $status_link, t("View Status") => $status_link,
t("View Profile") => $profile_link, t("View Profile") => $profile_link,
t("View Photos") => $photos_link, t("View Photos") => $photos_link,
t("Matrix Activity") => $posts_link, t("Activity/Posts") => $posts_link,
t("Connect") => $follow_url, t("Connect") => $follow_url,
t("Edit Contact") => $contact_url, t("Edit Connection") => $contact_url,
t("Send PM") => $pm_url, t("Send PM") => $pm_url,
t("Poke") => $poke_link t("Poke") => $poke_link
); );

View File

@ -172,8 +172,8 @@ EOT;
if(local_channel()) { if(local_channel()) {
$nav['network'] = array('network', t('Matrix'), "", t('Your matrix'),'network_nav_btn'); $nav['network'] = array('network', t('Grid'), "", t('Your grid'),'network_nav_btn');
$nav['network']['mark'] = array('', t('Mark all matrix notifications seen'), '',''); $nav['network']['mark'] = array('', t('Mark all grid notifications seen'), '','');
$nav['home'] = array('channel/' . $channel['channel_address'], t('Channel Home'), "", t('Channel home'),'home_nav_btn'); $nav['home'] = array('channel/' . $channel['channel_address'], t('Channel Home'), "", t('Channel home'),'home_nav_btn');
$nav['home']['mark'] = array('', t('Mark all channel notifications seen'), '',''); $nav['home']['mark'] = array('', t('Mark all channel notifications seen'), '','');

View File

@ -18,6 +18,8 @@ function wfinger_init(&$a) {
killme(); killme();
} }
$zot = intval($_REQUEST['zot']);
$resource = $_REQUEST['resource']; $resource = $_REQUEST['resource'];
logger('webfinger: ' . $resource,LOGGER_DEBUG); logger('webfinger: ' . $resource,LOGGER_DEBUG);
@ -30,7 +32,7 @@ function wfinger_init(&$a) {
if(strpos($channel,'@') !== false) { if(strpos($channel,'@') !== false) {
$host = substr($channel,strpos($channel,'@')+1); $host = substr($channel,strpos($channel,'@')+1);
if(strcasecmp($host,get_app()->get_hostname())) { if(strcasecmp($host,get_app()->get_hostname())) {
goaway('https://' . $host . '/.well-known/webfinger?resource=' . $resource); goaway('https://' . $host . '/.well-known/webfinger?f=&resource=' . $resource . (($zot) ? '&zot=' . $zot : ''));
} }
$channel = substr($channel,0,strpos($channel,'@')); $channel = substr($channel,0,strpos($channel,'@'));
} }
@ -52,10 +54,9 @@ function wfinger_init(&$a) {
header('Content-type: application/jrd+json'); header('Content-type: application/jrd+json');
if($resource && $r) { if($resource && $r) {
$h = q("select hubloc_addr from hubloc where hubloc_hash = '%s'", $h = q("select hubloc_addr from hubloc where hubloc_hash = '%s' and hubloc_deleted = 0",
dbesc($r[0]['channel_hash']) dbesc($r[0]['channel_hash'])
); );
@ -105,6 +106,13 @@ function wfinger_init(&$a) {
) )
); );
if($zot) {
// @FIXME do a lookup straightaway and return the zot-info packet
$_REQUEST['address'] = $r[0]['xchan_address'];
}
} }
else { else {
header($_SERVER["SERVER_PROTOCOL"] . ' ' . 400 . ' ' . 'Bad Request'); header($_SERVER["SERVER_PROTOCOL"] . ' ' . 400 . ' ' . 'Bad Request');

View File

@ -25,17 +25,6 @@ function zfinger_init(&$a) {
} }
} }
// allow re-written domains so bob@foo.example.com can provide an address of bob@example.com
// The top-level domain also needs to redirect .well-known/zot-info to the sub-domain with a 301 or 308
// TODO: Make 308 work in include/network.php for zot_fetch_url and zot_post_url
if(($zaddr) && ($s = get_config('system','zotinfo_domainrewrite'))) {
$arr = explode('^',$s);
if(count($arr) == 2)
$zaddr = str_replace($arr[0],$arr[1],$zaddr);
}
$r = null; $r = null;
if(strlen($zhash)) { if(strlen($zhash)) {