From d00860430f3d90e75a464cee03d3ff79c34715eb Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 25 May 2023 08:03:10 +0000 Subject: owa fixes for where keyId = acct:xxx@yyy.zz --- Zotlabs/Module/Owa.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Owa.php') diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index 02997d3f1..920a92240 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -32,7 +32,7 @@ class Owa extends Controller { $keyId = $sigblock['keyId']; if ($keyId) { $r = q("SELECT * FROM hubloc LEFT JOIN xchan ON hubloc_hash = xchan_hash - WHERE ( hubloc_addr = '%s' OR hubloc_id_url = '%s' ) AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC", + WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s') AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC", dbesc(str_replace('acct:', '', $keyId)), dbesc($keyId) ); @@ -40,11 +40,13 @@ class Owa extends Controller { $found = discover_by_webbie($keyId); if ($found) { $r = q("SELECT * FROM hubloc LEFT JOIN xchan ON hubloc_hash = xchan_hash - WHERE hubloc_id_url = '%s' AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC ", + WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s') AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC ", + dbesc(str_replace('acct:', '', $keyId)), dbesc($keyId) ); } } + if ($r) { foreach ($r as $hubloc) { $verified = HTTPSig::verify(file_get_contents('php://input'), $hubloc['xchan_pubkey']); @@ -73,7 +75,8 @@ class Owa extends Controller { if ($found) { $r = q("SELECT * FROM hubloc LEFT JOIN xchan ON hubloc_hash = xchan_hash - WHERE hubloc_id_url = '%s' AND hubloc_deleted = 0 ORDER BY hubloc_id DESC LIMIT 1", + WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s') AND hubloc_deleted = 0 ORDER BY hubloc_id DESC LIMIT 1", + dbesc(str_replace('acct:', '', $keyId)), dbesc($keyId) ); -- cgit v1.2.3 From 423fdc0a9618e322636a5291ed92df00115fafb0 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 1 Jun 2023 08:15:33 +0000 Subject: owa: workaround for friendica when using nginx until this will be fixed at their side and check prrofile uid for features instead of local channel --- Zotlabs/Module/Owa.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Zotlabs/Module/Owa.php') diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index 920a92240..4de4d32d6 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -49,6 +49,10 @@ class Owa extends Controller { if ($r) { foreach ($r as $hubloc) { + // fix friendica accept header for nginx + if (str_starts_with($keyId, 'acct:') && $_SERVER['HTTP_ACCEPT'] === 'application/x-zot+json') + $_SERVER['HTTP_ACCEPT'] = 'application/x-dfrn+json, application/x-zot+json'; + $verified = HTTPSig::verify(file_get_contents('php://input'), $hubloc['xchan_pubkey']); if ($verified && $verified['header_signed'] && $verified['header_valid'] && ($verified['content_valid'] || (! $verified['content_signed']))) { logger('OWA header: ' . print_r($verified,true),LOGGER_DATA); -- cgit v1.2.3