mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:35:30 +00:00
dm button in profile: don't show if the observer is the channel page owner.
This commit is contained in:
parent
305a88f725
commit
717934fbf3
2 changed files with 29 additions and 0 deletions
|
@ -285,6 +285,10 @@ class Libprofile
|
|||
|
||||
$can_dm = perm_is_allowed($profile['uid'], (is_array($observer)) ? $observer['xchan_hash'] : EMPTY_STR, 'post_mail') && intval($observer['xchan_type']) !== XCHAN_TYPE_GROUP ;
|
||||
|
||||
if (intval($profile['uid']) === local_channel()) {
|
||||
$can_dm = false;
|
||||
}
|
||||
|
||||
if ($can_dm) {
|
||||
$dm_path = Libzot::get_rpost_path($observer);
|
||||
if ($dm_path) {
|
||||
|
|
|
@ -1147,6 +1147,31 @@ function discover_by_webbie($webbie, $protocol = '', $verify = true)
|
|||
}
|
||||
}
|
||||
|
||||
if (strpos($webbie, 'http') === 0 && !$x) {
|
||||
$record = Zotfinger::exec($webbie, null, $verify);
|
||||
|
||||
// Check the HTTP signature
|
||||
|
||||
if ($record) {
|
||||
if ($verify) {
|
||||
$hsig = $record['signature'];
|
||||
if ($hsig && ($hsig['signer'] === $url || $hsig['signer'] === $webbie) && $hsig['header_valid'] === true && $hsig['content_valid'] === true) {
|
||||
$hsig_valid = true;
|
||||
}
|
||||
|
||||
if (! $hsig_valid) {
|
||||
logger('http signature not valid: ' . print_r($hsig, true));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$x = Libzot::import_xchan($record['data']);
|
||||
if ($x['success']) {
|
||||
return $x['hash'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($webbie, 'http') === 0) {
|
||||
$ap = ActivityPub::discover($webbie);
|
||||
if ($ap) {
|
||||
|
|
Loading…
Reference in a new issue