From 5ee70092712be1604ce1450a8735154fdb7c9485 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 25 Jun 2019 18:37:27 -0700 Subject: provide auto redirect from zot6 /item permalinks --- Zotlabs/Module/Item.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 901f54c72..3eac2b6a0 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -193,6 +193,25 @@ class Item extends Controller { killme(); } + + if(argc() > 1 && argv(1) !== 'drop') { + $x = q("select uid, item_wall, llink, mid from item where mid = '%s' ", + dbesc(z_root() . '/item/' . argv(1)) + ); + if($x) { + foreach($x as $xv) { + if (intval($xv['item_wall'])) { + $c = channelx_by_n($xv['uid']); + if ($c) { + goaway($c['xchan_url'] . '?mid=' . gen_link_id($xv['mid'])); + } + } + } + goaway($x[0]['llink']); + } + http_status_exit(404, 'Not found'); + } + } -- cgit v1.2.3 From 4f280b5497325c7e7389096cb39f1f409de2638c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 25 Jun 2019 18:47:16 -0700 Subject: allow api login by address or url (url will use zot6 hubloc records, address can use either zot or zot6 hubloc records) --- include/api_auth.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/api_auth.php b/include/api_auth.php index 23ab9c946..9235bd28c 100644 --- a/include/api_auth.php +++ b/include/api_auth.php @@ -96,11 +96,15 @@ function api_login(&$a){ if($sigblock) { $keyId = str_replace('acct:','',$sigblock['keyId']); if($keyId) { - $r = q("select * from hubloc where hubloc_addr = '%s' limit 1", + $r = q("select * from hubloc where ( hubloc_addr = '%s' or hubloc_id_url = '%s' ) limit 1", + dbesc($keyId), dbesc($keyId) ); if($r) { $c = channelx_by_hash($r[0]['hubloc_hash']); + if (! $c) { + $c = channelx_by_portid($r[0]['hubloc_hash']); + } if($c) { $a = q("select * from account where account_id = %d limit 1", intval($c['channel_account_id']) -- cgit v1.2.3