mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 15:55:13 +00:00
improve detection
This commit is contained in:
parent
5654130cdc
commit
36f8e84c72
2 changed files with 4 additions and 3 deletions
|
@ -4816,7 +4816,8 @@ class Activity
|
||||||
$alt = htmlspecialchars($a['name'], ENT_QUOTES, 'UTF-8', false);
|
$alt = htmlspecialchars($a['name'], ENT_QUOTES, 'UTF-8', false);
|
||||||
// Escape brackets by converting to unicode full-width bracket since regular brackets will confuse multicode/bbcode parsing.
|
// Escape brackets by converting to unicode full-width bracket since regular brackets will confuse multicode/bbcode parsing.
|
||||||
// The full width bracket isn't quite as alien looking as most other unicode bracket replacements.
|
// The full width bracket isn't quite as alien looking as most other unicode bracket replacements.
|
||||||
$alt = str_replace(['[', ']', '"'], ['[', ']', '\"'], $alt);
|
// Do the same for double-quotes; which may present issues with the HTML purifier and when rendered as HTML attributes.
|
||||||
|
$alt = str_replace(['[', ']', '\"', '"', '"'], ['[', ']', '"', '"', '"'], $alt);
|
||||||
$item['body'] .= "\n\n" . '[img alt="' . $alt . '"]' . $a['href'] . '[/img]';
|
$item['body'] .= "\n\n" . '[img alt="' . $alt . '"]' . $a['href'] . '[/img]';
|
||||||
} else {
|
} else {
|
||||||
$item['body'] .= "\n\n" . '[img]' . $a['href'] . '[/img]';
|
$item['body'] .= "\n\n" . '[img]' . $a['href'] . '[/img]';
|
||||||
|
@ -4829,7 +4830,7 @@ class Activity
|
||||||
$alt = htmlspecialchars($a['name'], ENT_QUOTES, 'UTF-8', false);
|
$alt = htmlspecialchars($a['name'], ENT_QUOTES, 'UTF-8', false);
|
||||||
// Escape brackets by converting to unicode full-width bracket since regular brackets will confuse multicode/bbcode parsing.
|
// Escape brackets by converting to unicode full-width bracket since regular brackets will confuse multicode/bbcode parsing.
|
||||||
// The full width bracket isn't quite as alien looking as most other unicode bracket replacements.
|
// The full width bracket isn't quite as alien looking as most other unicode bracket replacements.
|
||||||
$alt = str_replace(['[', ']', '"'], ['[', ']', '\"'], $alt);
|
$alt = str_replace(['[', ']', '\"', '"', '"'], ['[', ']', '"', '"', '"'], $alt);
|
||||||
$item['body'] .= "\n\n" . '[img alt="' . $alt . '"]' . $a['href'] . '[/img]';
|
$item['body'] .= "\n\n" . '[img alt="' . $alt . '"]' . $a['href'] . '[/img]';
|
||||||
} else {
|
} else {
|
||||||
$item['body'] .= "\n\n" . '[img]' . $a['href'] . '[/img]';
|
$item['body'] .= "\n\n" . '[img]' . $a['href'] . '[/img]';
|
||||||
|
|
|
@ -2084,7 +2084,7 @@ class Channel
|
||||||
{
|
{
|
||||||
$pubkey = (new Multibase())->publicKey($channel['channel_epubkey']);
|
$pubkey = (new Multibase())->publicKey($channel['channel_epubkey']);
|
||||||
$nomadic = PConfig::Get($channel['channel_id'], 'system', 'nomadicAP');
|
$nomadic = PConfig::Get($channel['channel_id'], 'system', 'nomadicAP');
|
||||||
if (!str_contains($id, '/.well-known/apgateway/')) {
|
if (!str_contains($id, '/.well-known/apgateway/') && !str_starts_with($id,'ap://')) {
|
||||||
$nomadic = false;
|
$nomadic = false;
|
||||||
}
|
}
|
||||||
return (($nomadic) ? Channel::getDid($channel) : Channel::url($channel) . '#' . $pubkey);
|
return (($nomadic) ? Channel::getDid($channel) : Channel::url($channel) . '#' . $pubkey);
|
||||||
|
|
Loading…
Reference in a new issue