Prevent users from following relay accounts (#13894)

This commit is contained in:
Michael Vogel 2024-02-13 06:50:46 +01:00 committed by GitHub
parent 262ca4131d
commit fad55e0948
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 26 deletions

View File

@ -3106,6 +3106,13 @@ class Contact
$ret['url'] = str_replace('?absolute=true', '', $ret['url']); $ret['url'] = str_replace('?absolute=true', '', $ret['url']);
} }
if (($protocol == Protocol::ACTIVITYPUB) && ($uid != 0)) {
if (APContact::isRelay(APContact::getByURL($ret['url']))) {
$result['message'] = DI::l10n()->t('This seems to be a relay account. They can\'t be followed by users.');
return $result;
}
}
// do we have enough information? // do we have enough information?
if (empty($protocol) || ($protocol == Protocol::PHANTOM) || (empty($ret['url']) && empty($ret['addr']))) { if (empty($protocol) || ($protocol == Protocol::PHANTOM) || (empty($ret['url']) && empty($ret['addr']))) {
$result['message'] .= DI::l10n()->t('The profile address specified does not provide adequate information.') . '<br />'; $result['message'] .= DI::l10n()->t('The profile address specified does not provide adequate information.') . '<br />';

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 2024.03-dev\n" "Project-Id-Version: 2024.03-dev\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-10 11:45+0000\n" "POT-Creation-Date: 2024-02-13 05:20+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -2190,39 +2190,39 @@ msgstr ""
msgid "last" msgid "last"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:762 src/Content/Text/BBCode.php:1707 #: src/Content/Text/BBCode.php:766 src/Content/Text/BBCode.php:1727
#: src/Content/Text/BBCode.php:1708 #: src/Content/Text/BBCode.php:1728
msgid "Image/photo" msgid "Image/photo"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:980 #: src/Content/Text/BBCode.php:984
#, php-format #, php-format
msgid "" msgid ""
"<a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2$s</a> %3$s" "<a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">%2$s</a> %3$s"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:1005 src/Model/Item.php:3993 #: src/Content/Text/BBCode.php:1009 src/Model/Item.php:3999
#: src/Model/Item.php:3999 src/Model/Item.php:4000 #: src/Model/Item.php:4005 src/Model/Item.php:4006
msgid "Link to source" msgid "Link to source"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:1614 src/Content/Text/HTML.php:905 #: src/Content/Text/BBCode.php:1634 src/Content/Text/HTML.php:905
msgid "Click to open/close" msgid "Click to open/close"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:1647 #: src/Content/Text/BBCode.php:1667
msgid "$1 wrote:" msgid "$1 wrote:"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:1712 src/Content/Text/BBCode.php:1713 #: src/Content/Text/BBCode.php:1732 src/Content/Text/BBCode.php:1733
msgid "Encrypted content" msgid "Encrypted content"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:1968 #: src/Content/Text/BBCode.php:1996
msgid "Invalid source protocol" msgid "Invalid source protocol"
msgstr "" msgstr ""
#: src/Content/Text/BBCode.php:1987 #: src/Content/Text/BBCode.php:2015
msgid "Invalid link protocol" msgid "Invalid link protocol"
msgstr "" msgstr ""
@ -3289,44 +3289,48 @@ msgid "Expected network %s does not match actual network %s"
msgstr "" msgstr ""
#: src/Model/Contact.php:3111 #: src/Model/Contact.php:3111
msgid "This seems to be a relay account. They can't be followed by users."
msgstr ""
#: src/Model/Contact.php:3118
msgid "The profile address specified does not provide adequate information." msgid "The profile address specified does not provide adequate information."
msgstr "" msgstr ""
#: src/Model/Contact.php:3113 #: src/Model/Contact.php:3120
msgid "No compatible communication protocols or feeds were discovered." msgid "No compatible communication protocols or feeds were discovered."
msgstr "" msgstr ""
#: src/Model/Contact.php:3116 #: src/Model/Contact.php:3123
msgid "An author or name was not found." msgid "An author or name was not found."
msgstr "" msgstr ""
#: src/Model/Contact.php:3119 #: src/Model/Contact.php:3126
msgid "No browser URL could be matched to this address." msgid "No browser URL could be matched to this address."
msgstr "" msgstr ""
#: src/Model/Contact.php:3122 #: src/Model/Contact.php:3129
msgid "" msgid ""
"Unable to match @-style Identity Address with a known protocol or email " "Unable to match @-style Identity Address with a known protocol or email "
"contact." "contact."
msgstr "" msgstr ""
#: src/Model/Contact.php:3123 #: src/Model/Contact.php:3130
msgid "Use mailto: in front of address to force email check." msgid "Use mailto: in front of address to force email check."
msgstr "" msgstr ""
#: src/Model/Contact.php:3129 #: src/Model/Contact.php:3136
msgid "" msgid ""
"The profile address specified belongs to a network which has been disabled " "The profile address specified belongs to a network which has been disabled "
"on this site." "on this site."
msgstr "" msgstr ""
#: src/Model/Contact.php:3134 #: src/Model/Contact.php:3141
msgid "" msgid ""
"Limited profile. This person will be unable to receive direct/personal " "Limited profile. This person will be unable to receive direct/personal "
"notifications from you." "notifications from you."
msgstr "" msgstr ""
#: src/Model/Contact.php:3200 #: src/Model/Contact.php:3207
msgid "Unable to retrieve contact information." msgid "Unable to retrieve contact information."
msgstr "" msgstr ""
@ -3478,44 +3482,44 @@ msgstr ""
msgid "Content warning: %s" msgid "Content warning: %s"
msgstr "" msgstr ""
#: src/Model/Item.php:3900 #: src/Model/Item.php:3906
msgid "bytes" msgid "bytes"
msgstr "" msgstr ""
#: src/Model/Item.php:3931 #: src/Model/Item.php:3937
#, php-format #, php-format
msgid "%2$s (%3$d%%, %1$d vote)" msgid "%2$s (%3$d%%, %1$d vote)"
msgid_plural "%2$s (%3$d%%, %1$d votes)" msgid_plural "%2$s (%3$d%%, %1$d votes)"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: src/Model/Item.php:3933 #: src/Model/Item.php:3939
#, php-format #, php-format
msgid "%2$s (%1$d vote)" msgid "%2$s (%1$d vote)"
msgid_plural "%2$s (%1$d votes)" msgid_plural "%2$s (%1$d votes)"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: src/Model/Item.php:3938 #: src/Model/Item.php:3944
#, php-format #, php-format
msgid "%d voter. Poll end: %s" msgid "%d voter. Poll end: %s"
msgid_plural "%d voters. Poll end: %s" msgid_plural "%d voters. Poll end: %s"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: src/Model/Item.php:3940 #: src/Model/Item.php:3946
#, php-format #, php-format
msgid "%d voter." msgid "%d voter."
msgid_plural "%d voters." msgid_plural "%d voters."
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
#: src/Model/Item.php:3942 #: src/Model/Item.php:3948
#, php-format #, php-format
msgid "Poll end: %s" msgid "Poll end: %s"
msgstr "" msgstr ""
#: src/Model/Item.php:3976 src/Model/Item.php:3977 #: src/Model/Item.php:3982 src/Model/Item.php:3983
msgid "View on separate page" msgid "View on separate page"
msgstr "" msgstr ""