Split FSDisableLabeledChatLinks setting into nearby-chat and everything-else

Signed-off-by: PanteraPolnocy <panterapolnocy@gmail.com>
This commit is contained in:
PanteraPolnocy
2026-06-14 05:12:54 +02:00
parent 21daba0832
commit fd501b84df
14 changed files with 51 additions and 13 deletions
+4 -1
View File
@@ -2638,7 +2638,10 @@ void LLTextBase::appendTextImpl(const std::string& new_text, const LLStyle::Para
LLUrlMatch match;
std::string text = new_text;
while (LLUrlRegistry::instance().findUrl(text, match,
boost::bind(&LLTextBase::replaceUrl, this, _1, _2, _3), isContentTrusted() || mAlwaysShowIcons, force_slurl))
// <FS:PP> Pass nearby-chat flag for labeled-link masking
// boost::bind(&LLTextBase::replaceUrl, this, _1, _2, _3), isContentTrusted() || mAlwaysShowIcons, force_slurl))
boost::bind(&LLTextBase::replaceUrl, this, _1, _2, _3), isContentTrusted() || mAlwaysShowIcons, force_slurl, mNearbyChatContent))
// </FS:PP>
{
start = match.getStart();
end = match.getEnd()+1;
+5
View File
@@ -478,6 +478,10 @@ public:
bool isContentTrusted() const { return mTrustedContent; }
void setContentTrusted(bool trusted_content) { mTrustedContent = trusted_content; }
// <FS:PP> Selects the nearby-chat labeled-link setting (FSDisableLabeledChatLinksNearbyChat) for this editor's content
void setNearbyChatContent(bool nearby_chat_content) { mNearbyChatContent = nearby_chat_content; }
// </FS:PP>
// TODO: move into LLTextSegment?
void createUrlContextMenu(S32 x, S32 y, const std::string &url); // create a popup context menu for the given Url
@@ -826,6 +830,7 @@ protected:
bool mClip; // clip text to widget rect
bool mClipPartial; // false if we show lines that are partially inside bounding rect
bool mTrustedContent; // if false, does not allow to execute SURL links from this editor
bool mNearbyChatContent { false }; // <FS:PP> if true, labeled-link masking uses the nearby chat setting
bool mPlainText; // didn't use Image or Icon segments
bool mAutoIndent;
S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes
+6 -2
View File
@@ -225,7 +225,10 @@ static bool stringHasJira(const std::string &text)
text.find("WEB") != std::string::npos);
}
bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb, bool is_content_trusted, bool skip_non_mentions)
// <FS:PP> Option to disable bracket links needs is_nearby_chat here
// bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb, bool is_content_trusted, bool skip_non_mentions)
bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb, bool is_content_trusted, bool skip_non_mentions, bool is_nearby_chat)
// </FS:PP>
{
// avoid costly regexes if there is clearly no URL in the text
if (! (stringHasUrl(text) || stringHasJira(text)))
@@ -253,7 +256,8 @@ bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LL
// <FS:PP> Option to disable square-bracket links (intentionally ignores secondlife:// and hop://)
static LLUICachedControl<bool> sDisableLabeledLinks("FSDisableLabeledChatLinks", false);
if (!is_content_trusted && (mUrlEntryHTTPLabel == *it) && sDisableLabeledLinks)
static LLUICachedControl<bool> sDisableLabeledLinksNearby("FSDisableLabeledChatLinksNearbyChat", false);
if (!is_content_trusted && (mUrlEntryHTTPLabel == *it) && (is_nearby_chat ? sDisableLabeledLinksNearby : sDisableLabeledLinks))
{
continue;
}
+2 -1
View File
@@ -75,7 +75,8 @@ public:
/// your callback is invoked if the matched Url's label changes in the future
bool findUrl(const std::string &text, LLUrlMatch &match,
const LLUrlLabelCallback &cb = &LLUrlRegistryNullCallback,
bool is_content_trusted = false, bool skip_non_mentions = false);
bool is_content_trusted = false, bool skip_non_mentions = false,
bool is_nearby_chat = false); // <FS:PP> Option to disable bracket links needs is_nearby_chat here
/// a slightly less efficient version of findUrl for wide strings
bool findUrl(const LLWString &text, LLUrlMatch &match,
+12 -1
View File
@@ -19658,7 +19658,18 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>FSDisableLabeledChatLinks</key>
<map>
<key>Comment</key>
<string>When true, do not treat wiki-style bracketed links ([https://host label]) as labeled URLs; mitigates misleading link text.</string>
<string>When true, do not treat wiki-style bracketed links ([https://host label]) as labeled URLs in IMs, group chat, ad-hoc conferences and group notices; mitigates misleading link text.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>FSDisableLabeledChatLinksNearbyChat</key>
<map>
<key>Comment</key>
<string>When true, do not treat wiki-style bracketed links ([https://host label]) as labeled URLs in nearby (local) chat and object text; mitigates misleading link text.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
+2
View File
@@ -1942,9 +1942,11 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
bool is_trusted = isContentTrusted();
setContentTrusted(chat.mFromID.isNull() && is_p2p); // <FS:Ansariel> Set trusted content temporarily for system messages
setNearbyChatContent(is_local); // <FS:PP> Use the nearby-chat labeled-link setting for local/object chat
setPlainText((use_plain_text_chat_history && is_p2p) ? chat.mFromID.notNull() : use_plain_text_chat_history);
appendText(message, prependNewLineState, body_message_params); // <FS:Zi> FIRE-8600: TAB out of chat history
setContentTrusted(is_trusted);
setNearbyChatContent(false); // <FS:PP> Use the nearby-chat labeled-link setting for local/object chat
setPlainText(use_plain_text_chat_history);
// Uncomment this if we never need to append to the end of a message. [FS:CR]
//prependNewLineState = false;
@@ -242,6 +242,7 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification)
mMsgText = getChild<LLChatMsgBox>("msg_text", false);
mMsgText->setContentTrusted(false);
mMsgText->setNearbyChatContent(true); // <FS:PP> Nearby chat toast follows the nearby-chat labeled-link setting
mMsgText->setIsFriendCallback(LLAvatarActions::isFriend);
mMsgText->setText(std::string(""));
@@ -40,7 +40,7 @@
</panel>
<panel label="Qoruma" name="ProtectionTab">
<check_box label="Sol maus düyməsi ilə basdıqda obyektə oturmaq bloku" name="FSBlockClickSit" />
<check_box label="Çatda kvadrat mötərizəli linkləri deaktiv edin (URL görünməyə davam edir)" name="FSDisableLabeledChatLinks" tool_tip="Aktivləşdirildikdə, digər sakinlərdən gələn çat, IM, qrup bildirişləri və obyekt mətnlərindəki kvadrat mötərizəli linklər tək bir etiketə daraldılmır. Bunun əvəzinə əsl URL göstərilir və əlaqələndirilir. Görünən mətnin fərqli təyinat yerini gizlətdiyi fişinq cəhdlərini azaltmağa kömək edir. Viewer-in daxili mətnləri (bildirişlər, parametrlər və s.) təsirlənmir."/>
<check_box label="IM, qrup çatı və bildirişlərdə kvadrat mötərizəli linkləri deaktiv edin (URL görünməyə davam edir)" name="FSDisableLabeledChatLinks" tool_tip="Aktivləşdirildikdə, digər sakinlərdən gələn IM, qrup çatı, ad-hoc konfranslar və qrup bildirişlərindəki kvadrat mötərizəli linklər tək bir etiketə daraldılmır. Bunun əvəzinə əsl URL göstərilir və əlaqələndirilir. Görünən mətnin fərqli təyinat yerini gizlətdiyi fişinq cəhdlərini azaltmağa kömək edir. Yaxınlıqdakı (lokal) çat aşağıdakı ayrıca seçimlə idarə olunur. Viewer-in daxili mətnləri (bildirişlər, parametrlər və s.) təsirlənmir."/>
<check_box label="Skriptlərin (llMapDestination) istifadəsinə icazə verin" name="ScriptsCanShowUI" />
<text name="revokepermissions_txt">
Animasiya icazələrini ləğv edin:
@@ -262,13 +262,23 @@
<check_box
top_pad="4"
left="10"
label="Disable square-bracket links in chat (URL stays visible)"
label="Disable square-bracket links in IMs, group chat and notices (URL stays visible)"
control_name="FSDisableLabeledChatLinks"
follows="left|top"
height="16"
name="FSDisableLabeledChatLinks"
width="520"
tool_tip="When enabled, square-bracket links sent in chat, IM, group notices and object text from other residents are not collapsed into a single labeled link. The actual URL is shown and linked instead. Helps reduce phishing where the visible label hides a different destination. Built-in viewer text (notifications, preferences, etc.) is not affected."/>
tool_tip="When enabled, square-bracket links received in IMs, group chat, ad-hoc conferences and group notices from other residents are not collapsed into a single labeled link. The actual URL is shown and linked instead. Helps reduce phishing where the visible label hides a different destination. Nearby (local) chat is controlled by the separate option below. Built-in viewer text (notifications, preferences, etc.) is not affected."/>
<check_box
top_pad="4"
left="10"
label="Disable square-bracket links in nearby chat and object text (URL stays visible)"
control_name="FSDisableLabeledChatLinksNearbyChat"
follows="left|top"
height="16"
name="FSDisableLabeledChatLinksNearbyChat"
width="520"
tool_tip="When enabled, square-bracket links received in nearby (local) chat and object text are not collapsed into a single labeled link. The actual URL is shown and linked instead. Disabled by default."/>
<check_box
left="10"
@@ -18,7 +18,7 @@
</panel>
<panel label="Protección" name="ProtectionTab">
<check_box label="Impedir que pueda sentarme con un clic del botón izquierdo del ratón" name="FSBlockClickSit"/>
<check_box label="Desactivar enlaces entre corchetes en el chat (la URL sigue visible)" name="FSDisableLabeledChatLinks" tool_tip="Cuando se activa, los enlaces entre corchetes recibidos en chat, MI, avisos de grupo y texto de objetos de otros residentes no se contraen en una sola etiqueta. Se muestra y enlaza la URL real. Ayuda a reducir el phishing donde el texto visible oculta un destino distinto. El texto integrado del visor (notificaciones, preferencias, etc.) no se ve afectado."/>
<check_box label="Desactivar enlaces entre corchetes en MI, chat de grupo y avisos (la URL sigue visible)" name="FSDisableLabeledChatLinks" tool_tip="Cuando se activa, los enlaces entre corchetes recibidos en MI, chat de grupo, conferencias ad-hoc y avisos de grupo de otros residentes no se contraen en una sola etiqueta. Se muestra y enlaza la URL real. Ayuda a reducir el phishing donde el texto visible oculta un destino distinto. El chat cercano (local) se controla con la opción separada de abajo. El texto integrado del visor (notificaciones, preferencias, etc.) no se ve afectado."/>
<check_box label="Permitir a los scripts que muestren el IU del mapa (llMapDestination)" name="ScriptsCanShowUI"/>
<text name="revokepermissions_txt">
Revocar permisos:
@@ -39,7 +39,7 @@
</panel>
<panel label="Protezione" name="ProtectionTab">
<check_box label="Blocca seduta tramite tasto sinistro del mouse" name="FSBlockClickSit" />
<check_box label="Disabilita i link tra parentesi quadre nella chat (l'URL resta visibile)" name="FSDisableLabeledChatLinks" tool_tip="Quando attivo, i link tra parentesi quadre ricevuti tramite chat, IM, avvisi di gruppo e testi degli oggetti da altri residenti non vengono compressi in una singola etichetta. Viene mostrato e reso cliccabile l'URL reale. Aiuta a ridurre il phishing dove il testo visibile nasconde una destinazione diversa. I testi integrati nel viewer (notifiche, preferenze, ecc.) non sono interessati."/>
<check_box label="Disabilita i link tra parentesi quadre in IM, chat di gruppo e avvisi (l'URL resta visibile)" name="FSDisableLabeledChatLinks" tool_tip="Quando attivo, i link tra parentesi quadre ricevuti tramite IM, chat di gruppo, conferenze ad-hoc e avvisi di gruppo da altri residenti non vengono compressi in una singola etichetta. Viene mostrato e reso cliccabile l'URL reale. Aiuta a ridurre il phishing dove il testo visibile nasconde una destinazione diversa. La chat nelle vicinanze (locale) è controllata dall'opzione separata qui sotto. I testi integrati nel viewer (notifiche, preferenze, ecc.) non sono interessati."/>
<check_box label="Consente agli script di aprire la mappa (llMapDestination)" name="ScriptsCanShowUI" />
<text name="revokepermissions_txt">
Rimuovi autorizzazioni:
@@ -47,7 +47,7 @@
<!-- Protection -->
<panel label="保護" name="ProtectionTab">
<check_box label="左クリックで座らないようにする" name="FSBlockClickSit"/>
<check_box label="チャットの角括弧リンクを無効にする(URL は引き続き表示されます)" name="FSDisableLabeledChatLinks" tool_tip="有効にすると、他の住人から送信されたチャット、IM、グループ通知、オブジェクトテキスト内の角括弧リンクが単一のラベルにまとめられず、実際の URL が表示されてリンクになります。表示テキストが異なる宛先を隠すフィッシングを軽減するのに役立ちます。ビューア内蔵のテキスト(通知、環境設定など)には影響しません。"/>
<check_box label="IM、グループチャット、通知の角括弧リンクを無効にする(URL は引き続き表示されます)" name="FSDisableLabeledChatLinks" tool_tip="有効にすると、他の住人から送信された IM、グループチャット、アドホック会議、グループ通知内の角括弧リンクが単一のラベルにまとめられず、実際の URL が表示されてリンクになります。表示テキストが異なる宛先を隠すフィッシングを軽減するのに役立ちます。近くの(ローカル)チャットは下の別のオプションで制御されます。ビューア内蔵のテキスト(通知、環境設定など)には影響しません。"/>
<check_box label="ワールドマップを開くスクリプト(llMapDestinatin)を許可する" name="ScriptsCanShowUI"/>
<text name="revokepermissions_txt">
オブジェクトのアニメーション権限取消:
@@ -41,7 +41,8 @@
</panel>
<panel label="Ochrona" name="ProtectionTab">
<check_box label="Blokuj siadanie na obiektach przez kliknięcie lewym przyciskiem myszy" name="FSBlockClickSit" />
<check_box label="Wyłącz linki w nawiasach kwadratowych w czacie (URL pozostaje widoczny)" name="FSDisableLabeledChatLinks" tool_tip="Po włączeniu linki w nawiasach kwadratowych otrzymywane w czacie, IM, ogłoszeniach grup i tekstach obiektów od innych rezydentów nie są zwijane do pojedynczej etykiety. Wyświetlany i klikalny jest rzeczywisty URL. Pomaga ograniczyć phishing, w którym widoczny tekst ukrywa inne miejsce docelowe. Wbudowane teksty przeglądarki (powiadomienia, preferencje itp.) pozostają bez zmian."/>
<check_box label="Wyłącz linki w nawiasach kwadratowych: IM, czat grupowy, ogłoszenia (URLe dalej widoczne)" name="FSDisableLabeledChatLinks" tool_tip="Po włączeniu linki w nawiasach kwadratowych otrzymywane w IM, czacie grupowym, konferencjach ad-hoc i ogłoszeniach grup od innych rezydentów nie są zwijane do pojedynczej etykiety. Wyświetlany i klikalny jest rzeczywisty URL. Pomaga ograniczyć phishing, w którym widoczny tekst ukrywa inne miejsce docelowe. Czat w pobliżu (lokalny) jest sterowany osobną opcją poniżej. Wbudowane teksty przeglądarki (powiadomienia, preferencje itp.) pozostają bez zmian."/>
<check_box label="Wyłącz linki w nawiasach kwadratowych: czat w pobliżu, tekst obiektów (URLe dalej widoczne)" name="FSDisableLabeledChatLinksNearbyChat" tool_tip="Po włączeniu linki w nawiasach kwadratowych otrzymywane w czacie w pobliżu (lokalnym) i tekstach obiektów nie są zwijane do pojedynczej etykiety. Wyświetlany i klikalny jest rzeczywisty URL. Domyślnie wyłączone."/>
<check_box label="Pozwól skryptom na pokazywanie interfejsu mapy (llMapDestination)" name="ScriptsCanShowUI" />
<text name="revokepermissions_txt">
Cofnij zezwolenia do animowania:
@@ -41,7 +41,7 @@
</panel>
<panel label="Защита" name="ProtectionTab">
<check_box label="Блокировка нажатия левой кнопкой мыши, чтобы сесть на объекты" name="FSBlockClickSit" />
<check_box label="Отключить ссылки в квадратных скобках в чате (URL остаётся видимым)" name="FSDisableLabeledChatLinks" tool_tip="Когда включено, ссылки в квадратных скобках, получаемые в чате, ЛС, групповых уведомлениях и тексте объектов от других резидентов, не сворачиваются в одну метку. Показывается и используется в качестве ссылки реальный URL. Помогает уменьшить фишинг, при котором видимый текст скрывает другое место назначения. Встроенный текст вьюера (уведомления, настройки и т. п.) не затрагивается."/>
<check_box label="Отключить квадратных скобках ссылки: ЛС, групповом чате, уведомлениях (URL видимым)" name="FSDisableLabeledChatLinks" tool_tip="Когда включено, ссылки в квадратных скобках, получаемые в ЛС, групповом чате, конференциях ad-hoc и групповых уведомлениях от других резидентов, не сворачиваются в одну метку. Показывается и используется в качестве ссылки реальный URL. Помогает уменьшить фишинг, при котором видимый текст скрывает другое место назначения. Чат поблизости (локальный) управляется отдельной опцией ниже. Встроенный текст вьюера (уведомления, настройки и т. п.) не затрагивается."/>
<check_box label="Позволить скриптам использовать (llMapDestination)" name="ScriptsCanShowUI" />
<text name="revokepermissions_txt">
Отменить разрешение анимирования: