diff options
author | Pascal <pascal.deklerck@gmail.com> | 2023-10-04 17:00:19 +0200 |
---|---|---|
committer | Pascal <pascal.deklerck@gmail.com> | 2023-10-04 17:00:19 +0200 |
commit | 2bd09d3b305e0bf4fc81f9694f8054bdd8edc868 (patch) | |
tree | 28d6d54bd6c687f32537efa5098d3374771f7af4 /Zotlabs | |
parent | 56e54ac820b32f4b5f7d3f554191079003ac78a5 (diff) | |
download | volse-hubzilla-2bd09d3b305e0bf4fc81f9694f8054bdd8edc868.tar.gz volse-hubzilla-2bd09d3b305e0bf4fc81f9694f8054bdd8edc868.tar.bz2 volse-hubzilla-2bd09d3b305e0bf4fc81f9694f8054bdd8edc868.zip |
work with Mastodon-style keyId
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Owa.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index 4de4d32d6..e41435ecd 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -30,18 +30,32 @@ class Owa extends Controller { $sigblock = HTTPSig::parse_sigheader($_SERVER['HTTP_AUTHORIZATION']); if ($sigblock) { $keyId = $sigblock['keyId']; + $parsed = parse_url($keyId); + if (str_starts_with($parsed['scheme'],'http')) { + unset($parsed['fragment']); + unset($parsed['query']); + $keyId = unparse_url($parsed); + } + else { + $keyId = str_replace('acct:', '', $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", - dbesc(str_replace('acct:', '', $keyId)), + WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s' OR xchan_hash = '%s') + AND hubloc_deleted = 0 AND xchan_pubkey != '' + ORDER BY hubloc_id DESC", + dbesc($keyId), + dbesc($keyId), dbesc($keyId) ); if (! $r) { $found = discover_by_webbie($keyId); + logger('found = ' . print_r($found, true)); if ($found) { $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 ", - dbesc(str_replace('acct:', '', $keyId)), + WHERE (hubloc_addr = '%s' OR hubloc_id_url = '%s' OR xchan_hash = '%s') AND hubloc_deleted = 0 AND xchan_pubkey != '' ORDER BY hubloc_id DESC ", + dbesc($keyId), + dbesc($keyId), dbesc($keyId) ); } |