Profile: Show insecure client warning (#6845)

This commit is contained in:
zubiden 2026-04-14 14:36:42 +02:00 committed by Alexander Zinchuk
parent 32a0a1e9cd
commit 7b26965b45
6 changed files with 26 additions and 1 deletions

View File

@ -37,7 +37,7 @@ export function buildApiUserFullInfo(mtpUserFull: GramJs.users.UserFull): ApiUse
birthday, personalChannelId, personalChannelMessage, sponsoredEnabled, stargiftsCount, botVerification, birthday, personalChannelId, personalChannelMessage, sponsoredEnabled, stargiftsCount, botVerification,
botCanManageEmojiStatus, settings, sendPaidMessagesStars, displayGiftsButton, disallowedGifts, botCanManageEmojiStatus, settings, sendPaidMessagesStars, displayGiftsButton, disallowedGifts,
starsRating, starsMyPendingRating, starsMyPendingRatingDate, mainTab, note, starsRating, starsMyPendingRating, starsMyPendingRatingDate, mainTab, note,
noforwardsMyEnabled, noforwardsPeerEnabled, noforwardsMyEnabled, noforwardsPeerEnabled, unofficialSecurityRisk,
}, },
users, users,
} = mtpUserFull; } = mtpUserFull;
@ -80,6 +80,7 @@ export function buildApiUserFullInfo(mtpUserFull: GramJs.users.UserFull): ApiUse
note: note && buildApiFormattedText(note), note: note && buildApiFormattedText(note),
noForwardsMyEnabled: noforwardsMyEnabled, noForwardsMyEnabled: noforwardsMyEnabled,
noForwardsPeerEnabled: noforwardsPeerEnabled, noForwardsPeerEnabled: noforwardsPeerEnabled,
isUnofficialSecurityRisk: unofficialSecurityRisk,
}; };
} }

View File

@ -87,6 +87,7 @@ export interface ApiUserFullInfo {
note?: ApiFormattedText; note?: ApiFormattedText;
noForwardsMyEnabled?: boolean; noForwardsMyEnabled?: boolean;
noForwardsPeerEnabled?: boolean; noForwardsPeerEnabled?: boolean;
isUnofficialSecurityRisk?: boolean;
} }
export type ApiUserType = 'userTypeBot' | 'userTypeRegular' | 'userTypeDeleted' | 'userTypeUnknown'; export type ApiUserType = 'userTypeBot' | 'userTypeRegular' | 'userTypeDeleted' | 'userTypeUnknown';

View File

@ -2814,3 +2814,4 @@
"ReminderSetToast" = "You set up a reminder in **Saved Messages**"; "ReminderSetToast" = "You set up a reminder in **Saved Messages**";
"NoForwardsRequestReject" = "Reject"; "NoForwardsRequestReject" = "Reject";
"NoForwardsRequestAccept" = "Accept"; "NoForwardsRequestAccept" = "Accept";
"UnofficialSecurityRisk" = "{peer} uses an unofficial Telegram client — messages to this user may be less secure."

View File

@ -144,6 +144,18 @@
cursor: var(--custom-cursor, pointer); cursor: var(--custom-cursor, pointer);
} }
.unofficialSecurityRisk {
margin-bottom: 0.5rem;
padding-inline: 0.5rem;
line-height: 1.25;
text-wrap: balance;
}
.riskIcon {
margin-inline-end: 0.25rem;
color: var(--color-error);
}
@include mixins.on-active-vt('profileNote') { @include mixins.on-active-vt('profileNote') {
&::view-transition-image-pair(.noteText) { &::view-transition-image-pair(.noteText) {
overflow: hidden; overflow: hidden;

View File

@ -26,6 +26,7 @@ import {
isUserRightBanned, isUserRightBanned,
} from '../../../global/helpers'; } from '../../../global/helpers';
import { getIsChatMuted } from '../../../global/helpers/notifications'; import { getIsChatMuted } from '../../../global/helpers/notifications';
import { getPeerTitle } from '../../../global/helpers/peers';
import { import {
selectBotAppPermissions, selectBotAppPermissions,
selectChat, selectChat,
@ -392,6 +393,12 @@ const ChatExtra = ({
return ( return (
<div className={buildClassName('ChatExtra', className)} style={createVtnStyle('chatExtra')}> <div className={buildClassName('ChatExtra', className)} style={createVtnStyle('chatExtra')}>
{user && userFullInfo?.isUnofficialSecurityRisk && (
<div className={styles.unofficialSecurityRisk}>
<Icon className={buildClassName(styles.riskIcon, 'in-text-icon')} name="info-filled" />
{lang('UnofficialSecurityRisk', { peer: getPeerTitle(lang, user) })}
</div>
)}
{personalChannel && ( {personalChannel && (
<div className={styles.personalChannel} style={createVtnStyle('personalChannel')}> <div className={styles.personalChannel} style={createVtnStyle('personalChannel')}>
<h3 className={styles.personalChannelTitle}>{oldLang('ProfileChannel')}</h3> <h3 className={styles.personalChannelTitle}>{oldLang('ProfileChannel')}</h3>

View File

@ -3625,6 +3625,9 @@ export interface LangPairWithVariables<V = LangVariable> {
'RankEditText': { 'RankEditText': {
'user': V; 'user': V;
}; };
'UnofficialSecurityRisk': {
'peer': V;
};
} }
export interface LangPairPlural { export interface LangPairPlural {